Follow the steps below to add an OpenShift registry in order to scan it.
You'll first need to create a service account and extract the service account token. Then log into the Container Security UI to add the registry.
Here's a sample yaml where the service account is named "qualystestuser":
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: qualystestuserbinding
selfLink: >-
/apis/rbac.authorization.k8s.io/v1/clusterrolebindings/balatestbindingclusterwide
uid: 71967d33-d7d4-470d-a7f1-dc43794d5af6
resourceVersion: '1263987'
creationTimestamp: '2021-05-20T19:51:09Z'
subjects:
- kind: ServiceAccount
name: qualystestuser
namespace: default
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: registry-viewer
Perform the following commands to extract the service account token. You'll need this token to add the registry.
oc describe sa qualystestuser
oc describe secrets ##token##
Perform the following command to assign permissions to access the registry and list the images:
oc adm policy add-cluster-role-to-user registry-viewer system:serviceaccount:<project>:qualystestuser
Perform the following commands to verify that the user has permission to list repositories:
oc login -u user
curl -v -u unused:$(oc whoami -t) https://<registry_server>:<port>/v2/_catalog?n=100
You can also use the Container Security API to add a registry. See the Container Security API User Guide for details.