此内容没有您所选择的语言版本。
8.2.4. Authenticating Using Mutual SSL
Mutual SSL authentication, commonly referred to as x509 or two-way authentication, allows for an application developer, which is the SSL client, to authenticate to an application, which is the SSL server, and vice versa. Each side has a verification certificate, which is shared upon connection. Using mutual authentication ensures an additional level of security in your deployment, because without the approved authentication certificate a user is unable to connect to the SSL server.
Apache supports mutual SSL authentication natively in Red Hat Enterprise Linux 6; however, the SSL connection for the broker in OpenShift Enterprise 2 terminates by default on a separate Apache instance from the one that runs the broker application. Therefore, you must take special care when modifying the default configurations to securely pass the trusted
REMOTE_USER to the broker.
Ensuring mutual SSL authentication on your OpenShift Enterprise instance requires the completion of a series of procedures, outlined below. Each procedure is for a different interaction component of your installation: the broker proxy, the broker application, and, if it has been installed, the Management Console. After the broker has been configured, developers must also configure their client tools to use mutual SSL authentication, which is covered in the OpenShift Enterprise User Guide [4].
Procedure 8.4. To Modify the Broker Proxy Configuration for Mutual SSL Authentication:
While it is possible to translate the following configuration changes to a proxy or load balancer of your choice, this procedure assumes that Apache is being used to terminate the SSL connection for the broker. The default proxy on the broker is configured by the
/etc/httpd/conf.d/000002_openshift_origin_broker_proxy.conf file.
- Edit the
/etc/httpd/conf.d/000002_openshift_origin_broker_proxy.conffile on the broker host and add the following lines in the<VirtualHost *:443>block directly after theSSLProxyEnginedirective, removing any otherSSLCertificateFile,SSLCertificateKeyFile, andSSLCACertificateFiledirectives that may have previously been set:Copy to Clipboard Copied! Toggle word wrap Toggle overflow These directives serve the following functions for the SSL virtual host:- The
SSLCertificateFile,SSLCertificateKeyFile, andSSLCACertificateFiledirectives are critical, because they set the paths to the certificates. - The
SSLVerifyClientdirective set tooptionalis also critical as it accommodates certain broker API calls that do not require authentication. - The
SSLVerifyDepthdirective can be changed based on the number of certificate authorities used to create the certificates. - The
RequestHeaderdirective set to the above options allows a mostly standard broker proxy to turn the CN from the client certificate subject into anX_REMOTE_USERheader that is trusted by the back-end broker. Importantly, ensure that the traffic between the SSL termination proxy and the broker application is trusted.
- Restart the broker proxy:
service httpd restart
# service httpd restartCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Procedure 8.5. To Modify the Broker Application Configuration for Mutual SSL Authentication:
- Edit the
/var/www/openshift/broker/httpd/conf.d/openshift-origin-auth-remote-user.conffile on the broker host to be exactly as shown:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Set the following in the
/etc/openshift/plugins.d/openshift-origin-auth-remote-user.conffile:TRUSTED_HEADER="HTTP_X_REMOTE_USER"
TRUSTED_HEADER="HTTP_X_REMOTE_USER"Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Restart the broker service for the changes to take effect:
service openshift-broker restart
# service openshift-broker restartCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Procedure 8.6. To Modify the Management Console Configuration for Mutual SSL Authentication:
If you have installed the optional Management Console, it must be configured before mutual SSL authentication can be used. See Section 8.9, “Management Console” first for instructions on installing the Management Console.
- Edit the
/var/www/openshift/console/httpd/conf.d/openshift-origin-auth-remote-user.conffile on the broker host and add the following:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Set the following in the
/etc/openshift/console.conffile:REMOTE_USER_HEADER=HTTP_X_REMOTE_USER
REMOTE_USER_HEADER=HTTP_X_REMOTE_USERCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Restart the Management Console service for the changes to take effect:
service openshift-console restart
# service openshift-console restartCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Procedure 8.7. To Test the Mutual SSL Configuration:
- Run the following command and ensure it returns successfully:
curl -k https://broker.example.com/broker/rest/api
# curl -k https://broker.example.com/broker/rest/apiCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Run the following command and ensure it returns with a
403 Forbiddenstatus code:curl -k https://broker.example.com/broker/rest/user
# curl -k https://broker.example.com/broker/rest/userCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Run the following commands and ensure they return successfully:
curl --cert path/to/certificate/file --key path/to/certificate/keyfile --cacert path/to/SSLCA/certificate/file https://broker.example.com/broker/rest/api curl --cert path/to/certificate/file --key path/to/certificate/keyfile --cacert path/to/SSLCA/certificate/file https://broker.example.com/broker/rest/user
# curl --cert path/to/certificate/file --key path/to/certificate/keyfile --cacert path/to/SSLCA/certificate/file https://broker.example.com/broker/rest/api # curl --cert path/to/certificate/file --key path/to/certificate/keyfile --cacert path/to/SSLCA/certificate/file https://broker.example.com/broker/rest/userCopy to Clipboard Copied! Toggle word wrap Toggle overflow Note that the above commands may need to be altered with the--keyoption if your key and certificate are not located in the same PEM file. This option is used to specify the key location if it differs from your certificate file.
To test using the client tools, each application developer must first configure them to use mutual SSL authentication. See the OpenShift Enterprise User Guide [4]for instructions.