Skip to content

Instantly share code, notes, and snippets.

@jewzaam
Last active March 22, 2019 18:43
Show Gist options
  • Save jewzaam/f3eb76d8da2f15ddde63faffbe7a2ac4 to your computer and use it in GitHub Desktop.
Save jewzaam/f3eb76d8da2f15ddde63faffbe7a2ac4 to your computer and use it in GitHub Desktop.
htpasswd -c -b htpasswd $USER $PASSWORD
oc delete secret htpass-secret -n openshift-config
oc create secret generic htpass-secret --from-file=htpasswd=htpasswd -n openshift-config
git clone [email protected]:openshift/online.git --depth=1 -b prod
oc delete secret -n openshift-config oauth-templates
oc create secret generic oauth-templates -n openshift-config \
--from-file=login.html=online/ansible/roles/oso_custom_templates/files/dedicated/login.html \
--from-file=providers.html=online/ansible/roles/oso_custom_templates/files/dedicated/provider-selection.html \
--from-file=errors.html=online/ansible/roles/oso_custom_templates/files/dedicated/oauth-error.html
echo "apiVersion: config.openshift.io/v1
kind: OAuth
metadata:
name: cluster
spec:
identityProviders:
- name: SRE Authentication Provider
challenge: true
login: true
mappingMethod: claim
type: HTPasswd
htpasswd:
fileData:
name: htpass-secret
templates:
login:
name: oauth-templates
providerSelection:
name: oauth-templates
error:
name: oauth-templates" > oauth.yaml
oc apply -f oauth.yaml
nmalik@nmalik tmp.3W0BlQX52y$ oc get oauth cluster -o yaml --export
apiVersion: config.openshift.io/v1
kind: OAuth
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"config.openshift.io/v1","kind":"OAuth","metadata":{"annotations":{},"name":"cluster"},"spec":{"identityProviders":[{"challenge":true,"htpasswd":{"fileData":{"name":"htpass-secret"}},"login":true,"mappingMethod":"claim","name":"SRE Authentication Provider","type":"HTPasswd"}],"templates":{"error":{"name":"oauth-templates"},"login":{"name":"oauth-templates"},"providerSelection":{"name":"oauth-templates"}}}}
generation: 1
name: cluster
selfLink: /apis/config.openshift.io/v1/oauths/cluster
spec:
identityProviders:
- challenge: true
htpasswd:
fileData:
name: htpass-secret
login: true
mappingMethod: claim
name: SRE Authentication Provider
type: HTPasswd
templates:
error:
name: oauth-templates
login:
name: oauth-templates
providerSelection:
name: oauth-templates
tokenConfig:
accessTokenMaxAgeSeconds: 86400
nmalik@nmalik tmp.3W0BlQX52y$ oc get secrets -n openshift-authentication | grep oauth-templates
v4-0-config-user-template--oauth-templates-errors.html Opaque 3 43s
v4-0-config-user-template--oauth-templates-login.html Opaque 3 43s
v4-0-config-user-template--oauth-templates-providers.html Opaque 3 43s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment