2015-11-13 14:12:28 +00:00
|
|
|
|
================================
|
|
|
|
|
CephFS Client Capabilities
|
|
|
|
|
================================
|
|
|
|
|
|
|
|
|
|
Use Ceph authentication capabilities to restrict your filesystem clients
|
|
|
|
|
to the lowest possible level of authority needed.
|
|
|
|
|
|
2015-12-08 14:10:18 +00:00
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
|
|
Path restriction and layout modification restriction are new features
|
|
|
|
|
in the Jewel release of Ceph.
|
|
|
|
|
|
2015-11-13 14:12:28 +00:00
|
|
|
|
Path restriction
|
|
|
|
|
================
|
|
|
|
|
|
|
|
|
|
By default, clients are not restricted in what paths they are allowed to mount.
|
|
|
|
|
Further, when clients mount a subdirectory, e.g., /home/user, the MDS does not
|
|
|
|
|
by default verify that subsequent operations
|
|
|
|
|
are ‘locked’ within that directory.
|
|
|
|
|
|
|
|
|
|
To restrict clients to only mount and work within a certain directory, use
|
|
|
|
|
path-based MDS authentication capabilities.
|
|
|
|
|
|
|
|
|
|
Syntax
|
|
|
|
|
------
|
|
|
|
|
|
|
|
|
|
To grant rw access to the specified directory only, we mention the specified
|
2017-08-02 15:39:51 +00:00
|
|
|
|
directory while creating key for a client using the following syntax. ::
|
2015-11-13 14:12:28 +00:00
|
|
|
|
|
2017-08-02 15:39:51 +00:00
|
|
|
|
ceph fs authorize *filesystem_name* client.*client_name* /*specified_directory* rw
|
2015-11-13 14:12:28 +00:00
|
|
|
|
|
2017-08-02 15:39:51 +00:00
|
|
|
|
for example, to restrict client ``foo`` to writing only in the ``bar`` directory of filesystem ``cephfs``, use ::
|
2015-11-13 14:12:28 +00:00
|
|
|
|
|
2017-08-02 15:39:51 +00:00
|
|
|
|
ceph fs authorize cephfs client.foo / r /bar rw
|
2015-11-13 14:12:28 +00:00
|
|
|
|
|
2017-10-03 14:17:12 +00:00
|
|
|
|
results in:
|
|
|
|
|
|
|
|
|
|
client.foo
|
|
|
|
|
key: *key*
|
|
|
|
|
caps: [mds] allow r, allow rw path=/bar
|
|
|
|
|
caps: [mon] allow r
|
|
|
|
|
caps: [osd] allow rw tag cephfs data=cephfs_a
|
|
|
|
|
|
2017-01-19 05:23:42 +00:00
|
|
|
|
To completely restrict the client to the ``bar`` directory, omit the
|
2017-08-02 15:39:51 +00:00
|
|
|
|
root directory ::
|
2017-01-19 05:23:42 +00:00
|
|
|
|
|
2017-08-02 15:39:51 +00:00
|
|
|
|
ceph fs authorize cephfs client.foo /bar rw
|
2017-01-19 05:23:42 +00:00
|
|
|
|
|
|
|
|
|
Note that if a client's read access is restricted to a path, they will only
|
|
|
|
|
be able to mount the filesystem when specifying a readable path in the
|
|
|
|
|
mount command (see below).
|
|
|
|
|
|
2017-11-13 21:40:43 +00:00
|
|
|
|
Supplying ``all`` or ``*`` as the filesystem name will grant access to every
|
|
|
|
|
file system. Note that it is usually necessary to quote ``*`` to protect it from
|
|
|
|
|
the shell.
|
2017-01-19 05:23:42 +00:00
|
|
|
|
|
2016-08-04 11:50:18 +00:00
|
|
|
|
See `User Management - Add a User to a Keyring`_. for additional details on user management
|
2015-11-13 14:12:28 +00:00
|
|
|
|
|
|
|
|
|
To restrict a client to the specfied sub-directory only, we mention the specified
|
2017-08-02 15:39:51 +00:00
|
|
|
|
directory while mounting using the following syntax. ::
|
2015-11-13 14:12:28 +00:00
|
|
|
|
|
2017-08-02 15:39:51 +00:00
|
|
|
|
./ceph-fuse -n client.*client_name* *mount_path* -r *directory_to_be_mounted*
|
2015-11-13 14:12:28 +00:00
|
|
|
|
|
|
|
|
|
for example, to restrict client ``foo`` to ``mnt/bar`` directory, we will use. ::
|
|
|
|
|
|
2017-08-02 15:39:51 +00:00
|
|
|
|
./ceph-fuse -n client.foo mnt -r /bar
|
2015-11-13 14:12:28 +00:00
|
|
|
|
|
2016-05-11 12:18:23 +00:00
|
|
|
|
Free space reporting
|
|
|
|
|
--------------------
|
|
|
|
|
|
|
|
|
|
By default, when a client is mounting a sub-directory, the used space (``df``)
|
|
|
|
|
will be calculated from the quota on that sub-directory, rather than reporting
|
|
|
|
|
the overall amount of space used on the cluster.
|
|
|
|
|
|
|
|
|
|
If you would like the client to report the overall usage of the filesystem,
|
|
|
|
|
and not just the quota usage on the sub-directory mounted, then set the
|
|
|
|
|
following config option on the client:
|
|
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
|
|
client quota df = false
|
|
|
|
|
|
|
|
|
|
If quotas are not enabled, or no quota is set on the sub-directory mounted,
|
|
|
|
|
then the overall usage of the filesystem will be reported irrespective of
|
|
|
|
|
the value of this setting.
|
|
|
|
|
|
2017-02-24 12:40:43 +00:00
|
|
|
|
Layout and Quota restriction (the 'p' flag)
|
|
|
|
|
===========================================
|
2015-11-13 14:12:28 +00:00
|
|
|
|
|
2017-02-24 12:40:43 +00:00
|
|
|
|
To set layouts or quotas, clients require the 'p' flag in addition to 'rw'.
|
|
|
|
|
This restricts all the attributes that are set by special extended attributes
|
|
|
|
|
with a "ceph." prefix, as well as restricting other means of setting
|
|
|
|
|
these fields (such as openc operations with layouts).
|
2015-11-13 14:12:28 +00:00
|
|
|
|
|
2017-10-03 14:17:12 +00:00
|
|
|
|
For example, in the following snippet client.0 can modify layouts and quotas
|
|
|
|
|
on the filesystem cephfs_a, but client.1 cannot.
|
2015-11-13 14:12:28 +00:00
|
|
|
|
|
|
|
|
|
::
|
2015-12-08 14:10:18 +00:00
|
|
|
|
|
2015-11-13 14:12:28 +00:00
|
|
|
|
client.0
|
|
|
|
|
key: AQAz7EVWygILFRAAdIcuJ12opU/JKyfFmxhuaw==
|
|
|
|
|
caps: [mds] allow rwp
|
|
|
|
|
caps: [mon] allow r
|
2017-10-03 14:17:12 +00:00
|
|
|
|
caps: [osd] allow rw tag cephfs data=cephfs_a
|
2015-11-13 14:12:28 +00:00
|
|
|
|
|
|
|
|
|
client.1
|
|
|
|
|
key: AQAz7EVWygILFRAAdIcuJ12opU/JKyfFmxhuaw==
|
|
|
|
|
caps: [mds] allow rw
|
|
|
|
|
caps: [mon] allow r
|
2017-10-03 14:17:12 +00:00
|
|
|
|
caps: [osd] allow rw tag cephfs data=cephfs_a
|
2015-11-13 14:12:28 +00:00
|
|
|
|
|
2016-08-04 11:50:18 +00:00
|
|
|
|
|
2017-03-01 01:51:01 +00:00
|
|
|
|
.. _User Management - Add a User to a Keyring: ../../rados/operations/user-management/#add-a-user-to-a-keyring
|