Use the kubesec docker images to scan the given YAML manifest, edit and apply the advised changes, and passed with a score of 4 points.kubesec-test.yamlapiVersion: v1kind: Podmetadata:name: kubesec-demospec:containers:- name: kubesec-demoimage: gcr.io/google-samples/node-hello:1.0securityContext:readOnlyRootFilesystem: trueHint:docker run -i kubesec/kubesec:512c5e0 scan /dev/stdin < kubesec-test.yaml
A) Explanation:
kubesec scan k8s-deployment.yaml
cat <<EOF > kubesec-test.yaml
apiVersion: v1
kind: Pod
metadata:
name: kubesec-demo
spec:
containers:
- name: kubesec-demo
image: gcr.io/google-samples/node-hello:1.0
securityContext:
readOnlyRootFilesystem: true
EOF
kubesec scan kubesec-test.yaml
docker run -i kubesec/kubesec:512c5e0 scan /dev/stdin < kubesec-test.yaml
kubesec http 8080 &
[1] 12345
{'severity':'info','timestamp':'2019-05-12T11:58:34.662+0100','caller':'server/server.go:69','message':'Starting HTTP server on port 8080'}
curl -sSX POST --data-binary @test/asset/score-0-cap-sys-admin.yml http://localhost:8080/scan
[
{
'object': 'Pod/security-context-demo.default',
'valid': true,
'message': 'Failed with a score of -30 points',
'score': -30,
'scoring': {
'critical': [
{
'selector': 'containers[] .securityContext .capabilities .add == SYS_ADMIN',
'reason': 'CAP_SYS_ADMIN is the most privileged capability and should always be avoided'
},
{
'selector': 'containers[] .securityContext .runAsNonRoot == true',
'reason': 'Force the running image to run as a non-root user to ensure least privilege'
},
// ...
Rolf
7 months agoJunita
7 months agoLacresha
7 months agoKimbery
7 months agoViva
8 months agoFelicitas
8 months agoAugustine
8 months agoGalen
8 months agoReynalda
8 months agoFrank
8 months agoCandida
8 months agoAdela
8 months agoLorenza
8 months agoKizzy
8 months agoSherron
9 months agoMertie
9 months agoGary
9 months agoKenneth
1 year agoGregoria
1 year agoReid
1 year agoColby
1 year agoRoyce
1 year agoLashonda
1 year agoPaola
1 year agoValentin
1 year agoLavera
1 year agoShaquana
1 year agoSharen
1 year agoFrancis
1 year agoHelga
1 year agoFrancis
1 year agoJohana
1 year agoSelene
1 year agoMelissa
1 year agoEvette
1 year agoSharika
1 year agoFrancine
1 year agoBrock
1 year agoJohana
1 year ago