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