Files
rancher-docs/assets/js/0a820456.3faedc57.js
T

1 line
280 KiB
JavaScript

"use strict";(self.webpackChunkrancher_docs=self.webpackChunkrancher_docs||[]).push([[99761],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>k});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t){if(null==e)return{};var r,a,n=function(e,t){if(null==e)return{};var r,a,n={},s=Object.keys(e);for(a=0;a<s.length;a++)r=s[a],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a<s.length;a++)r=s[a],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var l=a.createContext({}),u=function(e){var t=a.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=u(e.components);return a.createElement(l.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,s=e.originalType,l=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),d=u(r),k=n,m=d["".concat(l,".").concat(k)]||d[k]||p[k]||s;return r?a.createElement(m,i(i({ref:t},c),{},{components:r})):a.createElement(m,i({ref:t},c))}));function k(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var s=r.length,i=new Array(s);i[0]=d;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o.mdxType="string"==typeof e?e:n,i[1]=o;for(var u=2;u<s;u++)i[u]=r[u];return a.createElement.apply(null,i)}return a.createElement.apply(null,r)}d.displayName="MDXCreateElement"},3508:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>p,frontMatter:()=>s,metadata:()=>o,toc:()=>u});var a=r(87462),n=(r(67294),r(3905));const s={title:"RKE CIS v1.6 Benchmark - Self-Assessment Guide - Rancher v2.6"},i=void 0,o={unversionedId:"reference-guides/rancher-security/rancher-v2.6-hardening-guides/rke1-self-assessment-guide-with-cis-v1.6-benchmark",id:"version-2.6/reference-guides/rancher-security/rancher-v2.6-hardening-guides/rke1-self-assessment-guide-with-cis-v1.6-benchmark",title:"RKE CIS v1.6 Benchmark - Self-Assessment Guide - Rancher v2.6",description:"RKE CIS v1.6 Kubernetes Benchmark - Rancher v2.6 with Kubernetes v1.18 to v1.23",source:"@site/versioned_docs/version-2.6/reference-guides/rancher-security/rancher-v2.6-hardening-guides/rke1-self-assessment-guide-with-cis-v1.6-benchmark.md",sourceDirName:"reference-guides/rancher-security/rancher-v2.6-hardening-guides",slug:"/reference-guides/rancher-security/rancher-v2.6-hardening-guides/rke1-self-assessment-guide-with-cis-v1.6-benchmark",permalink:"/v2.6/reference-guides/rancher-security/rancher-v2.6-hardening-guides/rke1-self-assessment-guide-with-cis-v1.6-benchmark",draft:!1,editUrl:"https://github.com/rancher/rancher-docs/edit/main/versioned_docs/version-2.6/reference-guides/rancher-security/rancher-v2.6-hardening-guides/rke1-self-assessment-guide-with-cis-v1.6-benchmark.md",tags:[],version:"2.6",lastUpdatedAt:1668452187,formattedLastUpdatedAt:"Nov 14, 2022",frontMatter:{title:"RKE CIS v1.6 Benchmark - Self-Assessment Guide - Rancher v2.6"},sidebar:"tutorialSidebar",previous:{title:"RKE Hardening Guide with CIS v1.6 Benchmark",permalink:"/v2.6/reference-guides/rancher-security/rancher-v2.6-hardening-guides/rke1-hardening-guide-with-cis-v1.6-benchmark"},next:{title:"RKE2 Hardening Guide with CIS v1.6 Benchmark",permalink:"/v2.6/reference-guides/rancher-security/rancher-v2.6-hardening-guides/rke2-hardening-guide-with-cis-v1.6-benchmark"}},l={},u=[{value:"RKE CIS v1.6 Kubernetes Benchmark - Rancher v2.6 with Kubernetes v1.18 to v1.23",id:"rke-cis-v16-kubernetes-benchmark---rancher-v26-with-kubernetes-v118-to-v123",level:3},{value:"Overview",id:"overview",level:4},{value:"Testing controls methodology",id:"testing-controls-methodology",level:4},{value:"Controls",id:"controls",level:3},{value:"1.1 Master Node Configuration Files",id:"11-master-node-configuration-files",level:2},{value:"1.1.1 Ensure that the API server pod specification file permissions are set to 644 or more restrictive (Automated)",id:"111-ensure-that-the-api-server-pod-specification-file-permissions-are-set-to-644-or-more-restrictive-automated",level:3},{value:"1.1.2 Ensure that the API server pod specification file ownership is set to root:root (Automated)",id:"112-ensure-that-the-api-server-pod-specification-file-ownership-is-set-to-rootroot-automated",level:3},{value:"1.1.3 Ensure that the controller manager pod specification file permissions are set to 644 or more restrictive (Automated)",id:"113-ensure-that-the-controller-manager-pod-specification-file-permissions-are-set-to-644-or-more-restrictive-automated",level:3},{value:"1.1.4 Ensure that the controller manager pod specification file ownership is set to root:root (Automated)",id:"114-ensure-that-the-controller-manager-pod-specification-file-ownership-is-set-to-rootroot-automated",level:3},{value:"1.1.5 Ensure that the scheduler pod specification file permissions are set to 644 or more restrictive (Automated)",id:"115-ensure-that-the-scheduler-pod-specification-file-permissions-are-set-to-644-or-more-restrictive-automated",level:3},{value:"1.1.6 Ensure that the scheduler pod specification file ownership is set to root:root (Automated)",id:"116-ensure-that-the-scheduler-pod-specification-file-ownership-is-set-to-rootroot-automated",level:3},{value:"1.1.7 Ensure that the etcd pod specification file permissions are set to 644 or more restrictive (Automated)",id:"117-ensure-that-the-etcd-pod-specification-file-permissions-are-set-to-644-or-more-restrictive-automated",level:3},{value:"1.1.8 Ensure that the etcd pod specification file ownership is set to root:root (Automated)",id:"118-ensure-that-the-etcd-pod-specification-file-ownership-is-set-to-rootroot-automated",level:3},{value:"1.1.9 Ensure that the Container Network Interface file permissions are set to 644 or more restrictive (Manual)",id:"119-ensure-that-the-container-network-interface-file-permissions-are-set-to-644-or-more-restrictive-manual",level:3},{value:"1.1.10 Ensure that the Container Network Interface file ownership is set to root:root (Manual)",id:"1110-ensure-that-the-container-network-interface-file-ownership-is-set-to-rootroot-manual",level:3},{value:"1.1.11 Ensure that the etcd data directory permissions are set to 700 or more restrictive (Automated)",id:"1111-ensure-that-the-etcd-data-directory-permissions-are-set-to-700-or-more-restrictive-automated",level:3},{value:"1.1.12 Ensure that the etcd data directory ownership is set to etcd:etcd (Automated)",id:"1112-ensure-that-the-etcd-data-directory-ownership-is-set-to-etcdetcd-automated",level:3},{value:"1.1.13 Ensure that the admin.conf file permissions are set to 644 or more restrictive (Automated)",id:"1113-ensure-that-the-adminconf-file-permissions-are-set-to-644-or-more-restrictive-automated",level:3},{value:"1.1.14 Ensure that the admin.conf file ownership is set to root:root (Automated)",id:"1114-ensure-that-the-adminconf-file-ownership-is-set-to-rootroot-automated",level:3},{value:"1.1.15 Ensure that the scheduler.conf file permissions are set to 644 or more restrictive (Automated)",id:"1115-ensure-that-the-schedulerconf-file-permissions-are-set-to-644-or-more-restrictive-automated",level:3},{value:"1.1.16 Ensure that the scheduler.conf file ownership is set to root:root (Automated)",id:"1116-ensure-that-the-schedulerconf-file-ownership-is-set-to-rootroot-automated",level:3},{value:"1.1.17 Ensure that the controller-manager.conf file permissions are set to 644 or more restrictive (Automated)",id:"1117-ensure-that-the-controller-managerconf-file-permissions-are-set-to-644-or-more-restrictive-automated",level:3},{value:"1.1.18 Ensure that the controller-manager.conf file ownership is set to root:root (Automated)",id:"1118-ensure-that-the-controller-managerconf-file-ownership-is-set-to-rootroot-automated",level:3},{value:"1.1.19 Ensure that the Kubernetes PKI directory and file ownership is set to root:root (Automated)",id:"1119-ensure-that-the-kubernetes-pki-directory-and-file-ownership-is-set-to-rootroot-automated",level:3},{value:"1.1.20 Ensure that the Kubernetes PKI certificate file permissions are set to 644 or more restrictive (Automated)",id:"1120-ensure-that-the-kubernetes-pki-certificate-file-permissions-are-set-to-644-or-more-restrictive-automated",level:3},{value:"1.1.21 Ensure that the Kubernetes PKI key file permissions are set to 600 (Automated)",id:"1121-ensure-that-the-kubernetes-pki-key-file-permissions-are-set-to-600-automated",level:3},{value:"1.2 API Server",id:"12-api-server",level:2},{value:"1.2.1 Ensure that the --anonymous-auth argument is set to false (Automated)",id:"121-ensure-that-the---anonymous-auth-argument-is-set-to-false-automated",level:3},{value:"1.2.2 Ensure that the --basic-auth-file argument is not set (Automated)",id:"122-ensure-that-the---basic-auth-file-argument-is-not-set-automated",level:3},{value:"1.2.3 Ensure that the --token-auth-file parameter is not set (Automated)",id:"123-ensure-that-the---token-auth-file-parameter-is-not-set-automated",level:3},{value:"1.2.4 Ensure that the --kubelet-https argument is set to true (Automated)",id:"124-ensure-that-the---kubelet-https-argument-is-set-to-true-automated",level:3},{value:"1.2.5 Ensure that the --kubelet-client-certificate and --kubelet-client-key arguments are set as appropriate (Automated)",id:"125-ensure-that-the---kubelet-client-certificate-and---kubelet-client-key-arguments-are-set-as-appropriate-automated",level:3},{value:"1.2.6 Ensure that the --kubelet-certificate-authority argument is set as appropriate (Automated)",id:"126-ensure-that-the---kubelet-certificate-authority-argument-is-set-as-appropriate-automated",level:3},{value:"1.2.7 Ensure that the --authorization-mode argument is not set to AlwaysAllow (Automated)",id:"127-ensure-that-the---authorization-mode-argument-is-not-set-to-alwaysallow-automated",level:3},{value:"1.2.8 Ensure that the --authorization-mode argument includes Node (Automated)",id:"128-ensure-that-the---authorization-mode-argument-includes-node-automated",level:3},{value:"1.2.9 Ensure that the --authorization-mode argument includes RBAC (Automated)",id:"129-ensure-that-the---authorization-mode-argument-includes-rbac-automated",level:3},{value:"1.2.10 Ensure that the admission control plugin EventRateLimit is set (Automated)",id:"1210-ensure-that-the-admission-control-plugin-eventratelimit-is-set-automated",level:3},{value:"1.2.11 Ensure that the admission control plugin AlwaysAdmit is not set (Automated)",id:"1211-ensure-that-the-admission-control-plugin-alwaysadmit-is-not-set-automated",level:3},{value:"1.2.12 Ensure that the admission control plugin AlwaysPullImages is set (Manual)",id:"1212-ensure-that-the-admission-control-plugin-alwayspullimages-is-set-manual",level:3},{value:"1.2.13 Ensure that the admission control plugin SecurityContextDeny is set if PodSecurityPolicy is not used (Manual)",id:"1213-ensure-that-the-admission-control-plugin-securitycontextdeny-is-set-if-podsecuritypolicy-is-not-used-manual",level:3},{value:"1.2.14 Ensure that the admission control plugin ServiceAccount is set (Automated)",id:"1214-ensure-that-the-admission-control-plugin-serviceaccount-is-set-automated",level:3},{value:"1.2.15 Ensure that the admission control plugin NamespaceLifecycle is set (Automated)",id:"1215-ensure-that-the-admission-control-plugin-namespacelifecycle-is-set-automated",level:3},{value:"1.2.16 Ensure that the admission control plugin PodSecurityPolicy is set (Automated)",id:"1216-ensure-that-the-admission-control-plugin-podsecuritypolicy-is-set-automated",level:3},{value:"1.2.17 Ensure that the admission control plugin NodeRestriction is set (Automated)",id:"1217-ensure-that-the-admission-control-plugin-noderestriction-is-set-automated",level:3},{value:"1.2.18 Ensure that the --insecure-bind-address argument is not set (Automated)",id:"1218-ensure-that-the---insecure-bind-address-argument-is-not-set-automated",level:3},{value:"1.2.19 Ensure that the --insecure-port argument is set to 0 (Automated)",id:"1219-ensure-that-the---insecure-port-argument-is-set-to-0-automated",level:3},{value:"1.2.20 Ensure that the --secure-port argument is not set to 0 (Automated)",id:"1220-ensure-that-the---secure-port-argument-is-not-set-to-0-automated",level:3},{value:"1.2.21 Ensure that the --profiling argument is set to false (Automated)",id:"1221-ensure-that-the---profiling-argument-is-set-to-false-automated",level:3},{value:"1.2.22 Ensure that the --audit-log-path argument is set (Automated)",id:"1222-ensure-that-the---audit-log-path-argument-is-set-automated",level:3},{value:"1.2.23 Ensure that the --audit-log-maxage argument is set to 30 or as appropriate (Automated)",id:"1223-ensure-that-the---audit-log-maxage-argument-is-set-to-30-or-as-appropriate-automated",level:3},{value:"1.2.24 Ensure that the --audit-log-maxbackup argument is set to 10 or as appropriate (Automated)",id:"1224-ensure-that-the---audit-log-maxbackup-argument-is-set-to-10-or-as-appropriate-automated",level:3},{value:"1.2.25 Ensure that the --audit-log-maxsize argument is set to 100 or as appropriate (Automated)",id:"1225-ensure-that-the---audit-log-maxsize-argument-is-set-to-100-or-as-appropriate-automated",level:3},{value:"1.2.26 Ensure that the --request-timeout argument is set as appropriate (Automated)",id:"1226-ensure-that-the---request-timeout-argument-is-set-as-appropriate-automated",level:3},{value:"1.2.27 Ensure that the --service-account-lookup argument is set to true (Automated)",id:"1227-ensure-that-the---service-account-lookup-argument-is-set-to-true-automated",level:3},{value:"1.2.28 Ensure that the --service-account-key-file argument is set as appropriate (Automated)",id:"1228-ensure-that-the---service-account-key-file-argument-is-set-as-appropriate-automated",level:3},{value:"1.2.29 Ensure that the --etcd-certfile and --etcd-keyfile arguments are set as appropriate (Automated)",id:"1229-ensure-that-the---etcd-certfile-and---etcd-keyfile-arguments-are-set-as-appropriate-automated",level:3},{value:"1.2.30 Ensure that the --tls-cert-file and --tls-private-key-file arguments are set as appropriate (Automated)",id:"1230-ensure-that-the---tls-cert-file-and---tls-private-key-file-arguments-are-set-as-appropriate-automated",level:3},{value:"1.2.31 Ensure that the --client-ca-file argument is set as appropriate (Automated)",id:"1231-ensure-that-the---client-ca-file-argument-is-set-as-appropriate-automated",level:3},{value:"1.2.32 Ensure that the --etcd-cafile argument is set as appropriate (Automated)",id:"1232-ensure-that-the---etcd-cafile-argument-is-set-as-appropriate-automated",level:3},{value:"1.2.33 Ensure that the --encryption-provider-config argument is set as appropriate (Automated)",id:"1233-ensure-that-the---encryption-provider-config-argument-is-set-as-appropriate-automated",level:3},{value:"1.2.34 Ensure that encryption providers are appropriately configured (Automated)",id:"1234-ensure-that-encryption-providers-are-appropriately-configured-automated",level:3},{value:"1.2.35 Ensure that the API Server only makes use of Strong Cryptographic Ciphers (Automated)",id:"1235-ensure-that-the-api-server-only-makes-use-of-strong-cryptographic-ciphers-automated",level:3},{value:"1.3 Controller Manager",id:"13-controller-manager",level:2},{value:"1.3.1 Ensure that the --terminated-pod-gc-threshold argument is set as appropriate (Automated)",id:"131-ensure-that-the---terminated-pod-gc-threshold-argument-is-set-as-appropriate-automated",level:3},{value:"1.3.2 Ensure that the --profiling argument is set to false (Automated)",id:"132-ensure-that-the---profiling-argument-is-set-to-false-automated",level:3},{value:"1.3.3 Ensure that the --use-service-account-credentials argument is set to true (Automated)",id:"133-ensure-that-the---use-service-account-credentials-argument-is-set-to-true-automated",level:3},{value:"1.3.4 Ensure that the --service-account-private-key-file argument is set as appropriate (Automated)",id:"134-ensure-that-the---service-account-private-key-file-argument-is-set-as-appropriate-automated",level:3},{value:"1.3.5 Ensure that the --root-ca-file argument is set as appropriate (Automated)",id:"135-ensure-that-the---root-ca-file-argument-is-set-as-appropriate-automated",level:3},{value:"1.3.6 Ensure that the RotateKubeletServerCertificate argument is set to true (Automated)",id:"136-ensure-that-the-rotatekubeletservercertificate-argument-is-set-to-true-automated",level:3},{value:"1.3.7 Ensure that the --bind-address argument is set to 127.0.0.1 (Automated)",id:"137-ensure-that-the---bind-address-argument-is-set-to-127001-automated",level:3},{value:"1.4 Scheduler",id:"14-scheduler",level:2},{value:"1.4.1 Ensure that the --profiling argument is set to false (Automated)",id:"141-ensure-that-the---profiling-argument-is-set-to-false-automated",level:3},{value:"1.4.2 Ensure that the --bind-address argument is set to 127.0.0.1 (Automated)",id:"142-ensure-that-the---bind-address-argument-is-set-to-127001-automated",level:3},{value:"2 Etcd Node Configuration Files",id:"2-etcd-node-configuration-files",level:2},{value:"2.1 Ensure that the --cert-file and --key-file arguments are set as appropriate (Automated)",id:"21-ensure-that-the---cert-file-and---key-file-arguments-are-set-as-appropriate-automated",level:3},{value:"2.2 Ensure that the --client-cert-auth argument is set to true (Automated)",id:"22-ensure-that-the---client-cert-auth-argument-is-set-to-true-automated",level:3},{value:"2.3 Ensure that the --auto-tls argument is not set to true (Automated)",id:"23-ensure-that-the---auto-tls-argument-is-not-set-to-true-automated",level:3},{value:"2.4 Ensure that the --peer-cert-file and --peer-key-file arguments are set as appropriate (Automated)",id:"24-ensure-that-the---peer-cert-file-and---peer-key-file-arguments-are-set-as-appropriate-automated",level:3},{value:"2.5 Ensure that the --peer-client-cert-auth argument is set to true (Automated)",id:"25-ensure-that-the---peer-client-cert-auth-argument-is-set-to-true-automated",level:3},{value:"2.6 Ensure that the --peer-auto-tls argument is not set to true (Automated)",id:"26-ensure-that-the---peer-auto-tls-argument-is-not-set-to-true-automated",level:3},{value:"2.7 Ensure that a unique Certificate Authority is used for etcd (Automated)",id:"27-ensure-that-a-unique-certificate-authority-is-used-for-etcd-automated",level:3},{value:"3.1 Authentication and Authorization",id:"31-authentication-and-authorization",level:2},{value:"3.1.1 Client certificate authentication should not be used for users (Manual)",id:"311-client-certificate-authentication-should-not-be-used-for-users-manual",level:3},{value:"3.2 Logging",id:"32-logging",level:2},{value:"3.2.1 Ensure that a minimal audit policy is created (Automated)",id:"321-ensure-that-a-minimal-audit-policy-is-created-automated",level:3},{value:"3.2.2 Ensure that the audit policy covers key security concerns (Manual)",id:"322-ensure-that-the-audit-policy-covers-key-security-concerns-manual",level:3},{value:"4.1 Worker Node Configuration Files",id:"41-worker-node-configuration-files",level:2},{value:"4.1.1 Ensure that the kubelet service file permissions are set to 644 or more restrictive (Automated)",id:"411-ensure-that-the-kubelet-service-file-permissions-are-set-to-644-or-more-restrictive-automated",level:3},{value:"4.1.2 Ensure that the kubelet service file ownership is set to root:root (Automated)",id:"412-ensure-that-the-kubelet-service-file-ownership-is-set-to-rootroot-automated",level:3},{value:"4.1.3 If proxy kubeconfig file exists ensure permissions are set to 644 or more restrictive (Automated)",id:"413-if-proxy-kubeconfig-file-exists-ensure-permissions-are-set-to-644-or-more-restrictive-automated",level:3},{value:"4.1.4 Ensure that the proxy kubeconfig file ownership is set to root:root (Automated)",id:"414-ensure-that-the-proxy-kubeconfig-file-ownership-is-set-to-rootroot-automated",level:3},{value:"4.1.5 Ensure that the --kubeconfig kubelet.conf file permissions are set to 644 or more restrictive (Automated)",id:"415-ensure-that-the---kubeconfig-kubeletconf-file-permissions-are-set-to-644-or-more-restrictive-automated",level:3},{value:"4.1.6 Ensure that the --kubeconfig kubelet.conf file ownership is set to root:root (Automated)",id:"416-ensure-that-the---kubeconfig-kubeletconf-file-ownership-is-set-to-rootroot-automated",level:3},{value:"4.1.7 Ensure that the certificate authorities file permissions are set to 644 or more restrictive (Automated)",id:"417-ensure-that-the-certificate-authorities-file-permissions-are-set-to-644-or-more-restrictive-automated",level:3},{value:"4.1.8 Ensure that the client certificate authorities file ownership is set to root:root (Automated)",id:"418-ensure-that-the-client-certificate-authorities-file-ownership-is-set-to-rootroot-automated",level:3},{value:"4.1.9 Ensure that the kubelet --config configuration file has permissions set to 644 or more restrictive (Automated)",id:"419-ensure-that-the-kubelet---config-configuration-file-has-permissions-set-to-644-or-more-restrictive-automated",level:3},{value:"4.1.10 Ensure that the kubelet --config configuration file ownership is set to root:root (Automated)",id:"4110-ensure-that-the-kubelet---config-configuration-file-ownership-is-set-to-rootroot-automated",level:3},{value:"4.2 Kubelet",id:"42-kubelet",level:2},{value:"4.2.1 Ensure that the anonymous-auth argument is set to false (Automated)",id:"421-ensure-that-the-anonymous-auth-argument-is-set-to-false-automated",level:3},{value:"4.2.2 Ensure that the --authorization-mode argument is not set to AlwaysAllow (Automated)",id:"422-ensure-that-the---authorization-mode-argument-is-not-set-to-alwaysallow-automated",level:3},{value:"4.2.3 Ensure that the --client-ca-file argument is set as appropriate (Automated)",id:"423-ensure-that-the---client-ca-file-argument-is-set-as-appropriate-automated",level:3},{value:"4.2.4 Ensure that the --read-only-port argument is set to 0 (Automated)",id:"424-ensure-that-the---read-only-port-argument-is-set-to-0-automated",level:3},{value:"4.2.5 Ensure that the --streaming-connection-idle-timeout argument is not set to 0 (Automated)",id:"425-ensure-that-the---streaming-connection-idle-timeout-argument-is-not-set-to-0-automated",level:3},{value:"4.2.6 Ensure that the --protect-kernel-defaults argument is set to true (Automated)",id:"426-ensure-that-the---protect-kernel-defaults-argument-is-set-to-true-automated",level:3},{value:"4.2.7 Ensure that the --make-iptables-util-chains argument is set to true (Automated)",id:"427-ensure-that-the---make-iptables-util-chains-argument-is-set-to-true-automated",level:3},{value:"4.2.8 Ensure that the --hostname-override argument is not set (Manual)",id:"428-ensure-that-the---hostname-override-argument-is-not-set-manual",level:3},{value:"4.2.9 Ensure that the --event-qps argument is set to 0 or a level which ensures appropriate event capture (Automated)",id:"429-ensure-that-the---event-qps-argument-is-set-to-0-or-a-level-which-ensures-appropriate-event-capture-automated",level:3},{value:"4.2.10 Ensure that the --tls-cert-file and --tls-private-key-file arguments are set as appropriate (Automated)",id:"4210-ensure-that-the---tls-cert-file-and---tls-private-key-file-arguments-are-set-as-appropriate-automated",level:3},{value:"4.2.11 Ensure that the --rotate-certificates argument is not set to false (Automated)",id:"4211-ensure-that-the---rotate-certificates-argument-is-not-set-to-false-automated",level:3},{value:"4.2.12 Verify that the RotateKubeletServerCertificate argument is set to true (Automated)",id:"4212-verify-that-the-rotatekubeletservercertificate-argument-is-set-to-true-automated",level:3},{value:"4.2.13 Ensure that the Kubelet only makes use of Strong Cryptographic Ciphers (Automated)",id:"4213-ensure-that-the-kubelet-only-makes-use-of-strong-cryptographic-ciphers-automated",level:3},{value:"5.1 RBAC and Service Accounts",id:"51-rbac-and-service-accounts",level:2},{value:"5.1.1 Ensure that the cluster-admin role is only used where required (Manual)",id:"511-ensure-that-the-cluster-admin-role-is-only-used-where-required-manual",level:3},{value:"5.1.2 Minimize access to secrets (Manual)",id:"512-minimize-access-to-secrets-manual",level:3},{value:"5.1.3 Minimize wildcard use in Roles and ClusterRoles (Manual)",id:"513-minimize-wildcard-use-in-roles-and-clusterroles-manual",level:3},{value:"5.1.4 Minimize access to create pods (Manual)",id:"514-minimize-access-to-create-pods-manual",level:3},{value:"5.1.5 Ensure that default service accounts are not actively used. (Automated)",id:"515-ensure-that-default-service-accounts-are-not-actively-used-automated",level:3},{value:"5.1.6 Ensure that Service Account Tokens are only mounted where necessary (Manual)",id:"516-ensure-that-service-account-tokens-are-only-mounted-where-necessary-manual",level:3},{value:"5.2 Pod Security Policies",id:"52-pod-security-policies",level:2},{value:"5.2.1 Minimize the admission of privileged containers (Manual)",id:"521-minimize-the-admission-of-privileged-containers-manual",level:3},{value:"5.2.2 Minimize the admission of containers wishing to share the host process ID namespace (Automated)",id:"522-minimize-the-admission-of-containers-wishing-to-share-the-host-process-id-namespace-automated",level:3},{value:"5.2.3 Minimize the admission of containers wishing to share the host IPC namespace (Automated)",id:"523-minimize-the-admission-of-containers-wishing-to-share-the-host-ipc-namespace-automated",level:3},{value:"5.2.4 Minimize the admission of containers wishing to share the host network namespace (Automated)",id:"524-minimize-the-admission-of-containers-wishing-to-share-the-host-network-namespace-automated",level:3},{value:"5.2.5 Minimize the admission of containers with allowPrivilegeEscalation (Automated)",id:"525-minimize-the-admission-of-containers-with-allowprivilegeescalation-automated",level:3},{value:"5.2.6 Minimize the admission of root containers (Manual)",id:"526-minimize-the-admission-of-root-containers-manual",level:3},{value:"5.2.7 Minimize the admission of containers with the NET_RAW capability (Manual)",id:"527-minimize-the-admission-of-containers-with-the-net_raw-capability-manual",level:3},{value:"5.2.8 Minimize the admission of containers with added capabilities (Manual)",id:"528-minimize-the-admission-of-containers-with-added-capabilities-manual",level:3},{value:"5.2.9 Minimize the admission of containers with capabilities assigned (Manual)",id:"529-minimize-the-admission-of-containers-with-capabilities-assigned-manual",level:3},{value:"5.3 Network Policies and CNI",id:"53-network-policies-and-cni",level:2},{value:"5.3.1 Ensure that the CNI in use supports Network Policies (Manual)",id:"531-ensure-that-the-cni-in-use-supports-network-policies-manual",level:3},{value:"5.3.2 Ensure that all Namespaces have Network Policies defined (Automated)",id:"532-ensure-that-all-namespaces-have-network-policies-defined-automated",level:3},{value:"5.4 Secrets Management",id:"54-secrets-management",level:2},{value:"5.4.1 Prefer using secrets as files over secrets as environment variables (Manual)",id:"541-prefer-using-secrets-as-files-over-secrets-as-environment-variables-manual",level:3},{value:"5.4.2 Consider external secret storage (Manual)",id:"542-consider-external-secret-storage-manual",level:3},{value:"5.5 Extensible Admission Control",id:"55-extensible-admission-control",level:2},{value:"5.5.1 Configure Image Provenance using ImagePolicyWebhook admission controller (Manual)",id:"551-configure-image-provenance-using-imagepolicywebhook-admission-controller-manual",level:3},{value:"5.7 General Policies",id:"57-general-policies",level:2},{value:"5.7.1 Create administrative boundaries between resources using namespaces (Manual)",id:"571-create-administrative-boundaries-between-resources-using-namespaces-manual",level:3},{value:"5.7.2 Ensure that the seccomp profile is set to docker/default in your pod definitions (Manual)",id:"572-ensure-that-the-seccomp-profile-is-set-to-dockerdefault-in-your-pod-definitions-manual",level:3},{value:"5.7.3 Apply Security Context to Your Pods and Containers (Manual)",id:"573-apply-security-context-to-your-pods-and-containers-manual",level:3},{value:"5.7.4 The default namespace should not be used (Automated)",id:"574-the-default-namespace-should-not-be-used-automated",level:3}],c={toc:u};function p(e){let{components:t,...r}=e;return(0,n.kt)("wrapper",(0,a.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h3",{id:"rke-cis-v16-kubernetes-benchmark---rancher-v26-with-kubernetes-v118-to-v123"},"RKE CIS v1.6 Kubernetes Benchmark - Rancher v2.6 with Kubernetes v1.18 to v1.23"),(0,n.kt)("p",null,(0,n.kt)("a",{parentName:"p",href:"https://releases.rancher.com/documents/security/2.6/Rancher_v2-6_CIS_v1-6_Benchmark_Assessment.pdf"},"Click here to download a PDF version of this document"),"."),(0,n.kt)("h4",{id:"overview"},"Overview"),(0,n.kt)("p",null,"This document is a companion to the ",(0,n.kt)("a",{parentName:"p",href:"/v2.6/reference-guides/rancher-security/rancher-v2.6-hardening-guides/rke1-hardening-guide-with-cis-v1.6-benchmark"},"Rancher v2.6 RKE security hardening guide"),". The hardening guide provides prescriptive guidance for hardening a production installation of Rancher, and this benchmark guide is meant to help you evaluate the level of security of the hardened cluster against each control in the benchmark."),(0,n.kt)("p",null,"This guide corresponds to specific versions of the hardening guide, Rancher, CIS Benchmark and Kubernetes:"),(0,n.kt)("table",null,(0,n.kt)("thead",{parentName:"table"},(0,n.kt)("tr",{parentName:"thead"},(0,n.kt)("th",{parentName:"tr",align:null},"Hardening Guide Version"),(0,n.kt)("th",{parentName:"tr",align:null},"Rancher Version"),(0,n.kt)("th",{parentName:"tr",align:null},"CIS Benchmark Version"),(0,n.kt)("th",{parentName:"tr",align:null},"Kubernetes Version"))),(0,n.kt)("tbody",{parentName:"table"},(0,n.kt)("tr",{parentName:"tbody"},(0,n.kt)("td",{parentName:"tr",align:null},"Hardening Guide CIS v1.6 Benchmark"),(0,n.kt)("td",{parentName:"tr",align:null},"Rancher v2.6"),(0,n.kt)("td",{parentName:"tr",align:null},"CIS v1.6"),(0,n.kt)("td",{parentName:"tr",align:null},"Kubernetes v1.18 up to v1.23")))),(0,n.kt)("p",null,"Because Rancher and RKE install Kubernetes services as Docker containers, many of the control verification checks in the CIS Kubernetes Benchmark do not apply and will have a result of ",(0,n.kt)("inlineCode",{parentName:"p"},"Not Applicable"),". This guide will walk through the various controls and provide updated example commands to audit compliance in Rancher created clusters."),(0,n.kt)("p",null,"This document is to be used by Rancher operators, security teams, auditors and decision makers."),(0,n.kt)("p",null,"For more detail about each audit, including rationales and remediations for failing tests, you can refer to the corresponding section of the CIS Kubernetes Benchmark v1.6. You can download the benchmark, after creating a free account, in ",(0,n.kt)("a",{parentName:"p",href:"https://www.cisecurity.org/benchmark/kubernetes/"},"Center for Internet Security (CIS)"),"."),(0,n.kt)("h4",{id:"testing-controls-methodology"},"Testing controls methodology"),(0,n.kt)("p",null,"Rancher and RKE install Kubernetes services via Docker containers. Configuration is defined by arguments passed to the container at the time of initialization, not via configuration files."),(0,n.kt)("p",null,"Where control audits differ from the original CIS benchmark, the audit commands specific to Rancher are provided for testing. When performing the tests, you will need access to the command line on the hosts of all RKE nodes. The commands also make use of the ",(0,n.kt)("a",{parentName:"p",href:"https://kubernetes.io/docs/tasks/tools/"},"kubectl")," (with a valid configuration file) and ",(0,n.kt)("a",{parentName:"p",href:"https://stedolan.github.io/jq/"},"jq")," tools, which are required in the testing and evaluation of test results."),(0,n.kt)("admonition",{type:"note"},(0,n.kt)("p",{parentName:"admonition"},"Only ",(0,n.kt)("inlineCode",{parentName:"p"},"automated")," tests (previously called ",(0,n.kt)("inlineCode",{parentName:"p"},"scored"),") are covered in this guide.")),(0,n.kt)("h3",{id:"controls"},"Controls"),(0,n.kt)("h2",{id:"11-master-node-configuration-files"},"1.1 Master Node Configuration Files"),(0,n.kt)("h3",{id:"111-ensure-that-the-api-server-pod-specification-file-permissions-are-set-to-644-or-more-restrictive-automated"},"1.1.1 Ensure that the API server pod specification file permissions are set to 644 or more restrictive (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," Not Applicable"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nCluster provisioned by RKE doesn't require or maintain a configuration file for kube-apiserver.\nAll configuration is passed in as arguments at container run time."),(0,n.kt)("h3",{id:"112-ensure-that-the-api-server-pod-specification-file-ownership-is-set-to-rootroot-automated"},"1.1.2 Ensure that the API server pod specification file ownership is set to root:root (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," Not Applicable"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nCluster provisioned by RKE doesn't require or maintain a configuration file for kube-apiserver.\nAll configuration is passed in as arguments at container run time."),(0,n.kt)("h3",{id:"113-ensure-that-the-controller-manager-pod-specification-file-permissions-are-set-to-644-or-more-restrictive-automated"},"1.1.3 Ensure that the controller manager pod specification file permissions are set to 644 or more restrictive (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," Not Applicable"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nCluster provisioned by RKE doesn't require or maintain a configuration file for controller-manager.\nAll configuration is passed in as arguments at container run time."),(0,n.kt)("h3",{id:"114-ensure-that-the-controller-manager-pod-specification-file-ownership-is-set-to-rootroot-automated"},"1.1.4 Ensure that the controller manager pod specification file ownership is set to root:root (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," Not Applicable"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nCluster provisioned by RKE doesn't require or maintain a configuration file for controller-manager.\nAll configuration is passed in as arguments at container run time."),(0,n.kt)("h3",{id:"115-ensure-that-the-scheduler-pod-specification-file-permissions-are-set-to-644-or-more-restrictive-automated"},"1.1.5 Ensure that the scheduler pod specification file permissions are set to 644 or more restrictive (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," Not Applicable"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nCluster provisioned by RKE doesn't require or maintain a configuration file for scheduler.\nAll configuration is passed in as arguments at container run time."),(0,n.kt)("h3",{id:"116-ensure-that-the-scheduler-pod-specification-file-ownership-is-set-to-rootroot-automated"},"1.1.6 Ensure that the scheduler pod specification file ownership is set to root:root (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," Not Applicable"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nCluster provisioned by RKE doesn't require or maintain a configuration file for scheduler.\nAll configuration is passed in as arguments at container run time."),(0,n.kt)("h3",{id:"117-ensure-that-the-etcd-pod-specification-file-permissions-are-set-to-644-or-more-restrictive-automated"},"1.1.7 Ensure that the etcd pod specification file permissions are set to 644 or more restrictive (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," Not Applicable"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nCluster provisioned by RKE doesn't require or maintain a configuration file for etcd.\nAll configuration is passed in as arguments at container run time."),(0,n.kt)("h3",{id:"118-ensure-that-the-etcd-pod-specification-file-ownership-is-set-to-rootroot-automated"},"1.1.8 Ensure that the etcd pod specification file ownership is set to root:root (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," Not Applicable"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nCluster provisioned by RKE doesn't require or maintain a configuration file for etcd.\nAll configuration is passed in as arguments at container run time."),(0,n.kt)("h3",{id:"119-ensure-that-the-container-network-interface-file-permissions-are-set-to-644-or-more-restrictive-manual"},"1.1.9 Ensure that the Container Network Interface file permissions are set to 644 or more restrictive (Manual)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," warn"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nRun the below command (based on the file location on your system) on the master node.\nFor example,\nchmod 644 <path/to/cni/files>"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"stat -c permissions=%a <path/to/cni/files>\n")),(0,n.kt)("h3",{id:"1110-ensure-that-the-container-network-interface-file-ownership-is-set-to-rootroot-manual"},"1.1.10 Ensure that the Container Network Interface file ownership is set to root:root (Manual)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," warn"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nRun the below command (based on the file location on your system) on the master node.\nFor example,\nchown root:root <path/to/cni/files>"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"stat -c %U:%G <path/to/cni/files>\n")),(0,n.kt)("h3",{id:"1111-ensure-that-the-etcd-data-directory-permissions-are-set-to-700-or-more-restrictive-automated"},"1.1.11 Ensure that the etcd data directory permissions are set to 700 or more restrictive (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nOn the etcd server node, get the etcd data directory, passed as an argument --data-dir,\nfrom the below command:\nps -ef | grep etcd Run the below command (based on the etcd data directory found above). For example,\nchmod 700 /var/lib/etcd"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"stat -c %a /node/var/lib/etcd\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'700' is equal to '700'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"700\n")),(0,n.kt)("h3",{id:"1112-ensure-that-the-etcd-data-directory-ownership-is-set-to-etcdetcd-automated"},"1.1.12 Ensure that the etcd data directory ownership is set to etcd:etcd (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nOn the etcd server node, get the etcd data directory, passed as an argument --data-dir,\nfrom the below command:\nps -ef | grep etcd\nRun the below command (based on the etcd data directory found above).\nFor example, chown etcd:etcd /var/lib/etcd"),(0,n.kt)("p",null,"A system service account is required for etcd data directory ownership.\nRefer to Rancher's hardening guide for more details on how to configure this ownership."),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"stat -c %U:%G /node/var/lib/etcd\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'etcd:etcd' is present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"etcd:etcd\n")),(0,n.kt)("h3",{id:"1113-ensure-that-the-adminconf-file-permissions-are-set-to-644-or-more-restrictive-automated"},"1.1.13 Ensure that the admin.conf file permissions are set to 644 or more restrictive (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," Not Applicable"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nCluster provisioned by RKE does not store the kubernetes default kubeconfig credentials file on the nodes."),(0,n.kt)("h3",{id:"1114-ensure-that-the-adminconf-file-ownership-is-set-to-rootroot-automated"},"1.1.14 Ensure that the admin.conf file ownership is set to root:root (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," Not Applicable"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nCluster provisioned by RKE does not store the kubernetes default kubeconfig credentials file on the nodes."),(0,n.kt)("h3",{id:"1115-ensure-that-the-schedulerconf-file-permissions-are-set-to-644-or-more-restrictive-automated"},"1.1.15 Ensure that the scheduler.conf file permissions are set to 644 or more restrictive (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," Not Applicable"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nCluster provisioned by RKE doesn't require or maintain a configuration file for scheduler.\nAll configuration is passed in as arguments at container run time."),(0,n.kt)("h3",{id:"1116-ensure-that-the-schedulerconf-file-ownership-is-set-to-rootroot-automated"},"1.1.16 Ensure that the scheduler.conf file ownership is set to root:root (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," Not Applicable"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nCluster provisioned by RKE doesn't require or maintain a configuration file for scheduler.\nAll configuration is passed in as arguments at container run time."),(0,n.kt)("h3",{id:"1117-ensure-that-the-controller-managerconf-file-permissions-are-set-to-644-or-more-restrictive-automated"},"1.1.17 Ensure that the controller-manager.conf file permissions are set to 644 or more restrictive (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," Not Applicable"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nCluster provisioned by RKE doesn't require or maintain a configuration file for controller-manager.\nAll configuration is passed in as arguments at container run time."),(0,n.kt)("h3",{id:"1118-ensure-that-the-controller-managerconf-file-ownership-is-set-to-rootroot-automated"},"1.1.18 Ensure that the controller-manager.conf file ownership is set to root:root (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," Not Applicable"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nCluster provisioned by RKE doesn't require or maintain a configuration file for controller-manager.\nAll configuration is passed in as arguments at container run time."),(0,n.kt)("h3",{id:"1119-ensure-that-the-kubernetes-pki-directory-and-file-ownership-is-set-to-rootroot-automated"},"1.1.19 Ensure that the Kubernetes PKI directory and file ownership is set to root:root (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nRun the below command (based on the file location on your system) on the master node.\nFor example,\nchown -R root:root /etc/kubernetes/pki/"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Script:")," ",(0,n.kt)("inlineCode",{parentName:"p"},"check_files_owner_in_dir.sh")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},'#!/usr/bin/env bash\n\n# This script is used to ensure the owner is set to root:root for\n# the given directory and all the files in it\n#\n# inputs:\n# $1 = /full/path/to/directory\n#\n# outputs:\n# true/false\n\nINPUT_DIR=$1\n\nif [[ "${INPUT_DIR}" == "" ]]; then\n echo "false"\n exit\nfi\n\nif [[ $(stat -c %U:%G ${INPUT_DIR}) != "root:root" ]]; then\n echo "false"\n exit\nfi\n\nstatInfoLines=$(stat -c "%n %U:%G" ${INPUT_DIR}/*)\nwhile read -r statInfoLine; do\n f=$(echo ${statInfoLine} | cut -d\' \' -f1)\n p=$(echo ${statInfoLine} | cut -d\' \' -f2)\n\n if [[ $(basename "$f" .pem) == "kube-etcd-"* ]]; then\n if [[ "$p" != "root:root" && "$p" != "etcd:etcd" ]]; then\n echo "false"\n exit\n fi\n else\n if [[ "$p" != "root:root" ]]; then\n echo "false"\n exit\n fi\n fi\ndone <<< "${statInfoLines}"\n\n\necho "true"\nexit\n\n')),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Execution:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"./check_files_owner_in_dir.sh /node/etc/kubernetes/ssl\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'true' is equal to 'true'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"true\n")),(0,n.kt)("h3",{id:"1120-ensure-that-the-kubernetes-pki-certificate-file-permissions-are-set-to-644-or-more-restrictive-automated"},"1.1.20 Ensure that the Kubernetes PKI certificate file permissions are set to 644 or more restrictive (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nRun the below command (based on the file location on your system) on the master node.\nFor example,\nchmod -R 644 /etc/kubernetes/pki/*.crt"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Script:")," ",(0,n.kt)("inlineCode",{parentName:"p"},"check_files_permissions.sh")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},'#!/usr/bin/env bash\n\n# This script is used to ensure the file permissions are set to 644 or\n# more restrictive for all files in a given directory or a wildcard\n# selection of files\n#\n# inputs:\n# $1 = /full/path/to/directory or /path/to/fileswithpattern\n# ex: !(*key).pem\n#\n# $2 (optional) = permission (ex: 600)\n#\n# outputs:\n# true/false\n\n# Turn on "extended glob" for use of \'!\' in wildcard\nshopt -s extglob\n\n# Turn off history to avoid surprises when using \'!\'\nset -H\n\nUSER_INPUT=$1\n\nif [[ "${USER_INPUT}" == "" ]]; then\n echo "false"\n exit\nfi\n\n\nif [[ -d ${USER_INPUT} ]]; then\n PATTERN="${USER_INPUT}/*"\nelse\n PATTERN="${USER_INPUT}"\nfi\n\nPERMISSION=""\nif [[ "$2" != "" ]]; then\n PERMISSION=$2\nfi\n\nFILES_PERMISSIONS=$(stat -c %n\\ %a ${PATTERN})\n\nwhile read -r fileInfo; do\n p=$(echo ${fileInfo} | cut -d\' \' -f2)\n\n if [[ "${PERMISSION}" != "" ]]; then\n if [[ "$p" != "${PERMISSION}" ]]; then\n echo "false"\n exit\n fi\n else\n if [[ "$p" != "644" && "$p" != "640" && "$p" != "600" ]]; then\n echo "false"\n exit\n fi\n fi\ndone <<< "${FILES_PERMISSIONS}"\n\n\necho "true"\nexit\n\n')),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Execution:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"./check_files_permissions.sh /node/etc/kubernetes/ssl/!(*key).pem\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'true' is equal to 'true'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"true\n")),(0,n.kt)("h3",{id:"1121-ensure-that-the-kubernetes-pki-key-file-permissions-are-set-to-600-automated"},"1.1.21 Ensure that the Kubernetes PKI key file permissions are set to 600 (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nRun the below command (based on the file location on your system) on the master node.\nFor example,\nchmod -R 600 /etc/kubernetes/ssl/*key.pem"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Script:")," ",(0,n.kt)("inlineCode",{parentName:"p"},"check_files_permissions.sh")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},'#!/usr/bin/env bash\n\n# This script is used to ensure the file permissions are set to 644 or\n# more restrictive for all files in a given directory or a wildcard\n# selection of files\n#\n# inputs:\n# $1 = /full/path/to/directory or /path/to/fileswithpattern\n# ex: !(*key).pem\n#\n# $2 (optional) = permission (ex: 600)\n#\n# outputs:\n# true/false\n\n# Turn on "extended glob" for use of \'!\' in wildcard\nshopt -s extglob\n\n# Turn off history to avoid surprises when using \'!\'\nset -H\n\nUSER_INPUT=$1\n\nif [[ "${USER_INPUT}" == "" ]]; then\n echo "false"\n exit\nfi\n\n\nif [[ -d ${USER_INPUT} ]]; then\n PATTERN="${USER_INPUT}/*"\nelse\n PATTERN="${USER_INPUT}"\nfi\n\nPERMISSION=""\nif [[ "$2" != "" ]]; then\n PERMISSION=$2\nfi\n\nFILES_PERMISSIONS=$(stat -c %n\\ %a ${PATTERN})\n\nwhile read -r fileInfo; do\n p=$(echo ${fileInfo} | cut -d\' \' -f2)\n\n if [[ "${PERMISSION}" != "" ]]; then\n if [[ "$p" != "${PERMISSION}" ]]; then\n echo "false"\n exit\n fi\n else\n if [[ "$p" != "644" && "$p" != "640" && "$p" != "600" ]]; then\n echo "false"\n exit\n fi\n fi\ndone <<< "${FILES_PERMISSIONS}"\n\n\necho "true"\nexit\n\n')),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Execution:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"./check_files_permissions.sh /node/etc/kubernetes/ssl/*key.pem\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'true' is equal to 'true'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"true\n")),(0,n.kt)("h2",{id:"12-api-server"},"1.2 API Server"),(0,n.kt)("h3",{id:"121-ensure-that-the---anonymous-auth-argument-is-set-to-false-automated"},"1.2.1 Ensure that the --anonymous-auth argument is set to false (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and set the below parameter.\n--anonymous-auth=false"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'false' is equal to 'false'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:27 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"122-ensure-that-the---basic-auth-file-argument-is-not-set-automated"},"1.2.2 Ensure that the --basic-auth-file argument is not set (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nFollow the documentation and configure alternate mechanisms for authentication. Then,\nedit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and remove the ",(0,n.kt)("inlineCode",{parentName:"p"},"--basic-auth-file=<filename>")," parameter."),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--basic-auth-file' is not present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:27 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"123-ensure-that-the---token-auth-file-parameter-is-not-set-automated"},"1.2.3 Ensure that the --token-auth-file parameter is not set (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nFollow the documentation and configure alternate mechanisms for authentication. Then,\nedit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and remove the ",(0,n.kt)("inlineCode",{parentName:"p"},"--token-auth-file=<filename>")," parameter."),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--token-auth-file' is not present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:27 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"124-ensure-that-the---kubelet-https-argument-is-set-to-true-automated"},"1.2.4 Ensure that the --kubelet-https argument is set to true (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and remove the --kubelet-https parameter."),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--kubelet-https' is not present OR '--kubelet-https' is not present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:27 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"125-ensure-that-the---kubelet-client-certificate-and---kubelet-client-key-arguments-are-set-as-appropriate-automated"},"1.2.5 Ensure that the --kubelet-client-certificate and --kubelet-client-key arguments are set as appropriate (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nFollow the Kubernetes documentation and set up the TLS connection between the\napiserver and kubelets. Then, edit API server pod specification file\n/etc/kubernetes/manifests/kube-apiserver.yaml on the master node and set the\nkubelet client certificate and key parameters as below.\n--kubelet-client-certificate=<path/to/client-certificate-file>\n--kubelet-client-key=<path/to/client-key-file>"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--kubelet-client-certificate' is present AND '--kubelet-client-key' is present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:27 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"126-ensure-that-the---kubelet-certificate-authority-argument-is-set-as-appropriate-automated"},"1.2.6 Ensure that the --kubelet-certificate-authority argument is set as appropriate (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nFollow the Kubernetes documentation and setup the TLS connection between\nthe apiserver and kubelets. Then, edit the API server pod specification file\n/etc/kubernetes/manifests/kube-apiserver.yaml on the master node and set the\n",(0,n.kt)("inlineCode",{parentName:"p"},"--kubelet-certificate-authority")," parameter to the path to the cert file for the certificate authority.\n",(0,n.kt)("inlineCode",{parentName:"p"},"--kubelet-certificate-authority=<ca-string>")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--kubelet-certificate-authority' is present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:27 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"127-ensure-that-the---authorization-mode-argument-is-not-set-to-alwaysallow-automated"},"1.2.7 Ensure that the --authorization-mode argument is not set to AlwaysAllow (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and set the --authorization-mode parameter to values other than AlwaysAllow.\nOne such example could be as below.\n--authorization-mode=RBAC"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'Node,RBAC' not have 'AlwaysAllow'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:27 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"128-ensure-that-the---authorization-mode-argument-includes-node-automated"},"1.2.8 Ensure that the --authorization-mode argument includes Node (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and set the --authorization-mode parameter to a value that includes Node.\n--authorization-mode=Node,RBAC"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'Node,RBAC' has 'Node'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:27 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"129-ensure-that-the---authorization-mode-argument-includes-rbac-automated"},"1.2.9 Ensure that the --authorization-mode argument includes RBAC (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and set the --authorization-mode parameter to a value that includes RBAC,\nfor example:\n--authorization-mode=Node,RBAC"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'Node,RBAC' has 'RBAC'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:27 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"1210-ensure-that-the-admission-control-plugin-eventratelimit-is-set-automated"},"1.2.10 Ensure that the admission control plugin EventRateLimit is set (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nFollow the Kubernetes documentation and set the desired limits in a configuration file.\nThen, edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\nand set the below parameters.\n--enable-admission-plugins=...,EventRateLimit,...\n--admission-control-config-file=<path/to/configuration/file>"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit' has 'EventRateLimit'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:27 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"1211-ensure-that-the-admission-control-plugin-alwaysadmit-is-not-set-automated"},"1.2.11 Ensure that the admission control plugin AlwaysAdmit is not set (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and either remove the --enable-admission-plugins parameter, or set it to a\nvalue that does not include AlwaysAdmit."),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit' not have 'AlwaysAdmit' OR '--enable-admission-plugins' is not present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:27 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"1212-ensure-that-the-admission-control-plugin-alwayspullimages-is-set-manual"},"1.2.12 Ensure that the admission control plugin AlwaysPullImages is set (Manual)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," warn"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and set the --enable-admission-plugins parameter to include\nAlwaysPullImages.\n--enable-admission-plugins=...,AlwaysPullImages,..."),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("h3",{id:"1213-ensure-that-the-admission-control-plugin-securitycontextdeny-is-set-if-podsecuritypolicy-is-not-used-manual"},"1.2.13 Ensure that the admission control plugin SecurityContextDeny is set if PodSecurityPolicy is not used (Manual)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," warn"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and set the --enable-admission-plugins parameter to include\nSecurityContextDeny, unless PodSecurityPolicy is already in place.\n--enable-admission-plugins=...,SecurityContextDeny,..."),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("h3",{id:"1214-ensure-that-the-admission-control-plugin-serviceaccount-is-set-automated"},"1.2.14 Ensure that the admission control plugin ServiceAccount is set (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nFollow the documentation and create ServiceAccount objects as per your environment.\nThen, edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and ensure that the --disable-admission-plugins parameter is set to a\nvalue that does not include ServiceAccount."),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--disable-admission-plugins' is not present OR '--disable-admission-plugins' is not present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:28 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"1215-ensure-that-the-admission-control-plugin-namespacelifecycle-is-set-automated"},"1.2.15 Ensure that the admission control plugin NamespaceLifecycle is set (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and set the --disable-admission-plugins parameter to\nensure it does not include NamespaceLifecycle."),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--disable-admission-plugins' is not present OR '--disable-admission-plugins' is not present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:28 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"1216-ensure-that-the-admission-control-plugin-podsecuritypolicy-is-set-automated"},"1.2.16 Ensure that the admission control plugin PodSecurityPolicy is set (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nFollow the documentation and create Pod Security Policy objects as per your environment.\nThen, edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and set the --enable-admission-plugins parameter to a\nvalue that includes PodSecurityPolicy:\n--enable-admission-plugins=...,PodSecurityPolicy,...\nThen restart the API Server."),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit' has 'PodSecurityPolicy'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:28 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"1217-ensure-that-the-admission-control-plugin-noderestriction-is-set-automated"},"1.2.17 Ensure that the admission control plugin NodeRestriction is set (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nFollow the Kubernetes documentation and configure NodeRestriction plug-in on kubelets.\nThen, edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and set the --enable-admission-plugins parameter to a\nvalue that includes NodeRestriction.\n--enable-admission-plugins=...,NodeRestriction,..."),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit' has 'NodeRestriction'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:28 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"1218-ensure-that-the---insecure-bind-address-argument-is-not-set-automated"},"1.2.18 Ensure that the --insecure-bind-address argument is not set (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and remove the --insecure-bind-address parameter."),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--insecure-bind-address' is not present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:28 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"1219-ensure-that-the---insecure-port-argument-is-set-to-0-automated"},"1.2.19 Ensure that the --insecure-port argument is set to 0 (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and set the below parameter.\n--insecure-port=0"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'0' is equal to '0'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:28 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"1220-ensure-that-the---secure-port-argument-is-not-set-to-0-automated"},"1.2.20 Ensure that the --secure-port argument is not set to 0 (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and either remove the --secure-port parameter or\nset it to a different (non-zero) desired port."),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"6443 is greater than 0 OR '--secure-port' is not present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:28 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"1221-ensure-that-the---profiling-argument-is-set-to-false-automated"},"1.2.21 Ensure that the --profiling argument is set to false (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and set the below parameter.\n--profiling=false"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'false' is equal to 'false'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:28 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"1222-ensure-that-the---audit-log-path-argument-is-set-automated"},"1.2.22 Ensure that the --audit-log-path argument is set (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and set the --audit-log-path parameter to a suitable path and\nfile where you would like audit logs to be written, for example:\n--audit-log-path=/var/log/apiserver/audit.log"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--audit-log-path' is present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:28 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"1223-ensure-that-the---audit-log-maxage-argument-is-set-to-30-or-as-appropriate-automated"},"1.2.23 Ensure that the --audit-log-maxage argument is set to 30 or as appropriate (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and set the --audit-log-maxage parameter to 30 or as an appropriate number of days:\n--audit-log-maxage=30"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"30 is greater or equal to 30\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:28 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"1224-ensure-that-the---audit-log-maxbackup-argument-is-set-to-10-or-as-appropriate-automated"},"1.2.24 Ensure that the --audit-log-maxbackup argument is set to 10 or as appropriate (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and set the --audit-log-maxbackup parameter to 10 or to an appropriate\nvalue.\n--audit-log-maxbackup=10"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"10 is greater or equal to 10\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:28 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"1225-ensure-that-the---audit-log-maxsize-argument-is-set-to-100-or-as-appropriate-automated"},"1.2.25 Ensure that the --audit-log-maxsize argument is set to 100 or as appropriate (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and set the --audit-log-maxsize parameter to an appropriate size in MB.\nFor example, to set it as 100 MB:\n--audit-log-maxsize=100"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"100 is greater or equal to 100\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:28 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"1226-ensure-that-the---request-timeout-argument-is-set-as-appropriate-automated"},"1.2.26 Ensure that the --request-timeout argument is set as appropriate (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\nand set the below parameter as appropriate and if needed.\nFor example,\n--request-timeout=300s"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--request-timeout' is not present OR '--request-timeout' is not present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:28 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"1227-ensure-that-the---service-account-lookup-argument-is-set-to-true-automated"},"1.2.27 Ensure that the --service-account-lookup argument is set to true (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and set the below parameter.\n--service-account-lookup=true\nAlternatively, you can delete the --service-account-lookup parameter from this file so\nthat the default takes effect."),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--service-account-lookup' is not present OR 'true' is equal to 'true'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:28 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"1228-ensure-that-the---service-account-key-file-argument-is-set-as-appropriate-automated"},"1.2.28 Ensure that the --service-account-key-file argument is set as appropriate (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and set the --service-account-key-file parameter\nto the public key file for service accounts:\n",(0,n.kt)("inlineCode",{parentName:"p"},"--service-account-key-file=<filename>")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--service-account-key-file' is present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:28 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"1229-ensure-that-the---etcd-certfile-and---etcd-keyfile-arguments-are-set-as-appropriate-automated"},"1.2.29 Ensure that the --etcd-certfile and --etcd-keyfile arguments are set as appropriate (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nFollow the Kubernetes documentation and set up the TLS connection between the apiserver and etcd.\nThen, edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and set the etcd certificate and key file parameters.\n",(0,n.kt)("inlineCode",{parentName:"p"},"--etcd-certfile=<path/to/client-certificate-file>"),"\n",(0,n.kt)("inlineCode",{parentName:"p"},"--etcd-keyfile=<path/to/client-key-file>")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--etcd-certfile' is present AND '--etcd-keyfile' is present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:28 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"1230-ensure-that-the---tls-cert-file-and---tls-private-key-file-arguments-are-set-as-appropriate-automated"},"1.2.30 Ensure that the --tls-cert-file and --tls-private-key-file arguments are set as appropriate (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nFollow the Kubernetes documentation and set up the TLS connection on the apiserver.\nThen, edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and set the TLS certificate and private key file parameters.\n",(0,n.kt)("inlineCode",{parentName:"p"},"--tls-cert-file=<path/to/tls-certificate-file>"),"\n",(0,n.kt)("inlineCode",{parentName:"p"},"--tls-private-key-file=<path/to/tls-key-file>")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--tls-cert-file' is present AND '--tls-private-key-file' is present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:28 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"1231-ensure-that-the---client-ca-file-argument-is-set-as-appropriate-automated"},"1.2.31 Ensure that the --client-ca-file argument is set as appropriate (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nFollow the Kubernetes documentation and set up the TLS connection on the apiserver.\nThen, edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and set the client certificate authority file.\n",(0,n.kt)("inlineCode",{parentName:"p"},"--client-ca-file=<path/to/client-ca-file>")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--client-ca-file' is present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:28 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"1232-ensure-that-the---etcd-cafile-argument-is-set-as-appropriate-automated"},"1.2.32 Ensure that the --etcd-cafile argument is set as appropriate (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nFollow the Kubernetes documentation and set up the TLS connection between the apiserver and etcd.\nThen, edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and set the etcd certificate authority file parameter.\n",(0,n.kt)("inlineCode",{parentName:"p"},"--etcd-cafile=<path/to/ca-file>")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--etcd-cafile' is present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:28 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"1233-ensure-that-the---encryption-provider-config-argument-is-set-as-appropriate-automated"},"1.2.33 Ensure that the --encryption-provider-config argument is set as appropriate (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nFollow the Kubernetes documentation and configure a EncryptionConfig file.\nThen, edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and set the --encryption-provider-config parameter to the path of that file: --encryption-provider-config=</path/to/EncryptionConfig/File>"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--encryption-provider-config' is present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:28 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"1234-ensure-that-encryption-providers-are-appropriately-configured-automated"},"1.2.34 Ensure that encryption providers are appropriately configured (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nFollow the Kubernetes documentation and configure a EncryptionConfig file.\nIn this file, choose aescbc, kms or secretbox as the encryption provider."),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Script:")," ",(0,n.kt)("inlineCode",{parentName:"p"},"check_encryption_provider_config.sh")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},'#!/usr/bin/env bash\n\n# This script is used to check the encrption provider config is set to aesbc\n#\n# outputs:\n# true/false\n\n# TODO: Figure out the file location from the kube-apiserver commandline args\nENCRYPTION_CONFIG_FILE="/node/etc/kubernetes/ssl/encryption.yaml"\n\nif [[ ! -f "${ENCRYPTION_CONFIG_FILE}" ]]; then\n echo "false"\n exit\nfi\n\nfor provider in "$@"\ndo\n if grep "$provider" "${ENCRYPTION_CONFIG_FILE}"; then\n echo "true"\n exit\n fi\ndone\n\necho "false"\nexit\n\n')),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Execution:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"./check_encryption_provider_config.sh aescbc\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'true' is equal to 'true'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"- aescbc: true\n")),(0,n.kt)("h3",{id:"1235-ensure-that-the-api-server-only-makes-use-of-strong-cryptographic-ciphers-automated"},"1.2.35 Ensure that the API Server only makes use of Strong Cryptographic Ciphers (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," warn"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and set the below parameter.\n--tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM\n_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_256_GCM\n_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_ECDSA_WITH_AES_256_GCM\n_SHA384"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("h2",{id:"13-controller-manager"},"1.3 Controller Manager"),(0,n.kt)("h3",{id:"131-ensure-that-the---terminated-pod-gc-threshold-argument-is-set-as-appropriate-automated"},"1.3.1 Ensure that the --terminated-pod-gc-threshold argument is set as appropriate (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the Controller Manager pod specification file /etc/kubernetes/manifests/kube-controller-manager.yaml\non the master node and set the --terminated-pod-gc-threshold to an appropriate threshold,\nfor example:\n--terminated-pod-gc-threshold=10"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-controller-manager | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--terminated-pod-gc-threshold' is present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121366 121346 1 12:27 ? 00:01:13 kube-controller-manager --cluster-cidr=10.42.0.0/16 --kubeconfig=/etc/kubernetes/ssl/kubecfg-kube-controller-manager.yaml --allocate-node-cidrs=true --configure-cloud-routes=false --leader-elect=true --pod-eviction-timeout=5m0s --authentication-kubeconfig=/etc/kubernetes/ssl/kubecfg-kube-controller-manager.yaml --feature-gates=RotateKubeletServerCertificate=true --bind-address=127.0.0.1 --enable-hostpath-provisioner=false --address=127.0.0.1 --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 --cloud-provider= --service-account-private-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --service-cluster-ip-range=10.43.0.0/16 --authorization-kubeconfig=/etc/kubernetes/ssl/kubecfg-kube-controller-manager.yaml --root-ca-file=/etc/kubernetes/ssl/kube-ca.pem --node-monitor-grace-period=40s --profiling=false --terminated-pod-gc-threshold=1000 --v=2 --allow-untagged-cloud=true --use-service-account-credentials=true\n")),(0,n.kt)("h3",{id:"132-ensure-that-the---profiling-argument-is-set-to-false-automated"},"1.3.2 Ensure that the --profiling argument is set to false (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the Controller Manager pod specification file /etc/kubernetes/manifests/kube-controller-manager.yaml\non the master node and set the below parameter.\n--profiling=false"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-controller-manager | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'false' is equal to 'false'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121366 121346 1 12:27 ? 00:01:13 kube-controller-manager --cluster-cidr=10.42.0.0/16 --kubeconfig=/etc/kubernetes/ssl/kubecfg-kube-controller-manager.yaml --allocate-node-cidrs=true --configure-cloud-routes=false --leader-elect=true --pod-eviction-timeout=5m0s --authentication-kubeconfig=/etc/kubernetes/ssl/kubecfg-kube-controller-manager.yaml --feature-gates=RotateKubeletServerCertificate=true --bind-address=127.0.0.1 --enable-hostpath-provisioner=false --address=127.0.0.1 --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 --cloud-provider= --service-account-private-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --service-cluster-ip-range=10.43.0.0/16 --authorization-kubeconfig=/etc/kubernetes/ssl/kubecfg-kube-controller-manager.yaml --root-ca-file=/etc/kubernetes/ssl/kube-ca.pem --node-monitor-grace-period=40s --profiling=false --terminated-pod-gc-threshold=1000 --v=2 --allow-untagged-cloud=true --use-service-account-credentials=true\n")),(0,n.kt)("h3",{id:"133-ensure-that-the---use-service-account-credentials-argument-is-set-to-true-automated"},"1.3.3 Ensure that the --use-service-account-credentials argument is set to true (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the Controller Manager pod specification file /etc/kubernetes/manifests/kube-controller-manager.yaml\non the master node to set the below parameter.\n--use-service-account-credentials=true"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-controller-manager | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'true' is not equal to 'false'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121366 121346 1 12:27 ? 00:01:13 kube-controller-manager --cluster-cidr=10.42.0.0/16 --kubeconfig=/etc/kubernetes/ssl/kubecfg-kube-controller-manager.yaml --allocate-node-cidrs=true --configure-cloud-routes=false --leader-elect=true --pod-eviction-timeout=5m0s --authentication-kubeconfig=/etc/kubernetes/ssl/kubecfg-kube-controller-manager.yaml --feature-gates=RotateKubeletServerCertificate=true --bind-address=127.0.0.1 --enable-hostpath-provisioner=false --address=127.0.0.1 --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 --cloud-provider= --service-account-private-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --service-cluster-ip-range=10.43.0.0/16 --authorization-kubeconfig=/etc/kubernetes/ssl/kubecfg-kube-controller-manager.yaml --root-ca-file=/etc/kubernetes/ssl/kube-ca.pem --node-monitor-grace-period=40s --profiling=false --terminated-pod-gc-threshold=1000 --v=2 --allow-untagged-cloud=true --use-service-account-credentials=true\n")),(0,n.kt)("h3",{id:"134-ensure-that-the---service-account-private-key-file-argument-is-set-as-appropriate-automated"},"1.3.4 Ensure that the --service-account-private-key-file argument is set as appropriate (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the Controller Manager pod specification file /etc/kubernetes/manifests/kube-controller-manager.yaml\non the master node and set the --service-account-private-key-file parameter\nto the private key file for service accounts.\n",(0,n.kt)("inlineCode",{parentName:"p"},"--service-account-private-key-file=<filename>")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-controller-manager | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--service-account-private-key-file' is present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121366 121346 1 12:27 ? 00:01:13 kube-controller-manager --cluster-cidr=10.42.0.0/16 --kubeconfig=/etc/kubernetes/ssl/kubecfg-kube-controller-manager.yaml --allocate-node-cidrs=true --configure-cloud-routes=false --leader-elect=true --pod-eviction-timeout=5m0s --authentication-kubeconfig=/etc/kubernetes/ssl/kubecfg-kube-controller-manager.yaml --feature-gates=RotateKubeletServerCertificate=true --bind-address=127.0.0.1 --enable-hostpath-provisioner=false --address=127.0.0.1 --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 --cloud-provider= --service-account-private-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --service-cluster-ip-range=10.43.0.0/16 --authorization-kubeconfig=/etc/kubernetes/ssl/kubecfg-kube-controller-manager.yaml --root-ca-file=/etc/kubernetes/ssl/kube-ca.pem --node-monitor-grace-period=40s --profiling=false --terminated-pod-gc-threshold=1000 --v=2 --allow-untagged-cloud=true --use-service-account-credentials=true\n")),(0,n.kt)("h3",{id:"135-ensure-that-the---root-ca-file-argument-is-set-as-appropriate-automated"},"1.3.5 Ensure that the --root-ca-file argument is set as appropriate (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the Controller Manager pod specification file /etc/kubernetes/manifests/kube-controller-manager.yaml\non the master node and set the --root-ca-file parameter to the certificate bundle file",(0,n.kt)("inlineCode",{parentName:"p"},".\n"),"--root-ca-file=<path/to/file>`"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-controller-manager | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--root-ca-file' is present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121366 121346 1 12:27 ? 00:01:13 kube-controller-manager --cluster-cidr=10.42.0.0/16 --kubeconfig=/etc/kubernetes/ssl/kubecfg-kube-controller-manager.yaml --allocate-node-cidrs=true --configure-cloud-routes=false --leader-elect=true --pod-eviction-timeout=5m0s --authentication-kubeconfig=/etc/kubernetes/ssl/kubecfg-kube-controller-manager.yaml --feature-gates=RotateKubeletServerCertificate=true --bind-address=127.0.0.1 --enable-hostpath-provisioner=false --address=127.0.0.1 --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 --cloud-provider= --service-account-private-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --service-cluster-ip-range=10.43.0.0/16 --authorization-kubeconfig=/etc/kubernetes/ssl/kubecfg-kube-controller-manager.yaml --root-ca-file=/etc/kubernetes/ssl/kube-ca.pem --node-monitor-grace-period=40s --profiling=false --terminated-pod-gc-threshold=1000 --v=2 --allow-untagged-cloud=true --use-service-account-credentials=true\n")),(0,n.kt)("h3",{id:"136-ensure-that-the-rotatekubeletservercertificate-argument-is-set-to-true-automated"},"1.3.6 Ensure that the RotateKubeletServerCertificate argument is set to true (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," Not Applicable"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the Controller Manager pod specification file /etc/kubernetes/manifests/kube-controller-manager.yaml\non the master node and set the --feature-gates parameter to include RotateKubeletServerCertificate=true.\n--feature-gates=RotateKubeletServerCertificate=true"),(0,n.kt)("p",null,"Cluster provisioned by RKE handles certificate rotation directly through RKE."),(0,n.kt)("h3",{id:"137-ensure-that-the---bind-address-argument-is-set-to-127001-automated"},"1.3.7 Ensure that the --bind-address argument is set to 127.0.0.1 (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the Controller Manager pod specification file /etc/kubernetes/manifests/kube-controller-manager.yaml\non the master node and ensure the correct value for the --bind-address parameter"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-controller-manager | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'127.0.0.1' is equal to '127.0.0.1' OR '--bind-address' is not present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121366 121346 1 12:27 ? 00:01:13 kube-controller-manager --cluster-cidr=10.42.0.0/16 --kubeconfig=/etc/kubernetes/ssl/kubecfg-kube-controller-manager.yaml --allocate-node-cidrs=true --configure-cloud-routes=false --leader-elect=true --pod-eviction-timeout=5m0s --authentication-kubeconfig=/etc/kubernetes/ssl/kubecfg-kube-controller-manager.yaml --feature-gates=RotateKubeletServerCertificate=true --bind-address=127.0.0.1 --enable-hostpath-provisioner=false --address=127.0.0.1 --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 --cloud-provider= --service-account-private-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --service-cluster-ip-range=10.43.0.0/16 --authorization-kubeconfig=/etc/kubernetes/ssl/kubecfg-kube-controller-manager.yaml --root-ca-file=/etc/kubernetes/ssl/kube-ca.pem --node-monitor-grace-period=40s --profiling=false --terminated-pod-gc-threshold=1000 --v=2 --allow-untagged-cloud=true --use-service-account-credentials=true\n")),(0,n.kt)("h2",{id:"14-scheduler"},"1.4 Scheduler"),(0,n.kt)("h3",{id:"141-ensure-that-the---profiling-argument-is-set-to-false-automated"},"1.4.1 Ensure that the --profiling argument is set to false (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the Scheduler pod specification file /etc/kubernetes/manifests/kube-scheduler.yaml file\non the master node and set the below parameter.\n--profiling=false"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-scheduler | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'false' is equal to 'false'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121587 121567 0 12:27 ? 00:00:12 kube-scheduler --kubeconfig=/etc/kubernetes/ssl/kubecfg-kube-scheduler.yaml --address=127.0.0.1 --leader-elect=true --profiling=false --v=2 --bind-address=127.0.0.1 --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\n")),(0,n.kt)("h3",{id:"142-ensure-that-the---bind-address-argument-is-set-to-127001-automated"},"1.4.2 Ensure that the --bind-address argument is set to 127.0.0.1 (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the Scheduler pod specification file /etc/kubernetes/manifests/kube-scheduler.yaml\non the master node and ensure the correct value for the --bind-address parameter"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-scheduler | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'127.0.0.1' is equal to '127.0.0.1' OR '--bind-address' is not present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121587 121567 0 12:27 ? 00:00:12 kube-scheduler --kubeconfig=/etc/kubernetes/ssl/kubecfg-kube-scheduler.yaml --address=127.0.0.1 --leader-elect=true --profiling=false --v=2 --bind-address=127.0.0.1 --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\n")),(0,n.kt)("h2",{id:"2-etcd-node-configuration-files"},"2 Etcd Node Configuration Files"),(0,n.kt)("h3",{id:"21-ensure-that-the---cert-file-and---key-file-arguments-are-set-as-appropriate-automated"},"2.1 Ensure that the --cert-file and --key-file arguments are set as appropriate (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nFollow the etcd service documentation and configure TLS encryption.\nThen, edit the etcd pod specification file /etc/kubernetes/manifests/etcd.yaml\non the master node and set the below parameters.\n",(0,n.kt)("inlineCode",{parentName:"p"},"--cert-file=</path/to/ca-file>"),"\n",(0,n.kt)("inlineCode",{parentName:"p"},"--key-file=</path/to/key-file>")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | /bin/grep etcd | /bin/grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--cert-file' is present AND '--key-file' is present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"etcd 120679 120657 1 12:27 ? 00:01:17 /usr/local/bin/etcd --trusted-ca-file=/etc/kubernetes/ssl/kube-ca.pem --cert-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>.pem --heartbeat-interval=500 --election-timeout=5000 --initial-cluster-token=etcd-cluster-1 --initial-cluster=etcd-<external_ip>=https://<node_ip>:2380 --peer-trusted-ca-file=/etc/kubernetes/ssl/kube-ca.pem --peer-cert-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>.pem --peer-key-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>-key.pem --peer-client-cert-auth=true --data-dir=/var/lib/rancher/etcd/ --initial-advertise-peer-urls=https://<node_ip>:2380 --initial-cluster-state=new --advertise-client-urls=https://<node_ip>:2379 --client-cert-auth=true --enable-v2=true --name=etcd-<external_ip> --listen-client-urls=https://<node_ip>:2379 --listen-peer-urls=https://<node_ip>:2380 --key-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>-key.pem --cipher-suites=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 root 120728 120707 0 12:27 ? 00:00:00 /opt/rke-tools/rke-etcd-backup etcd-backup save --cacert /etc/kubernetes/ssl/kube-ca.pem --cert /etc/kubernetes/ssl/kube-node.pem --key /etc/kubernetes/ssl/kube-node-key.pem --name etcd-rolling-snapshots --endpoints=<node_ip>:2379 --retention=72h --creation=12h root 121142 121120 7 12:27 ? 00:06:27 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json root 214939 214868 2 13:56 ? 00:00:00 kube-bench run --targets etcd --scored --nosummary --noremediations --v=5 --config-dir=/etc/kube-bench/cfg --benchmark rke-cis-1.6-hardened --json --log_dir /tmp/results/logs --outputfile /tmp/results/etcd.json\n")),(0,n.kt)("h3",{id:"22-ensure-that-the---client-cert-auth-argument-is-set-to-true-automated"},"2.2 Ensure that the --client-cert-auth argument is set to true (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),'\nEdit the etcd pod specification file /etc/kubernetes/manifests/etcd.yaml on the master\nnode and set the below parameter.\n--client-cert-auth="true"'),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | /bin/grep etcd | /bin/grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--client-cert-auth' is present OR 'true' is equal to 'true'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"etcd 120679 120657 1 12:27 ? 00:01:17 /usr/local/bin/etcd --trusted-ca-file=/etc/kubernetes/ssl/kube-ca.pem --cert-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>.pem --heartbeat-interval=500 --election-timeout=5000 --initial-cluster-token=etcd-cluster-1 --initial-cluster=etcd-<external_ip>=https://<node_ip>:2380 --peer-trusted-ca-file=/etc/kubernetes/ssl/kube-ca.pem --peer-cert-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>.pem --peer-key-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>-key.pem --peer-client-cert-auth=true --data-dir=/var/lib/rancher/etcd/ --initial-advertise-peer-urls=https://<node_ip>:2380 --initial-cluster-state=new --advertise-client-urls=https://<node_ip>:2379 --client-cert-auth=true --enable-v2=true --name=etcd-<external_ip> --listen-client-urls=https://<node_ip>:2379 --listen-peer-urls=https://<node_ip>:2380 --key-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>-key.pem --cipher-suites=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 root 120728 120707 0 12:27 ? 00:00:00 /opt/rke-tools/rke-etcd-backup etcd-backup save --cacert /etc/kubernetes/ssl/kube-ca.pem --cert /etc/kubernetes/ssl/kube-node.pem --key /etc/kubernetes/ssl/kube-node-key.pem --name etcd-rolling-snapshots --endpoints=<node_ip>:2379 --retention=72h --creation=12h root 121142 121120 7 12:27 ? 00:06:27 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json root 214939 214868 2 13:56 ? 00:00:00 kube-bench run --targets etcd --scored --nosummary --noremediations --v=5 --config-dir=/etc/kube-bench/cfg --benchmark rke-cis-1.6-hardened --json --log_dir /tmp/results/logs --outputfile /tmp/results/etcd.json\n")),(0,n.kt)("h3",{id:"23-ensure-that-the---auto-tls-argument-is-not-set-to-true-automated"},"2.3 Ensure that the --auto-tls argument is not set to true (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the etcd pod specification file /etc/kubernetes/manifests/etcd.yaml on the master\nnode and either remove the --auto-tls parameter or set it to false.\n--auto-tls=false"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | /bin/grep etcd | /bin/grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--auto-tls' is not present OR '--auto-tls' is not present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"etcd 120679 120657 1 12:27 ? 00:01:17 /usr/local/bin/etcd --trusted-ca-file=/etc/kubernetes/ssl/kube-ca.pem --cert-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>.pem --heartbeat-interval=500 --election-timeout=5000 --initial-cluster-token=etcd-cluster-1 --initial-cluster=etcd-<external_ip>=https://<node_ip>:2380 --peer-trusted-ca-file=/etc/kubernetes/ssl/kube-ca.pem --peer-cert-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>.pem --peer-key-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>-key.pem --peer-client-cert-auth=true --data-dir=/var/lib/rancher/etcd/ --initial-advertise-peer-urls=https://<node_ip>:2380 --initial-cluster-state=new --advertise-client-urls=https://<node_ip>:2379 --client-cert-auth=true --enable-v2=true --name=etcd-<external_ip> --listen-client-urls=https://<node_ip>:2379 --listen-peer-urls=https://<node_ip>:2380 --key-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>-key.pem --cipher-suites=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 root 120728 120707 0 12:27 ? 00:00:00 /opt/rke-tools/rke-etcd-backup etcd-backup save --cacert /etc/kubernetes/ssl/kube-ca.pem --cert /etc/kubernetes/ssl/kube-node.pem --key /etc/kubernetes/ssl/kube-node-key.pem --name etcd-rolling-snapshots --endpoints=<node_ip>:2379 --retention=72h --creation=12h root 121142 121120 7 12:27 ? 00:06:27 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json root 214939 214868 1 13:56 ? 00:00:00 kube-bench run --targets etcd --scored --nosummary --noremediations --v=5 --config-dir=/etc/kube-bench/cfg --benchmark rke-cis-1.6-hardened --json --log_dir /tmp/results/logs --outputfile /tmp/results/etcd.json\n")),(0,n.kt)("h3",{id:"24-ensure-that-the---peer-cert-file-and---peer-key-file-arguments-are-set-as-appropriate-automated"},"2.4 Ensure that the --peer-cert-file and --peer-key-file arguments are set as appropriate (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nFollow the etcd service documentation and configure peer TLS encryption as appropriate\nfor your etcd cluster.\nThen, edit the etcd pod specification file /etc/kubernetes/manifests/etcd.yaml on the\nmaster node and set the below parameters.\n",(0,n.kt)("inlineCode",{parentName:"p"},"--peer-client-file=</path/to/peer-cert-file>"),"\n",(0,n.kt)("inlineCode",{parentName:"p"},"--peer-key-file=</path/to/peer-key-file>")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | /bin/grep etcd | /bin/grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--peer-cert-file' is present AND '--peer-key-file' is present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"etcd 120679 120657 1 12:27 ? 00:01:17 /usr/local/bin/etcd --trusted-ca-file=/etc/kubernetes/ssl/kube-ca.pem --cert-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>.pem --heartbeat-interval=500 --election-timeout=5000 --initial-cluster-token=etcd-cluster-1 --initial-cluster=etcd-<external_ip>=https://<node_ip>:2380 --peer-trusted-ca-file=/etc/kubernetes/ssl/kube-ca.pem --peer-cert-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>.pem --peer-key-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>-key.pem --peer-client-cert-auth=true --data-dir=/var/lib/rancher/etcd/ --initial-advertise-peer-urls=https://<node_ip>:2380 --initial-cluster-state=new --advertise-client-urls=https://<node_ip>:2379 --client-cert-auth=true --enable-v2=true --name=etcd-<external_ip> --listen-client-urls=https://<node_ip>:2379 --listen-peer-urls=https://<node_ip>:2380 --key-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>-key.pem --cipher-suites=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 root 120728 120707 0 12:27 ? 00:00:00 /opt/rke-tools/rke-etcd-backup etcd-backup save --cacert /etc/kubernetes/ssl/kube-ca.pem --cert /etc/kubernetes/ssl/kube-node.pem --key /etc/kubernetes/ssl/kube-node-key.pem --name etcd-rolling-snapshots --endpoints=<node_ip>:2379 --retention=72h --creation=12h root 121142 121120 7 12:27 ? 00:06:27 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json root 214939 214868 5 13:56 ? 00:00:00 kube-bench run --targets etcd --scored --nosummary --noremediations --v=5 --config-dir=/etc/kube-bench/cfg --benchmark rke-cis-1.6-hardened --json --log_dir /tmp/results/logs --outputfile /tmp/results/etcd.json\n")),(0,n.kt)("h3",{id:"25-ensure-that-the---peer-client-cert-auth-argument-is-set-to-true-automated"},"2.5 Ensure that the --peer-client-cert-auth argument is set to true (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the etcd pod specification file /etc/kubernetes/manifests/etcd.yaml on the master\nnode and set the below parameter.\n--peer-client-cert-auth=true"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | /bin/grep etcd | /bin/grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--peer-client-cert-auth' is present OR 'true' is equal to 'true'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"etcd 120679 120657 1 12:27 ? 00:01:17 /usr/local/bin/etcd --trusted-ca-file=/etc/kubernetes/ssl/kube-ca.pem --cert-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>.pem --heartbeat-interval=500 --election-timeout=5000 --initial-cluster-token=etcd-cluster-1 --initial-cluster=etcd-<external_ip>=https://<node_ip>:2380 --peer-trusted-ca-file=/etc/kubernetes/ssl/kube-ca.pem --peer-cert-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>.pem --peer-key-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>-key.pem --peer-client-cert-auth=true --data-dir=/var/lib/rancher/etcd/ --initial-advertise-peer-urls=https://<node_ip>:2380 --initial-cluster-state=new --advertise-client-urls=https://<node_ip>:2379 --client-cert-auth=true --enable-v2=true --name=etcd-<external_ip> --listen-client-urls=https://<node_ip>:2379 --listen-peer-urls=https://<node_ip>:2380 --key-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>-key.pem --cipher-suites=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 root 120728 120707 0 12:27 ? 00:00:00 /opt/rke-tools/rke-etcd-backup etcd-backup save --cacert /etc/kubernetes/ssl/kube-ca.pem --cert /etc/kubernetes/ssl/kube-node.pem --key /etc/kubernetes/ssl/kube-node-key.pem --name etcd-rolling-snapshots --endpoints=<node_ip>:2379 --retention=72h --creation=12h root 121142 121120 7 12:27 ? 00:06:27 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json root 214939 214868 4 13:56 ? 00:00:00 kube-bench run --targets etcd --scored --nosummary --noremediations --v=5 --config-dir=/etc/kube-bench/cfg --benchmark rke-cis-1.6-hardened --json --log_dir /tmp/results/logs --outputfile /tmp/results/etcd.json\n")),(0,n.kt)("h3",{id:"26-ensure-that-the---peer-auto-tls-argument-is-not-set-to-true-automated"},"2.6 Ensure that the --peer-auto-tls argument is not set to true (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the etcd pod specification file /etc/kubernetes/manifests/etcd.yaml on the master\nnode and either remove the --peer-auto-tls parameter or set it to false.\n--peer-auto-tls=false"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | /bin/grep etcd | /bin/grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--peer-auto-tls' is not present OR '--peer-auto-tls' is present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"etcd 120679 120657 1 12:27 ? 00:01:17 /usr/local/bin/etcd --trusted-ca-file=/etc/kubernetes/ssl/kube-ca.pem --cert-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>.pem --heartbeat-interval=500 --election-timeout=5000 --initial-cluster-token=etcd-cluster-1 --initial-cluster=etcd-<external_ip>=https://<node_ip>:2380 --peer-trusted-ca-file=/etc/kubernetes/ssl/kube-ca.pem --peer-cert-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>.pem --peer-key-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>-key.pem --peer-client-cert-auth=true --data-dir=/var/lib/rancher/etcd/ --initial-advertise-peer-urls=https://<node_ip>:2380 --initial-cluster-state=new --advertise-client-urls=https://<node_ip>:2379 --client-cert-auth=true --enable-v2=true --name=etcd-<external_ip> --listen-client-urls=https://<node_ip>:2379 --listen-peer-urls=https://<node_ip>:2380 --key-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>-key.pem --cipher-suites=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 root 120728 120707 0 12:27 ? 00:00:00 /opt/rke-tools/rke-etcd-backup etcd-backup save --cacert /etc/kubernetes/ssl/kube-ca.pem --cert /etc/kubernetes/ssl/kube-node.pem --key /etc/kubernetes/ssl/kube-node-key.pem --name etcd-rolling-snapshots --endpoints=<node_ip>:2379 --retention=72h --creation=12h root 121142 121120 7 12:27 ? 00:06:27 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json root 214939 214868 4 13:56 ? 00:00:00 kube-bench run --targets etcd --scored --nosummary --noremediations --v=5 --config-dir=/etc/kube-bench/cfg --benchmark rke-cis-1.6-hardened --json --log_dir /tmp/results/logs --outputfile /tmp/results/etcd.json\n")),(0,n.kt)("h3",{id:"27-ensure-that-a-unique-certificate-authority-is-used-for-etcd-automated"},"2.7 Ensure that a unique Certificate Authority is used for etcd (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\n","[Manual test]","\nFollow the etcd documentation and create a dedicated certificate authority setup for the\netcd service.\nThen, edit the etcd pod specification file /etc/kubernetes/manifests/etcd.yaml on the\nmaster node and set the below parameter.\n",(0,n.kt)("inlineCode",{parentName:"p"},"--trusted-ca-file=</path/to/ca-file>")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | /bin/grep etcd | /bin/grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--trusted-ca-file' is present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"etcd 120679 120657 1 12:27 ? 00:01:17 /usr/local/bin/etcd --trusted-ca-file=/etc/kubernetes/ssl/kube-ca.pem --cert-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>.pem --heartbeat-interval=500 --election-timeout=5000 --initial-cluster-token=etcd-cluster-1 --initial-cluster=etcd-<external_ip>=https://<node_ip>:2380 --peer-trusted-ca-file=/etc/kubernetes/ssl/kube-ca.pem --peer-cert-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>.pem --peer-key-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>-key.pem --peer-client-cert-auth=true --data-dir=/var/lib/rancher/etcd/ --initial-advertise-peer-urls=https://<node_ip>:2380 --initial-cluster-state=new --advertise-client-urls=https://<node_ip>:2379 --client-cert-auth=true --enable-v2=true --name=etcd-<external_ip> --listen-client-urls=https://<node_ip>:2379 --listen-peer-urls=https://<node_ip>:2380 --key-file=/etc/kubernetes/ssl/kube-etcd-<node_ip>-key.pem --cipher-suites=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 root 120728 120707 0 12:27 ? 00:00:00 /opt/rke-tools/rke-etcd-backup etcd-backup save --cacert /etc/kubernetes/ssl/kube-ca.pem --cert /etc/kubernetes/ssl/kube-node.pem --key /etc/kubernetes/ssl/kube-node-key.pem --name etcd-rolling-snapshots --endpoints=<node_ip>:2379 --retention=72h --creation=12h root 121142 121120 7 12:27 ? 00:06:27 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json root 214939 214868 3 13:56 ? 00:00:00 kube-bench run --targets etcd --scored --nosummary --noremediations --v=5 --config-dir=/etc/kube-bench/cfg --benchmark rke-cis-1.6-hardened --json --log_dir /tmp/results/logs --outputfile /tmp/results/etcd.json\n")),(0,n.kt)("h2",{id:"31-authentication-and-authorization"},"3.1 Authentication and Authorization"),(0,n.kt)("h3",{id:"311-client-certificate-authentication-should-not-be-used-for-users-manual"},"3.1.1 Client certificate authentication should not be used for users (Manual)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," warn"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nAlternative mechanisms provided by Kubernetes such as the use of OIDC should be\nimplemented in place of client certificates."),(0,n.kt)("h2",{id:"32-logging"},"3.2 Logging"),(0,n.kt)("h3",{id:"321-ensure-that-a-minimal-audit-policy-is-created-automated"},"3.2.1 Ensure that a minimal audit policy is created (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nCreate an audit policy file for your cluster."),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -ef | grep kube-apiserver | grep -v grep\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--audit-policy-file' is present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root 121142 121120 7 12:27 ? 00:06:28 kube-apiserver --audit-log-maxsize=100 --etcd-keyfile=/etc/kubernetes/ssl/kube-node-key.pem --service-cluster-ip-range=10.43.0.0/16 --encryption-provider-config=/etc/kubernetes/ssl/encryption.yaml --requestheader-username-headers=X-Remote-User --bind-address=0.0.0.0 --advertise-address=<node_ip> --requestheader-allowed-names=kube-apiserver-proxy-client --etcd-certfile=/etc/kubernetes/ssl/kube-node.pem --requestheader-client-ca-file=/etc/kubernetes/ssl/kube-apiserver-requestheader-ca.pem --allow-privileged=true --requestheader-extra-headers-prefix=X-Remote-Extra- --admission-control-config-file=/etc/kubernetes/admission.yaml --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --service-account-lookup=true --runtime-config=policy/v1beta1/podsecuritypolicy=true --authorization-mode=Node,RBAC --audit-log-maxage=30 --profiling=false --storage-backend=etcd3 --etcd-cafile=/etc/kubernetes/ssl/kube-ca.pem --etcd-servers=https://<node_ip>:2379 --kubelet-certificate-authority=/etc/kubernetes/ssl/kube-ca.pem --secure-port=6443 --tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 --insecure-port=0 --api-audiences=unknown --audit-policy-file=/etc/kubernetes/audit-policy.yaml --etcd-prefix=/registry --kubelet-client-certificate=/etc/kubernetes/ssl/kube-apiserver.pem --kubelet-client-key=/etc/kubernetes/ssl/kube-apiserver-key.pem --proxy-client-key-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client-key.pem --service-account-issuer=rke --service-account-signing-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --requestheader-group-headers=X-Remote-Group --cloud-provider= --proxy-client-cert-file=/etc/kubernetes/ssl/kube-apiserver-proxy-client.pem --service-node-port-range=30000-32767 --tls-cert-file=/etc/kubernetes/ssl/kube-apiserver.pem --tls-private-key-file=/etc/kubernetes/ssl/kube-apiserver-key.pem --anonymous-auth=false --audit-log-path=/var/log/kube-audit/audit-log.json --audit-log-maxbackup=10 --service-account-key-file=/etc/kubernetes/ssl/kube-service-account-token-key.pem --enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,Priority,TaintNodesByCondition,PersistentVolumeClaimResize,PodSecurityPolicy,EventRateLimit --audit-log-format=json\n")),(0,n.kt)("h3",{id:"322-ensure-that-the-audit-policy-covers-key-security-concerns-manual"},"3.2.2 Ensure that the audit policy covers key security concerns (Manual)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," warn"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nConsider modification of the audit policy in use on the cluster to include these items, at a\nminimum."),(0,n.kt)("h2",{id:"41-worker-node-configuration-files"},"4.1 Worker Node Configuration Files"),(0,n.kt)("h3",{id:"411-ensure-that-the-kubelet-service-file-permissions-are-set-to-644-or-more-restrictive-automated"},"4.1.1 Ensure that the kubelet service file permissions are set to 644 or more restrictive (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," Not Applicable"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nCluster provisioned by RKE doesn\u2019t require or maintain a configuration file for the kubelet service.\nAll configuration is passed in as arguments at container run time."),(0,n.kt)("h3",{id:"412-ensure-that-the-kubelet-service-file-ownership-is-set-to-rootroot-automated"},"4.1.2 Ensure that the kubelet service file ownership is set to root:root (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," Not Applicable"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nCluster provisioned by RKE doesn\u2019t require or maintain a configuration file for the kubelet service.\nAll configuration is passed in as arguments at container run time."),(0,n.kt)("h3",{id:"413-if-proxy-kubeconfig-file-exists-ensure-permissions-are-set-to-644-or-more-restrictive-automated"},"4.1.3 If proxy kubeconfig file exists ensure permissions are set to 644 or more restrictive (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nRun the below command (based on the file location on your system) on the each worker node.\nFor example,\nchmod 644 $proykubeconfig"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/sh -c 'if test -e /node/etc/kubernetes/ssl/kubecfg-kube-proxy.yaml; then stat -c %a /node/etc/kubernetes/ssl/kubecfg-kube-proxy.yaml; fi'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'644' is present OR '640' is present OR '600' is equal to '600' OR '444' is present OR '440' is present OR '400' is present OR '000' is present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"600\n")),(0,n.kt)("h3",{id:"414-ensure-that-the-proxy-kubeconfig-file-ownership-is-set-to-rootroot-automated"},"4.1.4 Ensure that the proxy kubeconfig file ownership is set to root:root (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nRun the below command (based on the file location on your system) on the each worker node.\nFor example, chown root:root /etc/kubernetes/ssl/kubecfg-kube-proxy.yaml"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/sh -c 'if test -e /etc/kubernetes/ssl/kubecfg-kube-proxy.yaml; then stat -c %U:%G /etc/kubernetes/ssl/kubecfg-kube-proxy.yaml; fi'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'root:root' is not present OR '/etc/kubernetes/ssl/kubecfg-kube-proxy.yaml' is not present\n")),(0,n.kt)("h3",{id:"415-ensure-that-the---kubeconfig-kubeletconf-file-permissions-are-set-to-644-or-more-restrictive-automated"},"4.1.5 Ensure that the --kubeconfig kubelet.conf file permissions are set to 644 or more restrictive (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nRun the below command (based on the file location on your system) on the each worker node.\nFor example,\nchmod 644 /etc/kubernetes/ssl/kubecfg-kube-node.yaml"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/sh -c 'if test -e /etc/kubernetes/ssl/kubecfg-kube-node.yaml; then stat -c permissions=%a /etc/kubernetes/ssl/kubecfg-kube-node.yaml; fi'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'permissions' is not present\n")),(0,n.kt)("h3",{id:"416-ensure-that-the---kubeconfig-kubeletconf-file-ownership-is-set-to-rootroot-automated"},"4.1.6 Ensure that the --kubeconfig kubelet.conf file ownership is set to root:root (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nRun the below command (based on the file location on your system) on the each worker node.\nFor example,\nchown root:root /etc/kubernetes/ssl/kubecfg-kube-node.yaml"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/sh -c 'if test -e /node/etc/kubernetes/ssl/kubecfg-kube-node.yaml; then stat -c %U:%G /node/etc/kubernetes/ssl/kubecfg-kube-node.yaml; fi'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'root:root' is equal to 'root:root'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"root:root\n")),(0,n.kt)("h3",{id:"417-ensure-that-the-certificate-authorities-file-permissions-are-set-to-644-or-more-restrictive-automated"},"4.1.7 Ensure that the certificate authorities file permissions are set to 644 or more restrictive (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nRun the following command to modify the file permissions of the\n",(0,n.kt)("inlineCode",{parentName:"p"},"--client-ca-file chmod 644 <filename>")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Script:")," ",(0,n.kt)("inlineCode",{parentName:"p"},"check_cafile_permissions.sh")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"#!/usr/bin/env bash\n\nCAFILE=$(ps -ef | grep kubelet | grep -v apiserver | grep -- --client-ca-file= | awk -F '--client-ca-file=' '{print $2}' | awk '{print $1}')\nif test -z $CAFILE; then CAFILE=$kubeletcafile; fi\nif test -e $CAFILE; then stat -c permissions=%a $CAFILE; fi\n\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Execution:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"./check_cafile_permissions.sh\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'permissions' is not present\n")),(0,n.kt)("h3",{id:"418-ensure-that-the-client-certificate-authorities-file-ownership-is-set-to-rootroot-automated"},"4.1.8 Ensure that the client certificate authorities file ownership is set to root:root (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nRun the following command to modify the ownership of the --client-ca-file.\n",(0,n.kt)("inlineCode",{parentName:"p"},"chown root:root <filename>")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Script:")," ",(0,n.kt)("inlineCode",{parentName:"p"},"check_cafile_ownership.sh")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"#!/usr/bin/env bash\n\nCAFILE=$(ps -ef | grep kubelet | grep -v apiserver | grep -- --client-ca-file= | awk -F '--client-ca-file=' '{print $2}' | awk '{print $1}')\nif test -z $CAFILE; then CAFILE=$kubeletcafile; fi\nif test -e $CAFILE; then stat -c %U:%G $CAFILE; fi\n\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Execution:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"./check_cafile_ownership.sh\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'root:root' is not present\n")),(0,n.kt)("h3",{id:"419-ensure-that-the-kubelet---config-configuration-file-has-permissions-set-to-644-or-more-restrictive-automated"},"4.1.9 Ensure that the kubelet --config configuration file has permissions set to 644 or more restrictive (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," Not Applicable"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nRun the following command (using the config file location identified in the Audit step)\nchmod 644 /var/lib/kubelet/config.yaml"),(0,n.kt)("p",null,"Clusters provisioned by RKE doesn\u2019t require or maintain a configuration file for the kubelet.\nAll configuration is passed in as arguments at container run time."),(0,n.kt)("h3",{id:"4110-ensure-that-the-kubelet---config-configuration-file-ownership-is-set-to-rootroot-automated"},"4.1.10 Ensure that the kubelet --config configuration file ownership is set to root:root (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," Not Applicable"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nRun the following command (using the config file location identified in the Audit step)\nchown root:root /var/lib/kubelet/config.yaml"),(0,n.kt)("p",null,"Clusters provisioned by RKE doesn\u2019t require or maintain a configuration file for the kubelet.\nAll configuration is passed in as arguments at container run time."),(0,n.kt)("h2",{id:"42-kubelet"},"4.2 Kubelet"),(0,n.kt)("h3",{id:"421-ensure-that-the-anonymous-auth-argument-is-set-to-false-automated"},"4.2.1 Ensure that the anonymous-auth argument is set to false (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nIf using a Kubelet config file, edit the file to set authentication: anonymous: enabled to\nfalse.\nIf using executable arguments, edit the kubelet service file\n/etc/systemd/system/kubelet.service.d/10-kubeadm.conf on each worker node and\nset the below parameter in KUBELET_SYSTEM_PODS_ARGS variable.\n--anonymous-auth=false\nBased on your system, restart the kubelet service. For example:\nsystemctl daemon-reload\nsystemctl restart kubelet.service"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -fC kubelet\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Config:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/cat /var/lib/kubelet/config.yaml\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'' is not present\n")),(0,n.kt)("h3",{id:"422-ensure-that-the---authorization-mode-argument-is-not-set-to-alwaysallow-automated"},"4.2.2 Ensure that the --authorization-mode argument is not set to AlwaysAllow (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nIf using a Kubelet config file, edit the file to set authorization: mode to Webhook. If\nusing executable arguments, edit the kubelet service file\n/etc/systemd/system/kubelet.service.d/10-kubeadm.conf on each worker node and\nset the below parameter in KUBELET_AUTHZ_ARGS variable.\n--authorization-mode=Webhook\nBased on your system, restart the kubelet service. For example:\nsystemctl daemon-reload\nsystemctl restart kubelet.service"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -fC kubelet\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Config:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/cat /var/lib/kubelet/config.yaml\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'' is not present\n")),(0,n.kt)("h3",{id:"423-ensure-that-the---client-ca-file-argument-is-set-as-appropriate-automated"},"4.2.3 Ensure that the --client-ca-file argument is set as appropriate (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nIf using a Kubelet config file, edit the file to set authentication: x509: clientCAFile to\nthe location of the client CA file.\nIf using command line arguments, edit the kubelet service file\n/etc/systemd/system/kubelet.service.d/10-kubeadm.conf on each worker node and\nset the below parameter in KUBELET_AUTHZ_ARGS variable.\n",(0,n.kt)("inlineCode",{parentName:"p"},"--client-ca-file=<path/to/client-ca-file>"),"\nBased on your system, restart the kubelet service. For example:\nsystemctl daemon-reload\nsystemctl restart kubelet.service"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -fC kubelet\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Config:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/cat /var/lib/kubelet/config.yaml\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'' is not present\n")),(0,n.kt)("h3",{id:"424-ensure-that-the---read-only-port-argument-is-set-to-0-automated"},"4.2.4 Ensure that the --read-only-port argument is set to 0 (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nIf using a Kubelet config file, edit the file to set readOnlyPort to 0.\nIf using command line arguments, edit the kubelet service file\n/etc/systemd/system/kubelet.service.d/10-kubeadm.conf on each worker node and\nset the below parameter in KUBELET_SYSTEM_PODS_ARGS variable.\n--read-only-port=0\nBased on your system, restart the kubelet service. For example:\nsystemctl daemon-reload\nsystemctl restart kubelet.service"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -fC kubelet\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Config:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/cat /var/lib/kubelet/config.yaml\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'' is not present OR '' is not present\n")),(0,n.kt)("h3",{id:"425-ensure-that-the---streaming-connection-idle-timeout-argument-is-not-set-to-0-automated"},"4.2.5 Ensure that the --streaming-connection-idle-timeout argument is not set to 0 (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nIf using a Kubelet config file, edit the file to set streamingConnectionIdleTimeout to a\nvalue other than 0.\nIf using command line arguments, edit the kubelet service file\n/etc/systemd/system/kubelet.service.d/10-kubeadm.conf on each worker node and\nset the below parameter in KUBELET_SYSTEM_PODS_ARGS variable.\n--streaming-connection-idle-timeout=5m\nBased on your system, restart the kubelet service. For example:\nsystemctl daemon-reload\nsystemctl restart kubelet.service"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -fC kubelet\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Config:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/cat /var/lib/kubelet/config.yaml\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'30m' is not equal to '0' OR '--streaming-connection-idle-timeout' is not present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"UID PID PPID C STIME TTY TIME CMD root 121813 121792 4 12:27 ? 00:03:37 kubelet --fail-swap-on=false --resolv-conf=/etc/resolv.conf --authorization-mode=Webhook --kubeconfig=/etc/kubernetes/ssl/kubecfg-kube-node.yaml --v=2 --volume-plugin-dir=/var/lib/kubelet/volumeplugins --address=0.0.0.0 --make-iptables-util-chains=true --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --hostname-override=<external_ip> --tls-cert-file=/etc/kubernetes/ssl/kube-kubelet-<node_ip>.pem --network-plugin=cni --streaming-connection-idle-timeout=30m --root-dir=/var/lib/kubelet --event-qps=0 --feature-gates=RotateKubeletServerCertificate=true --protect-kernel-defaults=true --cloud-provider= --tls-private-key-file=/etc/kubernetes/ssl/kube-kubelet-<node_ip>-key.pem --cgroups-per-qos=True --cni-bin-dir=/opt/cni/bin --cni-conf-dir=/etc/cni/net.d --pod-infra-container-image=rancher/mirrored-pause:3.5 --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 --anonymous-auth=false --authentication-token-webhook=true --node-ip=<node_ip> --cluster-dns=10.43.0.10 --cluster-domain=cluster.local --read-only-port=0 --cgroup-driver=cgroupfs --resolv-conf=/run/systemd/resolve/resolv.conf\n")),(0,n.kt)("h3",{id:"426-ensure-that-the---protect-kernel-defaults-argument-is-set-to-true-automated"},"4.2.6 Ensure that the --protect-kernel-defaults argument is set to true (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nIf using a Kubelet config file, edit the file to set protectKernelDefaults: true.\nIf using command line arguments, edit the kubelet service file\n/etc/systemd/system/kubelet.service.d/10-kubeadm.conf on each worker node and\nset the below parameter in KUBELET_SYSTEM_PODS_ARGS variable.\n--protect-kernel-defaults=true\nBased on your system, restart the kubelet service. For example:\nsystemctl daemon-reload\nsystemctl restart kubelet.service"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -fC kubelet\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Config:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/cat /var/lib/kubelet/config.yaml\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'' is not present\n")),(0,n.kt)("h3",{id:"427-ensure-that-the---make-iptables-util-chains-argument-is-set-to-true-automated"},"4.2.7 Ensure that the --make-iptables-util-chains argument is set to true (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nIf using a Kubelet config file, edit the file to set makeIPTablesUtilChains: true.\nIf using command line arguments, edit the kubelet service file\n/etc/systemd/system/kubelet.service.d/10-kubeadm.conf on each worker node and\nremove the --make-iptables-util-chains argument from the\nKUBELET_SYSTEM_PODS_ARGS variable.\nBased on your system, restart the kubelet service. For example:\nsystemctl daemon-reload\nsystemctl restart kubelet.service"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -fC kubelet\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Config:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/cat /var/lib/kubelet/config.yaml\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'' is not present OR '' is not present\n")),(0,n.kt)("h3",{id:"428-ensure-that-the---hostname-override-argument-is-not-set-manual"},"4.2.8 Ensure that the --hostname-override argument is not set (Manual)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," Not Applicable"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the kubelet service file /etc/systemd/system/kubelet.service.d/10-kubeadm.conf\non each worker node and remove the --hostname-override argument from the\nKUBELET_SYSTEM_PODS_ARGS variable.\nBased on your system, restart the kubelet service. For example:\nsystemctl daemon-reload\nsystemctl restart kubelet.service"),(0,n.kt)("p",null,"Clusters provisioned by RKE set the --hostname-override to avoid any hostname configuration errors"),(0,n.kt)("h3",{id:"429-ensure-that-the---event-qps-argument-is-set-to-0-or-a-level-which-ensures-appropriate-event-capture-automated"},"4.2.9 Ensure that the --event-qps argument is set to 0 or a level which ensures appropriate event capture (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nIf using a Kubelet config file, edit the file to set eventRecordQPS: to an appropriate level.\nIf using command line arguments, edit the kubelet service file\n/etc/systemd/system/kubelet.service.d/10-kubeadm.conf on each worker node and\nset the below parameter in KUBELET_SYSTEM_PODS_ARGS variable.\nBased on your system, restart the kubelet service. For example:\nsystemctl daemon-reload\nsystemctl restart kubelet.service"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -fC kubelet\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Config:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/cat /var/lib/kubelet/config.yaml\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'' is not present\n")),(0,n.kt)("h3",{id:"4210-ensure-that-the---tls-cert-file-and---tls-private-key-file-arguments-are-set-as-appropriate-automated"},"4.2.10 Ensure that the --tls-cert-file and --tls-private-key-file arguments are set as appropriate (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nIf using a Kubelet config file, edit the file to set tlsCertFile to the location\nof the certificate file to use to identify this Kubelet, and tlsPrivateKeyFile\nto the location of the corresponding private key file.\nIf using command line arguments, edit the kubelet service file\n/etc/systemd/system/kubelet.service.d/10-kubeadm.conf on each worker node and\nset the below parameters in KUBELET_CERTIFICATE_ARGS variable.\n",(0,n.kt)("inlineCode",{parentName:"p"},"--tls-cert-file=<path/to/tls-certificate-file>"),"\n",(0,n.kt)("inlineCode",{parentName:"p"},"--tls-private-key-file=<path/to/tls-key-file>"),"\nBased on your system, restart the kubelet service. For example:\nsystemctl daemon-reload\nsystemctl restart kubelet.service"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -fC kubelet\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Config:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/cat /var/lib/kubelet/config.yaml\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'' is not present AND '' is not present\n")),(0,n.kt)("h3",{id:"4211-ensure-that-the---rotate-certificates-argument-is-not-set-to-false-automated"},"4.2.11 Ensure that the --rotate-certificates argument is not set to false (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nIf using a Kubelet config file, edit the file to add the line rotateCertificates: true or\nremove it altogether to use the default value.\nIf using command line arguments, edit the kubelet service file\n/etc/systemd/system/kubelet.service.d/10-kubeadm.conf on each worker node and\nremove --rotate-certificates=false argument from the KUBELET_CERTIFICATE_ARGS\nvariable.\nBased on your system, restart the kubelet service. For example:\nsystemctl daemon-reload\nsystemctl restart kubelet.service"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -fC kubelet\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Config:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/cat /var/lib/kubelet/config.yaml\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'--rotate-certificates' is not present OR '--rotate-certificates' is not present\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"UID PID PPID C STIME TTY TIME CMD root 121813 121792 4 12:27 ? 00:03:37 kubelet --fail-swap-on=false --resolv-conf=/etc/resolv.conf --authorization-mode=Webhook --kubeconfig=/etc/kubernetes/ssl/kubecfg-kube-node.yaml --v=2 --volume-plugin-dir=/var/lib/kubelet/volumeplugins --address=0.0.0.0 --make-iptables-util-chains=true --client-ca-file=/etc/kubernetes/ssl/kube-ca.pem --hostname-override=<external_ip> --tls-cert-file=/etc/kubernetes/ssl/kube-kubelet-<node_ip>.pem --network-plugin=cni --streaming-connection-idle-timeout=30m --root-dir=/var/lib/kubelet --event-qps=0 --feature-gates=RotateKubeletServerCertificate=true --protect-kernel-defaults=true --cloud-provider= --tls-private-key-file=/etc/kubernetes/ssl/kube-kubelet-<node_ip>-key.pem --cgroups-per-qos=True --cni-bin-dir=/opt/cni/bin --cni-conf-dir=/etc/cni/net.d --pod-infra-container-image=rancher/mirrored-pause:3.5 --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 --anonymous-auth=false --authentication-token-webhook=true --node-ip=<node_ip> --cluster-dns=10.43.0.10 --cluster-domain=cluster.local --read-only-port=0 --cgroup-driver=cgroupfs --resolv-conf=/run/systemd/resolve/resolv.conf\n")),(0,n.kt)("h3",{id:"4212-verify-that-the-rotatekubeletservercertificate-argument-is-set-to-true-automated"},"4.2.12 Verify that the RotateKubeletServerCertificate argument is set to true (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," Not Applicable"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEdit the kubelet service file /etc/systemd/system/kubelet.service.d/10-kubeadm.conf\non each worker node and set the below parameter in KUBELET_CERTIFICATE_ARGS variable.\n--feature-gates=RotateKubeletServerCertificate=true\nBased on your system, restart the kubelet service. For example:\nsystemctl daemon-reload\nsystemctl restart kubelet.service"),(0,n.kt)("p",null,"Clusters provisioned by RKE handles certificate rotation directly through RKE."),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Config:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/cat /var/lib/kubelet/config.yaml\n")),(0,n.kt)("h3",{id:"4213-ensure-that-the-kubelet-only-makes-use-of-strong-cryptographic-ciphers-automated"},"4.2.13 Ensure that the Kubelet only makes use of Strong Cryptographic Ciphers (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nIf using a Kubelet config file, edit the file to set TLSCipherSuites: to\nTLS_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\nor to a subset of these values.\nIf using executable arguments, edit the kubelet service file\n/etc/systemd/system/kubelet.service.d/10-kubeadm.conf on each worker node and\nset the --tls-cipher-suites parameter as follows, or to a subset of these values.\n--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\nBased on your system, restart the kubelet service. For example:\nsystemctl daemon-reload\nsystemctl restart kubelet.service"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/ps -fC kubelet\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Config:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"/bin/cat /var/lib/kubelet/config.yaml\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'' is not present\n")),(0,n.kt)("h2",{id:"51-rbac-and-service-accounts"},"5.1 RBAC and Service Accounts"),(0,n.kt)("h3",{id:"511-ensure-that-the-cluster-admin-role-is-only-used-where-required-manual"},"5.1.1 Ensure that the cluster-admin role is only used where required (Manual)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," warn"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nIdentify all clusterrolebindings to the cluster-admin role. Check if they are used and\nif they need this role or if they could use a role with fewer privileges.\nWhere possible, first bind users to a lower privileged role and then remove the\nclusterrolebinding to the cluster-admin role :\nkubectl delete clusterrolebinding ","[name]"),(0,n.kt)("h3",{id:"512-minimize-access-to-secrets-manual"},"5.1.2 Minimize access to secrets (Manual)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," warn"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nWhere possible, remove get, list and watch access to secret objects in the cluster."),(0,n.kt)("h3",{id:"513-minimize-wildcard-use-in-roles-and-clusterroles-manual"},"5.1.3 Minimize wildcard use in Roles and ClusterRoles (Manual)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," warn"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nWhere possible replace any use of wildcards in clusterroles and roles with specific\nobjects or actions."),(0,n.kt)("h3",{id:"514-minimize-access-to-create-pods-manual"},"5.1.4 Minimize access to create pods (Manual)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," warn"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nWhere possible, remove create access to pod objects in the cluster."),(0,n.kt)("h3",{id:"515-ensure-that-default-service-accounts-are-not-actively-used-automated"},"5.1.5 Ensure that default service accounts are not actively used. (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nCreate explicit service accounts wherever a Kubernetes workload requires specific access\nto the Kubernetes API server.\nModify the configuration of each default service account to include this value\nautomountServiceAccountToken: false"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Script:")," ",(0,n.kt)("inlineCode",{parentName:"p"},"check_for_default_sa.sh")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},'#!/bin/bash\n\nset -eE\n\nhandle_error() {\n echo "false"\n}\n\ntrap \'handle_error\' ERR\n\ncount_sa=$(kubectl get serviceaccounts --all-namespaces -o json | jq -r \'.items[] | select(.metadata.name=="default") | select((.automountServiceAccountToken == null) or (.automountServiceAccountToken == true))\' | jq .metadata.namespace | wc -l)\nif [[ ${count_sa} -gt 0 ]]; then\n echo "false"\n exit\nfi\n\nfor ns in $(kubectl get ns --no-headers -o custom-columns=":metadata.name")\ndo\n for result in $(kubectl get clusterrolebinding,rolebinding -n $ns -o json | jq -r \'.items[] | select((.subjects[].kind=="ServiceAccount" and .subjects[].name=="default") or (.subjects[].kind=="Group" and .subjects[].name=="system:serviceaccounts"))\' | jq -r \'"\\(.roleRef.kind),\\(.roleRef.name)"\')\n do\n read kind name <<<$(IFS=","; echo $result)\n resource_count=$(kubectl get $kind $name -n $ns -o json | jq -r \'.rules[] | select(.resources[] != "podsecuritypolicies")\' | wc -l)\n if [[ ${resource_count} -gt 0 ]]; then\n echo "false"\n exit\n fi\n done\ndone\n\n\necho "true"\n')),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Execution:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"./check_for_default_sa.sh\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'true' is equal to 'true'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"true\n")),(0,n.kt)("h3",{id:"516-ensure-that-service-account-tokens-are-only-mounted-where-necessary-manual"},"5.1.6 Ensure that Service Account Tokens are only mounted where necessary (Manual)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," warn"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nModify the definition of pods and service accounts which do not need to mount service\naccount tokens to disable it."),(0,n.kt)("h2",{id:"52-pod-security-policies"},"5.2 Pod Security Policies"),(0,n.kt)("h3",{id:"521-minimize-the-admission-of-privileged-containers-manual"},"5.2.1 Minimize the admission of privileged containers (Manual)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," warn"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nCreate a PSP as described in the Kubernetes documentation, ensuring that\nthe .spec.privileged field is omitted or set to false."),(0,n.kt)("h3",{id:"522-minimize-the-admission-of-containers-wishing-to-share-the-host-process-id-namespace-automated"},"5.2.2 Minimize the admission of containers wishing to share the host process ID namespace (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nCreate a PSP as described in the Kubernetes documentation, ensuring that the\n.spec.hostPID field is omitted or set to false."),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get psp -o json | jq .items[] | jq -r 'select((.spec.hostPID == null) or (.spec.hostPID == false))' | jq .metadata.name | wc -l | xargs -I {} echo '--count={}'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"1 is greater than 0\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"--count=1\n")),(0,n.kt)("h3",{id:"523-minimize-the-admission-of-containers-wishing-to-share-the-host-ipc-namespace-automated"},"5.2.3 Minimize the admission of containers wishing to share the host IPC namespace (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nCreate a PSP as described in the Kubernetes documentation, ensuring that the\n.spec.hostIPC field is omitted or set to false."),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get psp -o json | jq .items[] | jq -r 'select((.spec.hostIPC == null) or (.spec.hostIPC == false))' | jq .metadata.name | wc -l | xargs -I {} echo '--count={}'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"1 is greater than 0\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"--count=1\n")),(0,n.kt)("h3",{id:"524-minimize-the-admission-of-containers-wishing-to-share-the-host-network-namespace-automated"},"5.2.4 Minimize the admission of containers wishing to share the host network namespace (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nCreate a PSP as described in the Kubernetes documentation, ensuring that the\n.spec.hostNetwork field is omitted or set to false."),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get psp -o json | jq .items[] | jq -r 'select((.spec.hostNetwork == null) or (.spec.hostNetwork == false))' | jq .metadata.name | wc -l | xargs -I {} echo '--count={}'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"1 is greater than 0\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"--count=1\n")),(0,n.kt)("h3",{id:"525-minimize-the-admission-of-containers-with-allowprivilegeescalation-automated"},"5.2.5 Minimize the admission of containers with allowPrivilegeEscalation (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nCreate a PSP as described in the Kubernetes documentation, ensuring that the\n.spec.allowPrivilegeEscalation field is omitted or set to false."),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get psp -o json | jq .items[] | jq -r 'select((.spec.allowPrivilegeEscalation == null) or (.spec.allowPrivilegeEscalation == false))' | jq .metadata.name | wc -l | xargs -I {} echo '--count={}'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"1 is greater than 0\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"--count=1\n")),(0,n.kt)("h3",{id:"526-minimize-the-admission-of-root-containers-manual"},"5.2.6 Minimize the admission of root containers (Manual)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," warn"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nCreate a PSP as described in the Kubernetes documentation, ensuring that the\n.spec.runAsUser.rule is set to either MustRunAsNonRoot or MustRunAs with the range of\nUIDs not including 0."),(0,n.kt)("h3",{id:"527-minimize-the-admission-of-containers-with-the-net_raw-capability-manual"},"5.2.7 Minimize the admission of containers with the NET_RAW capability (Manual)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," warn"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nCreate a PSP as described in the Kubernetes documentation, ensuring that the\n.spec.requiredDropCapabilities is set to include either NET_RAW or ALL."),(0,n.kt)("h3",{id:"528-minimize-the-admission-of-containers-with-added-capabilities-manual"},"5.2.8 Minimize the admission of containers with added capabilities (Manual)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," warn"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEnsure that allowedCapabilities is not present in PSPs for the cluster unless\nit is set to an empty array."),(0,n.kt)("h3",{id:"529-minimize-the-admission-of-containers-with-capabilities-assigned-manual"},"5.2.9 Minimize the admission of containers with capabilities assigned (Manual)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," warn"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nReview the use of capabilites in applications runnning on your cluster. Where a namespace\ncontains applicaions which do not require any Linux capabities to operate consider adding\na PSP which forbids the admission of containers which do not drop all capabilities."),(0,n.kt)("h2",{id:"53-network-policies-and-cni"},"5.3 Network Policies and CNI"),(0,n.kt)("h3",{id:"531-ensure-that-the-cni-in-use-supports-network-policies-manual"},"5.3.1 Ensure that the CNI in use supports Network Policies (Manual)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," warn"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nIf the CNI plugin in use does not support network policies, consideration should be given to\nmaking use of a different plugin, or finding an alternate mechanism for restricting traffic\nin the Kubernetes cluster."),(0,n.kt)("h3",{id:"532-ensure-that-all-namespaces-have-network-policies-defined-automated"},"5.3.2 Ensure that all Namespaces have Network Policies defined (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nFollow the documentation and create NetworkPolicy objects as you need them."),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Script:")," ",(0,n.kt)("inlineCode",{parentName:"p"},"check_for_network_policies.sh")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"#!/bin/bash\n\nset -eE\n\nhandle_error() {\n echo \"false\"\n}\n\ntrap 'handle_error' ERR\n\nfor namespace in $(kubectl get namespaces --all-namespaces -o json | jq -r '.items[].metadata.name'); do\n policy_count=$(kubectl get networkpolicy -n ${namespace} -o json | jq '.items | length')\n if [[ ${policy_count} -eq 0 ]]; then\n echo \"false\"\n exit\n fi\ndone\n\necho \"true\"\n\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Execution:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"./check_for_network_policies.sh\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'true' is equal to 'true'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"true\n")),(0,n.kt)("h2",{id:"54-secrets-management"},"5.4 Secrets Management"),(0,n.kt)("h3",{id:"541-prefer-using-secrets-as-files-over-secrets-as-environment-variables-manual"},"5.4.1 Prefer using secrets as files over secrets as environment variables (Manual)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," warn"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nif possible, rewrite application code to read secrets from mounted secret files, rather than\nfrom environment variables."),(0,n.kt)("h3",{id:"542-consider-external-secret-storage-manual"},"5.4.2 Consider external secret storage (Manual)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," warn"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nRefer to the secrets management options offered by your cloud provider or a third-party\nsecrets management solution."),(0,n.kt)("h2",{id:"55-extensible-admission-control"},"5.5 Extensible Admission Control"),(0,n.kt)("h3",{id:"551-configure-image-provenance-using-imagepolicywebhook-admission-controller-manual"},"5.5.1 Configure Image Provenance using ImagePolicyWebhook admission controller (Manual)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," warn"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nFollow the Kubernetes documentation and setup image provenance."),(0,n.kt)("h2",{id:"57-general-policies"},"5.7 General Policies"),(0,n.kt)("h3",{id:"571-create-administrative-boundaries-between-resources-using-namespaces-manual"},"5.7.1 Create administrative boundaries between resources using namespaces (Manual)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," warn"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nFollow the documentation and create namespaces for objects in your deployment as you need\nthem."),(0,n.kt)("h3",{id:"572-ensure-that-the-seccomp-profile-is-set-to-dockerdefault-in-your-pod-definitions-manual"},"5.7.2 Ensure that the seccomp profile is set to docker/default in your pod definitions (Manual)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," warn"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),'\nSeccomp is an alpha feature currently. By default, all alpha features are disabled. So, you\nwould need to enable alpha features in the apiserver by passing "--feature-\ngates=AllAlpha=true" argument.\nEdit the /etc/kubernetes/apiserver file on the master node and set the KUBE_API_ARGS\nparameter to "--feature-gates=AllAlpha=true"\nKUBE_API_ARGS="--feature-gates=AllAlpha=true"\nBased on your system, restart the kube-apiserver service. For example:\nsystemctl restart kube-apiserver.service\nUse annotations to enable the docker/default seccomp profile in your pod definitions. An\nexample is as below:\napiVersion: v1\nkind: Pod\nmetadata:\nname: trustworthy-pod\nannotations:\nseccomp.security.alpha.kubernetes.io/pod: docker/default\nspec:\ncontainers:'),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"name: trustworthy-container\nimage: sotrustworthy:latest")),(0,n.kt)("h3",{id:"573-apply-security-context-to-your-pods-and-containers-manual"},"5.7.3 Apply Security Context to Your Pods and Containers (Manual)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," warn"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nFollow the Kubernetes documentation and apply security contexts to your pods. For a\nsuggested list of security contexts, you may refer to the CIS Security Benchmark for Docker\nContainers."),(0,n.kt)("h3",{id:"574-the-default-namespace-should-not-be-used-automated"},"5.7.4 The default namespace should not be used (Automated)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Result:")," pass"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Remediation:"),"\nEnsure that namespaces are created to allow for appropriate segregation of Kubernetes\nresources and that all new resources are created in a specific namespace."),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Script:")," ",(0,n.kt)("inlineCode",{parentName:"p"},"check_for_default_ns.sh")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},'#!/bin/bash\n\nset -eE\n\nhandle_error() {\n echo "false"\n}\n\ntrap \'handle_error\' ERR\n\ncount=$(kubectl get all -n default -o json | jq .items[] | jq -r \'select((.metadata.name!="kubernetes"))\' | jq .metadata.name | wc -l)\nif [[ ${count} -gt 0 ]]; then\n echo "false"\n exit\nfi\n\necho "true"\n\n\n')),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Execution:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"./check_for_default_ns.sh\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Expected Result"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"'true' is equal to 'true'\n")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Returned Value"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-console"},"true\n")))}p.isMDXComponent=!0}}]);