]> git.proxmox.com Git - ceph.git/blame - ceph/doc/cephfs/client-auth.rst
bump version to 12.1.2-pve1
[ceph.git] / ceph / doc / cephfs / client-auth.rst
CommitLineData
7c673cae
FG
1================================
2CephFS Client Capabilities
3================================
4
5Use Ceph authentication capabilities to restrict your filesystem clients
6to the lowest possible level of authority needed.
7
8.. note::
9
10 Path restriction and layout modification restriction are new features
11 in the Jewel release of Ceph.
12
13Path restriction
14================
15
16By default, clients are not restricted in what paths they are allowed to mount.
17Further, when clients mount a subdirectory, e.g., /home/user, the MDS does not
18by default verify that subsequent operations
19are ‘locked’ within that directory.
20
21To restrict clients to only mount and work within a certain directory, use
22path-based MDS authentication capabilities.
23
24Syntax
25------
26
27To grant rw access to the specified directory only, we mention the specified
28directory while creating key for a client following the undermentioned syntax. ::
29
30./ceph auth get-or-create client.*client_name* mon 'allow r' mds 'allow r, allow rw path=/*specified_directory*' osd 'allow rw pool=data'
31
32for example, to restrict client ``foo`` to writing only in the ``bar`` directory,
33we will use: ::
34
35./ceph auth get-or-create client.foo mon 'allow r' mds 'allow r, allow rw path=/bar' osd 'allow rw pool=data'
36
37To completely restrict the client to the ``bar`` directory, omit the
38unqualified "allow r" clause: ::
39
40./ceph auth get-or-create client.foo mon 'allow r' mds 'allow rw path=/bar' osd 'allow rw pool=data'
41
42Note that if a client's read access is restricted to a path, they will only
43be able to mount the filesystem when specifying a readable path in the
44mount command (see below).
45
46
47See `User Management - Add a User to a Keyring`_. for additional details on user management
48
49To restrict a client to the specfied sub-directory only, we mention the specified
50directory while mounting following the undermentioned syntax. ::
51
52./ceph-fuse -n client.*client_name* *mount_path* -r *directory_to_be_mounted*
53
54for example, to restrict client ``foo`` to ``mnt/bar`` directory, we will use. ::
55
56./ceph-fuse -n client.foo mnt -r /bar
57
58Free space reporting
59--------------------
60
61By default, when a client is mounting a sub-directory, the used space (``df``)
62will be calculated from the quota on that sub-directory, rather than reporting
63the overall amount of space used on the cluster.
64
65If you would like the client to report the overall usage of the filesystem,
66and not just the quota usage on the sub-directory mounted, then set the
67following config option on the client:
68
69::
70
71 client quota df = false
72
73If quotas are not enabled, or no quota is set on the sub-directory mounted,
74then the overall usage of the filesystem will be reported irrespective of
75the value of this setting.
76
77OSD restriction
78===============
79
80To prevent clients from writing or reading data to pools other than
81those in use for CephFS, set an OSD authentication capability that
82restricts access to the CephFS data pool(s):
83
84::
85
86 client.0
87 key: AQAz7EVWygILFRAAdIcuJ12opU/JKyfFmxhuaw==
88 caps: [mds] allow rw
89 caps: [mon] allow r
90 caps: [osd] allow rw pool=data1, allow rw pool=data2
91
92.. note::
93
94 Without a corresponding MDS path restriction, the OSD capabilities above do
95 **not** restrict file deletions outside of the ``data1`` and ``data2``
96 pools.
97
98You may also restrict clients from writing data by using 'r' instead of
99'rw' in OSD capabilities. This does not affect the ability of the client
100to update filesystem metadata for these files, but it will prevent them
101from persistently writing data in a way that would be visible to other clients.
102
103Layout and Quota restriction (the 'p' flag)
104===========================================
105
106To set layouts or quotas, clients require the 'p' flag in addition to 'rw'.
107This restricts all the attributes that are set by special extended attributes
108with a "ceph." prefix, as well as restricting other means of setting
109these fields (such as openc operations with layouts).
110
111For example, in the following snippet client.0 can modify layouts and quotas,
112but client.1 cannot.
113
114::
115
116 client.0
117 key: AQAz7EVWygILFRAAdIcuJ12opU/JKyfFmxhuaw==
118 caps: [mds] allow rwp
119 caps: [mon] allow r
120 caps: [osd] allow rw pool=data
121
122 client.1
123 key: AQAz7EVWygILFRAAdIcuJ12opU/JKyfFmxhuaw==
124 caps: [mds] allow rw
125 caps: [mon] allow r
126 caps: [osd] allow rw pool=data
127
128
129.. _User Management - Add a User to a Keyring: ../../rados/operations/user-management/#add-a-user-to-a-keyring