Security Flashcards
v What is the command to create a service account?
k create serviceaccount <username></username>
What component provides authorization for users?
kube-apiserver
What are the 4 options for authorization?
- Static Password File
- Static Token File
- Certificates
- 3rd party Identity Services (such as LDAP)
Where do you add the flag/option for specifying a static password file and what is the flag/option? (THIS IS NOT RECOMMENDED IN A PROD ENV)
You specify the static password file in the kube-apiserver.service or in the manifest in the spec section with with the –basic-auth-file=<filename></filename>
Where do you add the flag/option for specifying a static password file and what is the flag/option? (THIS IS NOT RECOMMENDED IN A PROD ENV)
You specify the static password file in the or in the manifest in the spec section with with the –basic-auth-file=<filename></filename>
What command will show you all the certificates used by the kube-apiserver?
cat /etc/kubernetes/manifests/kube-apiserver.yaml
What command checks the content of a certificate?
openssl x509 -in /etc/kubrenetes/pki/apiserver.crt -text -noout
What command generates kets for the CA?
openssl genrsa -out ca.key 2048
What is the command to create a CSR for the CA?
openssl req -new -key ca.key -subj :/CN=KUBERNETES-CA” -out ca.csr
What command signs certificates for the CA?
openssl x509 -req -in ca.csr signkey ca.key -out ca.crt
What command creates a CSR for an admin user?
openssl req -new -key admin.key -subj :/CN=kube-admin/O=system:masters” -out admin.csr
What command signs a CSR for an admin user?
openssl x509 -req -in admin.csr -CA ca.crt -CAkey ca.key -out admin.crt
What are the names that are specified on the kube-apiserver certificate?
kubernetes
kubernetes.default
kubernetes.default.svc
kubernetes.default.svc.cluster.local
10.96.0.1
172.17.0.87
What are the steps to adding new users via the certificates API?
- Create CertificateSigningRequest Object
- Review Requests
- Approve Requests
- Share Certs to Users
What is the openssl command to generate a key for a new user?
openssl genrsa -out <user>.key 2048</user>
What is the openssl command to generate a cert for a new user?
openssl req -new -key <user>.key -subj "/CN=<user>" -out <user>.csr</user></user></user>
What is the command for an admin to see all CSR requests?
k get csr
What are the attributes of a CSR definition file?
apiVersion: certificates.k8s.io/v1
kind: CertificateSigningRequest
metadata:
name: akshay
spec:
groups:
- system:authenticated
request: <Paste>
signerName: kubernetes.io/kube-apiserver-client
usages:
- client auth</Paste>
What is the command to approve a csr request?
kubectl certificate approve <user></user>
What is the command to get a user certificate?
k get csr <user> -o yaml under status.certificate and to decript: echo "xxx" | base64 --decode</user>