Openstack-authn


 * Launchpad Entry: NovaSpec:openstack-authn
 * Created: 10-29-2010

= Authentication in OpenStack = Jorge L Williams < jorge.williams@rackspace.com >, Khaled Hussein < khaled.hussein@rackspace.com >, Ziad N Sawalha < ziad.sawalha@rackspace.com >

Abstract
The purpose of this blueprint is to define a standard for authentication in OpenStack that enables services to support multiple authentication protocols in a pluggable manner. By providing support for authentication via pluggable authentication components, this standard allows OpenStack services to be integrated easily into existing deployment environments. It also provides a path by which to implement support for emerging authentication standards such as OpenID. The standard is not an authentication system onto itself, but rather a protocol by which authentication systems may be integrated with OpenStack services.

Rationale and Goals
Currently, OpenStack does not support a unified authentication mechanism for its storage and compute services. This complicates the deployment of these services in a single environment and prevents OpenStack from easily integrating with existing authentication and identity management systems. To address this issue, we propose a standard for authentication that allows support for multiple authentication protocols via pluggable authentication components.

In this blueprint, we define the responsibilities of authentication components. We describe how these interact with underlying OpenStack services and how existing services can be modified to take advantage of pluggable authentication. The goal is to allow OpenStack services to be integrated easily into existing deployment environments and to provide a path by which to implement support for emerging authentication standards such as OpenID.

Specification Overview
Authentication is the process of determining that users are who they say they are. Typically, authentication protocols such as HTTP Basic Auth, Digest Access, public key, token, etc, are used to verify a user's identity. In this blueprint, we define an authentication component as a software module that implements an authentication protocol for an OpenStack service.

At a high level, an authentication component is simply a reverse proxy that intercepts HTTP calls from clients. Once it has verified a user's identity, the authentication component extends the call with information about the current user and forwards the request to the OpenStack service. Otherwise, if a user's identity is not verified, the message is rejected before it gets to the service. This is illustrated in Figure 1.

'''Figure 1. An Authentication Component'''



Authentication components may operate in delegated mode. In this mode, the decision to reject an unauthenticated client is delegated to the OpenStack service. Delegated mode is illustrated in Figure 2. Here, requests are forwarded to the OpenStack service with an identity status message that indicates whether the client's identity has been confirmed or is indeterminate. It is the OpenStack service that decides whether or not a reject message should be sent to the client. Note that it is always the responsibility of the Authentication Component to transmit reject messages to the client.

'''Figure 2. An Authentication Component (Delegated Mode)'''



In this blueprint, we define interactions between the authentication component and the OpenStack service. Interactions between the client and the authentication component are defined only for exceptional cases. For example, we define the message that should be returned when the OpenStack service is down. Other interactions, however, are defined by the underlying authentication protocol and the OpenStack service and are considered out of scope.

Deployment Strategies
An authentication component may be integrated directly into the service implementation, or it may be deployed separately as an HTTP reverse proxy. This is illustrated in Figure 3, showing both approaches to authentication, labeled Option (a) and Option (b).

'''Figure 3. Authentication Component Deployments Options'''



In Option (a), the component is integrated into the service implementation. In this case, communication between the authentication component and the service can be efficiently implemented via a method call. In Option (b), the component is deployed separately and communication between the service and the component involves an HTTP request. In both cases, unauthenticated requests are filtered before they reach the service.

Each approach offers some benefits. Option (a) offers low latency and ease of initial implementation, making it possibly most appropriate as a starting point for simple configurations. Option (b) offers several key advantages that may be of particular value in complex and dynamic configurations. It offers the ability to scale horizontally in cases where authentication is computationally expensive, such as when verifying digital signatures. Option (b) also allows authentication components to be written in different programming languages. Finally, Option (b) allows multiple authentication components to be deployed in front of the same service.

OpenStack services MUST support both embedded (Option (a)) and external (Option (b)) deployment strategies. Individual authentication components MAY support either strategy or they MAY support both strategies. In order to support option (a), authentication components written in the Python programming language MUST be written as middleware components in accordance with the Web Server Gateway Interface (WSGI) standard [pep0333]. Additionally, services MUST support the ability to swap between different embedded or external authentication components via configuration options.

