Application Security Flashcards
Create a generic secret containing key-value pairs from literal values typed on the command
line:
$ oc create secret generic secret_name –from-literal key1=secret –from-literal key2=secret2
Create a generic secret called test-secret with the credentials for user1/password and connection information to access a MySQL
database.
$ oc create secret generic mysql –from-literal user=user1 –from-literal password=password –from-literal database=test_secrets –from-literal hostname=mysql
Command to expose the service named mysql with hostname mysql.apps.ocp.example.com so it can be accessed from outside the cluster
$ oc expose service mysql –hostname mysql.apps.ocp4.example.com
From the command line, create a passthrough route called myroute with the service myroute2, port 8443 and hostname myroute-default.app-crc.testing. Once created, use curl to test by host:
$ oc create route passthrough myroute –service myroute2 –port 8443 –hostname=myroute-default.app-crc.testing
$ curl https://myroute-default.app-crc.testing
How is service account exporter-sa associated with Security Context Constraint (scc) node-exporter?
As a cluster-admin:
$ oc create sa exportersa
$ oc adm policy add-scc-to-user node-exporter -z exporter-sa