2010-07-12 17:03:45 -05:00
|
|
|
===============
|
|
|
|
The Auth System
|
|
|
|
===============
|
|
|
|
|
2011-05-26 02:17:42 +00:00
|
|
|
--------
|
2016-09-21 15:23:03 +01:00
|
|
|
Overview
|
2011-05-26 02:17:42 +00:00
|
|
|
--------
|
2010-07-23 17:15:29 -05:00
|
|
|
|
2016-09-21 15:23:03 +01:00
|
|
|
Swift supports a number of auth systems that share the following common
|
|
|
|
characteristics:
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2011-03-14 02:56:37 +00:00
|
|
|
* The authentication/authorization part can be an external system or a
|
|
|
|
subsystem run within Swift as WSGI middleware
|
2010-07-12 17:03:45 -05:00
|
|
|
* The user of Swift passes in an auth token with each request
|
2011-03-14 02:56:37 +00:00
|
|
|
* Swift validates each token with the external auth system or auth subsystem
|
|
|
|
and caches the result
|
2010-07-12 17:03:45 -05:00
|
|
|
* The token does not change from request to request, but does expire
|
|
|
|
|
|
|
|
The token can be passed into Swift using the X-Auth-Token or the
|
|
|
|
X-Storage-Token header. Both have the same format: just a simple string
|
2011-03-14 02:56:37 +00:00
|
|
|
representing the token. Some auth systems use UUID tokens, some an MD5 hash of
|
|
|
|
something unique, some use "something else" but the salient point is that the
|
|
|
|
token is a string which can be sent as-is back to the auth system for
|
2010-07-12 17:03:45 -05:00
|
|
|
validation.
|
|
|
|
|
2011-03-14 02:56:37 +00:00
|
|
|
Swift will make calls to the auth system, giving the auth token to be
|
2010-09-05 20:30:09 -07:00
|
|
|
validated. For a valid token, the auth system responds with an overall
|
2016-09-21 15:23:03 +01:00
|
|
|
expiration time in seconds from now. To avoid the overhead in validating the same
|
|
|
|
token over and over again, Swift will cache the
|
|
|
|
token for a configurable time, but no longer than the expiration
|
2011-07-08 19:57:45 +00:00
|
|
|
time.
|
|
|
|
|
2016-09-21 15:23:03 +01:00
|
|
|
The Swift project includes two auth systems:
|
|
|
|
|
|
|
|
- :ref:`temp_auth`
|
|
|
|
- :ref:`keystone_auth`
|
|
|
|
|
|
|
|
It is also possible to write your own auth system as described in
|
|
|
|
:ref:`extending_auth`.
|
|
|
|
|
|
|
|
.. _temp_auth:
|
|
|
|
|
|
|
|
--------
|
|
|
|
TempAuth
|
|
|
|
--------
|
|
|
|
|
2016-11-23 12:00:19 +00:00
|
|
|
TempAuth is used primarily in Swift's functional test environment and can be
|
|
|
|
used in other test environments (such as :doc:`development_saio`). It is not
|
|
|
|
recommended to use TempAuth in a production system. However, TempAuth is fully
|
|
|
|
functional and can be used as a model to develop your own auth system.
|
|
|
|
|
|
|
|
TempAuth has the concept of admin and non-admin users
|
Privileged acct ACL header, new ACL syntax, TempAuth impl.
* Introduce a new privileged account header: X-Account-Access-Control
* Introduce JSON-based version 2 ACL syntax -- see below for discussion
* Implement account ACL authorization in TempAuth
X-Account-Access-Control Header
-------------------------------
Accounts now have a new privileged header to represent ACLs or any other
form of account-level access control. The value of the header is an opaque
string to be interpreted by the auth system, but it must be a JSON-encoded
dictionary. A reference implementation is given in TempAuth, with the
knowledge that historically other auth systems often use TempAuth as a
starting point.
The reference implementation describes three levels of account access:
"admin", "read-write", and "read-only". Adding new access control
features in a future patch (e.g. "write-only" account access) will
automatically be forward- and backward-compatible, due to the JSON
dictionary header format.
The privileged X-Account-Access-Control header may only be read or written
by a user with "swift_owner" status, traditionally the account owner but
now also any user on the "admin" ACL.
Access Levels:
Read-only access is intended to indicate to the auth system that this
list of identities can read everything (except privileged headers) in
the account. Specifically, a user with read-only account access can get
a list of containers in the account, list the contents of any container,
retrieve any object, and see the (non-privileged) headers of the
account, any container, or any object.
Read-write access is intended to indicate to the auth system that this
list of identities can read or write (or create) any container. A user
with read-write account access can create new containers, set any
unprivileged container headers, overwrite objects, delete containers,
etc. A read-write user can NOT set account headers (or perform any
PUT/POST/DELETE requests on the account).
Admin access is intended to indicate to the auth system that this list of
identities has "swift_owner" privileges. A user with admin account access
can do anything the account owner can, including setting account headers
and any privileged headers -- and thus changing the value of
X-Account-Access-Control and thereby granting read-only, read-write, or
admin access to other users.
The auth system is responsible for making decisions based on this header,
if it chooses to support its use. Therefore the above access level
descriptions are necessarily advisory only for other auth systems.
When setting the value of the header, callers are urged to use the new
format_acl() method, described below.
New ACL Format
--------------
The account ACLs introduce a new format for ACLs, rather than reusing the
existing format from X-Container-Read/X-Container-Write. There are several
reasons for this:
* Container ACL format does not support Unicode
* Container ACLs have a different structure than account ACLs
+ account ACLs have no concept of referrers or rlistings
+ accounts have additional "admin" access level
+ account access levels are structured as admin > rw > ro, which seems more
appropriate for how people access accounts, rather than reusing
container ACLs' orthogonal read and write access
In addition, the container ACL syntax is a bit arbitrary and highly custom,
so instead of parsing additional custom syntax, I'd rather propose a next
version and introduce a means for migration. The V2 ACL syntax has the
following benefits:
* JSON is a well-known standard syntax with parsers in all languages
* no artificial value restrictions (you can grant access to a user named
".rlistings" if you want)
* forward and backward compatibility: you may have extraneous keys, but
your attempt to parse the header won't raise an exception
I've introduced hooks in parse_acl and format_acl which currently default
to the old V1 syntax but tolerate the V2 syntax and can easily be flipped
to default to V2. I'm not changing the default or adding code to rewrite
V1 ACLs to V2, because this patch has suffered a lot of scope creep already,
but this seems like a sensible milestone in the migration.
TempAuth Account ACL Implementation
-----------------------------------
As stated above, core Swift is responsible for privileging the
X-Account-Access-Control header (making it only accessible to swift_owners),
for translating it to -sysmeta-* headers to trigger persistence by the
account server, and for including the header in the responses to requests
by privileged users. Core Swift puts no expectation on the *content* of
this header. Auth systems (including TempAuth) are responsible for
defining the content of the header and taking action based on it.
In addition to the changes described above, this patch defines a format
to be used by TempAuth for these headers in the common.middleware.acl
module, in the methods format_v2_acl() and parse_v2_acl(). This patch
also teaches TempAuth to take action based on the header contents. TempAuth
now sets swift_owner=True if the user is on the Admin ACL, authorizes
GET/HEAD/OPTIONS requests if the user is on any ACL, authorizes
PUT/POST/DELETE requests if the user is on the admin or read-write ACL, etc.
Note that the action of setting swift_owner=True triggers core Swift to
add or strip the privileged headers from the responses. Core Swift (not
the auth system) is responsible for that.
DocImpact: Documentation for the new ACL usage and format appears in
summary form in doc/source/overview_auth.rst, and in more detail in
swift/common/middleware/tempauth.py in the TempAuth class docstring.
I leave it to the Swift doc team to determine whether more is needed.
Change-Id: I836a99eaaa6bb0e92dc03e1ca46a474522e6e826
2013-11-13 20:55:14 +00:00
|
|
|
within an account. Admin users can do anything within the account.
|
2016-09-21 15:23:03 +01:00
|
|
|
Non-admin users can only perform read operations. However, some
|
|
|
|
privileged metadata such as X-Container-Sync-Key is not accessible to
|
|
|
|
non-admin users.
|
Privileged acct ACL header, new ACL syntax, TempAuth impl.
* Introduce a new privileged account header: X-Account-Access-Control
* Introduce JSON-based version 2 ACL syntax -- see below for discussion
* Implement account ACL authorization in TempAuth
X-Account-Access-Control Header
-------------------------------
Accounts now have a new privileged header to represent ACLs or any other
form of account-level access control. The value of the header is an opaque
string to be interpreted by the auth system, but it must be a JSON-encoded
dictionary. A reference implementation is given in TempAuth, with the
knowledge that historically other auth systems often use TempAuth as a
starting point.
The reference implementation describes three levels of account access:
"admin", "read-write", and "read-only". Adding new access control
features in a future patch (e.g. "write-only" account access) will
automatically be forward- and backward-compatible, due to the JSON
dictionary header format.
The privileged X-Account-Access-Control header may only be read or written
by a user with "swift_owner" status, traditionally the account owner but
now also any user on the "admin" ACL.
Access Levels:
Read-only access is intended to indicate to the auth system that this
list of identities can read everything (except privileged headers) in
the account. Specifically, a user with read-only account access can get
a list of containers in the account, list the contents of any container,
retrieve any object, and see the (non-privileged) headers of the
account, any container, or any object.
Read-write access is intended to indicate to the auth system that this
list of identities can read or write (or create) any container. A user
with read-write account access can create new containers, set any
unprivileged container headers, overwrite objects, delete containers,
etc. A read-write user can NOT set account headers (or perform any
PUT/POST/DELETE requests on the account).
Admin access is intended to indicate to the auth system that this list of
identities has "swift_owner" privileges. A user with admin account access
can do anything the account owner can, including setting account headers
and any privileged headers -- and thus changing the value of
X-Account-Access-Control and thereby granting read-only, read-write, or
admin access to other users.
The auth system is responsible for making decisions based on this header,
if it chooses to support its use. Therefore the above access level
descriptions are necessarily advisory only for other auth systems.
When setting the value of the header, callers are urged to use the new
format_acl() method, described below.
New ACL Format
--------------
The account ACLs introduce a new format for ACLs, rather than reusing the
existing format from X-Container-Read/X-Container-Write. There are several
reasons for this:
* Container ACL format does not support Unicode
* Container ACLs have a different structure than account ACLs
+ account ACLs have no concept of referrers or rlistings
+ accounts have additional "admin" access level
+ account access levels are structured as admin > rw > ro, which seems more
appropriate for how people access accounts, rather than reusing
container ACLs' orthogonal read and write access
In addition, the container ACL syntax is a bit arbitrary and highly custom,
so instead of parsing additional custom syntax, I'd rather propose a next
version and introduce a means for migration. The V2 ACL syntax has the
following benefits:
* JSON is a well-known standard syntax with parsers in all languages
* no artificial value restrictions (you can grant access to a user named
".rlistings" if you want)
* forward and backward compatibility: you may have extraneous keys, but
your attempt to parse the header won't raise an exception
I've introduced hooks in parse_acl and format_acl which currently default
to the old V1 syntax but tolerate the V2 syntax and can easily be flipped
to default to V2. I'm not changing the default or adding code to rewrite
V1 ACLs to V2, because this patch has suffered a lot of scope creep already,
but this seems like a sensible milestone in the migration.
TempAuth Account ACL Implementation
-----------------------------------
As stated above, core Swift is responsible for privileging the
X-Account-Access-Control header (making it only accessible to swift_owners),
for translating it to -sysmeta-* headers to trigger persistence by the
account server, and for including the header in the responses to requests
by privileged users. Core Swift puts no expectation on the *content* of
this header. Auth systems (including TempAuth) are responsible for
defining the content of the header and taking action based on it.
In addition to the changes described above, this patch defines a format
to be used by TempAuth for these headers in the common.middleware.acl
module, in the methods format_v2_acl() and parse_v2_acl(). This patch
also teaches TempAuth to take action based on the header contents. TempAuth
now sets swift_owner=True if the user is on the Admin ACL, authorizes
GET/HEAD/OPTIONS requests if the user is on any ACL, authorizes
PUT/POST/DELETE requests if the user is on the admin or read-write ACL, etc.
Note that the action of setting swift_owner=True triggers core Swift to
add or strip the privileged headers from the responses. Core Swift (not
the auth system) is responsible for that.
DocImpact: Documentation for the new ACL usage and format appears in
summary form in doc/source/overview_auth.rst, and in more detail in
swift/common/middleware/tempauth.py in the TempAuth class docstring.
I leave it to the Swift doc team to determine whether more is needed.
Change-Id: I836a99eaaa6bb0e92dc03e1ca46a474522e6e826
2013-11-13 20:55:14 +00:00
|
|
|
|
2013-03-08 19:33:27 +01:00
|
|
|
Users with the special group ``.reseller_admin`` can operate on any account.
|
|
|
|
For an example usage please see :mod:`swift.common.middleware.tempauth`.
|
|
|
|
If a request is coming from a reseller the auth system sets the request environ
|
|
|
|
reseller_request to True. This can be used by other middlewares.
|
|
|
|
|
2016-09-21 15:23:03 +01:00
|
|
|
Other users may be granted the ability to perform operations on
|
|
|
|
an account or container via ACLs. TempAuth supports two types of ACL:
|
|
|
|
|
|
|
|
- Per container ACLs based on the
|
|
|
|
container's ``X-Container-Read`` and ``X-Container-Write`` metadata. See
|
|
|
|
:ref:`container_acls` for more information.
|
|
|
|
|
|
|
|
- Per account ACLs based on the account's ``X-Account-Access-Control``
|
|
|
|
metadata. For more information see :ref:`account_acls`.
|
|
|
|
|
2012-10-11 16:52:26 -05:00
|
|
|
TempAuth will now allow OPTIONS requests to go through without a token.
|
|
|
|
|
2016-09-21 15:23:03 +01:00
|
|
|
The TempAuth middleware is responsible for creating its own tokens. A user
|
|
|
|
makes a request containing their username and password and TempAuth
|
|
|
|
responds with a token. This token is then used to perform subsequent
|
|
|
|
requests on the user's account, containers and objects.
|
|
|
|
|
|
|
|
.. _keystone_auth:
|
2010-07-23 17:15:29 -05:00
|
|
|
|
2012-06-20 16:37:30 +01:00
|
|
|
-------------
|
|
|
|
Keystone Auth
|
|
|
|
-------------
|
|
|
|
|
2016-09-21 15:23:03 +01:00
|
|
|
Swift is able to authenticate against OpenStack Keystone_. In this
|
|
|
|
environment, Keystone is responsible for creating and validating
|
|
|
|
tokens. The :ref:`keystoneauth` middleware is responsible for
|
|
|
|
implementing the auth system within Swift as described here.
|
|
|
|
|
|
|
|
The :ref:`keystoneauth` middleware supports per container based ACLs on the
|
|
|
|
container's ``X-Container-Read`` and ``X-Container-Write`` metadata.
|
|
|
|
For more information see :ref:`container_acls`.
|
|
|
|
|
|
|
|
The account-level ACL is not supported by Keystone auth.
|
2012-06-20 16:37:30 +01:00
|
|
|
|
2014-09-10 16:09:13 +01:00
|
|
|
In order to use the ``keystoneauth`` middleware the ``auth_token``
|
|
|
|
middleware from KeystoneMiddleware_ will need to be configured.
|
2012-06-20 16:37:30 +01:00
|
|
|
|
|
|
|
The ``authtoken`` middleware performs the authentication token
|
|
|
|
validation and retrieves actual user authentication information. It
|
2014-09-10 16:09:13 +01:00
|
|
|
can be found in the KeystoneMiddleware_ distribution.
|
2012-06-20 16:37:30 +01:00
|
|
|
|
2014-09-10 16:09:13 +01:00
|
|
|
The :ref:`keystoneauth` middleware performs authorization and mapping the
|
|
|
|
Keystone roles to Swift's ACLs.
|
|
|
|
|
2017-09-05 19:01:48 +08:00
|
|
|
.. _KeystoneMiddleware: https://docs.openstack.org/keystonemiddleware/latest/
|
|
|
|
.. _Keystone: https://docs.openstack.org/keystone/latest/
|
2012-06-20 16:37:30 +01:00
|
|
|
|
2016-09-07 17:54:36 +01:00
|
|
|
.. _configuring_keystone_auth:
|
|
|
|
|
2012-06-20 16:37:30 +01:00
|
|
|
Configuring Swift to use Keystone
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2014-09-10 16:09:13 +01:00
|
|
|
Configuring Swift to use Keystone_
|
2016-09-19 16:06:18 +01:00
|
|
|
is relatively straightforward. The first
|
2014-09-10 16:09:13 +01:00
|
|
|
step is to ensure that you have the ``auth_token`` middleware installed. It can
|
|
|
|
either be dropped in your python path or installed via the KeystoneMiddleware_
|
|
|
|
package.
|
2012-06-20 16:37:30 +01:00
|
|
|
|
|
|
|
You need at first make sure you have a service endpoint of type
|
2014-09-10 16:09:13 +01:00
|
|
|
``object-store`` in Keystone pointing to your Swift proxy. For example
|
2012-06-20 16:37:30 +01:00
|
|
|
having this in your ``/etc/keystone/default_catalog.templates`` ::
|
|
|
|
|
|
|
|
catalog.RegionOne.object_store.name = Swift Service
|
|
|
|
catalog.RegionOne.object_store.publicURL = http://swiftproxy:8080/v1/AUTH_$(tenant_id)s
|
|
|
|
catalog.RegionOne.object_store.adminURL = http://swiftproxy:8080/
|
|
|
|
catalog.RegionOne.object_store.internalURL = http://swiftproxy:8080/v1/AUTH_$(tenant_id)s
|
|
|
|
|
2016-07-07 21:24:52 +00:00
|
|
|
On your Swift proxy server you will want to adjust your main pipeline
|
2012-06-20 16:37:30 +01:00
|
|
|
and add auth_token and keystoneauth in your
|
|
|
|
``/etc/swift/proxy-server.conf`` like this ::
|
|
|
|
|
|
|
|
[pipeline:main]
|
|
|
|
pipeline = [....] authtoken keystoneauth proxy-logging proxy-server
|
|
|
|
|
|
|
|
add the configuration for the authtoken middleware::
|
|
|
|
|
|
|
|
[filter:authtoken]
|
2014-07-23 10:27:40 -07:00
|
|
|
paste.filter_factory = keystonemiddleware.auth_token:filter_factory
|
2018-04-18 02:06:40 +00:00
|
|
|
www_authenticate_uri = http://keystonehost:5000/
|
2019-07-10 15:46:32 +08:00
|
|
|
auth_url = http://keystonehost:5000/
|
2016-03-16 11:38:33 +00:00
|
|
|
auth_plugin = password
|
|
|
|
project_domain_id = default
|
|
|
|
user_domain_id = default
|
|
|
|
project_name = service
|
|
|
|
username = swift
|
|
|
|
password = password
|
2013-02-21 22:58:27 +01:00
|
|
|
cache = swift.cache
|
2013-12-02 13:40:01 +00:00
|
|
|
include_service_catalog = False
|
2015-02-05 11:01:02 -08:00
|
|
|
delay_auth_decision = True
|
2012-06-20 16:37:30 +01:00
|
|
|
|
|
|
|
The actual values for these variables will need to be set depending on
|
2015-02-03 11:57:06 +00:00
|
|
|
your situation, but in short:
|
|
|
|
|
2018-04-18 02:06:40 +00:00
|
|
|
* ``www_authenticate_uri`` should point to a Keystone service from which users may
|
2015-02-03 11:57:06 +00:00
|
|
|
retrieve tokens. This value is used in the `WWW-Authenticate` header that
|
|
|
|
auth_token sends with any denial response.
|
2016-03-16 11:38:33 +00:00
|
|
|
* ``auth_url`` points to the Keystone Admin service. This information is
|
|
|
|
used by the middleware to actually query Keystone about the validity of the
|
|
|
|
authentication tokens. It is not necessary to append any Keystone API version
|
|
|
|
number to this URI.
|
|
|
|
* The auth credentials (``project_domain_id``, ``user_domain_id``,
|
|
|
|
``username``, ``project_name``, ``password``) will be used to retrieve an
|
|
|
|
admin token. That token will be used to authorize user tokens behind the
|
2016-09-19 16:06:18 +01:00
|
|
|
scenes. These credentials must match the Keystone credentials for the Swift
|
|
|
|
service. The example values shown here assume a user named 'swift' with admin
|
|
|
|
role on a project named 'service', both being in the Keystone domain with id
|
|
|
|
'default'. Refer to the `KeystoneMiddleware documentation
|
2017-09-05 19:01:48 +08:00
|
|
|
<https://docs.openstack.org/keystonemiddleware/latest/middlewarearchitecture.html#configuration>`_
|
2016-09-19 16:06:18 +01:00
|
|
|
for other examples.
|
|
|
|
|
2014-09-10 16:09:13 +01:00
|
|
|
* ``cache`` is set to ``swift.cache``. This means that the middleware
|
2013-12-02 13:40:01 +00:00
|
|
|
will get the Swift memcache from the request environment.
|
2014-09-10 16:09:13 +01:00
|
|
|
* ``include_service_catalog`` defaults to ``True`` if not set. This means
|
2013-12-02 13:40:01 +00:00
|
|
|
that when validating a token, the service catalog is retrieved
|
2023-08-11 13:25:38 +10:00
|
|
|
and stored in the ``X-Service-Catalog`` header. This is required if you use
|
|
|
|
access-rules in Application Credentials. You may also need to increase
|
|
|
|
`max_header_size`.
|
2013-12-02 13:40:01 +00:00
|
|
|
|
2012-06-20 16:37:30 +01:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
2015-02-05 11:01:02 -08:00
|
|
|
The authtoken config variable ``delay_auth_decision`` must be set to
|
|
|
|
``True``. The default is ``False``, but that breaks public access,
|
|
|
|
:ref:`staticweb`, :ref:`formpost`, :ref:`tempurl`, and authenticated
|
|
|
|
capabilities requests (using :ref:`discoverability`).
|
2012-06-20 16:37:30 +01:00
|
|
|
|
2014-11-25 14:42:42 +00:00
|
|
|
and you can finally add the keystoneauth configuration. Here is a simple
|
|
|
|
configuration::
|
2012-06-20 16:37:30 +01:00
|
|
|
|
|
|
|
[filter:keystoneauth]
|
|
|
|
use = egg:swift#keystoneauth
|
|
|
|
operator_roles = admin, swiftoperator
|
|
|
|
|
2014-11-25 14:42:42 +00:00
|
|
|
Use an appropriate list of roles in operator_roles. For example, in
|
|
|
|
some systems, the role ``_member_`` or ``Member`` is used to indicate
|
|
|
|
that the user is allowed to operate on project resources.
|
|
|
|
|
|
|
|
OpenStack Service Using Composite Tokens
|
|
|
|
----------------------------------------
|
|
|
|
|
2016-02-04 16:47:15 +05:30
|
|
|
Some OpenStack services such as Cinder and Glance may use
|
2014-11-25 14:42:42 +00:00
|
|
|
a "service account". In this mode, you configure a separate account where
|
|
|
|
the service stores project data that it manages. This account is not used
|
|
|
|
directly by the end-user. Instead, all access is done through the service.
|
|
|
|
|
|
|
|
To access the "service" account, the service must present two tokens: one from
|
|
|
|
the end-user and another from its own service user. Only when both tokens are
|
|
|
|
present can the account be accessed. This section describes how to set the
|
|
|
|
configuration options to correctly control access to both the "normal" and
|
|
|
|
"service" accounts.
|
|
|
|
|
|
|
|
In this example, end users use the ``AUTH_`` prefix in account names,
|
|
|
|
whereas services use the ``SERVICE_`` prefix::
|
|
|
|
|
|
|
|
[filter:keystoneauth]
|
|
|
|
use = egg:swift#keystoneauth
|
|
|
|
reseller_prefix = AUTH, SERVICE
|
|
|
|
operator_roles = admin, swiftoperator
|
|
|
|
SERVICE_service_roles = service
|
|
|
|
|
|
|
|
The actual values for these variable will need to be set depending on your
|
|
|
|
situation as follows:
|
|
|
|
|
|
|
|
* The first item in the reseller_prefix list must match Keystone's endpoint
|
|
|
|
(see ``/etc/keystone/default_catalog.templates`` above). Normally
|
|
|
|
this is ``AUTH``.
|
|
|
|
* The second item in the reseller_prefix list is the prefix used by the
|
2016-02-04 16:47:15 +05:30
|
|
|
OpenStack services(s). You must configure this value (``SERVICE`` in the
|
|
|
|
example) with whatever the other OpenStack service(s) use.
|
2014-11-25 14:42:42 +00:00
|
|
|
* Set the operator_roles option to contain a role or roles that end-user's
|
|
|
|
have on project's they use.
|
|
|
|
* Set the SERVICE_service_roles value to a role or roles that only the
|
2016-02-04 16:47:15 +05:30
|
|
|
OpenStack service user has. Do not use a role that is assigned to
|
2014-11-25 14:42:42 +00:00
|
|
|
"normal" end users. In this example, the role ``service`` is used.
|
|
|
|
The service user is granted this role to a *single* project only. You do
|
|
|
|
not need to make the service user a member of every project.
|
|
|
|
|
|
|
|
This configuration works as follows:
|
|
|
|
|
2016-02-04 16:47:15 +05:30
|
|
|
* The end-user presents a user token to an OpenStack service. The service
|
2014-11-25 14:42:42 +00:00
|
|
|
then makes a Swift request to the account with the ``SERVICE`` prefix.
|
|
|
|
* The service forwards the original user token with the request. It also
|
|
|
|
adds it's own service token.
|
|
|
|
* Swift validates both tokens. When validated, the user token gives the
|
|
|
|
``admin`` or ``swiftoperator`` role(s). When validated, the service token
|
|
|
|
gives the ``service`` role.
|
|
|
|
* Swift interprets the above configuration as follows:
|
2015-10-19 13:55:02 +01:00
|
|
|
|
2014-11-25 14:42:42 +00:00
|
|
|
* Did the user token provide one of the roles listed in operator_roles?
|
|
|
|
* Did the service token have the ``service`` role as described by the
|
|
|
|
``SERVICE_service_roles`` options.
|
2015-10-19 13:55:02 +01:00
|
|
|
|
2014-11-25 14:42:42 +00:00
|
|
|
* If both conditions are met, the request is granted. Otherwise, Swift
|
|
|
|
rejects the request.
|
|
|
|
|
|
|
|
In the above example, all services share the same account. You can separate
|
|
|
|
each service into its own account. For example, the following provides a
|
|
|
|
dedicated account for each of the Glance and Cinder services. In addition,
|
|
|
|
you must assign the ``glance_service`` and ``cinder_service`` to the
|
|
|
|
appropriate service users::
|
|
|
|
|
|
|
|
[filter:keystoneauth]
|
|
|
|
use = egg:swift#keystoneauth
|
|
|
|
reseller_prefix = AUTH, IMAGE, VOLUME
|
|
|
|
operator_roles = admin, swiftoperator
|
|
|
|
IMAGE_service_roles = glance_service
|
|
|
|
VOLUME_service_roles = cinder_service
|
|
|
|
|
|
|
|
|
2014-09-10 16:09:13 +01:00
|
|
|
Access control using keystoneauth
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
By default the only users able to perform operations (e.g. create a container)
|
|
|
|
on an account are those having a Keystone role for the corresponding Keystone
|
|
|
|
project that matches one of the roles specified in the ``operator_roles``
|
|
|
|
option.
|
|
|
|
|
|
|
|
Users who have one of the ``operator_roles`` will be able to set container ACLs
|
|
|
|
to grant other users permission to read and/or write objects in specific
|
|
|
|
containers, using ``X-Container-Read`` and ``X-Container-Write`` headers
|
|
|
|
respectively. In addition to the ACL formats described
|
|
|
|
:mod:`here <swift.common.middleware.acl>`, keystoneauth supports ACLs using the
|
|
|
|
format::
|
|
|
|
|
|
|
|
other_project_id:other_user_id.
|
|
|
|
|
|
|
|
where ``other_project_id`` is the UUID of a Keystone project and
|
|
|
|
``other_user_id`` is the UUID of a Keystone user. This will allow the other
|
|
|
|
user to access a container provided their token is scoped on the other
|
|
|
|
project. Both ``other_project_id`` and ``other_user_id`` may be replaced with
|
|
|
|
the wildcard character ``*`` which will match any project or user respectively.
|
|
|
|
|
|
|
|
Be sure to use Keystone UUIDs rather than names in container ACLs.
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
For backwards compatibility, keystoneauth will by default grant container
|
|
|
|
ACLs expressed as ``other_project_name:other_user_name`` (i.e. using
|
|
|
|
Keystone names rather than UUIDs) in the special case when both the other
|
|
|
|
project and the other user are in Keystone's default domain and the project
|
|
|
|
being accessed is also in the default domain.
|
2012-06-20 16:37:30 +01:00
|
|
|
|
2014-09-10 16:09:13 +01:00
|
|
|
For further information see :ref:`keystoneauth`
|
2012-06-20 16:37:30 +01:00
|
|
|
|
2013-03-08 19:33:27 +01:00
|
|
|
Users with the Keystone role defined in ``reseller_admin_role``
|
|
|
|
(``ResellerAdmin`` by default) can operate on any account. The auth system
|
|
|
|
sets the request environ reseller_request to True if a request is coming
|
2014-05-26 16:05:42 -05:00
|
|
|
from a user with this role. This can be used by other middlewares.
|
2013-03-08 19:33:27 +01:00
|
|
|
|
2016-09-07 17:54:36 +01:00
|
|
|
Troubleshooting tips for keystoneauth deployment
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Some common mistakes can result in API requests failing when first deploying
|
|
|
|
keystone with Swift:
|
|
|
|
|
|
|
|
* Incorrect configuration of the Swift endpoint in the Keystone service.
|
|
|
|
|
|
|
|
By default, keystoneauth expects the account part of a URL to have the form
|
|
|
|
``AUTH_<keystone_project_id>``. Sometimes the ``AUTH_`` prefix is missed when
|
|
|
|
configuring Swift endpoints in Keystone, as described in the `Install Guide
|
|
|
|
<http://docs.openstack.org/>`_. This is easily diagnosed by inspecting the
|
|
|
|
proxy-server log file for a failed request URL and checking that the URL
|
|
|
|
includes the ``AUTH_`` prefix (or whatever reseller prefix may have been
|
|
|
|
configured for keystoneauth)::
|
|
|
|
|
|
|
|
GOOD:
|
|
|
|
proxy-server: 127.0.0.1 127.0.0.1 07/Sep/2016/16/06/58 HEAD /v1/AUTH_cfb8d9d45212408b90bc0776117aec9e HTTP/1.0 204 ...
|
|
|
|
|
|
|
|
BAD:
|
|
|
|
proxy-server: 127.0.0.1 127.0.0.1 07/Sep/2016/16/07/35 HEAD /v1/cfb8d9d45212408b90bc0776117aec9e HTTP/1.0 403 ...
|
|
|
|
|
|
|
|
|
|
|
|
* Incorrect configuration of the ``authtoken`` middleware options in the Swift
|
|
|
|
proxy server.
|
|
|
|
|
|
|
|
The ``authtoken`` middleware communicates with the Keystone service to
|
|
|
|
validate tokens that are presented with client requests. To do this
|
|
|
|
``authtoken`` must authenticate itself with Keystone using the credentials
|
|
|
|
configured in the ``[filter:authtoken]`` section of
|
|
|
|
``/etc/swift/proxy-server.conf``. Errors in these credentials can result in
|
|
|
|
``authtoken`` failing to validate tokens and may be revealed in the proxy
|
|
|
|
server logs by a message such as::
|
|
|
|
|
|
|
|
proxy-server: Identity server rejected authorization
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
More detailed log messaging may be seen by setting the ``authtoken``
|
|
|
|
option ``log_level = debug``.
|
|
|
|
|
|
|
|
The ``authtoken`` configuration options may be checked by attempting to use
|
|
|
|
them to communicate directly with Keystone using an ``openstack`` command
|
|
|
|
line. For example, given the ``authtoken`` configuration sample shown in
|
|
|
|
:ref:`configuring_keystone_auth`, the following command should return a
|
|
|
|
service catalog::
|
|
|
|
|
|
|
|
openstack --os-identity-api-version=3 --os-auth-url=http://keystonehost:5000/ \
|
|
|
|
--os-username=swift --os-user-domain-id=default \
|
|
|
|
--os-project-name=service --os-project-domain-id=default \
|
|
|
|
--os-password=password catalog show object-store
|
|
|
|
|
|
|
|
If this ``openstack`` command fails then it is likely that there is a problem
|
|
|
|
with the ``authtoken`` configuration.
|
|
|
|
|
2016-09-21 15:23:03 +01:00
|
|
|
.. _extending_auth:
|
|
|
|
|
2010-07-23 17:15:29 -05:00
|
|
|
--------------
|
|
|
|
Extending Auth
|
|
|
|
--------------
|
|
|
|
|
2011-05-26 02:24:12 +00:00
|
|
|
TempAuth is written as wsgi middleware, so implementing your own auth is as
|
2011-05-26 02:17:42 +00:00
|
|
|
easy as writing new wsgi middleware, and plugging it in to the proxy server.
|
2016-09-21 15:23:03 +01:00
|
|
|
|
|
|
|
See :doc:`development_auth` for detailed information on extending the
|
|
|
|
auth system.
|
|
|
|
|
2010-07-23 17:15:29 -05:00
|
|
|
|