Skip to content

Instantly share code, notes, and snippets.

@glennswest
Created September 23, 2022 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glennswest/7df601bb72039db33e2abda0bd6bda34 to your computer and use it in GitHub Desktop.
Save glennswest/7df601bb72039db33e2abda0bd6bda34 to your computer and use it in GitHub Desktop.
Simple bash script to setup htpassd support, and add initial admin users - change to what you want - least secure auth model
oc delete secret htpasswd -n openshift-config
rm -r -f users
mkdir users
cd users
touch htpasswd
htpasswd -Bb htpasswd admin Admin1!
htpasswd -Bb htpasswd gwest password
oc --user=admin create secret generic htpasswd --from-file=htpasswd -n openshift-config
oc replace -f - <<API
apiVersion: config.openshift.io/v1
kind: OAuth
metadata:
name: cluster
spec:
identityProviders:
- name: Local Password
mappingMethod: claim
type: HTPasswd
htpasswd:
fileData:
name: htpasswd
API
oc adm groups new mylocaladmins
oc adm groups add-users mylocaladmins admin gwest
oc adm policy add-cluster-role-to-group cluster-admin mylocaladmins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment