Authentication, Authentication, Authorization Flashcards

1
Q

Export the existing OAuth cluster resource to a file

A

oc get oauth cluster -o yaml > oauth.yaml

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

Update oAuth cluster resource afters aving it to file

A

oc replace -f oauth.yaml

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

Create the htpasswd file

A

htpasswd -c -B -b /tmp/htpasswd student redhat123

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

Add or update credentials in htpasswd file

A

htpasswd -b /tmp/htpasswd student redhat1234

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

Delete credentials in htpasswd file

A

htpasswd -D /tmp/htpasswd student

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

create a secret that contains the htpasswd file data

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
7
Q

3 steps to completely detele a htpasswd user

A

1) htpasswd -D /tmp/htpasswd manager
2) oc set data secret/htpasswd-secret –from-file htpasswd=/tmp/htpasswd -n openshift-config
3) oc delete user manager

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

List all identity resources

A

oc get identities

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

Delete an identity resource

A

oc delete identity my_htpasswd_provider:manager

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

Assign the cluster-admin role to the student user

A

oc adm policy add-cluster-role-to-user cluster-admin student

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

Assign the cluster-role role to the student user

A

oc adm policy add-cluster-role-to-user cluster-role student

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

Remove the cluster-role role from the student user

A

oc adm policy remove-cluster-role-from-user cluster-role student

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

Determine if a user can execute an action on a resource

A

oc adm policy who-can delete user

oc adm policy who-can /verb/ /resource/

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

Add a specified role to a user

A

oc adm policy add-role-to-user role-name username -n project

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

Mentally list all user types

A
  1. regular users
  2. system users
  3. service accounts
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Create a generic secret containing key-value pairs from literal values typed on the command line

A

oc create secret generic secret_name –from-literal key1=secret1 –from-literal key2=secret2

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

Create a generic secret using key names specified on the command line and values from files

A

oc create secret generic ssh-keys –from-file id_rsa=/path-to/id_rsa –from-file id_rsa.pub=/path-to/id_rsa.pub

18
Q

Create a secret specifying a certificate and the associated key

A

oc create secret tls secret-tls –cert /path-to-certificate –key /path-to-key

19
Q

set application environment variables from secrets

A

oc set env deployment/demo –from secret/demo-secret –prefix MYSQL_

20
Q

mount secrets as file in a pod

A

oc set volume deployment/demo –add –type secret –secret-name demo-secret –mount-path /app-secrets

21
Q

create a configuration map

A

oc create configmap my-config –from-literal key1=config1 –from-literal key2=config2

22
Q

Save the cm data to a specific directory

A

oc extract cm/myconfig –to /tmp/ –confirm

23
Q

Update modified secret file

A

oc set data secret/htpasswd-ppklq -n openshift-config –from-file /tmp/htpasswd

24
Q

Command to list all scc defined in OpenShift

A

oc get scc

25
Q

Obtain more info on an scc

A

oc describe scc anyuid

26
Q

view the security context constraint that a pod uses

A

oc describe pod console-5df4fcbb47-67c52 -n openshift-console | grep scc

27
Q

Command to list all the security context constraints that can overcome the limitations of a container

A

oc get pod podname -o yaml | oc adm policy scc-subject-review -f -

28
Q

Create service account

A

oc create serviceaccount service-account-name

29
Q

Associate a service account with an SCC

A

oc adm policy add-scc-to-user SCC -z service-account

30
Q

Modify an existing deployment o to use a service account

A

oc set serviceaccount deployment/deployment-name service-account-name

31
Q

Create self signed cert

A

openssl x509 -in training.csr -out training.pem -req -signkey training.key

32
Q

nginx image

A

twalter/openshift-nginx

33
Q

List all cluster role bindings that reference the self-provisioner cluster role

A

oc get clusterrolebinding | grep -E ‘NAME|self-provisioner’

34
Q

Confirm that the group system:authenticated:oauth has the self-provisioner role

A

oc describe clusterrolebindings self-provisioners

35
Q

Remove the self-provisioner role from group system:authenticated:oauth

A

oc adm policy remove-cluster-role-from-group self-provisioner system:authenticated:oauth

36
Q

Grant project administration privileges to user leader on project auth-rbac

A

oc adm policy add-role-to-user admin leader

37
Q

Create a group called dev-group

A

oc adm groups new dev-group

38
Q

Add the qa-engineer user to qa-group

A

oc adm groups add-users qa-group qa-engineer

39
Q

List all groups

A

oc get groups

40
Q

Add write privileges to dev-group on the current project in which current user is logged in

A

oc adm policy add-role-to-group edit dev-group

41
Q

Add read privileges to dev-group on the current project in which current user is logged in

A

oc policy add-role-to-group view qa-group

42
Q

Check all roles people have on tthe current project

A

get rolebindings -o wide