Authentication and Authorization Flashcards

1
Q

What is an OpenShift User?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is an OpenShift Identity?

A

A resource that keeps record of successful authentication attempts for a single user resource and identity provider

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What’s an OpenShift Service Account?

A

Enables you to control API access without using a regular users credentials.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is an OpenShift role

A

Roles define a set of permissions to enable users, service accounts and groups to perform API operations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a kubeconfig file?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How can you make use of the kubeconfig file so you can run OC commands without logging in to OpenShift?

A

$ export KUBECONFIG=/home/users/auth/kubeconfig
$ OC get nodes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

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?

A

kubeadmin
$ oc delete secret kubeadmin -n kube-system

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What custom resource is added to the spec.identityProviders array in what yaml to use the HTpasswd identity provider and how?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the commands to update and apply the OAuth custom resource after editing?

A

$ oc get oauth cluster -o yaml > oauth.yaml

$ oc replace -f oauth.yaml

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Command to create the HTPasswd file and first user names admin with a password of password?

A

$ htpasswd -c - B - b / tmp/ htpasswd admin password

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

To use the HTPasswd provider, you must create a secret. Create a secret named htpasswd-secret where the htpasswd file is in /tmp

A

$ oc create secret generic htpasswd-secret —from-file htpasswd=/tmp/htpasswd -n openshift-config

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

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?

A

$ oc set data secret/htpasswd-secret —from-file htpasswd=/tmp/htpasswd -n openshift-config

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How to get the contents of the clusterrole in the event you don’t know the exact role name of “cluster-admin”

A

Narrow it down by using grep:

$ oc describe clusterrole.rbac | grep ^Name | grep -v ‘system:’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Command to set the rbac policy for the admins group to cluster-admin

A

$ oc adm policy add-cluster-role-to-group cluster-admin admins

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Command to give the group developers rbac edit on the cluster:

A

$ oc adm policy add-cluster-role-to-group view developers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Command to give user1 view only on a namespace called tester-namespace:

A

$ oc adm policy add-role-to-user view user1 -n tester-namespace

17
Q

What’s the order to set up authentication with identity provider?

A

1) Create htpasswd file (with first user)
2) create secret on openshift-config
3) get oauth from the cluster and output it to oauth.yaml
4) edit the yaml to add the fileData
5) replace the existing oauth