Exchanging User Information
If a request is successfully authenticated, the authentication component MUST extend the request by adding an `X-Authorization` header. The header MUST be formatted as illustrated in Example 1.

'''Example 1. An X-Authorization Header'''

X-Authorization: Proxy JoeUser

Here, `Proxy` denotes that the authentication occurred via a proxy (in this case authentication component) and JoeUser is the name of the user who issued the request.

Note
 * 1) !wiki note

We are considering using an `Authorization` header rather than an `X-Authorization`, thereby following normal HTTP semantics. There are some cases, however, where multiple `Authorization` headers need to be transmitted in a single request. We want to assure ourselves that this will not break common clients before we recommend the approach.

Authentication components MAY extend the request with additional information. For example, an authentication system may add additional headers or modify the target URI to pass authentication information to the back-end service. Additionally, an authentication component MAY strip sensitive information — a plain text password, for example — from the request. That said, an authentication component SHOULD pass the majority of the request unmodified.

Reverse Proxy Authentication
An OpenStack service SHOULD verify that it is receiving requests from a trusted authentication component. This is particularly important in cases where the authentication component and the OpenStack service are deployed separately. In order to trust incoming requests, the OpenStack service should therefore authenticate the authentication component. To avoid confusion, we call this reverse proxy authentication, since in this case the authentication component is acting as an HTTP reverse proxy.

Any HTTP-based authentication scheme may be used for reverse proxy authentication; however, all OpenStack services and all authentication components MUST support HTTP Basic Authentication as defined in RFC 2617 [rfc2617].

Whether or not reverse proxy authentication is required is strictly a deployment concern. For example, an operations team may opt to utilize firewall rules instead of an authentication protocol to verify the integrity of incoming request. Because of this, both OpenStack services and authentication components MUST also allow for unauthenticated communication.

In cases where reverse proxy authentication is used, the authorization component may receive an HTTP 401 authentication error or an HTTP 403 authorization error. These errors indicate that the component does not have access to the underlying OpenStack service. The authentication component MUST NOT return these errors to the client application. Instead, the component MUST return a 500 internal error. This is illustrated in Figures 4 and 5 below. The component SHOULD format the errors in a manner that does not break the service contract defined by the OpenStack service. Figure 5 illustrates proxy authorization in delegated mode. Delegated mode is discussed in detail in the next section.

'''Figure 4. Reverse Proxy Authentication'''



'''Figure 5. Reverse Proxy Authentication (Delegated Mode)'''



Delegated Mode
In some cases, the decision to reject an unauthenticated request should be delegated to the OpenStack service. An unauthenticated request may be appropriate in cases when anonymous access is allowed. In order to support these cases, an authentication component may be placed in Delegated Mode. In this mode, the component forwards requests to the OpenStack service when the client's identity has been confirmed or is indeterminate — that is when credentials are missing. The authentication component directly rejects requests with invalid credentials. Authentication components MUST extend the request by adding an `X-Identity-Status` header. The identity status header MUST contain one of the following values:

Identity Status Values


 * Confirmed :
 * : A `confirmed` value indicates that valid credentials were sent and identity has been confirmed. The service can trust that the request has been sent on behalf of the user specified in the `X-Authorization` header.
 * Indeterminate :
 * : An `indeterminate` value indicates that no credentials were sent and identity has not been confirmed. In this case, the service will receive an `X-Authorization` header with no user entry as illustrated in Example 2.

'''Example 2. Indeterminate Identity Headers'''

X-Identity-Status: Indeterminate X-Authorization: Proxy

Services MAY reject a delegated request by issuing an HTTP 401 authentication error or an HTTP 403 authorization error. These responses MUST contain an `WWW-Authenticate` header with a value of `Delegated` as illustrated in Example 3.

'''Example 3. Delegated WWW-Authenticate Header'''

WWW-Authenticate: Delegated

It is important to note that the actual reject message will likely be modified by the authentication component in order to comply with the authentication scheme it is implementing. This is illustrated in Figures 6 and 7 below.

'''Figure 6. Delegated Reject Basic Auth'''



'''Figure 7. Delegated Reject OAuth'''



The presence of the `WWW-Authenticate` header with a value of `Delegated` distinguishes a client authentication/authorization failure from a component failure. For example, compare Figure 8 with Figure 5. In Figure 8, the client is not allowed to access the OpenStack service. In Figure 5, it is the authentication component itself which is unauthorized.

