Chapter 7. Securing the Container Platform
7.1. Container Orchestration
APIs are key to automating container management at scale. APIs are used to:
- Validate and configure the data for pods, services, and replication controllers.
- Perform project validation on incoming requests and invoke triggers on other major system components.
Further Reading
- OpenShift Container Platform Architecture: How Is OpenShift Container Platform Secured?
7.2. Authentication and Authorization
7.2.1. Controlling Access Using OAuth
You can use API access control via authentication and authorization for securing your container platform. The OpenShift Container Platform master includes a built-in OAuth server. Users can obtain OAuth access tokens to authenticate themselves to the API.
As an administrator, you can configure OAuth to authenticate using an identity provider, such as LDAP, GitHub, or Google. The Deny All identity provider is used by default for new OpenShift Container Platform deployments, but you can configure this at initial installation time or post-installation. See Configuring authentication and user agent for a full list of identity providers.
For example, to configure the GitHub identity provider post-installation:
- Edit the master configuration file at /etc/origin/master-config.yaml.
Modify the
oauthConfig
stanza per the following:oauthConfig: ... identityProviders: - name: github challenge: false login: true mappingMethod: claim provider: apiVersion: v1 kind: GitHubIdentityProvider clientID: ... clientSecret: ... organizations: - myorganization1 - myorganization2 teams: - myorganization1/team-a - myorganization2/team-b
NoteSee the GitHub section in Configuring Authentication for more detailed information and usage.
After saving your changes, restart the master services for the changes to take effect:
# master-restart api # master-restart controllers
Further Reading
OpenShift Container Platform Architecture
- OpenShift Container Platform CLI Reference
- OpenShift Container Platform Developer Guide: CLI Authentication
7.2.2. API Access Control and Management
Applications can have multiple, independent API services which have different endpoints that require management. OpenShift Container Platform includes a containerized version of the 3scale API gateway so that you can manage your APIs and control access.
3scale gives you a variety of standard options for API authentication and security, which can be used alone or in combination to issue credentials and control access: Standard API keys, Application ID and key pair, and OAuth 2.0.
You can restrict access to specific end points, methods, and services and apply access policy for groups of users. Application plans allow you to set rate limits for API usage and control traffic flow for groups of developers.
For a tutorial on using APIcast v2, the containerized 3scale API Gateway, see Running APIcast on Red Hat OpenShift.
7.2.3. Red Hat SSO
The Red Hat Single Sign-On (RH-SSO) Server enables you to secure your applications by providing Web SSO capabilities based on standards, including SAML 2.0, OpenID Connect, and OAuth 2.0. The Server can act as a SAML or OpenID Connect–based identity provider (IdP), mediating with your enterprise user directory or third-party identity provider for identity information and your applications using standards-based tokens. You can integrate Red Hat SSO with LDAP-based directory services including Microsoft Active Directory and Red Hat Enterprise Linux Identity Management.
See Red Hat JBoss SSO for OpenShift documentation for usage tutorials.
7.2.4. Secure Self-service Web Console
OpenShift Container Platform provides a self-service web console to ensure that teams do not access other environments without authorization. OpenShift Container Platform ensures a secure multi-tenant master by providing the following:
- Access to the master uses Transport Layer Security (TLS)
- Access to the API Server uses X.509 certificates or OAuth access tokens
- Project quota limits the damage that a rogue token could do
- Etcd is not exposed directly to the cluster
Further Reading
-
OpenShift Container Platform Architecture: Infrastructure Components
Web Console - OpenShift Container Platform Developer Guide: Web Console Authentication
7.3. Managing Certificates for the Platform
OpenShift Container Platform has multiple components within its framework that use REST-based HTTPS communication leveraging encryption via TLS certificates. OpenShift Container Platform’s Ansible-based installer configures these certificates during installation. There are some primary components that generate this traffic:
- masters (API server and controllers)
- etcd
- nodes
- registry
- router
7.3.1. Configuring Custom Certificates
You can configure custom serving certificates for the public host names of the API server and web console during initial installation or when redeploying certificates. You can also use a custom CA.
During initial cluster installations using Ansible playbooks, custom certificates can be configured using the openshift_master_overwrite_named_certificates
Ansible variable, which is configurable in the inventory file. For example:
openshift_master_named_certificates=[{"certfile": "/path/on/host/to/custom1.crt", "keyfile": "/path/on/host/to/custom1.key", "cafile": "/path/on/host/to/custom-ca1.crt"}]
See Configuring Custom Certificates section for more options and instructions on how to run the installation playbook.
The installer provides Ansible playbooks for checking on the expiration dates of all cluster certificates. Additional playbooks can automatically redeploy all certificates at once using the current CA, redeploy specific certificates only, or redeploy a newly generated or custom CA on its own. See Redeploying Certificates for more on these playbooks.
The cafile
certificate is imported to the ca-bundle.crt
file on the masters during installation or during redeployment of certificates. The ca-bundle.crt
file is mounted to every pod that runs in OpenShift Container Platform. Several OpenShift Container Platform components automatically trust the named certificates by default when they access the masterPublicURL
endpoint. If you omit the cafile
option from the certificates parameter, the functionality of Web Console and several other components is reduced.
Further Reading
OpenShift Container Platform Configuring Clusters