]> git.proxmox.com Git - ceph.git/blame - ceph/doc/radosgw/multitenancy.rst
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / doc / radosgw / multitenancy.rst
CommitLineData
11fdf7f2
TL
1.. _rgw-multitenancy:
2
7c673cae
FG
3=================
4RGW Multi-tenancy
5=================
6
7.. versionadded:: Jewel
8
9The multi-tenancy feature allows to use buckets and users of the same
10name simultaneously by segregating them under so-called ``tenants``.
11This may be useful, for instance, to permit users of Swift API to
12create buckets with easily conflicting names such as "test" or "trove".
13
14From the Jewel release onward, each user and bucket lies under a tenant.
15For compatibility, a "legacy" tenant with an empty name is provided.
16Whenever a bucket is referred without an explicit tenant, an implicit
17tenant is used, taken from the user performing the operation. Since
18the pre-existing users are under the legacy tenant, they continue
19to create and access buckets as before. The layout of objects in RADOS
20is extended in a compatible way, ensuring a smooth upgrade to Jewel.
21
22Administering Users With Explicit Tenants
23=========================================
24
25Tenants as such do not have any operations on them. They appear and
11fdf7f2 26disappear as needed, when users are administered. In order to create,
7c673cae
FG
27modify, and remove users with explicit tenants, either an additional
28option --tenant is supplied, or a syntax "<tenant>$<user>" is used
29in the parameters of the radosgw-admin command.
30
31Examples
32--------
33
34Create a user testx$tester to be accessed with S3::
35
36 # radosgw-admin --tenant testx --uid tester --display-name "Test User" --access_key TESTER --secret test123 user create
37
38Create a user testx$tester to be accessed with Swift::
39
40 # radosgw-admin --tenant testx --uid tester --display-name "Test User" --subuser tester:test --key-type swift --access full user create
41 # radosgw-admin --subuser 'testx$tester:test' --key-type swift --secret test123
42
c07f9fc5
FG
43.. note:: The subuser with explicit tenant has to be quoted in the shell.
44
45 Tenant names may contain only alphanumeric characters and underscores.
7c673cae
FG
46
47Accessing Buckets with Explicit Tenants
48=======================================
49
50When a client application accesses buckets, it always operates with
51credentials of a particular user. As mentioned above, every user belongs
52to a tenant. Therefore, every operation has an implicit tenant in its
53context, to be used if no tenant is specified explicitly. Thus a complete
54compatibility is maintained with previous releases, as long as the
55referred buckets and referring user belong to the same tenant.
56In other words, anything unusual occurs when accessing another tenant's
57buckets *only*.
58
59Extensions employed to specify an explicit tenant differ according
60to the protocol and authentication system used.
61
62S3
63--
64
65In case of S3, a colon character is used to separate tenant and bucket.
66Thus a sample URL would be::
67
68 https://ep.host.dom/tenant:bucket
69
70Here's a simple Python sample:
71
72.. code-block:: python
73 :linenos:
74
75 from boto.s3.connection import S3Connection, OrdinaryCallingFormat
76 c = S3Connection(
77 aws_access_key_id="TESTER",
78 aws_secret_access_key="test123",
79 host="ep.host.dom",
80 calling_format = OrdinaryCallingFormat())
81 bucket = c.get_bucket("test5b:testbucket")
82
83Note that it's not possible to supply an explicit tenant using
84a hostname. Hostnames cannot contain colons, or any other separators
85that are not already valid in bucket names. Using a period creates an
86ambiguous syntax. Therefore, the bucket-in-URL-path format has to be
87used.
88
11fdf7f2
TL
89Due to the fact that the native S3 API does not deal with
90multi-tenancy and radosgw's implementation does, things get a bit
91involved when dealing with signed URLs and public read ACLs.
92
93* A **signed URL** does contain the ``AWSAccessKeyId`` query
94 parameters, from which radosgw is able to discern the correct user
95 and tenant owning the bucket. In other words, an application
96 generating signed URLs should be able to take just the un-prefixed
97 bucket name, and produce a signed URL that itself contains the
98 bucket name without the tenant prefix. However, it is *possible* to
99 include the prefix if you so choose.
100
101 Thus, accessing a signed URL of an object ``bar`` in a container
102 ``foo`` belonging to the tenant ``7188e165c0ae4424ac68ae2e89a05c50``
103 would be possible either via
104 ``http://<host>:<port>/foo/bar?AWSAccessKeyId=b200fb6634c547199e436a0f93c0c46e&Expires=1542890806&Signature=eok6CYQC%2FDwmQQmqvY5jTg6ehXU%3D``,
105 or via
106 ``http://<host>:<port>/7188e165c0ae4424ac68ae2e89a05c50:foo/bar?AWSAccessKeyId=b200fb6634c547199e436a0f93c0c46e&Expires=1542890806&Signature=eok6CYQC%2FDwmQQmqvY5jTg6ehXU%3D``,
107 depending on whether or not the tenant prefix was passed in on
108 signature generation.
109
110* A bucket with a **public read ACL** is meant to be read by an HTTP
111 client *without* including any query parameters that would allow
112 radosgw to discern tenants. Thus, publicly readable objects must
113 always be accessed using the bucket name with the tenant prefix.
114
115 Thus, if you set a public read ACL on an object ``bar`` in a
116 container ``foo`` belonging to the tenant
117 ``7188e165c0ae4424ac68ae2e89a05c50``, you would need to access that
118 object via the public URL
119 ``http://<host>:<port>/7188e165c0ae4424ac68ae2e89a05c50:foo/bar``.
120
7c673cae
FG
121Swift with built-in authenticator
122---------------------------------
123
124TBD -- not in test_multen.py yet
125
126Swift with Keystone
127-------------------
128
11fdf7f2
TL
129In the default configuration, although native Swift has inherent
130multi-tenancy, radosgw does not enable multi-tenancy for the Swift
131API. This is to ensure that a setup with legacy buckets --- that is,
132buckets that were created before radosgw supported multitenancy ---,
133those buckets retain their dual-API capability to be queried and
134modified using either S3 or Swift.
135
136If you want to enable multitenancy for Swift, particularly if your
137users only ever authenticate against OpenStack Keystone, you should
138enable Keystone-based multitenancy with the following ``ceph.conf``
139configuration option::
140
141 rgw keystone implicit tenants = true
142
143Once you enable this option, any newly connecting user (whether they
144are using the Swift API, or Keystone-authenticated S3) will prompt
145radosgw to create a user named ``<tenant_id>$<tenant_id``, where
146``<tenant_id>`` is a Keystone tenant (project) UUID --- for example,
147``7188e165c0ae4424ac68ae2e89a05c50$7188e165c0ae4424ac68ae2e89a05c50``.
148
149Whenever that user then creates an Swift container, radosgw internally
150translates the given container name into
151``<tenant_id>/<container_name>``, such as
152``7188e165c0ae4424ac68ae2e89a05c50/foo``. This ensures that if there
153are two or more different tenants all creating a container named
154``foo``, radosgw is able to transparently discern them by their tenant
155prefix.
7c673cae
FG
156
157Notes and known issues
158----------------------
159
160Just to be clear, it is not possible to create buckets in other
161tenants at present. The owner of newly created bucket is extracted
162from authentication information.