Authentication and Authorization Flashcards
What is an OpenShift User?
Users are entities that interact with the API server and are actors within the system. They get permissions by having roles assigned individually or via groups
What is an OpenShift Identity?
A resource that keeps record of successful authentication attempts for a single user resource and identity provider
What’s an OpenShift Service Account?
Enables you to control API access without using a regular users credentials.
What is an OpenShift role
Roles define a set of permissions to enable users, service accounts and groups to perform API operations.
What is a kubeconfig file?
It’s created during OpenShift installation in the …/auth directory that contain details and parameters used by the CLI to connect a client to the correct API server.
How can you make use of the kubeconfig file so you can run OC commands without logging in to OpenShift?
$ export KUBECONFIG=/home/users/auth/kubeconfig
$ OC get nodes
To improve cluster security what cluster-admin user should be removed (and how) after the identity provider is defined and a new cluster-admin has been created?
kubeadmin
$ oc delete secret kubeadmin -n kube-system
What custom resource is added to the spec.identityProviders array in what yaml to use the HTpasswd identity provider and how?
Edit the oauth.yaml
apiVersion: config.openshift.ip/v1
kind: OAuth
metadata:
name: cluster
spec:
identityProviders:
- name: my_htpasswd_provider
mappingMethod: claim
type: HTPasswd
htpasswd:
filedata:
name: htpasswd-secret
What are the commands to update and apply the OAuth custom resource after editing?
$ oc get oauth cluster -o yaml > oauth.yaml
$ oc replace -f oauth.yaml
Command to create the HTPasswd file and first user names admin with a password of password?
$ htpasswd -c - B - b / tmp/ htpasswd admin password
To use the HTPasswd provider, you must create a secret. Create a secret named htpasswd-secret where the htpasswd file is in /tmp
$ oc create secret generic htpasswd-secret —from-file htpasswd=/tmp/htpasswd -n openshift-config
What command is run to update the HTPasswd secret (with a name htpasswd-secret and htpasswd data file in /tmp) after adding, changing or deleting a user?
$ oc set data secret/htpasswd-secret —from-file htpasswd=/tmp/htpasswd -n openshift-config
How to get the contents of the clusterrole in the event you don’t know the exact role name of “cluster-admin”
Narrow it down by using grep:
$ oc describe clusterrole.rbac | grep ^Name | grep -v ‘system:’
Command to set the rbac policy for the admins group to cluster-admin
$ oc adm policy add-cluster-role-to-group cluster-admin admins
Command to give the group developers rbac edit on the cluster:
$ oc adm policy add-cluster-role-to-group view developers