2020-03-16 17:02:58,614 - xtesting.ci.run_tests - INFO - Deployment description:

+-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
|         ENV VAR         |                                                                       VALUE                                                                        |
+-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
|         CI_LOOP         |                                                                       daily                                                                        |
|          DEBUG          |                                                                        true                                                                        |
|     DEPLOY_SCENARIO     |                                                              k8-nosdn-nofeature-noha                                                               |
|      INSTALLER_TYPE     |                                                                      unknown                                                                       |
|        BUILD_TAG        |                                                                    H6GGV0X6WG9X                                                                    |
|        NODE_NAME        |                                                                    lf-virtual8                                                                     |
|       TEST_DB_URL       |                                                  http://testresults.opnfv.org/test/api/v1/results                                                  |
|     TEST_DB_EXT_URL     |                                                  http://testresults.opnfv.org/test/api/v1/results                                                  |
|     S3_ENDPOINT_URL     |                                                           https://storage.googleapis.com                                                           |
|        S3_DST_URL       |      s3://artifacts.opnfv.org/functest-kubernetes/H6GGV0X6WG9X/functest-kubernetes-opnfv-functest-kubernetes-security-latest-kube_bench-run-5      |
|       HTTP_DST_URL      |     http://artifacts.opnfv.org/functest-kubernetes/H6GGV0X6WG9X/functest-kubernetes-opnfv-functest-kubernetes-security-latest-kube_bench-run-5     |
+-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+

2020-03-16 17:02:58,619 - xtesting.ci.run_tests - DEBUG - No env file /var/lib/xtesting/conf/env_file found
2020-03-16 17:02:58,619 - xtesting.ci.run_tests - DEBUG - Test args: kube_bench
2020-03-16 17:02:58,624 - xtesting.ci.run_tests - INFO - Loading test case 'kube_bench'...
2020-03-16 17:02:58,891 - xtesting.ci.run_tests - INFO - Running test case 'kube_bench'...
2020-03-16 17:02:58,931 - kubernetes.client.rest - DEBUG - response body: {"kind":"Job","apiVersion":"batch/v1","metadata":{"name":"kube-bench","namespace":"default","selfLink":"/apis/batch/v1/namespaces/default/jobs/kube-bench","uid":"fd3115b5-3b14-4cc1-8b0e-a65a8c722e4f","resourceVersion":"338294","creationTimestamp":"2020-03-16T17:02:58Z","labels":{"app":"kube-bench","controller-uid":"fd3115b5-3b14-4cc1-8b0e-a65a8c722e4f","job-name":"kube-bench"}},"spec":{"parallelism":1,"completions":1,"backoffLimit":6,"selector":{"matchLabels":{"controller-uid":"fd3115b5-3b14-4cc1-8b0e-a65a8c722e4f"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app":"kube-bench","controller-uid":"fd3115b5-3b14-4cc1-8b0e-a65a8c722e4f","job-name":"kube-bench"}},"spec":{"volumes":[{"name":"var-lib-etcd","hostPath":{"path":"/var/lib/etcd","type":""}},{"name":"var-lib-kubelet","hostPath":{"path":"/var/lib/kubelet","type":""}},{"name":"etc-systemd","hostPath":{"path":"/etc/systemd","type":""}},{"name":"etc-kubernetes","hostPath":{"path":"/etc/kubernetes","type":""}},{"name":"usr-bin","hostPath":{"path":"/usr/bin","type":""}}],"containers":[{"name":"kube-bench","image":"aquasec/kube-bench:latest","command":["kube-bench"],"resources":{},"volumeMounts":[{"name":"var-lib-etcd","readOnly":true,"mountPath":"/var/lib/etcd"},{"name":"var-lib-kubelet","readOnly":true,"mountPath":"/var/lib/kubelet"},{"name":"etc-systemd","readOnly":true,"mountPath":"/etc/systemd"},{"name":"etc-kubernetes","readOnly":true,"mountPath":"/etc/kubernetes"},{"name":"usr-bin","readOnly":true,"mountPath":"/usr/local/mount-from-host/bin"}],"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"Always"}],"restartPolicy":"Never","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","hostPID":true,"securityContext":{},"schedulerName":"default-scheduler"}}},"status":{}}