'''Figure 8. Delegated Reject Forbidden'''



Authentication components MUST support both delegated and undelegated (standard) modes. Delegated mode SHOULD be configured via a configuration option. Delegated mode SHOULD be disabled by default.

OpenStack services are not required to support delegated mode. If a service does not support delegated mode, it MUST respond with a 501 not implemented error and an `WWW-Authenticate` header with a value of `Delegated`. The authentication component MUST NOT return the error to the client application. Instead, the component MUST return a 500 internal error; this is illustrated in Figure 9. The component SHOULD format the error in a manner that does not break the service contract defined by the OpenStack service. The component should also log the error such that it that will inform operators of the misconfiguration.

'''Figure 9. Unimplemented Delegated Mode'''



Handling Direct Client Connections
Requests from the authentication component to an OpenStack service MUST contain an `X-Authorization` header. If the header is missing, and reverse proxy authentication fails or is switched off, the OpenStack service MAY assume that the request is coming directly from a client application. In this case, the OpenStack service MUST redirect the request to the authentication component by issuing an HTTP 305 User Proxy redirect. This is illustrated in Figure 10. Note that the redirect response MUST include a `Location` header specifying the authentication component's URL as shown in Example 4.

'''Figure 10. Auth Component Redirect'''



'''Example 4. Auth Component Redirect Response'''

HTTP/1.1 305 Use Proxy Date: Thu, 28 Oct 2010 07:41:16 GMT Location: http://sample.auth.openstack.com/path/to/resource

Using Multiple Authentication Components
There are some use cases when a service provider might want to consider using multiple authentication components for different purposes. For instance, a service provider may have one authentication scheme to authenticate the users of the service and another one to authenticate the administrators or operations personnel that maintain the service. For such scenarios, we propose using a mapper as illustrated in Figure 11.

'''Figure 11. Multiple Authentication Components'''



At a high level, a mapper is a simple reverse proxy that intercepts HTTP calls from clients and routes the request to the appropriate authentication component. A mapper can make the routing decisions based on a number of routing rules that map a resource to a specific authentication component. For example, a request URI may determine whether a call should be authenticated via one authentication component or another.

Note that neither the authentication component nor the OpenStack service need be aware of the mapper. Any external authentication component can be used alongside others. Mappers may provide a means by which to offer support for anonymous or guest access to a subset of service resources. A mapper may be implemented via a traditional reverse proxy server such as Pound or Zeus.

The Default Component
Individual services MUST be distributed with a simple integrated authentication component by default. Providing such a component lowers barriers to the deployment of individual services. This is especially important to developers who may want to deploy OpenStack services on their own machines. Also, since there is no direct dependency on an external authentication system, OpenStack services can be deployed individually, without the need to stand up and configure additional services. Finally, having a standard authentication component that all services share promotes a separation of concerns. That is, as a community we are explicitly stating that services should not develop their own authentication mechanisms. Additional authentication components may be developed, of course, but these components should not be intimately coupled to any one particular service.

As discussed in “Deployment Strategies”, an authentication component may be integrated directly into the service implementation (Option (a)), or it may be deployed separately as an HTTP reverse proxy (Option (b)). The default component should be implemented to support Option (a) and services should maintian support for Option (b). One way to achieve this is to provide a method that allows the disabling of the default authentication component via configuration. This is illustrated in Figure 12. Here, requests are sent directly to the OpenStack service when the default authentication component is disabled.

We will discuss the design of the default component in a separate blueprint.

'''Figure 12. Disabled Embedded Component'''



Questions and Answers

 * 1) Why do authentication components send reject messages? Why not have OpenStack services reject requests themselves?
 * 2) * The content and format of an authentication failed message is determined by the authentication scheme (or protocol). For the service to respond appropriately, it would have to be aware of the authentication scheme in which it participates; this defeats the purpose of pluggable authentication components.
 * 3) Why require support for deploying authentication components in separate nodes?
 * 4) *The deployment strategy is very flexible. It allows for authentication components to be horizontally scalable. It allows for components to be written in different languages. Finally, it allows different authentication components to be deployed simultaneously as described above.