]> git.proxmox.com Git - ceph.git/blame - ceph/doc/rados/operations/user-management.rst
Import ceph 15.2.8
[ceph.git] / ceph / doc / rados / operations / user-management.rst
CommitLineData
11fdf7f2
TL
1.. _user-management:
2
7c673cae
FG
3=================
4 User Management
5=================
6
7This document describes :term:`Ceph Client` users, and their authentication and
8authorization with the :term:`Ceph Storage Cluster`. Users are either
9individuals or system actors such as applications, which use Ceph clients to
10interact with the Ceph Storage Cluster daemons.
11
f91f0fd5
TL
12.. ditaa::
13 +-----+
7c673cae
FG
14 | {o} |
15 | |
16 +--+--+ /---------\ /---------\
17 | | Ceph | | Ceph |
18 ---+---*----->| |<------------->| |
19 | uses | Clients | | Servers |
20 | \---------/ \---------/
21 /--+--\
22 | |
23 | |
11fdf7f2 24 actor
7c673cae
FG
25
26
27When Ceph runs with authentication and authorization enabled (enabled by
28default), you must specify a user name and a keyring containing the secret key
29of the specified user (usually via the command line). If you do not specify a
30user name, Ceph will use ``client.admin`` as the default user name. If you do
31not specify a keyring, Ceph will look for a keyring via the ``keyring`` setting
11fdf7f2 32in the Ceph configuration. For example, if you execute the ``ceph health``
7c673cae
FG
33command without specifying a user or keyring::
34
35 ceph health
11fdf7f2 36
7c673cae
FG
37Ceph interprets the command like this::
38
39 ceph -n client.admin --keyring=/etc/ceph/ceph.client.admin.keyring health
40
11fdf7f2 41Alternatively, you may use the ``CEPH_ARGS`` environment variable to avoid
7c673cae
FG
42re-entry of the user name and secret.
43
11fdf7f2 44For details on configuring the Ceph Storage Cluster to use authentication,
7c673cae
FG
45see `Cephx Config Reference`_. For details on the architecture of Cephx, see
46`Architecture - High Availability Authentication`_.
47
48
49Background
50==========
51
52Irrespective of the type of Ceph client (e.g., Block Device, Object Storage,
53Filesystem, native API, etc.), Ceph stores all data as objects within `pools`_.
54Ceph users must have access to pools in order to read and write data.
55Additionally, Ceph users must have execute permissions to use Ceph's
56administrative commands. The following concepts will help you understand Ceph
57user management.
58
59
60User
61----
62
63A user is either an individual or a system actor such as an application.
64Creating users allows you to control who (or what) can access your Ceph Storage
65Cluster, its pools, and the data within pools.
66
67Ceph has the notion of a ``type`` of user. For the purposes of user management,
68the type will always be ``client``. Ceph identifies users in period (.)
69delimited form consisting of the user type and the user ID: for example,
70``TYPE.ID``, ``client.admin``, or ``client.user1``. The reason for user typing
71is that Ceph Monitors, OSDs, and Metadata Servers also use the Cephx protocol,
72but they are not clients. Distinguishing the user type helps to distinguish
73between client users and other users--streamlining access control, user
74monitoring and traceability.
75
76Sometimes Ceph's user type may seem confusing, because the Ceph command line
77allows you to specify a user with or without the type, depending upon your
78command line usage. If you specify ``--user`` or ``--id``, you can omit the
79type. So ``client.user1`` can be entered simply as ``user1``. If you specify
80``--name`` or ``-n``, you must specify the type and name, such as
81``client.user1``. We recommend using the type and name as a best practice
82wherever possible.
83
84.. note:: A Ceph Storage Cluster user is not the same as a Ceph Object Storage
9f95a23c 85 user or a Ceph File System user. The Ceph Object Gateway uses a Ceph Storage
11fdf7f2
TL
86 Cluster user to communicate between the gateway daemon and the storage
87 cluster, but the gateway has its own user management functionality for end
9f95a23c
TL
88 users. The Ceph File System uses POSIX semantics. The user space associated
89 with the Ceph File System is not the same as a Ceph Storage Cluster user.
7c673cae
FG
90
91
92
93Authorization (Capabilities)
94----------------------------
95
96Ceph uses the term "capabilities" (caps) to describe authorizing an
97authenticated user to exercise the functionality of the monitors, OSDs and
11fdf7f2
TL
98metadata servers. Capabilities can also restrict access to data within a pool,
99a namespace within a pool, or a set of pools based on their application tags.
100A Ceph administrative user sets a user's capabilities when creating or updating
101a user.
7c673cae
FG
102
103Capability syntax follows the form::
104
11fdf7f2 105 {daemon-type} '{cap-spec}[, {cap-spec} ...]'
7c673cae 106
c07f9fc5
FG
107- **Monitor Caps:** Monitor capabilities include ``r``, ``w``, ``x`` access
108 settings or ``profile {name}``. For example::
7c673cae 109
11fdf7f2
TL
110 mon 'allow {access-spec} [network {network/prefix}]'
111
112 mon 'profile {name}'
113
114 The ``{access-spec}`` syntax is as follows: ::
115
116 * | all | [r][w][x]
117
118 The optional ``{network/prefix}`` is a standard network name and
119 prefix length in CIDR notation (e.g., ``10.3.0.0/16``). If present,
120 the use of this capability is restricted to clients connecting from
121 this network.
7c673cae 122
c07f9fc5
FG
123- **OSD Caps:** OSD capabilities include ``r``, ``w``, ``x``, ``class-read``,
124 ``class-write`` access settings or ``profile {name}``. Additionally, OSD
125 capabilities also allow for pool and namespace settings. ::
7c673cae 126
11fdf7f2
TL
127 osd 'allow {access-spec} [{match-spec}] [network {network/prefix}]'
128
129 osd 'profile {name} [pool={pool-name} [namespace={namespace-name}]] [network {network/prefix}]'
130
131 The ``{access-spec}`` syntax is either of the following: ::
132
133 * | all | [r][w][x] [class-read] [class-write]
134
135 class {class name} [{method name}]
136
137 The optional ``{match-spec}`` syntax is either of the following: ::
138
139 pool={pool-name} [namespace={namespace-name}] [object_prefix {prefix}]
140
141 [namespace={namespace-name}] tag {application} {key}={value}
142
143 The optional ``{network/prefix}`` is a standard network name and
144 prefix length in CIDR notation (e.g., ``10.3.0.0/16``). If present,
145 the use of this capability is restricted to clients connecting from
146 this network.
7c673cae 147
92f5a8d4
TL
148- **Manager Caps:** Manager (``ceph-mgr``) capabilities include
149 ``r``, ``w``, ``x`` access settings or ``profile {name}``. For example: ::
150
151 mgr 'allow {access-spec} [network {network/prefix}]'
152
153 mgr 'profile {name} [{key1} {match-type} {value1} ...] [network {network/prefix}]'
154
155 Manager capabilities can also be specified for specific commands,
156 all commands exported by a built-in manager service, or all commands
157 exported by a specific add-on module. For example: ::
158
159 mgr 'allow command "{command-prefix}" [with {key1} {match-type} {value1} ...] [network {network/prefix}]'
160
161 mgr 'allow service {service-name} {access-spec} [network {network/prefix}]'
162
163 mgr 'allow module {module-name} [with {key1} {match-type} {value1} ...] {access-spec} [network {network/prefix}]'
164
165 The ``{access-spec}`` syntax is as follows: ::
166
167 * | all | [r][w][x]
168
169 The ``{service-name}`` is one of the following: ::
170
171 mgr | osd | pg | py
172
173 The ``{match-type}`` is one of the following: ::
174
175 = | prefix | regex
176
d2e6a577
FG
177- **Metadata Server Caps:** For administrators, use ``allow *``. For all
178 other users, such as CephFS clients, consult :doc:`/cephfs/client-auth`
7c673cae
FG
179
180
11fdf7f2
TL
181.. note:: The Ceph Object Gateway daemon (``radosgw``) is a client of the
182 Ceph Storage Cluster, so it is not represented as a Ceph Storage
7c673cae
FG
183 Cluster daemon type.
184
11fdf7f2 185The following entries describe each access capability.
7c673cae
FG
186
187``allow``
188
11fdf7f2 189:Description: Precedes access settings for a daemon. Implies ``rw``
7c673cae
FG
190 for MDS only.
191
192
193``r``
194
11fdf7f2 195:Description: Gives the user read access. Required with monitors to retrieve
7c673cae
FG
196 the CRUSH map.
197
198
199``w``
200
201:Description: Gives the user write access to objects.
202
203
204``x``
205
11fdf7f2 206:Description: Gives the user the capability to call class methods
7c673cae
FG
207 (i.e., both read and write) and to conduct ``auth``
208 operations on monitors.
209
210
211``class-read``
212
11fdf7f2
TL
213:Descriptions: Gives the user the capability to call class read methods.
214 Subset of ``x``.
7c673cae
FG
215
216
217``class-write``
218
11fdf7f2
TL
219:Description: Gives the user the capability to call class write methods.
220 Subset of ``x``.
7c673cae
FG
221
222
11fdf7f2 223``*``, ``all``
7c673cae 224
11fdf7f2
TL
225:Description: Gives the user read, write and execute permissions for a
226 particular daemon/pool, and the ability to execute
7c673cae
FG
227 admin commands.
228
11fdf7f2 229The following entries describe valid capability profiles:
7c673cae 230
c07f9fc5 231``profile osd`` (Monitor only)
7c673cae 232
11fdf7f2 233:Description: Gives a user permissions to connect as an OSD to other OSDs or
7c673cae
FG
234 monitors. Conferred on OSDs to enable OSDs to handle replication
235 heartbeat traffic and status reporting.
236
237
c07f9fc5 238``profile mds`` (Monitor only)
7c673cae 239
11fdf7f2 240:Description: Gives a user permissions to connect as a MDS to other MDSs or
7c673cae
FG
241 monitors.
242
243
c07f9fc5 244``profile bootstrap-osd`` (Monitor only)
7c673cae 245
11fdf7f2
TL
246:Description: Gives a user permissions to bootstrap an OSD. Conferred on
247 deployment tools such as ``ceph-volume``, ``ceph-deploy``, etc.
248 so that they have permissions to add keys, etc. when
7c673cae
FG
249 bootstrapping an OSD.
250
251
c07f9fc5 252``profile bootstrap-mds`` (Monitor only)
7c673cae 253
11fdf7f2 254:Description: Gives a user permissions to bootstrap a metadata server.
7c673cae
FG
255 Conferred on deployment tools such as ``ceph-deploy``, etc.
256 so they have permissions to add keys, etc. when bootstrapping
257 a metadata server.
258
11fdf7f2
TL
259``profile bootstrap-rbd`` (Monitor only)
260
261:Description: Gives a user permissions to bootstrap an RBD user.
262 Conferred on deployment tools such as ``ceph-deploy``, etc.
263 so they have permissions to add keys, etc. when bootstrapping
264 an RBD user.
265
266``profile bootstrap-rbd-mirror`` (Monitor only)
267
268:Description: Gives a user permissions to bootstrap an ``rbd-mirror`` daemon
269 user. Conferred on deployment tools such as ``ceph-deploy``, etc.
270 so they have permissions to add keys, etc. when bootstrapping
271 an ``rbd-mirror`` daemon.
272
92f5a8d4 273``profile rbd`` (Manager, Monitor, and OSD)
c07f9fc5
FG
274
275:Description: Gives a user permissions to manipulate RBD images. When used
276 as a Monitor cap, it provides the minimal privileges required
92f5a8d4
TL
277 by an RBD client application; this includes the ability
278 to blacklist other client users. When used as an OSD cap, it
279 provides read-write access to the specified pool to an
280 RBD client application. The Manager cap supports optional
281 ``pool`` and ``namespace`` keyword arguments.
c07f9fc5 282
11fdf7f2
TL
283``profile rbd-mirror`` (Monitor only)
284
285:Description: Gives a user permissions to manipulate RBD images and retrieve
286 RBD mirroring config-key secrets. It provides the minimal
287 privileges required for the ``rbd-mirror`` daemon.
288
92f5a8d4 289``profile rbd-read-only`` (Manager and OSD)
c07f9fc5 290
92f5a8d4
TL
291:Description: Gives a user read-only permissions to RBD images. The Manager
292 cap supports optional ``pool`` and ``namespace`` keyword
293 arguments.
7c673cae
FG
294
295
296Pool
297----
298
299A pool is a logical partition where users store data.
300In Ceph deployments, it is common to create a pool as a logical partition for
301similar types of data. For example, when deploying Ceph as a backend for
302OpenStack, a typical deployment would have pools for volumes, images, backups
303and virtual machines, and users such as ``client.glance``, ``client.cinder``,
304etc.
305
11fdf7f2
TL
306Application Tags
307----------------
308
309Access may be restricted to specific pools as defined by their application
310metadata. The ``*`` wildcard may be used for the ``key`` argument, the
311``value`` argument, or both. ``all`` is a synony for ``*``.
7c673cae
FG
312
313Namespace
314---------
315
316Objects within a pool can be associated to a namespace--a logical group of
317objects within the pool. A user's access to a pool can be associated with a
318namespace such that reads and writes by the user take place only within the
319namespace. Objects written to a namespace within the pool can only be accessed
320by users who have access to the namespace.
321
c07f9fc5
FG
322.. note:: Namespaces are primarily useful for applications written on top of
323 ``librados`` where the logical grouping can alleviate the need to create
324 different pools. Ceph Object Gateway (from ``luminous``) uses namespaces for various
325 metadata objects.
7c673cae
FG
326
327The rationale for namespaces is that pools can be a computationally expensive
328method of segregating data sets for the purposes of authorizing separate sets
11fdf7f2
TL
329of users. For example, a pool should have ~100 placement groups per OSD. So an
330exemplary cluster with 1000 OSDs would have 100,000 placement groups for one
331pool. Each pool would create another 100,000 placement groups in the exemplary
332cluster. By contrast, writing an object to a namespace simply associates the
333namespace to the object name with out the computational overhead of a separate
7c673cae
FG
334pool. Rather than creating a separate pool for a user or set of users, you may
335use a namespace. **Note:** Only available using ``librados`` at this time.
336
11fdf7f2
TL
337Access may be restricted to specific RADOS namespaces using the ``namespace``
338capability. Limited globbing of namespaces is supported; if the last character
339of the specified namespace is ``*``, then access is granted to any namespace
340starting with the provided argument.
341
7c673cae
FG
342
343Managing Users
344==============
345
346User management functionality provides Ceph Storage Cluster administrators with
347the ability to create, update and delete users directly in the Ceph Storage
348Cluster.
349
350When you create or delete users in the Ceph Storage Cluster, you may need to
351distribute keys to clients so that they can be added to keyrings. See `Keyring
352Management`_ for details.
353
354
355List Users
356----------
357
358To list the users in your cluster, execute the following::
359
c07f9fc5 360 ceph auth ls
7c673cae
FG
361
362Ceph will list out all users in your cluster. For example, in a two-node
c07f9fc5 363exemplary cluster, ``ceph auth ls`` will output something that looks like
7c673cae
FG
364this::
365
366 installed auth entries:
367
368 osd.0
369 key: AQCvCbtToC6MDhAATtuT70Sl+DymPCfDSsyV4w==
370 caps: [mon] allow profile osd
371 caps: [osd] allow *
372 osd.1
373 key: AQC4CbtTCFJBChAAVq5spj0ff4eHZICxIOVZeA==
374 caps: [mon] allow profile osd
375 caps: [osd] allow *
376 client.admin
377 key: AQBHCbtT6APDHhAA5W00cBchwkQjh3dkKsyPjw==
378 caps: [mds] allow
379 caps: [mon] allow *
380 caps: [osd] allow *
381 client.bootstrap-mds
382 key: AQBICbtTOK9uGBAAdbe5zcIGHZL3T/u2g6EBww==
383 caps: [mon] allow profile bootstrap-mds
384 client.bootstrap-osd
385 key: AQBHCbtT4GxqORAADE5u7RkpCN/oo4e5W0uBtw==
386 caps: [mon] allow profile bootstrap-osd
387
388
389Note that the ``TYPE.ID`` notation for users applies such that ``osd.0`` is a
390user of type ``osd`` and its ID is ``0``, ``client.admin`` is a user of type
391``client`` and its ID is ``admin`` (i.e., the default ``client.admin`` user).
392Note also that each entry has a ``key: <value>`` entry, and one or more
393``caps:`` entries.
394
11fdf7f2 395You may use the ``-o {filename}`` option with ``ceph auth ls`` to
7c673cae
FG
396save the output to a file.
397
398
399Get a User
400----------
401
11fdf7f2 402To retrieve a specific user, key and capabilities, execute the
7c673cae
FG
403following::
404
405 ceph auth get {TYPE.ID}
406
407For example::
408
409 ceph auth get client.admin
410
11fdf7f2 411You may also use the ``-o {filename}`` option with ``ceph auth get`` to
7c673cae
FG
412save the output to a file. Developers may also execute the following::
413
414 ceph auth export {TYPE.ID}
415
11fdf7f2 416The ``auth export`` command is identical to ``auth get``.
7c673cae
FG
417
418
419
420Add a User
421----------
422
423Adding a user creates a username (i.e., ``TYPE.ID``), a secret key and
424any capabilities included in the command you use to create the user.
425
11fdf7f2 426A user's key enables the user to authenticate with the Ceph Storage Cluster.
7c673cae
FG
427The user's capabilities authorize the user to read, write, or execute on Ceph
428monitors (``mon``), Ceph OSDs (``osd``) or Ceph Metadata Servers (``mds``).
429
430There are a few ways to add a user:
431
432- ``ceph auth add``: This command is the canonical way to add a user. It
433 will create the user, generate a key and add any specified capabilities.
11fdf7f2 434
7c673cae 435- ``ceph auth get-or-create``: This command is often the most convenient way
11fdf7f2 436 to create a user, because it returns a keyfile format with the user name
7c673cae 437 (in brackets) and the key. If the user already exists, this command
11fdf7f2 438 simply returns the user name and key in the keyfile format. You may use the
7c673cae
FG
439 ``-o {filename}`` option to save the output to a file.
440
441- ``ceph auth get-or-create-key``: This command is a convenient way to create
442 a user and return the user's key (only). This is useful for clients that
443 need the key only (e.g., libvirt). If the user already exists, this command
11fdf7f2 444 simply returns the key. You may use the ``-o {filename}`` option to save the
7c673cae
FG
445 output to a file.
446
447When creating client users, you may create a user with no capabilities. A user
448with no capabilities is useless beyond mere authentication, because the client
11fdf7f2
TL
449cannot retrieve the cluster map from the monitor. However, you can create a
450user with no capabilities if you wish to defer adding capabilities later using
7c673cae
FG
451the ``ceph auth caps`` command.
452
11fdf7f2 453A typical user has at least read capabilities on the Ceph monitor and
7c673cae
FG
454read and write capability on Ceph OSDs. Additionally, a user's OSD permissions
455are often restricted to accessing a particular pool. ::
456
457 ceph auth add client.john mon 'allow r' osd 'allow rw pool=liverpool'
458 ceph auth get-or-create client.paul mon 'allow r' osd 'allow rw pool=liverpool'
459 ceph auth get-or-create client.george mon 'allow r' osd 'allow rw pool=liverpool' -o george.keyring
460 ceph auth get-or-create-key client.ringo mon 'allow r' osd 'allow rw pool=liverpool' -o ringo.key
461
462
463.. important:: If you provide a user with capabilities to OSDs, but you DO NOT
11fdf7f2 464 restrict access to particular pools, the user will have access to ALL
7c673cae
FG
465 pools in the cluster!
466
467
31f18b77 468.. _modify-user-capabilities:
224ce89b 469
7c673cae
FG
470Modify User Capabilities
471------------------------
472
11fdf7f2 473The ``ceph auth caps`` command allows you to specify a user and change the
7c673cae
FG
474user's capabilities. Setting new capabilities will overwrite current capabilities.
475To view current capabilities run ``ceph auth get USERTYPE.USERID``. To add
11fdf7f2 476capabilities, you should also specify the existing capabilities when using the form::
7c673cae
FG
477
478 ceph auth caps USERTYPE.USERID {daemon} 'allow [r|w|x|*|...] [pool={pool-name}] [namespace={namespace-name}]' [{daemon} 'allow [r|w|x|*|...] [pool={pool-name}] [namespace={namespace-name}]']
479
11fdf7f2 480For example::
7c673cae
FG
481
482 ceph auth get client.john
483 ceph auth caps client.john mon 'allow r' osd 'allow rw pool=liverpool'
484 ceph auth caps client.paul mon 'allow rw' osd 'allow rwx pool=liverpool'
485 ceph auth caps client.brian-manager mon 'allow *' osd 'allow *'
486
7c673cae
FG
487See `Authorization (Capabilities)`_ for additional details on capabilities.
488
489
490Delete a User
491-------------
492
11fdf7f2 493To delete a user, use ``ceph auth del``::
7c673cae
FG
494
495 ceph auth del {TYPE}.{ID}
11fdf7f2
TL
496
497Where ``{TYPE}`` is one of ``client``, ``osd``, ``mon``, or ``mds``,
7c673cae
FG
498and ``{ID}`` is the user name or ID of the daemon.
499
500
501Print a User's Key
502------------------
503
504To print a user's authentication key to standard output, execute the following::
505
506 ceph auth print-key {TYPE}.{ID}
507
11fdf7f2 508Where ``{TYPE}`` is one of ``client``, ``osd``, ``mon``, or ``mds``,
7c673cae
FG
509and ``{ID}`` is the user name or ID of the daemon.
510
11fdf7f2 511Printing a user's key is useful when you need to populate client
7c673cae
FG
512software with a user's key (e.g., libvirt). ::
513
514 mount -t ceph serverhost:/ mountpoint -o name=client.user,secret=`ceph auth print-key client.user`
515
516
517Import a User(s)
518----------------
519
520To import one or more users, use ``ceph auth import`` and
11fdf7f2 521specify a keyring::
7c673cae
FG
522
523 ceph auth import -i /path/to/keyring
524
11fdf7f2 525For example::
7c673cae
FG
526
527 sudo ceph auth import -i /etc/ceph/ceph.keyring
528
529
11fdf7f2
TL
530.. note:: The ceph storage cluster will add new users, their keys and their
531 capabilities and will update existing users, their keys and their
7c673cae
FG
532 capabilities.
533
534
535Keyring Management
536==================
537
11fdf7f2
TL
538When you access Ceph via a Ceph client, the Ceph client will look for a local
539keyring. Ceph presets the ``keyring`` setting with the following four keyring
540names by default so you don't have to set them in your Ceph configuration file
541unless you want to override the defaults (not recommended):
7c673cae
FG
542
543- ``/etc/ceph/$cluster.$name.keyring``
544- ``/etc/ceph/$cluster.keyring``
545- ``/etc/ceph/keyring``
546- ``/etc/ceph/keyring.bin``
547
548The ``$cluster`` metavariable is your Ceph cluster name as defined by the
549name of the Ceph configuration file (i.e., ``ceph.conf`` means the cluster name
11fdf7f2 550is ``ceph``; thus, ``ceph.keyring``). The ``$name`` metavariable is the user
7c673cae
FG
551type and user ID (e.g., ``client.admin``; thus, ``ceph.client.admin.keyring``).
552
553.. note:: When executing commands that read or write to ``/etc/ceph``, you may
554 need to use ``sudo`` to execute the command as ``root``.
555
556After you create a user (e.g., ``client.ringo``), you must get the key and add
557it to a keyring on a Ceph client so that the user can access the Ceph Storage
558Cluster.
559
560The `User Management`_ section details how to list, get, add, modify and delete
561users directly in the Ceph Storage Cluster. However, Ceph also provides the
562``ceph-authtool`` utility to allow you to manage keyrings from a Ceph client.
563
564
565Create a Keyring
566----------------
567
11fdf7f2
TL
568When you use the procedures in the `Managing Users`_ section to create users,
569you need to provide user keys to the Ceph client(s) so that the Ceph client
570can retrieve the key for the specified user and authenticate with the Ceph
571Storage Cluster. Ceph Clients access keyrings to lookup a user name and
7c673cae
FG
572retrieve the user's key.
573
11fdf7f2
TL
574The ``ceph-authtool`` utility allows you to create a keyring. To create an
575empty keyring, use ``--create-keyring`` or ``-C``. For example::
7c673cae
FG
576
577 ceph-authtool --create-keyring /path/to/keyring
578
579When creating a keyring with multiple users, we recommend using the cluster name
580(e.g., ``$cluster.keyring``) for the keyring filename and saving it in the
581``/etc/ceph`` directory so that the ``keyring`` configuration default setting
582will pick up the filename without requiring you to specify it in the local copy
583of your Ceph configuration file. For example, create ``ceph.keyring`` by
584executing the following::
585
586 sudo ceph-authtool -C /etc/ceph/ceph.keyring
587
588When creating a keyring with a single user, we recommend using the cluster name,
589the user type and the user name and saving it in the ``/etc/ceph`` directory.
590For example, ``ceph.client.admin.keyring`` for the ``client.admin`` user.
591
592To create a keyring in ``/etc/ceph``, you must do so as ``root``. This means
11fdf7f2
TL
593the file will have ``rw`` permissions for the ``root`` user only, which is
594appropriate when the keyring contains administrator keys. However, if you
7c673cae 595intend to use the keyring for a particular user or group of users, ensure
11fdf7f2 596that you execute ``chown`` or ``chmod`` to establish appropriate keyring
7c673cae
FG
597ownership and access.
598
599
600Add a User to a Keyring
601-----------------------
602
603When you `Add a User`_ to the Ceph Storage Cluster, you can use the `Get a
604User`_ procedure to retrieve a user, key and capabilities and save the user to a
605keyring.
606
607When you only want to use one user per keyring, the `Get a User`_ procedure with
11fdf7f2
TL
608the ``-o`` option will save the output in the keyring file format. For example,
609to create a keyring for the ``client.admin`` user, execute the following::
7c673cae
FG
610
611 sudo ceph auth get client.admin -o /etc/ceph/ceph.client.admin.keyring
11fdf7f2 612
7c673cae
FG
613Notice that we use the recommended file format for an individual user.
614
615When you want to import users to a keyring, you can use ``ceph-authtool``
616to specify the destination keyring and the source keyring.
11fdf7f2 617For example::
7c673cae
FG
618
619 sudo ceph-authtool /etc/ceph/ceph.keyring --import-keyring /etc/ceph/ceph.client.admin.keyring
620
621
622Create a User
623-------------
624
625Ceph provides the `Add a User`_ function to create a user directly in the Ceph
626Storage Cluster. However, you can also create a user, keys and capabilities
627directly on a Ceph client keyring. Then, you can import the user to the Ceph
628Storage Cluster. For example::
629
630 sudo ceph-authtool -n client.ringo --cap osd 'allow rwx' --cap mon 'allow rwx' /etc/ceph/ceph.keyring
631
632See `Authorization (Capabilities)`_ for additional details on capabilities.
633
634You can also create a keyring and add a new user to the keyring simultaneously.
635For example::
636
637 sudo ceph-authtool -C /etc/ceph/ceph.keyring -n client.ringo --cap osd 'allow rwx' --cap mon 'allow rwx' --gen-key
638
11fdf7f2 639In the foregoing scenarios, the new user ``client.ringo`` is only in the
7c673cae
FG
640keyring. To add the new user to the Ceph Storage Cluster, you must still add
641the new user to the Ceph Storage Cluster. ::
642
643 sudo ceph auth add client.ringo -i /etc/ceph/ceph.keyring
644
645
646Modify a User
647-------------
648
649To modify the capabilities of a user record in a keyring, specify the keyring,
650and the user followed by the capabilities. For example::
651
652 sudo ceph-authtool /etc/ceph/ceph.keyring -n client.ringo --cap osd 'allow rwx' --cap mon 'allow rwx'
653
654To update the user to the Ceph Storage Cluster, you must update the user
655in the keyring to the user entry in the the Ceph Storage Cluster. ::
656
657 sudo ceph auth import -i /etc/ceph/ceph.keyring
658
659See `Import a User(s)`_ for details on updating a Ceph Storage Cluster user
660from a keyring.
661
662You may also `Modify User Capabilities`_ directly in the cluster, store the
663results to a keyring file; then, import the keyring into your main
664``ceph.keyring`` file.
665
666
667Command Line Usage
668==================
669
670Ceph supports the following usage for user name and secret:
671
672``--id`` | ``--user``
673
674:Description: Ceph identifies users with a type and an ID (e.g., ``TYPE.ID`` or
11fdf7f2
TL
675 ``client.admin``, ``client.user1``). The ``id``, ``name`` and
676 ``-n`` options enable you to specify the ID portion of the user
677 name (e.g., ``admin``, ``user1``, ``foo``, etc.). You can specify
678 the user with the ``--id`` and omit the type. For example,
679 to specify user ``client.foo`` enter the following::
680
7c673cae
FG
681 ceph --id foo --keyring /path/to/keyring health
682 ceph --user foo --keyring /path/to/keyring health
683
684
685``--name`` | ``-n``
686
687:Description: Ceph identifies users with a type and an ID (e.g., ``TYPE.ID`` or
11fdf7f2
TL
688 ``client.admin``, ``client.user1``). The ``--name`` and ``-n``
689 options enables you to specify the fully qualified user name.
690 You must specify the user type (typically ``client``) with the
691 user ID. For example::
7c673cae
FG
692
693 ceph --name client.foo --keyring /path/to/keyring health
694 ceph -n client.foo --keyring /path/to/keyring health
695
696
697``--keyring``
698
11fdf7f2
TL
699:Description: The path to the keyring containing one or more user name and
700 secret. The ``--secret`` option provides the same functionality,
701 but it does not work with Ceph RADOS Gateway, which uses
702 ``--secret`` for another purpose. You may retrieve a keyring with
703 ``ceph auth get-or-create`` and store it locally. This is a
704 preferred approach, because you can switch user names without
705 switching the keyring path. For example::
7c673cae
FG
706
707 sudo rbd map --id foo --keyring /path/to/keyring mypool/myimage
708
709
710.. _pools: ../pools
711
712
713Limitations
714===========
715
716The ``cephx`` protocol authenticates Ceph clients and servers to each other. It
717is not intended to handle authentication of human users or application programs
718run on their behalf. If that effect is required to handle your access control
719needs, you must have another mechanism, which is likely to be specific to the
720front end used to access the Ceph object store. This other mechanism has the
721role of ensuring that only acceptable users and programs are able to run on the
11fdf7f2 722machine that Ceph will permit to access its object store.
7c673cae
FG
723
724The keys used to authenticate Ceph clients and servers are typically stored in
725a plain text file with appropriate permissions in a trusted host.
726
11fdf7f2
TL
727.. important:: Storing keys in plaintext files has security shortcomings, but
728 they are difficult to avoid, given the basic authentication methods Ceph
729 uses in the background. Those setting up Ceph systems should be aware of
730 these shortcomings.
7c673cae
FG
731
732In particular, arbitrary user machines, especially portable machines, should not
733be configured to interact directly with Ceph, since that mode of use would
734require the storage of a plaintext authentication key on an insecure machine.
735Anyone who stole that machine or obtained surreptitious access to it could
736obtain the key that will allow them to authenticate their own machines to Ceph.
737
738Rather than permitting potentially insecure machines to access a Ceph object
739store directly, users should be required to sign in to a trusted machine in
740your environment using a method that provides sufficient security for your
741purposes. That trusted machine will store the plaintext Ceph keys for the
742human users. A future version of Ceph may address these particular
743authentication issues more fully.
744
745At the moment, none of the Ceph authentication protocols provide secrecy for
746messages in transit. Thus, an eavesdropper on the wire can hear and understand
747all data sent between clients and servers in Ceph, even if it cannot create or
748alter them. Further, Ceph does not include options to encrypt user data in the
749object store. Users can hand-encrypt and store their own data in the Ceph
750object store, of course, but Ceph provides no features to perform object
751encryption itself. Those storing sensitive data in Ceph should consider
752encrypting their data before providing it to the Ceph system.
753
754
755.. _Architecture - High Availability Authentication: ../../../architecture#high-availability-authentication
756.. _Cephx Config Reference: ../../configuration/auth-config-ref