2020-03-16 17:02:58,936 - functest_kubernetes.security.security - INFO - Job kube-bench created
2020-03-16 17:02:58,936 - functest_kubernetes.security.security - DEBUG - create_namespaced_job: {'api_version': 'batch/v1',
 'kind': 'Job',
 'metadata': {'annotations': None,
              'cluster_name': None,
              'creation_timestamp': datetime.datetime(2020, 3, 16, 17, 2, 58, tzinfo=tzlocal()),
              'deletion_grace_period_seconds': None,
              'deletion_timestamp': None,
              'finalizers': None,
              'generate_name': None,
              'generation': None,
              'initializers': None,
              'labels': {'app': 'kube-bench',
                         'controller-uid': 'fd3115b5-3b14-4cc1-8b0e-a65a8c722e4f',
                         'job-name': 'kube-bench'},
              'managed_fields': None,
              'name': 'kube-bench',
              'namespace': 'default',
              'owner_references': None,
              'resource_version': '338294',
              'self_link': '/apis/batch/v1/namespaces/default/jobs/kube-bench',
              'uid': 'fd3115b5-3b14-4cc1-8b0e-a65a8c722e4f'},
 'spec': {'active_deadline_seconds': None,
          'backoff_limit': 6,
          'completions': 1,
          'manual_selector': None,
          'parallelism': 1,
          'selector': {'match_expressions': None,
                       'match_labels': {'controller-uid': 'fd3115b5-3b14-4cc1-8b0e-a65a8c722e4f'}},
          'template': {'metadata': {'annotations': None,
                                    'cluster_name': None,
                                    'creation_timestamp': None,
                                    'deletion_grace_period_seconds': None,
                                    'deletion_timestamp': None,
                                    'finalizers': None,
                                    'generate_name': None,
                                    'generation': None,
                                    'initializers': None,
                                    'labels': {'app': 'kube-bench',
                                               'controller-uid': 'fd3115b5-3b14-4cc1-8b0e-a65a8c722e4f',
                                               'job-name': 'kube-bench'},
                                    'managed_fields': None,
                                    'name': None,
                                    'namespace': None,
                                    'owner_references': None,
                                    'resource_version': None,
                                    'self_link': None,
                                    'uid': None},
                       'spec': {'active_deadline_seconds': None,
                                'affinity': None,
                                'automount_service_account_token': None,
                                'containers': [{'args': None,
                                                'command': ['kube-bench'],
                                                'env': None,
                                                'env_from': None,
                                                'image': 'aquasec/kube-bench:latest',
                                                'image_pull_policy': 'Always',
                                                'lifecycle': None,
                                                'liveness_probe': None,
                                                'name': 'kube-bench',
                                                'ports': None,
                                                'readiness_probe': None,
                                                'resources': {'limits': None,
                                                              'requests': None},
                                                'security_context': None,
                                                'stdin': None,
                                                'stdin_once': None,
                                                'termination_message_path': '/dev/termination-log',
                                                'termination_message_policy': 'File',
                                                'tty': None,
                                                'volume_devices': None,
                                                'volume_mounts': [{'mount_path': '/var/lib/etcd',
                                                                   'mount_propagation': None,
                                                                   'name': 'var-lib-etcd',
                                                                   'read_only': True,
                                                                   'sub_path': None,
                                                                   'sub_path_expr': None},
                                                                  {'mount_path': '/var/lib/kubelet',
                                                                   'mount_propagation': None,
                                                                   'name': 'var-lib-kubelet',
                                                                   'read_only': True,
                                                                   'sub_path': None,
                                                                   'sub_path_expr': None},
                                                                  {'mount_path': '/etc/systemd',
                                                                   'mount_propagation': None,
                                                                   'name': 'etc-systemd',
                                                                   'read_only': True,
                                                                   'sub_path': None,
                                                                   'sub_path_expr': None},
                                                                  {'mount_path': '/etc/kubernetes',
                                                                   'mount_propagation': None,
                                                                   'name': 'etc-kubernetes',
                                                                   'read_only': True,
                                                                   'sub_path': None,
                                                                   'sub_path_expr': None},
                                                                  {'mount_path': '/usr/local/mount-from-host/bin',
                                                                   'mount_propagation': None,
                                                                   'name': 'usr-bin',
                                                                   'read_only': True,
                                                                   'sub_path': None,
                                                                   'sub_path_expr': None}],
                                                'working_dir': None}],
                                'dns_config': None,
                                'dns_policy': 'ClusterFirst',
                                'enable_service_links': None,
                                'host_aliases': None,
                                'host_ipc': None,
                                'host_network': None,
                                'host_pid': True,
                                'hostname': None,
                                'image_pull_secrets': None,
                                'init_containers': None,
                                'node_name': None,
                                'node_selector': None,
                                'preemption_policy': None,
                                'priority': None,
                                'priority_class_name': None,
                                'readiness_gates': None,
                                'restart_policy': 'Never',
                                'runtime_class_name': None,
                                'scheduler_name': 'default-scheduler',
                                'security_context': {'fs_group': None,
                                                     'run_as_group': None,
                                                     'run_as_non_root': None,
                                                     'run_as_user': None,
                                                     'se_linux_options': None,
                                                     'supplemental_groups': None,
                                                     'sysctls': None,
                                                     'windows_options': None},
                                'service_account': None,
                                'service_account_name': None,
                                'share_process_namespace': None,
                                'subdomain': None,
                                'termination_grace_period_seconds': 30,
                                'tolerations': None,
                                'volumes': [{'aws_elastic_block_store': None,
                                             'azure_disk': None,
                                             'azure_file': None,
                                             'cephfs': None,
                                             'cinder': None,
                                             'config_map': None,
                                             'csi': None,
                                             'downward_api': None,
                                             'empty_dir': None,
                                             'fc': None,
                                             'flex_volume': None,
                                             'flocker': None,
                                             'gce_persistent_disk': None,
                                             'git_repo': None,
                                             'glusterfs': None,
                                             'host_path': {'path': '/var/lib/etcd',
                                                           'type': ''},
                                             'iscsi': None,
                                             'name': 'var-lib-etcd',
                                             'nfs': None,
                                             'persistent_volume_claim': None,
                                             'photon_persistent_disk': None,
                                             'portworx_volume': None,
                                             'projected': None,
                                             'quobyte': None,
                                             'rbd': None,
                                             'scale_io': None,
                                             'secret': None,
                                             'storageos': None,
                                             'vsphere_volume': None},
                                            {'aws_elastic_block_store': None,
                                             'azure_disk': None,
                                             'azure_file': None,
                                             'cephfs': None,
                                             'cinder': None,
                                             'config_map': None,
                                             'csi': None,
                                             'downward_api': None,
                                             'empty_dir': None,
                                             'fc': None,
                                             'flex_volume': None,
                                             'flocker': None,
                                             'gce_persistent_disk': None,
                                             'git_repo': None,
                                             'glusterfs': None,
                                             'host_path': {'path': '/var/lib/kubelet',
                                                           'type': ''},
                                             'iscsi': None,
                                             'name': 'var-lib-kubelet',
                                             'nfs': None,
                                             'persistent_volume_claim': None,
                                             'photon_persistent_disk': None,
                                             'portworx_volume': None,
                                             'projected': None,
                                             'quobyte': None,
                                             'rbd': None,
                                             'scale_io': None,
                                             'secret': None,
                                             'storageos': None,
                                             'vsphere_volume': None},
                                            {'aws_elastic_block_store': None,
                                             'azure_disk': None,
                                             'azure_file': None,
                                             'cephfs': None,
                                             'cinder': None,
                                             'config_map': None,
                                             'csi': None,
                                             'downward_api': None,
                                             'empty_dir': None,
                                             'fc': None,
                                             'flex_volume': None,
                                             'flocker': None,
                                             'gce_persistent_disk': None,
                                             'git_repo': None,
                                             'glusterfs': None,
                                             'host_path': {'path': '/etc/systemd',
                                                           'type': ''},
                                             'iscsi': None,
                                             'name': 'etc-systemd',
                                             'nfs': None,
                                             'persistent_volume_claim': None,
                                             'photon_persistent_disk': None,
                                             'portworx_volume': None,
                                             'projected': None,
                                             'quobyte': None,
                                             'rbd': None,
                                             'scale_io': None,
                                             'secret': None,
                                             'storageos': None,
                                             'vsphere_volume': None},
                                            {'aws_elastic_block_store': None,
                                             'azure_disk': None,
                                             'azure_file': None,
                                             'cephfs': None,
                                             'cinder': None,
                                             'config_map': None,
                                             'csi': None,
                                             'downward_api': None,
                                             'empty_dir': None,
                                             'fc': None,
                                             'flex_volume': None,
                                             'flocker': None,
                                             'gce_persistent_disk': None,
                                             'git_repo': None,
                                             'glusterfs': None,
                                             'host_path': {'path': '/etc/kubernetes',
                                                           'type': ''},
                                             'iscsi': None,
                                             'name': 'etc-kubernetes',
                                             'nfs': None,
                                             'persistent_volume_claim': None,
                                             'photon_persistent_disk': None,
                                             'portworx_volume': None,
                                             'projected': None,
                                             'quobyte': None,
                                             'rbd': None,
                                             'scale_io': None,
                                             'secret': None,
                                             'storageos': None,
                                             'vsphere_volume': None},
                                            {'aws_elastic_block_store': None,
                                             'azure_disk': None,
                                             'azure_file': None,
                                             'cephfs': None,
                                             'cinder': None,
                                             'config_map': None,
                                             'csi': None,
                                             'downward_api': None,
                                             'empty_dir': None,
                                             'fc': None,
                                             'flex_volume': None,
                                             'flocker': None,
                                             'gce_persistent_disk': None,
                                             'git_repo': None,
                                             'glusterfs': None,
                                             'host_path': {'path': '/usr/bin',
                                                           'type': ''},
                                             'iscsi': None,
                                             'name': 'usr-bin',
                                             'nfs': None,
                                             'persistent_volume_claim': None,
                                             'photon_persistent_disk': None,
                                             'portworx_volume': None,
                                             'projected': None,
                                             'quobyte': None,
                                             'rbd': None,
                                             'scale_io': None,
                                             'secret': None,
                                             'storageos': None,
                                             'vsphere_volume': None}]}},
          'ttl_seconds_after_finished': None},
 'status': {'active': None,
            'completion_time': None,
            'conditions': None,
            'failed': None,
            'start_time': None,
            'succeeded': None}}
