OpenShift supports different authentication methods based on the authentication provider. For more information, see the Red Hat document Understanding authentication.
Note: This deployment guide explains how to configure identity providers for htpasswd and Active Directory, but only one method is needed.
Unless otherwise directed, run the following commands in CSAH node as user core.
To set up the prerequisites for user authentication using OpenShift cluster:
cd /home/core/<install directory>/
htpasswd -c -B -b htpasswd dellemc1 Password1
htpasswd -b htpasswd mike Password2
htpasswd -b htpasswd umesh Password3
htpasswd -b htpasswd john Password4
htpasswd -b htpasswd user1 Password5
oc create secret generic htpass-secret --from-file=htpasswd=/home/core/openshift/htpasswd -n openshift-config
apiVersion: config.openshift.io/v1
kind: OAuth
metadata:
name: cluster
spec:
identityProviders:
- name: htpasswd
mappingMethod: claim
type: HTPasswd
htpasswd:
fileData:
name: htpass-secret
oc apply -f <file name>
oc login -u <username>
Authentication required for https://api.ocp.example.com:6443 (openshift)
Username: <username>
Password: <password>
Login successful.
You don't have any projects. You can try to create a new project, by running oc new-project <projectname>
The prerequisites for user authentication using Windows Active Directory (AD) are:
Note: Unless otherwise directed, run the commands in the CSAH node as user core.
Perform the following steps to integrate OpenShift and AD for user authentication:
If you are not using certificates for authentication, skip to Step 5.
--BEGIN CERTIFICATE---- to ---------END CERTIFICATE--
openssl s_client -connect <AD ip>:<SSL Port> 2>/dev/null | openssl x509 -text
For reference, ad.cert is provided as the name of the new file.
For reference, ca-config-map is provided as the name of the configmap.
apiVersion: config.openshift.io/v1
kind: OAuth
metadata:
name: cluster
spec:
identityProviders:
- name: <ip address of active directory>
mappingMethod: claim
type: LDAP
ldap:
attributes:
id:
- dn
email:
name:
- cn
preferredUsername:
- sAMAccountName
bindDN: <provide the bindDN of the user who can query root dn referenced in url>
bindPassword:
name: <provide the secret name for the user specified in bindDN>
ca:
name: <provide the name of the configmap created>
insecure: false
url: "ldap://<AD FQDN>/<root dn>?sAMAccountName"
If you are skipping Steps 2 to 4, delete ca, name and set insecure to true. Ensure that the AD FQDN entry is added to the DNS config in the CSAH node, and then save the file.
oc apply -f <CR file name>
oc login -u <username>
Authentication required for https://api.ocp.example.com:6443 (openshift)
Username: <username>
Password: <password>
Login successful.
You don't have any projects. You can try to create a new project, by running
oc new-project <projectname>