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
10 months agoJunita
10 months agoLacresha
10 months agoKimbery
10 months agoViva
11 months agoFelicitas
11 months agoAugustine
11 months agoGalen
11 months agoReynalda
11 months agoFrank
11 months agoCandida
11 months agoAdela
11 months agoLorenza
11 months agoKizzy
11 months agoSherron
12 months agoMertie
12 months agoGary
12 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