2020-03-16 17:03:15,612 - functest_kubernetes.security.security - INFO - kube-bench started in 16.72 sec
2020-03-16 17:03:15,766 - kubernetes.client.rest - DEBUG - response body: {"kind":"PodList","apiVersion":"v1","metadata":{"selfLink":"/api/v1/namespaces/default/pods","resourceVersion":"338362"},"items":[{"metadata":{"name":"kube-bench-52jzx","generateName":"kube-bench-","namespace":"default","selfLink":"/api/v1/namespaces/default/pods/kube-bench-52jzx","uid":"9559e0ec-a267-4ae0-8abb-da71e57b9a10","resourceVersion":"338361","creationTimestamp":"2020-03-16T17:02:58Z","labels":{"app":"kube-bench","controller-uid":"fd3115b5-3b14-4cc1-8b0e-a65a8c722e4f","job-name":"kube-bench"},"ownerReferences":[{"apiVersion":"batch/v1","kind":"Job","name":"kube-bench","uid":"fd3115b5-3b14-4cc1-8b0e-a65a8c722e4f","controller":true,"blockOwnerDeletion":true}]},"spec":{"volumes":[{"name":"var-lib-etcd","hostPath":{"path":"/var/lib/etcd","type":""}},{"name":"var-lib-kubelet","hostPath":{"path":"/var/lib/kubelet","type":""}},{"name":"etc-systemd","hostPath":{"path":"/etc/systemd","type":""}},{"name":"etc-kubernetes","hostPath":{"path":"/etc/kubernetes","type":""}},{"name":"usr-bin","hostPath":{"path":"/usr/bin","type":""}},{"name":"default-token-8srxc","secret":{"secretName":"default-token-8srxc","defaultMode":420}}],"containers":[{"name":"kube-bench","image":"aquasec/kube-bench:latest","command":["kube-bench"],"resources":{},"volumeMounts":[{"name":"var-lib-etcd","readOnly":true,"mountPath":"/var/lib/etcd"},{"name":"var-lib-kubelet","readOnly":true,"mountPath":"/var/lib/kubelet"},{"name":"etc-systemd","readOnly":true,"mountPath":"/etc/systemd"},{"name":"etc-kubernetes","readOnly":true,"mountPath":"/etc/kubernetes"},{"name":"usr-bin","readOnly":true,"mountPath":"/usr/local/mount-from-host/bin"},{"name":"default-token-8srxc","readOnly":true,"mountPath":"/var/run/secrets/kubernetes.io/serviceaccount"}],"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"Always"}],"restartPolicy":"Never","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","serviceAccountName":"default","serviceAccount":"default","nodeName":"latest-worker","hostPID":true,"securityContext":{},"schedulerName":"default-scheduler","tolerations":[{"key":"node.kubernetes.io/not-ready","operator":"Exists","effect":"NoExecute","tolerationSeconds":300},{"key":"node.kubernetes.io/unreachable","operator":"Exists","effect":"NoExecute","tolerationSeconds":300}],"priority":0,"enableServiceLinks":true},"status":{"phase":"Succeeded","conditions":[{"type":"Initialized","status":"True","lastProbeTime":null,"lastTransitionTime":"2020-03-16T17:02:58Z","reason":"PodCompleted"},{"type":"Ready","status":"False","lastProbeTime":null,"lastTransitionTime":"2020-03-16T17:03:15Z","reason":"PodCompleted"},{"type":"ContainersReady","status":"False","lastProbeTime":null,"lastTransitionTime":"2020-03-16T17:03:15Z","reason":"PodCompleted"},{"type":"PodScheduled","status":"True","lastProbeTime":null,"lastTransitionTime":"2020-03-16T17:02:58Z"}],"hostIP":"172.17.0.13","podIP":"10.244.2.213","podIPs":[{"ip":"10.244.2.213"}],"startTime":"2020-03-16T17:02:58Z","containerStatuses":[{"name":"kube-bench","state":{"terminated":{"exitCode":0,"reason":"Completed","startedAt":"2020-03-16T17:03:11Z","finishedAt":"2020-03-16T17:03:12Z","containerID":"containerd://72f21f39e4d5a23c55499e64b20d2e8d86dc085c780f86ca75279f0b79472f2d"}},"lastState":{},"ready":false,"restartCount":0,"image":"docker.io/aquasec/kube-bench:latest","imageID":"docker.io/aquasec/kube-bench@sha256:5e21ed2c67f8015ed449f4402c942d8200a0b59cc0b518744e2e45a3de219ba9","containerID":"containerd://72f21f39e4d5a23c55499e64b20d2e8d86dc085c780f86ca75279f0b79472f2d","started":false}],"qosClass":"BestEffort"}}]}

2020-03-16 17:03:15,800 - kubernetes.client.rest - DEBUG - response body: [INFO] 2 Etcd Node Configuration
[INFO] 2 Etcd Node Configuration Files
[FAIL] 2.1 Ensure that the --cert-file and --key-file arguments are set as appropriate (Scored)
[FAIL] 2.2 Ensure that the --client-cert-auth argument is set to true (Scored)
[PASS] 2.3 Ensure that the --auto-tls argument is not set to true (Scored)
[FAIL] 2.4 Ensure that the --peer-cert-file and --peer-key-file arguments are set as appropriate (Scored)
[FAIL] 2.5 Ensure that the --peer-client-cert-auth argument is set to true (Scored)
[PASS] 2.6 Ensure that the --peer-auto-tls argument is not set to true (Scored)
[WARN] 2.7 Ensure that a unique Certificate Authority is used for etcd (Not Scored)

== Remediations ==
2.1 Follow the etcd service documentation and configure TLS encryption.
Then, edit the etcd pod specification file /etc/kubernetes/manifests/etcd.yaml
on the master node and set the below parameters.
--cert-file=</path/to/ca-file>
--key-file=</path/to/key-file>

2.2 Edit the etcd pod specification file /etc/kubernetes/manifests/etcd.yaml on the master
node and set the below parameter.
--client-cert-auth="true"

2.4 Follow the etcd service documentation and configure peer TLS encryption as appropriate
for your etcd cluster. Then, edit the etcd pod specification file /etc/kubernetes/manifests/etcd.yaml on the
master node and set the below parameters.
--peer-client-file=</path/to/peer-cert-file>
--peer-key-file=</path/to/peer-key-file>

2.5 Edit the etcd pod specification file /etc/kubernetes/manifests/etcd.yaml on the master
node and set the below parameter.
--peer-client-cert-auth=true

2.7 [Manual test]
Follow the etcd documentation and create a dedicated certificate authority setup for the
etcd service.
Then, edit the etcd pod specification file /etc/kubernetes/manifests/etcd.yaml on the
master node and set the below parameter.
--trusted-ca-file=</path/to/ca-file>


== Summary ==
2 checks PASS
4 checks FAIL
1 checks WARN
0 checks INFO
[INFO] 4 Worker Node Security Configuration
[INFO] 4.1 Worker Node Configuration Files
[PASS] 4.1.1 Ensure that the kubelet service file permissions are set to 644 or more restrictive (Scored)
[PASS] 4.1.2 Ensure that the kubelet service file ownership is set to root:root (Scored)
[FAIL] 4.1.3 Ensure that the proxy kubeconfig file permissions are set to 644 or more restrictive (Scored)
[FAIL] 4.1.4 Ensure that the proxy kubeconfig file ownership is set to root:root (Scored)
[PASS] 4.1.5 Ensure that the kubelet.conf file permissions are set to 644 or more restrictive (Scored)
[PASS] 4.1.6 Ensure that the kubelet.conf file ownership is set to root:root (Scored)
[WARN] 4.1.7 Ensure that the certificate authorities file permissions are set to 644 or more restrictive (Scored)
[PASS] 4.1.8 Ensure that the client certificate authorities file ownership is set to root:root (Scored)
[PASS] 4.1.9 Ensure that the kubelet configuration file has permissions set to 644 or more restrictive (Scored)
[PASS] 4.1.10 Ensure that the kubelet configuration file ownership is set to root:root (Scored)
[INFO] 4.2 Kubelet
[PASS] 4.2.1 Ensure that the --anonymous-auth argument is set to false (Scored)
[PASS] 4.2.2 Ensure that the --authorization-mode argument is not set to AlwaysAllow (Scored)
[PASS] 4.2.3 Ensure that the --client-ca-file argument is set as appropriate (Scored)
[FAIL] 4.2.4 Ensure that the --read-only-port argument is set to 0 (Scored)
[PASS] 4.2.5 Ensure that the --streaming-connection-idle-timeout argument is not set to 0 (Scored)
[FAIL] 4.2.6 Ensure that the --protect-kernel-defaults argument is set to true (Scored)
[PASS] 4.2.7 Ensure that the --make-iptables-util-chains argument is set to true (Scored) 
[PASS] 4.2.8 Ensure that the --hostname-override argument is not set (Not Scored)
[WARN] 4.2.9 Ensure that the --event-qps argument is set to 0 or a level which ensures appropriate event capture (Not Scored)
[FAIL] 4.2.10 Ensure that the --tls-cert-file and --tls-private-key-file arguments are set as appropriate (Scored)
[PASS] 4.2.11 Ensure that the --rotate-certificates argument is not set to false (Scored)
[FAIL] 4.2.12 Ensure that the RotateKubeletServerCertificate argument is set to true (Scored)
[WARN] 4.2.13 Ensure that the Kubelet only makes use of Strong Cryptographic Ciphers (Not Scored)

== Remediations ==
4.1.3 Run the below command (based on the file location on your system) on the each worker node.
For example,
chmod 644 /etc/kubernetes/proxy.conf

4.1.4 Run the below command (based on the file location on your system) on the each worker node.
For example, chown root:root /etc/kubernetes/proxy.conf

4.1.7 audit test did not run: There are no tests
4.2.4 If using a Kubelet config file, edit the file to set readOnlyPort to 0.
If using command line arguments, edit the kubelet service file
/etc/systemd/system/kubelet.service.d/10-kubeadm.conf on each worker node and
set the below parameter in KUBELET_SYSTEM_PODS_ARGS variable.
--read-only-port=0
Based on your system, restart the kubelet service. For example:
systemctl daemon-reload
systemctl restart kubelet.service

4.2.6 If using a Kubelet config file, edit the file to set protectKernelDefaults: true.
If using command line arguments, edit the kubelet service file
/etc/systemd/system/kubelet.service.d/10-kubeadm.conf on each worker node and
set the below parameter in KUBELET_SYSTEM_PODS_ARGS variable.
--protect-kernel-defaults=true
Based on your system, restart the kubelet service. For example:
systemctl daemon-reload
systemctl restart kubelet.service

4.2.9 If using a Kubelet config file, edit the file to set eventRecordQPS: to an appropriate level.
If using command line arguments, edit the kubelet service file
/etc/systemd/system/kubelet.service.d/10-kubeadm.conf on each worker node and
set the below parameter in KUBELET_SYSTEM_PODS_ARGS variable.
Based on your system, restart the kubelet service. For example:
systemctl daemon-reload
systemctl restart kubelet.service

4.2.10 If using a Kubelet config file, edit the file to set tlsCertFile to the location
of the certificate file to use to identify this Kubelet, and tlsPrivateKeyFile
to the location of the corresponding private key file.
If using command line arguments, edit the kubelet service file
/etc/systemd/system/kubelet.service.d/10-kubeadm.conf on each worker node and
set the below parameters in KUBELET_CERTIFICATE_ARGS variable.
--tls-cert-file=<path/to/tls-certificate-file>
--tls-private-key-file=<path/to/tls-key-file>
Based on your system, restart the kubelet service. For example:
systemctl daemon-reload
systemctl restart kubelet.service

4.2.12 Edit the kubelet service file /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
on each worker node and set the below parameter in KUBELET_CERTIFICATE_ARGS variable.
--feature-gates=RotateKubeletServerCertificate=true
Based on your system, restart the kubelet service. For example:
systemctl daemon-reload
systemctl restart kubelet.service

4.2.13 If using a Kubelet config file, edit the file to set TLSCipherSuites: to
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_128_GCM_SHA256
or to a subset of these values.
If using executable arguments, edit the kubelet service file
/etc/systemd/system/kubelet.service.d/10-kubeadm.conf on each worker node and
set the --tls-cipher-suites parameter as follows, or to a subset of these values.
--tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_128_GCM_SHA256
Based on your system, restart the kubelet service. For example:
systemctl daemon-reload
systemctl restart kubelet.service


== Summary ==
14 checks PASS
6 checks FAIL
3 checks WARN
0 checks INFO
[INFO] 5 Kubernetes Policies
[INFO] 5.1 RBAC and Service Accounts
[WARN] 5.1.1 Ensure that the cluster-admin role is only used where required (Not Scored)
[WARN] 5.1.2 Minimize access to secrets (Not Scored)
[WARN] 5.1.3 Minimize wildcard use in Roles and ClusterRoles (Not Scored)
[WARN] 5.1.4 Minimize access to create pods (Not Scored)
[WARN] 5.1.5 Ensure that default service accounts are not actively used. (Scored)
[WARN] 5.1.6 Ensure that Service Account Tokens are only mounted where necessary (Not Scored)
[INFO] 5.2 Pod Security Policies
[WARN] 5.2.1 Minimize the admission of privileged containers (Not Scored)
[WARN] 5.2.2 Minimize the admission of containers wishing to share the host process ID namespace (Scored)
[WARN] 5.2.3 Minimize the admission of containers wishing to share the host IPC namespace (Scored)
[WARN] 5.2.4 Minimize the admission of containers wishing to share the host network namespace (Scored)
[WARN] 5.2.5 Minimize the admission of containers with allowPrivilegeEscalation (Scored)
[WARN] 5.2.6 Minimize the admission of root containers (Not Scored)
[WARN] 5.2.7 Minimize the admission of containers with the NET_RAW capability (Not Scored)
[WARN] 5.2.8 Minimize the admission of containers with added capabilities (Not Scored)
[WARN] 5.2.9 Minimize the admission of containers with capabilities assigned (Not Scored) 
[INFO] 5.3 Network Policies and CNI
[WARN] 5.3.1 Ensure that the CNI in use supports Network Policies (Not Scored)
[WARN] 5.3.2 Ensure that all Namespaces have Network Policies defined (Scored)
[INFO] 5.4 Secrets Management
[WARN] 5.4.1 Prefer using secrets as files over secrets as environment variables (Not Scored)
[WARN] 5.4.2 Consider external secret storage (Not Scored)
[INFO] 5.5 Extensible Admission Control
[WARN] 5.5.1 Configure Image Provenance using ImagePolicyWebhook admission controller (Not Scored)
[INFO] 5.6 General Policies
[WARN] 5.6.1 Create administrative boundaries between resources using namespaces (Not Scored)
[WARN] 5.6.2 Ensure that the seccomp profile is set to docker/default in your pod definitions (Not Scored)
[WARN] 5.6.3 Apply Security Context to Your Pods and Containers (Not Scored)
[WARN] 5.6.4 The default namespace should not be used (Scored)

== Remediations ==
5.1.1 Identify all clusterrolebindings to the cluster-admin role. Check if they are used and
if they need this role or if they could use a role with fewer privileges.
Where possible, first bind users to a lower privileged role and then remove the
clusterrolebinding to the cluster-admin role :
kubectl delete clusterrolebinding [name]

5.1.2 Where possible, remove get, list and watch access to secret objects in the cluster.

5.1.3 Where possible replace any use of wildcards in clusterroles and roles with specific
objects or actions.

5.1.4 
5.1.5 Create explicit service accounts wherever a Kubernetes workload requires specific access
to the Kubernetes API server.
Modify the configuration of each default service account to include this value
automountServiceAccountToken: false

5.1.6 Modify the definition of pods and service accounts which do not need to mount service
account tokens to disable it.

5.2.1 Create a PSP as described in the Kubernetes documentation, ensuring that
the .spec.privileged field is omitted or set to false.

5.2.2 Create a PSP as described in the Kubernetes documentation, ensuring that the
.spec.hostPID field is omitted or set to false.

5.2.3 Create a PSP as described in the Kubernetes documentation, ensuring that the
.spec.hostIPC field is omitted or set to false.

5.2.4 Create a PSP as described in the Kubernetes documentation, ensuring that the
.spec.hostNetwork field is omitted or set to false.

5.2.5 Create a PSP as described in the Kubernetes documentation, ensuring that the
.spec.allowPrivilegeEscalation field is omitted or set to false.

5.2.6 Create a PSP as described in the Kubernetes documentation, ensuring that the
.spec.runAsUser.rule is set to either MustRunAsNonRoot or MustRunAs with the range of
UIDs not including 0.

5.2.7 Create a PSP as described in the Kubernetes documentation, ensuring that the
.spec.requiredDropCapabilities is set to include either NET_RAW or ALL.

5.2.8 Ensure that allowedCapabilities is not present in PSPs for the cluster unless
it is set to an empty array.

5.2.9 Review the use of capabilites in applications runnning on your cluster. Where a namespace
contains applicaions which do not require any Linux capabities to operate consider adding
a PSP which forbids the admission of containers which do not drop all capabilities.

5.3.1 If the CNI plugin in use does not support network policies, consideration should be given to
making use of a different plugin, or finding an alternate mechanism for restricting traffic
in the Kubernetes cluster.

5.3.2 Follow the documentation and create NetworkPolicy objects as you need them.

5.4.1 if possible, rewrite application code to read secrets from mounted secret files, rather than
from environment variables.

5.4.2 Refer to the secrets management options offered by your cloud provider or a third-party
secrets management solution.

5.5.1 Follow the Kubernetes documentation and setup image provenance.

5.6.1 Follow the documentation and create namespaces for objects in your deployment as you need
them.

5.6.2 Seccomp is an alpha feature currently. By default, all alpha features are disabled. So, you
would need to enable alpha features in the apiserver by passing "--feature-
gates=AllAlpha=true" argument.
Edit the /etc/kubernetes/apiserver file on the master node and set the KUBE_API_ARGS
parameter to "--feature-gates=AllAlpha=true"
KUBE_API_ARGS="--feature-gates=AllAlpha=true"
Based on your system, restart the kube-apiserver service. For example:
systemctl restart kube-apiserver.service
Use annotations to enable the docker/default seccomp profile in your pod definitions. An
example is as below:
apiVersion: v1
kind: Pod
metadata:
  name: trustworthy-pod
  annotations:
    seccomp.security.alpha.kubernetes.io/pod: docker/default
spec:
  containers:
    - name: trustworthy-container
      image: sotrustworthy:latest

5.6.3 Follow the Kubernetes documentation and apply security contexts to your pods. For a
suggested list of security contexts, you may refer to the CIS Security Benchmark for Docker
Containers.

5.6.4 Ensure that namespaces are created to allow for appropriate segregation of Kubernetes
resources and that all new resources are created in a specific namespace.


== Summary ==
0 checks PASS
0 checks FAIL
24 checks WARN
0 checks INFO

2020-03-16 17:03:15,801 - functest_kubernetes.security.security - WARNING - 

[INFO] 2 Etcd Node Configuration
[INFO] 2 Etcd Node Configuration Files
[FAIL] 2.1 Ensure that the --cert-file and --key-file arguments are set as appropriate (Scored)
[FAIL] 2.2 Ensure that the --client-cert-auth argument is set to true (Scored)
[PASS] 2.3 Ensure that the --auto-tls argument is not set to true (Scored)
[FAIL] 2.4 Ensure that the --peer-cert-file and --peer-key-file arguments are set as appropriate (Scored)
[FAIL] 2.5 Ensure that the --peer-client-cert-auth argument is set to true (Scored)
[PASS] 2.6 Ensure that the --peer-auto-tls argument is not set to true (Scored)
[WARN] 2.7 Ensure that a unique Certificate Authority is used for etcd (Not Scored)

== Remediations ==
2.1 Follow the etcd service documentation and configure TLS encryption.
Then, edit the etcd pod specification file /etc/kubernetes/manifests/etcd.yaml
on the master node and set the below parameters.
--cert-file=</path/to/ca-file>
--key-file=</path/to/key-file>

2.2 Edit the etcd pod specification file /etc/kubernetes/manifests/etcd.yaml on the master
node and set the below parameter.
--client-cert-auth="true"

2.4 Follow the etcd service documentation and configure peer TLS encryption as appropriate
for your etcd cluster. Then, edit the etcd pod specification file /etc/kubernetes/manifests/etcd.yaml on the
master node and set the below parameters.
--peer-client-file=</path/to/peer-cert-file>
--peer-key-file=</path/to/peer-key-file>

2.5 Edit the etcd pod specification file /etc/kubernetes/manifests/etcd.yaml on the master
node and set the below parameter.
--peer-client-cert-auth=true

2.7 [Manual test]
Follow the etcd documentation and create a dedicated certificate authority setup for the
etcd service.
Then, edit the etcd pod specification file /etc/kubernetes/manifests/etcd.yaml on the
master node and set the below parameter.
--trusted-ca-file=</path/to/ca-file>


== Summary ==
2 checks PASS
4 checks FAIL
1 checks WARN
0 checks INFO
[INFO] 4 Worker Node Security Configuration
[INFO] 4.1 Worker Node Configuration Files
[PASS] 4.1.1 Ensure that the kubelet service file permissions are set to 644 or more restrictive (Scored)
[PASS] 4.1.2 Ensure that the kubelet service file ownership is set to root:root (Scored)
[FAIL] 4.1.3 Ensure that the proxy kubeconfig file permissions are set to 644 or more restrictive (Scored)
[FAIL] 4.1.4 Ensure that the proxy kubeconfig file ownership is set to root:root (Scored)
[PASS] 4.1.5 Ensure that the kubelet.conf file permissions are set to 644 or more restrictive (Scored)
[PASS] 4.1.6 Ensure that the kubelet.conf file ownership is set to root:root (Scored)
[WARN] 4.1.7 Ensure that the certificate authorities file permissions are set to 644 or more restrictive (Scored)
[PASS] 4.1.8 Ensure that the client certificate authorities file ownership is set to root:root (Scored)
[PASS] 4.1.9 Ensure that the kubelet configuration file has permissions set to 644 or more restrictive (Scored)
[PASS] 4.1.10 Ensure that the kubelet configuration file ownership is set to root:root (Scored)
[INFO] 4.2 Kubelet
[PASS] 4.2.1 Ensure that the --anonymous-auth argument is set to false (Scored)
[PASS] 4.2.2 Ensure that the --authorization-mode argument is not set to AlwaysAllow (Scored)
[PASS] 4.2.3 Ensure that the --client-ca-file argument is set as appropriate (Scored)
[FAIL] 4.2.4 Ensure that the --read-only-port argument is set to 0 (Scored)
[PASS] 4.2.5 Ensure that the --streaming-connection-idle-timeout argument is not set to 0 (Scored)
[FAIL] 4.2.6 Ensure that the --protect-kernel-defaults argument is set to true (Scored)
[PASS] 4.2.7 Ensure that the --make-iptables-util-chains argument is set to true (Scored) 
[PASS] 4.2.8 Ensure that the --hostname-override argument is not set (Not Scored)
[WARN] 4.2.9 Ensure that the --event-qps argument is set to 0 or a level which ensures appropriate event capture (Not Scored)
[FAIL] 4.2.10 Ensure that the --tls-cert-file and --tls-private-key-file arguments are set as appropriate (Scored)
[PASS] 4.2.11 Ensure that the --rotate-certificates argument is not set to false (Scored)
[FAIL] 4.2.12 Ensure that the RotateKubeletServerCertificate argument is set to true (Scored)
[WARN] 4.2.13 Ensure that the Kubelet only makes use of Strong Cryptographic Ciphers (Not Scored)

== Remediations ==
4.1.3 Run the below command (based on the file location on your system) on the each worker node.
For example,
chmod 644 /etc/kubernetes/proxy.conf

4.1.4 Run the below command (based on the file location on your system) on the each worker node.
For example, chown root:root /etc/kubernetes/proxy.conf

4.1.7 audit test did not run: There are no tests
4.2.4 If using a Kubelet config file, edit the file to set readOnlyPort to 0.
If using command line arguments, edit the kubelet service file
/etc/systemd/system/kubelet.service.d/10-kubeadm.conf on each worker node and
set the below parameter in KUBELET_SYSTEM_PODS_ARGS variable.
--read-only-port=0
Based on your system, restart the kubelet service. For example:
systemctl daemon-reload
systemctl restart kubelet.service

4.2.6 If using a Kubelet config file, edit the file to set protectKernelDefaults: true.
If using command line arguments, edit the kubelet service file
/etc/systemd/system/kubelet.service.d/10-kubeadm.conf on each worker node and
set the below parameter in KUBELET_SYSTEM_PODS_ARGS variable.
--protect-kernel-defaults=true
Based on your system, restart the kubelet service. For example:
systemctl daemon-reload
systemctl restart kubelet.service

4.2.9 If using a Kubelet config file, edit the file to set eventRecordQPS: to an appropriate level.
If using command line arguments, edit the kubelet service file
/etc/systemd/system/kubelet.service.d/10-kubeadm.conf on each worker node and
set the below parameter in KUBELET_SYSTEM_PODS_ARGS variable.
Based on your system, restart the kubelet service. For example:
systemctl daemon-reload
systemctl restart kubelet.service

4.2.10 If using a Kubelet config file, edit the file to set tlsCertFile to the location
of the certificate file to use to identify this Kubelet, and tlsPrivateKeyFile
to the location of the corresponding private key file.
If using command line arguments, edit the kubelet service file
/etc/systemd/system/kubelet.service.d/10-kubeadm.conf on each worker node and
set the below parameters in KUBELET_CERTIFICATE_ARGS variable.
--tls-cert-file=<path/to/tls-certificate-file>
--tls-private-key-file=<path/to/tls-key-file>
Based on your system, restart the kubelet service. For example:
systemctl daemon-reload
systemctl restart kubelet.service

4.2.12 Edit the kubelet service file /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
on each worker node and set the below parameter in KUBELET_CERTIFICATE_ARGS variable.
--feature-gates=RotateKubeletServerCertificate=true
Based on your system, restart the kubelet service. For example:
systemctl daemon-reload
systemctl restart kubelet.service

4.2.13 If using a Kubelet config file, edit the file to set TLSCipherSuites: to
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_128_GCM_SHA256
or to a subset of these values.
If using executable arguments, edit the kubelet service file
/etc/systemd/system/kubelet.service.d/10-kubeadm.conf on each worker node and
set the --tls-cipher-suites parameter as follows, or to a subset of these values.
--tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_128_GCM_SHA256
Based on your system, restart the kubelet service. For example:
systemctl daemon-reload
systemctl restart kubelet.service


== Summary ==
14 checks PASS
6 checks FAIL
3 checks WARN
0 checks INFO
[INFO] 5 Kubernetes Policies
[INFO] 5.1 RBAC and Service Accounts
[WARN] 5.1.1 Ensure that the cluster-admin role is only used where required (Not Scored)
[WARN] 5.1.2 Minimize access to secrets (Not Scored)
[WARN] 5.1.3 Minimize wildcard use in Roles and ClusterRoles (Not Scored)
[WARN] 5.1.4 Minimize access to create pods (Not Scored)
[WARN] 5.1.5 Ensure that default service accounts are not actively used. (Scored)
[WARN] 5.1.6 Ensure that Service Account Tokens are only mounted where necessary (Not Scored)
[INFO] 5.2 Pod Security Policies
[WARN] 5.2.1 Minimize the admission of privileged containers (Not Scored)
[WARN] 5.2.2 Minimize the admission of containers wishing to share the host process ID namespace (Scored)
[WARN] 5.2.3 Minimize the admission of containers wishing to share the host IPC namespace (Scored)
[WARN] 5.2.4 Minimize the admission of containers wishing to share the host network namespace (Scored)
[WARN] 5.2.5 Minimize the admission of containers with allowPrivilegeEscalation (Scored)
[WARN] 5.2.6 Minimize the admission of root containers (Not Scored)
[WARN] 5.2.7 Minimize the admission of containers with the NET_RAW capability (Not Scored)
[WARN] 5.2.8 Minimize the admission of containers with added capabilities (Not Scored)
[WARN] 5.2.9 Minimize the admission of containers with capabilities assigned (Not Scored) 
[INFO] 5.3 Network Policies and CNI
[WARN] 5.3.1 Ensure that the CNI in use supports Network Policies (Not Scored)
[WARN] 5.3.2 Ensure that all Namespaces have Network Policies defined (Scored)
[INFO] 5.4 Secrets Management
[WARN] 5.4.1 Prefer using secrets as files over secrets as environment variables (Not Scored)
[WARN] 5.4.2 Consider external secret storage (Not Scored)
[INFO] 5.5 Extensible Admission Control
[WARN] 5.5.1 Configure Image Provenance using ImagePolicyWebhook admission controller (Not Scored)
[INFO] 5.6 General Policies
[WARN] 5.6.1 Create administrative boundaries between resources using namespaces (Not Scored)
[WARN] 5.6.2 Ensure that the seccomp profile is set to docker/default in your pod definitions (Not Scored)
[WARN] 5.6.3 Apply Security Context to Your Pods and Containers (Not Scored)
[WARN] 5.6.4 The default namespace should not be used (Scored)

== Remediations ==
5.1.1 Identify all clusterrolebindings to the cluster-admin role. Check if they are used and
if they need this role or if they could use a role with fewer privileges.
Where possible, first bind users to a lower privileged role and then remove the
clusterrolebinding to the cluster-admin role :
kubectl delete clusterrolebinding [name]

5.1.2 Where possible, remove get, list and watch access to secret objects in the cluster.

5.1.3 Where possible replace any use of wildcards in clusterroles and roles with specific
objects or actions.

5.1.4 
5.1.5 Create explicit service accounts wherever a Kubernetes workload requires specific access
to the Kubernetes API server.
Modify the configuration of each default service account to include this value
automountServiceAccountToken: false

5.1.6 Modify the definition of pods and service accounts which do not need to mount service
account tokens to disable it.

5.2.1 Create a PSP as described in the Kubernetes documentation, ensuring that
the .spec.privileged field is omitted or set to false.

5.2.2 Create a PSP as described in the Kubernetes documentation, ensuring that the
.spec.hostPID field is omitted or set to false.

5.2.3 Create a PSP as described in the Kubernetes documentation, ensuring that the
.spec.hostIPC field is omitted or set to false.

5.2.4 Create a PSP as described in the Kubernetes documentation, ensuring that the
.spec.hostNetwork field is omitted or set to false.

5.2.5 Create a PSP as described in the Kubernetes documentation, ensuring that the
.spec.allowPrivilegeEscalation field is omitted or set to false.

5.2.6 Create a PSP as described in the Kubernetes documentation, ensuring that the
.spec.runAsUser.rule is set to either MustRunAsNonRoot or MustRunAs with the range of
UIDs not including 0.

5.2.7 Create a PSP as described in the Kubernetes documentation, ensuring that the
.spec.requiredDropCapabilities is set to include either NET_RAW or ALL.

5.2.8 Ensure that allowedCapabilities is not present in PSPs for the cluster unless
it is set to an empty array.

5.2.9 Review the use of capabilites in applications runnning on your cluster. Where a namespace
contains applicaions which do not require any Linux capabities to operate consider adding
a PSP which forbids the admission of containers which do not drop all capabilities.

5.3.1 If the CNI plugin in use does not support network policies, consideration should be given to
making use of a different plugin, or finding an alternate mechanism for restricting traffic
in the Kubernetes cluster.

5.3.2 Follow the documentation and create NetworkPolicy objects as you need them.

5.4.1 if possible, rewrite application code to read secrets from mounted secret files, rather than
from environment variables.

5.4.2 Refer to the secrets management options offered by your cloud provider or a third-party
secrets management solution.

5.5.1 Follow the Kubernetes documentation and setup image provenance.

5.6.1 Follow the documentation and create namespaces for objects in your deployment as you need
them.

5.6.2 Seccomp is an alpha feature currently. By default, all alpha features are disabled. So, you
would need to enable alpha features in the apiserver by passing "--feature-
gates=AllAlpha=true" argument.
Edit the /etc/kubernetes/apiserver file on the master node and set the KUBE_API_ARGS
parameter to "--feature-gates=AllAlpha=true"
KUBE_API_ARGS="--feature-gates=AllAlpha=true"
Based on your system, restart the kube-apiserver service. For example:
systemctl restart kube-apiserver.service
Use annotations to enable the docker/default seccomp profile in your pod definitions. An
example is as below:
apiVersion: v1
kind: Pod
metadata:
  name: trustworthy-pod
  annotations:
    seccomp.security.alpha.kubernetes.io/pod: docker/default
spec:
  containers:
    - name: trustworthy-container
      image: sotrustworthy:latest

5.6.3 Follow the Kubernetes documentation and apply security contexts to your pods. For a
suggested list of security contexts, you may refer to the CIS Security Benchmark for Docker
Containers.

5.6.4 Ensure that namespaces are created to allow for appropriate segregation of Kubernetes
resources and that all new resources are created in a specific namespace.


== Summary ==
0 checks PASS
0 checks FAIL
24 checks WARN
0 checks INFO

2020-03-16 17:03:15,801 - xtesting.ci.run_tests - INFO - Test result:

+--------------------+------------------+------------------+----------------+
|     TEST CASE      |     PROJECT      |     DURATION     |     RESULT     |
+--------------------+------------------+------------------+----------------+
|     kube_bench     |     functest     |      00:17       |      PASS      |
+--------------------+------------------+------------------+----------------+

2020-03-16 17:03:15,821 - kubernetes.client.rest - DEBUG - response body: {"kind":"Pod","apiVersion":"v1","metadata":{"name":"kube-bench-52jzx","generateName":"kube-bench-","namespace":"default","selfLink":"/api/v1/namespaces/default/pods/kube-bench-52jzx","uid":"9559e0ec-a267-4ae0-8abb-da71e57b9a10","resourceVersion":"338363","creationTimestamp":"2020-03-16T17:02:58Z","deletionTimestamp":"2020-03-16T17:03:15Z","deletionGracePeriodSeconds":0,"labels":{"app":"kube-bench","controller-uid":"fd3115b5-3b14-4cc1-8b0e-a65a8c722e4f","job-name":"kube-bench"},"ownerReferences":[{"apiVersion":"batch/v1","kind":"Job","name":"kube-bench","uid":"fd3115b5-3b14-4cc1-8b0e-a65a8c722e4f","controller":true,"blockOwnerDeletion":true}]},"spec":{"volumes":[{"name":"var-lib-etcd","hostPath":{"path":"/var/lib/etcd","type":""}},{"name":"var-lib-kubelet","hostPath":{"path":"/var/lib/kubelet","type":""}},{"name":"etc-systemd","hostPath":{"path":"/etc/systemd","type":""}},{"name":"etc-kubernetes","hostPath":{"path":"/etc/kubernetes","type":""}},{"name":"usr-bin","hostPath":{"path":"/usr/bin","type":""}},{"name":"default-token-8srxc","secret":{"secretName":"default-token-8srxc","defaultMode":420}}],"containers":[{"name":"kube-bench","image":"aquasec/kube-bench:latest","command":["kube-bench"],"resources":{},"volumeMounts":[{"name":"var-lib-etcd","readOnly":true,"mountPath":"/var/lib/etcd"},{"name":"var-lib-kubelet","readOnly":true,"mountPath":"/var/lib/kubelet"},{"name":"etc-systemd","readOnly":true,"mountPath":"/etc/systemd"},{"name":"etc-kubernetes","readOnly":true,"mountPath":"/etc/kubernetes"},{"name":"usr-bin","readOnly":true,"mountPath":"/usr/local/mount-from-host/bin"},{"name":"default-token-8srxc","readOnly":true,"mountPath":"/var/run/secrets/kubernetes.io/serviceaccount"}],"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"Always"}],"restartPolicy":"Never","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","serviceAccountName":"default","serviceAccount":"default","nodeName":"latest-worker","hostPID":true,"securityContext":{},"schedulerName":"default-scheduler","tolerations":[{"key":"node.kubernetes.io/not-ready","operator":"Exists","effect":"NoExecute","tolerationSeconds":300},{"key":"node.kubernetes.io/unreachable","operator":"Exists","effect":"NoExecute","tolerationSeconds":300}],"priority":0,"enableServiceLinks":true},"status":{"phase":"Succeeded","conditions":[{"type":"Initialized","status":"True","lastProbeTime":null,"lastTransitionTime":"2020-03-16T17:02:58Z","reason":"PodCompleted"},{"type":"Ready","status":"False","lastProbeTime":null,"lastTransitionTime":"2020-03-16T17:03:15Z","reason":"PodCompleted"},{"type":"ContainersReady","status":"False","lastProbeTime":null,"lastTransitionTime":"2020-03-16T17:03:15Z","reason":"PodCompleted"},{"type":"PodScheduled","status":"True","lastProbeTime":null,"lastTransitionTime":"2020-03-16T17:02:58Z"}],"hostIP":"172.17.0.13","podIP":"10.244.2.213","podIPs":[{"ip":"10.244.2.213"}],"startTime":"2020-03-16T17:02:58Z","containerStatuses":[{"name":"kube-bench","state":{"terminated":{"exitCode":0,"reason":"Completed","startedAt":"2020-03-16T17:03:11Z","finishedAt":"2020-03-16T17:03:12Z","containerID":"containerd://72f21f39e4d5a23c55499e64b20d2e8d86dc085c780f86ca75279f0b79472f2d"}},"lastState":{},"ready":false,"restartCount":0,"image":"docker.io/aquasec/kube-bench:latest","imageID":"docker.io/aquasec/kube-bench@sha256:5e21ed2c67f8015ed449f4402c942d8200a0b59cc0b518744e2e45a3de219ba9","containerID":"containerd://72f21f39e4d5a23c55499e64b20d2e8d86dc085c780f86ca75279f0b79472f2d","started":false}],"qosClass":"BestEffort"}}

2020-03-16 17:03:15,822 - functest_kubernetes.security.security - DEBUG - delete_namespaced_pod: {'api_version': 'v1',
 'code': None,
 'details': None,
 'kind': 'Pod',
 'message': None,
 'metadata': {'_continue': None,
              'remaining_item_count': None,
              'resource_version': '338363',
              'self_link': '/api/v1/namespaces/default/pods/kube-bench-52jzx'},
 'reason': None,
 'status': "{'phase': 'Succeeded', 'conditions': [{'type': 'Initialized', "
           "'status': 'True', 'lastProbeTime': None, 'lastTransitionTime': "
           "'2020-03-16T17:02:58Z', 'reason': 'PodCompleted'}, {'type': "
           "'Ready', 'status': 'False', 'lastProbeTime': None, "
           "'lastTransitionTime': '2020-03-16T17:03:15Z', 'reason': "
           "'PodCompleted'}, {'type': 'ContainersReady', 'status': 'False', "
           "'lastProbeTime': None, 'lastTransitionTime': "
           "'2020-03-16T17:03:15Z', 'reason': 'PodCompleted'}, {'type': "
           "'PodScheduled', 'status': 'True', 'lastProbeTime': None, "
           "'lastTransitionTime': '2020-03-16T17:02:58Z'}], 'hostIP': "
           "'172.17.0.13', 'podIP': '10.244.2.213', 'podIPs': [{'ip': "
           "'10.244.2.213'}], 'startTime': '2020-03-16T17:02:58Z', "
           "'containerStatuses': [{'name': 'kube-bench', 'state': "
           "{'terminated': {'exitCode': 0, 'reason': 'Completed', 'startedAt': "
           "'2020-03-16T17:03:11Z', 'finishedAt': '2020-03-16T17:03:12Z', "
           "'containerID': "
           "'containerd://72f21f39e4d5a23c55499e64b20d2e8d86dc085c780f86ca75279f0b79472f2d'}}, "
           "'lastState': {}, 'ready': False, 'restartCount': 0, 'image': "
           "'docker.io/aquasec/kube-bench:latest', 'imageID': "
           "'docker.io/aquasec/kube-bench@sha256:5e21ed2c67f8015ed449f4402c942d8200a0b59cc0b518744e2e45a3de219ba9', "
           "'containerID': "
           "'containerd://72f21f39e4d5a23c55499e64b20d2e8d86dc085c780f86ca75279f0b79472f2d', "
           "'started': False}], 'qosClass': 'BestEffort'}"}
2020-03-16 17:03:15,835 - kubernetes.client.rest - DEBUG - response body: {"kind":"Job","apiVersion":"batch/v1","metadata":{"name":"kube-bench","namespace":"default","selfLink":"/apis/batch/v1/namespaces/default/jobs/kube-bench","uid":"fd3115b5-3b14-4cc1-8b0e-a65a8c722e4f","resourceVersion":"338365","creationTimestamp":"2020-03-16T17:02:58Z","deletionTimestamp":"2020-03-16T17:03:15Z","deletionGracePeriodSeconds":0,"labels":{"app":"kube-bench","controller-uid":"fd3115b5-3b14-4cc1-8b0e-a65a8c722e4f","job-name":"kube-bench"},"finalizers":["orphan"]},"spec":{"parallelism":1,"completions":1,"backoffLimit":6,"selector":{"matchLabels":{"controller-uid":"fd3115b5-3b14-4cc1-8b0e-a65a8c722e4f"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app":"kube-bench","controller-uid":"fd3115b5-3b14-4cc1-8b0e-a65a8c722e4f","job-name":"kube-bench"}},"spec":{"volumes":[{"name":"var-lib-etcd","hostPath":{"path":"/var/lib/etcd","type":""}},{"name":"var-lib-kubelet","hostPath":{"path":"/var/lib/kubelet","type":""}},{"name":"etc-systemd","hostPath":{"path":"/etc/systemd","type":""}},{"name":"etc-kubernetes","hostPath":{"path":"/etc/kubernetes","type":""}},{"name":"usr-bin","hostPath":{"path":"/usr/bin","type":""}}],"containers":[{"name":"kube-bench","image":"aquasec/kube-bench:latest","command":["kube-bench"],"resources":{},"volumeMounts":[{"name":"var-lib-etcd","readOnly":true,"mountPath":"/var/lib/etcd"},{"name":"var-lib-kubelet","readOnly":true,"mountPath":"/var/lib/kubelet"},{"name":"etc-systemd","readOnly":true,"mountPath":"/etc/systemd"},{"name":"etc-kubernetes","readOnly":true,"mountPath":"/etc/kubernetes"},{"name":"usr-bin","readOnly":true,"mountPath":"/usr/local/mount-from-host/bin"}],"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"Always"}],"restartPolicy":"Never","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","hostPID":true,"securityContext":{},"schedulerName":"default-scheduler"}}},"status":{"conditions":[{"type":"Complete","status":"True","lastProbeTime":"2020-03-16T17:03:15Z","lastTransitionTime":"2020-03-16T17:03:15Z"}],"startTime":"2020-03-16T17:02:58Z","completionTime":"2020-03-16T17:03:15Z","succeeded":1}}

2020-03-16 17:03:15,836 - functest_kubernetes.security.security - DEBUG - delete_namespaced_deployment: {'api_version': 'batch/v1',
 'code': None,
 'details': None,
 'kind': 'Job',
 'message': None,
 'metadata': {'_continue': None,
              'remaining_item_count': None,
              'resource_version': '338365',
              'self_link': '/apis/batch/v1/namespaces/default/jobs/kube-bench'},
 'reason': None,
 'status': "{'conditions': [{'type': 'Complete', 'status': 'True', "
           "'lastProbeTime': '2020-03-16T17:03:15Z', 'lastTransitionTime': "
           "'2020-03-16T17:03:15Z'}], 'startTime': '2020-03-16T17:02:58Z', "
           "'completionTime': '2020-03-16T17:03:15Z', 'succeeded': 1}"}
2020-03-16 17:03:16,075 - xtesting.core.testcase - DEBUG - Publishing /var/lib/xtesting/results/functest-kubernetes.log ('text/plain', None)
2020-03-16 17:03:16,294 - xtesting.core.testcase - DEBUG - Publishing /var/lib/xtesting/results/functest-kubernetes.debug.log ('text/plain', None)
