We are seeing the plain credentials as part of k8s pull secrets file. Is there any way to safely secure them so that admin/user who have full rights cannot misuse them?
Pull-Secret Example:
.dockercfg:
{"dockercentral.test.com:5050":
{"username": "test.it.com",
"password":"dwew32",
"email":"mark.test@yahoo.com",
"auth":"br23231fsdfdfsdfs3211"
}
}
Above is the Pull-secrets file, where we see the user name and password values as plain text. Please help on safely securing them in k8s!
You can follow this guide from kubernetes documentation to create secret of docker-registry
type to authenticate with a container registry.
Example of docker-registry
secret:
apiVersion: v1
kind: Secret
metadata:
name: myregistrykey
namespace: awesomeapps
data:
.dockerconfigjson: UmVhbGx5IHJlYWxseSByZWVlZWVlZWVlZWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGx5eXl5eXl5eXl5eXl5eXl5eXl5eSBsbGxsbGxsbGxsbGxsbG9vb29vb29vb29vb29vb29vb29vb29vb29vb25ubm5ubm5ubm5ubm5ubm5ubm5ubm5ubmdnZ2dnZ2dnZ2dnZ2dnZ2dnZ2cgYXV0aCBrZXlzCg==
type: kubernetes.io/dockerconfigjson
As You can see this kind of secret doesn't have plain text credentials.
However user with cluster-admin rights can still easily decode them.
As Matthew pointed out currently, the main question is what you are trying to protect:
Role
/ClusterRole
that denies the permissions to get secrets in a specific namespace (or all namespaces). Then, bind this role (using RoleBinding
/ClusterRoleBinding
) to the relevant users - see the docs for more details.Hope that answer your question :)