Files
rancher-docs/zh/assets/js/3f4d0489.7dcdaaed.js
T

1 line
257 KiB
JavaScript

"use strict";(self.webpackChunkrancher_docs=self.webpackChunkrancher_docs||[]).push([[43583],{3905:(e,t,r)=>{r.d(t,{Zo:()=>u,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 l(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 o=a.createContext({}),c=function(e){var t=a.useContext(o),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},u=function(e){var t=c(e.components);return a.createElement(o.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,o=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=c(r),k=n,h=d["".concat(o,".").concat(k)]||d[k]||p[k]||s;return r?a.createElement(h,i(i({ref:t},u),{},{components:r})):a.createElement(h,i({ref:t},u))}));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 l={};for(var o in t)hasOwnProperty.call(t,o)&&(l[o]=t[o]);l.originalType=e,l.mdxType="string"==typeof e?e:n,i[1]=l;for(var c=2;c<s;c++)i[c]=r[c];return a.createElement.apply(null,i)}return a.createElement.apply(null,r)}d.displayName="MDXCreateElement"},36655:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>o,contentTitle:()=>i,default:()=>p,frontMatter:()=>s,metadata:()=>l,toc:()=>c});var a=r(87462),n=(r(67294),r(3905));const s={title:"K3s CIS v1.20 Benchmark - Self-Assessment Guide - Rancher v2.7"},i=void 0,l={unversionedId:"reference-guides/rancher-security/rancher-v2.7-hardening-guides/k3s-self-assessment-guide-with-cis-v1.20-benchmark",id:"reference-guides/rancher-security/rancher-v2.7-hardening-guides/k3s-self-assessment-guide-with-cis-v1.20-benchmark",title:"K3s CIS v1.20 Benchmark - Self-Assessment Guide - Rancher v2.7",description:"K3s CIS Kubernetes Benchmark v1.20 - K3s with Kubernetes v1.21",source:"@site/docs/reference-guides/rancher-security/rancher-v2.7-hardening-guides/k3s-self-assessment-guide-with-cis-v1.20-benchmark.md",sourceDirName:"reference-guides/rancher-security/rancher-v2.7-hardening-guides",slug:"/reference-guides/rancher-security/rancher-v2.7-hardening-guides/k3s-self-assessment-guide-with-cis-v1.20-benchmark",permalink:"/zh/reference-guides/rancher-security/rancher-v2.7-hardening-guides/k3s-self-assessment-guide-with-cis-v1.20-benchmark",draft:!1,editUrl:"https://github.com/rancher/rancher-docs/edit/main/docs/reference-guides/rancher-security/rancher-v2.7-hardening-guides/k3s-self-assessment-guide-with-cis-v1.20-benchmark.md",tags:[],version:"current",lastUpdatedAt:1664960242,formattedLastUpdatedAt:"2022\u5e7410\u67085\u65e5",frontMatter:{title:"K3s CIS v1.20 Benchmark - Self-Assessment Guide - Rancher v2.7"},sidebar:"tutorialSidebar",previous:{title:"K3s Hardening Guide with CIS Benchmark",permalink:"/zh/reference-guides/rancher-security/rancher-v2.7-hardening-guides/k3s-hardening-guide-with-cis-benchmark"},next:{title:"K3s CIS v1.23 Benchmark - Self-Assessment Guide - Rancher v2.7",permalink:"/zh/reference-guides/rancher-security/rancher-v2.7-hardening-guides/k3s-self-assessment-guide-with-cis-v1.23-benchmark"}},o={},c=[{value:"K3s CIS Kubernetes Benchmark v1.20 - K3s with Kubernetes v1.21",id:"k3s-cis-kubernetes-benchmark-v120---k3s-with-kubernetes-v121",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 (Manual)",id:"1120-ensure-that-the-kubernetes-pki-certificate-file-permissions-are-set-to-644-or-more-restrictive-manual",level:3},{value:"1.1.21 Ensure that the Kubernetes PKI key file permissions are set to 600 (Manual)",id:"1121-ensure-that-the-kubernetes-pki-key-file-permissions-are-set-to-600-manual",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 (Manual)",id:"121-ensure-that-the---anonymous-auth-argument-is-set-to-false-manual",level:3},{value:"1.2.2 Ensure that the --token-auth-file parameter is not set (Automated)",id:"122-ensure-that-the---token-auth-file-parameter-is-not-set-automated",level:3},{value:"1.2.3 Ensure that the --kubelet-https argument is set to true (Automated)",id:"123-ensure-that-the---kubelet-https-argument-is-set-to-true-automated",level:3},{value:"1.2.4 Ensure that the --kubelet-client-certificate and --kubelet-client-key arguments are set as appropriate (Automated)",id:"124-ensure-that-the---kubelet-client-certificate-and---kubelet-client-key-arguments-are-set-as-appropriate-automated",level:3},{value:"1.2.5 Ensure that the --kubelet-certificate-authority argument is set as appropriate (Automated)",id:"125-ensure-that-the---kubelet-certificate-authority-argument-is-set-as-appropriate-automated",level:3},{value:"1.2.6 Ensure that the --authorization-mode argument is not set to AlwaysAllow (Automated)",id:"126-ensure-that-the---authorization-mode-argument-is-not-set-to-alwaysallow-automated",level:3},{value:"1.2.7 Ensure that the --authorization-mode argument includes Node (Automated)",id:"127-ensure-that-the---authorization-mode-argument-includes-node-automated",level:3},{value:"1.2.8 Ensure that the --authorization-mode argument includes RBAC (Automated)",id:"128-ensure-that-the---authorization-mode-argument-includes-rbac-automated",level:3},{value:"1.2.9 Ensure that the admission control plugin EventRateLimit is set (Manual)",id:"129-ensure-that-the-admission-control-plugin-eventratelimit-is-set-manual",level:3},{value:"1.2.10 Ensure that the admission control plugin AlwaysAdmit is not set (Automated)",id:"1210-ensure-that-the-admission-control-plugin-alwaysadmit-is-not-set-automated",level:3},{value:"1.2.11 Ensure that the admission control plugin AlwaysPullImages is set (Manual)",id:"1211-ensure-that-the-admission-control-plugin-alwayspullimages-is-set-manual",level:3},{value:"1.2.12 Ensure that the admission control plugin SecurityContextDeny is set if PodSecurityPolicy is not used (Manual)",id:"1212-ensure-that-the-admission-control-plugin-securitycontextdeny-is-set-if-podsecuritypolicy-is-not-used-manual",level:3},{value:"1.2.13 Ensure that the admission control plugin ServiceAccount is set (Automated)",id:"1213-ensure-that-the-admission-control-plugin-serviceaccount-is-set-automated",level:3},{value:"1.2.14 Ensure that the admission control plugin NamespaceLifecycle is set (Automated)",id:"1214-ensure-that-the-admission-control-plugin-namespacelifecycle-is-set-automated",level:3},{value:"1.2.15 Ensure that the admission control plugin PodSecurityPolicy is set (Automated)",id:"1215-ensure-that-the-admission-control-plugin-podsecuritypolicy-is-set-automated",level:3},{value:"1.2.16 Ensure that the admission control plugin NodeRestriction is set (Automated)",id:"1216-ensure-that-the-admission-control-plugin-noderestriction-is-set-automated",level:3},{value:"1.2.17 Ensure that the --insecure-bind-address argument is not set (Automated)",id:"1217-ensure-that-the---insecure-bind-address-argument-is-not-set-automated",level:3},{value:"1.2.18 Ensure that the --insecure-port argument is set to 0 (Automated)",id:"1218-ensure-that-the---insecure-port-argument-is-set-to-0-automated",level:3},{value:"1.2.19 Ensure that the --secure-port argument is not set to 0 (Automated)",id:"1219-ensure-that-the---secure-port-argument-is-not-set-to-0-automated",level:3},{value:"1.2.20 Ensure that the --profiling argument is set to false (Automated)",id:"1220-ensure-that-the---profiling-argument-is-set-to-false-automated",level:3},{value:"1.2.21 Ensure that the --audit-log-path argument is set (Automated)",id:"1221-ensure-that-the---audit-log-path-argument-is-set-automated",level:3},{value:"1.2.22 Ensure that the --audit-log-maxage argument is set to 30 or as appropriate (Automated)",id:"1222-ensure-that-the---audit-log-maxage-argument-is-set-to-30-or-as-appropriate-automated",level:3},{value:"1.2.23 Ensure that the --audit-log-maxbackup argument is set to 10 or as appropriate (Automated)",id:"1223-ensure-that-the---audit-log-maxbackup-argument-is-set-to-10-or-as-appropriate-automated",level:3},{value:"1.2.24 Ensure that the --audit-log-maxsize argument is set to 100 or as appropriate (Automated)",id:"1224-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-key-file argument is set as appropriate (Automated)",id:"1227-ensure-that-the---service-account-key-file-argument-is-set-as-appropriate-automated",level:3},{value:"1.2.28 Ensure that the --etcd-certfile and --etcd-keyfile arguments are set as appropriate (Automated)",id:"1228-ensure-that-the---etcd-certfile-and---etcd-keyfile-arguments-are-set-as-appropriate-automated",level:3},{value:"1.2.29 Ensure that the --tls-cert-file and --tls-private-key-file arguments are set as appropriate (Automated)",id:"1229-ensure-that-the---tls-cert-file-and---tls-private-key-file-arguments-are-set-as-appropriate-automated",level:3},{value:"1.2.30 Ensure that the --client-ca-file argument is set as appropriate (Automated)",id:"1230-ensure-that-the---client-ca-file-argument-is-set-as-appropriate-automated",level:3},{value:"1.2.31 Ensure that the --etcd-cafile argument is set as appropriate (Automated)",id:"1231-ensure-that-the---etcd-cafile-argument-is-set-as-appropriate-automated",level:3},{value:"1.2.32 Ensure that the --encryption-provider-config argument is set as appropriate (Manual)",id:"1232-ensure-that-the---encryption-provider-config-argument-is-set-as-appropriate-manual",level:3},{value:"1.2.33 Ensure that encryption providers are appropriately configured (Manual)",id:"1233-ensure-that-encryption-providers-are-appropriately-configured-manual",level:3},{value:"1.2.34 Ensure that the API Server only makes use of Strong Cryptographic Ciphers (Manual)",id:"1234-ensure-that-the-api-server-only-makes-use-of-strong-cryptographic-ciphers-manual",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 (Manual)",id:"131-ensure-that-the---terminated-pod-gc-threshold-argument-is-set-as-appropriate-manual",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 (Manual)",id:"27-ensure-that-a-unique-certificate-authority-is-used-for-etcd-manual",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 (Manual)",id:"321-ensure-that-a-minimal-audit-policy-is-created-manual",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 (Manual)",id:"413-if-proxy-kubeconfig-file-exists-ensure-permissions-are-set-to-644-or-more-restrictive-manual",level:3},{value:"4.1.4 If proxy kubeconfig file exists ensure ownership is set to root:root (Manual)",id:"414-if-proxy-kubeconfig-file-exists-ensure-ownership-is-set-to-rootroot-manual",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 (Manual)",id:"417-ensure-that-the-certificate-authorities-file-permissions-are-set-to-644-or-more-restrictive-manual",level:3},{value:"4.1.8 Ensure that the client certificate authorities file ownership is set to root:root (Manual)",id:"418-ensure-that-the-client-certificate-authorities-file-ownership-is-set-to-rootroot-manual",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 (Manual)",id:"424-ensure-that-the---read-only-port-argument-is-set-to-0-manual",level:3},{value:"4.2.5 Ensure that the --streaming-connection-idle-timeout argument is not set to 0 (Manual)",id:"425-ensure-that-the---streaming-connection-idle-timeout-argument-is-not-set-to-0-manual",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 (Manual)",id:"429-ensure-that-the---event-qps-argument-is-set-to-0-or-a-level-which-ensures-appropriate-event-capture-manual",level:3},{value:"4.2.10 Ensure that the --tls-cert-file and --tls-private-key-file arguments are set as appropriate (Manual)",id:"4210-ensure-that-the---tls-cert-file-and---tls-private-key-file-arguments-are-set-as-appropriate-manual",level:3},{value:"4.2.11 Ensure that the --rotate-certificates argument is not set to false (Manual)",id:"4211-ensure-that-the---rotate-certificates-argument-is-not-set-to-false-manual",level:3},{value:"4.2.12 Verify that the RotateKubeletServerCertificate argument is set to true (Manual)",id:"4212-verify-that-the-rotatekubeletservercertificate-argument-is-set-to-true-manual",level:3},{value:"4.2.13 Ensure that the Kubelet only makes use of Strong Cryptographic Ciphers (Manual)",id:"4213-ensure-that-the-kubelet-only-makes-use-of-strong-cryptographic-ciphers-manual",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. (Manual)",id:"515-ensure-that-default-service-accounts-are-not-actively-used-manual",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.1.7 Avoid use of system:masters group (Manual)",id:"517-avoid-use-of-systemmasters-group-manual",level:3},{value:"5.1.8 Limit use of the Bind, Impersonate and Escalate permissions in the Kubernetes cluster (Manual)",id:"518-limit-use-of-the-bind-impersonate-and-escalate-permissions-in-the-kubernetes-cluster-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 (Automated)",id:"521-minimize-the-admission-of-privileged-containers-automated",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 (Automated)",id:"526-minimize-the-admission-of-root-containers-automated",level:3},{value:"5.2.7 Minimize the admission of containers with the NET_RAW capability (Automated)",id:"527-minimize-the-admission-of-containers-with-the-net_raw-capability-automated",level:3},{value:"5.2.8 Minimize the admission of containers with added capabilities (Automated)",id:"528-minimize-the-admission-of-containers-with-added-capabilities-automated",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 (Manual)",id:"532-ensure-that-all-namespaces-have-network-policies-defined-manual",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 (Manual)",id:"574-the-default-namespace-should-not-be-used-manual",level:3}],u={toc:c};function p(e){let{components:t,...r}=e;return(0,n.kt)("wrapper",(0,a.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h3",{id:"k3s-cis-kubernetes-benchmark-v120---k3s-with-kubernetes-v121"},"K3s CIS Kubernetes Benchmark v1.20 - K3s with Kubernetes v1.21"),(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:"/zh/reference-guides/rancher-security/rancher-v2.7-hardening-guides/k3s-hardening-guide-with-cis-benchmark"},"Rancher v2.7 K3s security hardening guide"),". The hardening guide provides prescriptive guidance for hardening a production installation of Rancher with K3s provisioned clusters, and this benchmark guide is meant to help you evaluate the level of security of the hardened cluster against each control in the CIS Kubernetes 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"),(0,n.kt)("td",{parentName:"tr",align:null},"Rancher v2.7"),(0,n.kt)("td",{parentName:"tr",align:null},"CIS v1.20"),(0,n.kt)("td",{parentName:"tr",align:null},"Kubernetes v1.21")))),(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 information about each control, including detailed descriptions and remediations for failing tests, you can refer to the corresponding section of the CIS Kubernetes Benchmark v1.20. 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,"Each control in the CIS Kubernetes Benchmark was evaluated against a K3s cluster that was configured according to the accompanying hardening guide."),(0,n.kt)("p",null,"Where control audits differ from the original CIS benchmark, the audit commands specific to K3s are provided for testing."),(0,n.kt)("p",null,"These are the possible results for each control:"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("strong",{parentName:"li"},"Pass")," - The K3s cluster under test passed the audit outlined in the benchmark."),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("strong",{parentName:"li"},"Not Applicable")," - The control is not applicable to K3s because of how it is designed to operate. The remediation section will explain why this is so."),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("strong",{parentName:"li"},"Warn")," - The control is manual in the CIS benchmark and it depends on the cluster's use case or some other factor that must be determined by the cluster operator. These controls have been evaluated to ensure K3s does not prevent their implementation, but no further configuration or auditing of the cluster under test has been performed.")),(0,n.kt)("p",null,'This guide makes the assumption that K3s is running as a Systemd unit. Your installation may vary and will require you to adjust the "audit" commands to fit your scenario.'),(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)("hr",null),(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:"),"\nRun the below command (based on the file location on your system) on the\nmaster node.\nFor example, chmod 644 /etc/kubernetes/manifests/kube-apiserver.yaml"),(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:"),"\nRun the below command (based on the file location on your system) on the master node.\nFor example,\nchown root:root /etc/kubernetes/manifests/kube-apiserver.yaml"),(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:"),"\nRun the below command (based on the file location on your system) on the master node.\nFor example,\nchmod 644 /etc/kubernetes/manifests/kube-controller-manager.yaml"),(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:"),"\nRun the below command (based on the file location on your system) on the master node.\nFor example,\nchown root:root /etc/kubernetes/manifests/kube-controller-manager.yaml"),(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:"),"\nRun the below command (based on the file location on your system) on the master node.\nFor example,\nchmod 644 /etc/kubernetes/manifests/kube-scheduler.yaml"),(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:"),"\nRun the below command (based on the file location on your system) on the master node.\nFor example,\nchown root:root /etc/kubernetes/manifests/kube-scheduler.yaml"),(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:"),"\nRun the below command (based on the file location on your system) on the master node.\nFor example,\nchmod 644 /etc/kubernetes/manifests/etcd.yaml"),(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:"),"\nRun the below command (based on the file location on your system) on the master node.\nFor example,\nchown root:root /etc/kubernetes/manifests/etcd.yaml"),(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:")," Not Applicable"),(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)("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:")," Not Applicable"),(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)("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\nRun 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 Script:")," ",(0,n.kt)("inlineCode",{parentName:"p"},"check_for_k3s_etcd.sh")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},'#!/bin/bash\n\n# This script is used to ensure that k3s is actually running etcd (and not other databases like sqlite3)\n# before it checks the requirement\nset -eE\n\nhandle_error() {\n echo "false"\n}\n\ntrap \'handle_error\' ERR\n\n\nif [[ "$(journalctl -D /var/log/journal -u k3s | grep \'Managed etcd cluster initializing\' | grep -v grep | wc -l)" -gt 0 ]]; then\n case $1 in \n "1.1.11")\n echo $(stat -c %a /var/lib/rancher/k3s/server/db/etcd);;\n "1.2.29")\n echo $(journalctl -D /var/log/journal -u k3s | grep \'Running kube-apiserver\' | tail -n1 | grep \'etcd-\');;\n "2.1")\n echo $(grep -A 5 \'client-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep -E \'cert-file|key-file\');;\n "2.2")\n echo $(grep -A 5 \'client-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep \'client-cert-auth\');;\n "2.3")\n echo $(grep \'auto-tls\' /var/lib/rancher/k3s/server/db/etcd/config);;\n "2.4")\n echo $(grep -A 5 \'peer-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep -E \'cert-file|key-file\');;\n "2.5")\n echo $(grep -A 5 \'peer-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep \'client-cert-auth\');;\n "2.6")\n echo $(grep \'peer-auto-tls\' /var/lib/rancher/k3s/server/db/etcd/config);;\n "2.7")\n echo $(grep \'trusted-ca-file\' /var/lib/rancher/k3s/server/db/etcd/config);;\n esac\nelse\n# If another database is running, return whatever is required to pass the scan\n case $1 in\n "1.1.11")\n echo "700";;\n "1.2.29")\n echo "--etcd-certfile AND --etcd-keyfile";;\n "2.1")\n echo "cert-file AND key-file";;\n "2.2")\n echo "--client-cert-auth=true";;\n "2.3")\n echo "false";;\n "2.4")\n echo "peer-cert-file AND peer-key-file";;\n "2.5")\n echo "--client-cert-auth=true";;\n "2.6")\n echo "--peer-auto-tls=false";;\n "2.7")\n echo "--trusted-ca-file";;\n esac\nfi\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_k3s_etcd.sh 1.1.11\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:")," Not Applicable"),(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)("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:"),"\nRun the below command (based on the file location on your system) on the master node.\nFor example,\nchmod 644 /var/lib/rancher/k3s/server/cred/admin.kubeconfig"),(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:")," 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 root:root /etc/kubernetes/admin.conf"),(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 /var/lib/rancher/k3s/server/cred/admin.kubeconfig; then stat -c %U:%G /var/lib/rancher/k3s/server/cred/admin.kubeconfig; 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:"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:")," 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 644 scheduler"),(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 /var/lib/rancher/k3s/server/cred/scheduler.kubeconfig; then stat -c permissions=%a /var/lib/rancher/k3s/server/cred/scheduler.kubeconfig; 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 has permissions 644, expected 644 or more restrictive\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"},"permissions=644\n")),(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:")," 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 root:root scheduler"),(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 /var/lib/rancher/k3s/server/cred/scheduler.kubeconfig; then stat -c %U:%G /var/lib/rancher/k3s/server/cred/scheduler.kubeconfig; 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 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:root\n")),(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:")," 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 644 controllermanager"),(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 /var/lib/rancher/k3s/server/cred/controller.kubeconfig; then stat -c permissions=%a /var/lib/rancher/k3s/server/cred/controller.kubeconfig; 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 has permissions 644, expected 644 or more restrictive\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"},"permissions=644\n")),(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:")," 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 root:root controllermanager"),(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 /var/lib/rancher/k3s/server/tls\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:"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:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"find /var/lib/rancher/k3s/server/tls | xargs stat -c %U:%G\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 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:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root root:root\n")),(0,n.kt)("h3",{id:"1120-ensure-that-the-kubernetes-pki-certificate-file-permissions-are-set-to-644-or-more-restrictive-manual"},"1.1.20 Ensure that the Kubernetes PKI certificate 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 -R 644 /etc/kubernetes/pki/*.crt"),(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 %n %a /var/lib/rancher/k3s/server/tls/*.crt\n")),(0,n.kt)("h3",{id:"1121-ensure-that-the-kubernetes-pki-key-file-permissions-are-set-to-600-manual"},"1.1.21 Ensure that the Kubernetes PKI key file permissions are set to 600 (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 -R 600 /etc/kubernetes/pki/*.key"),(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 %n %a /var/lib/rancher/k3s/server/tls/*.key\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-manual"},"1.2.1 Ensure that the --anonymous-auth argument is set to false (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 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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'anonymous-auth'\n")),(0,n.kt)("h3",{id:"122-ensure-that-the---token-auth-file-parameter-is-not-set-automated"},"1.2.2 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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | 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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"123-ensure-that-the---kubelet-https-argument-is-set-to-true-automated"},"1.2.3 Ensure that the --kubelet-https 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 API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml\non the master node and remove the --kubelet-https parameter."),(0,n.kt)("h3",{id:"124-ensure-that-the---kubelet-client-certificate-and---kubelet-client-key-arguments-are-set-as-appropriate-automated"},"1.2.4 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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'kubelet-certificate-authority'\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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"125-ensure-that-the---kubelet-certificate-authority-argument-is-set-as-appropriate-automated"},"1.2.5 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--kubelet-certificate-authority parameter to the path to the cert file for the certificate authority.\n--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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'kubelet-certificate-authority'\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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"126-ensure-that-the---authorization-mode-argument-is-not-set-to-alwaysallow-automated"},"1.2.6 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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'authorization-mode'\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"},"'--authorization-mode' does 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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"127-ensure-that-the---authorization-mode-argument-includes-node-automated"},"1.2.7 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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'authorization-mode'\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"},"'--authorization-mode' 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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"128-ensure-that-the---authorization-mode-argument-includes-rbac-automated"},"1.2.8 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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'authorization-mode'\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"},"'--authorization-mode' 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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"129-ensure-that-the-admission-control-plugin-eventratelimit-is-set-manual"},"1.2.9 Ensure that the admission control plugin EventRateLimit 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:"),"\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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'enable-admission-plugins'\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"},"'--enable-admission-plugins' 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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"1210-ensure-that-the-admission-control-plugin-alwaysadmit-is-not-set-automated"},"1.2.10 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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'enable-admission-plugins'\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"},"'--enable-admission-plugins' does 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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"1211-ensure-that-the-admission-control-plugin-alwayspullimages-is-set-manual"},"1.2.11 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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'enable-admission-plugins'\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"},"'--enable-admission-plugins' has 'AlwaysPullImages'\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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"1212-ensure-that-the-admission-control-plugin-securitycontextdeny-is-set-if-podsecuritypolicy-is-not-used-manual"},"1.2.12 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:")," 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 --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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'enable-admission-plugins'\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"},"'--enable-admission-plugins' has 'SecurityContextDeny' OR '--enable-admission-plugins' 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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"1213-ensure-that-the-admission-control-plugin-serviceaccount-is-set-automated"},"1.2.13 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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'ServiceAccount'\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 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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"1214-ensure-that-the-admission-control-plugin-namespacelifecycle-is-set-automated"},"1.2.14 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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | 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 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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"1215-ensure-that-the-admission-control-plugin-podsecuritypolicy-is-set-automated"},"1.2.15 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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'enable-admission-plugins'\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"},"'--enable-admission-plugins' 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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"1216-ensure-that-the-admission-control-plugin-noderestriction-is-set-automated"},"1.2.16 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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'enable-admission-plugins'\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"},"'--enable-admission-plugins' 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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"1217-ensure-that-the---insecure-bind-address-argument-is-not-set-automated"},"1.2.17 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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | 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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"1218-ensure-that-the---insecure-port-argument-is-set-to-0-automated"},"1.2.18 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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1\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-port' is present OR '--insecure-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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"1219-ensure-that-the---secure-port-argument-is-not-set-to-0-automated"},"1.2.19 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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'secure-port'\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"},"'--secure-port' 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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"1220-ensure-that-the---profiling-argument-is-set-to-false-automated"},"1.2.20 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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'profiling'\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"},"'--profiling' 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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"1221-ensure-that-the---audit-log-path-argument-is-set-automated"},"1.2.21 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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'audit-log-path'\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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"1222-ensure-that-the---audit-log-maxage-argument-is-set-to-30-or-as-appropriate-automated"},"1.2.22 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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'audit-log-maxage'\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-maxage' 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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"1223-ensure-that-the---audit-log-maxbackup-argument-is-set-to-10-or-as-appropriate-automated"},"1.2.23 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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'audit-log-maxbackup'\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-maxbackup' 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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"1224-ensure-that-the---audit-log-maxsize-argument-is-set-to-100-or-as-appropriate-automated"},"1.2.24 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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'audit-log-maxsize'\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-maxsize' 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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\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\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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'service-account-lookup'\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 '--service-account-lookup' 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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"1227-ensure-that-the---service-account-key-file-argument-is-set-as-appropriate-automated"},"1.2.27 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--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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'service-account-key-file'\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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"1228-ensure-that-the---etcd-certfile-and---etcd-keyfile-arguments-are-set-as-appropriate-automated"},"1.2.28 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--etcd-certfile='path/to/client-certificate-file'\n--etcd-keyfile='path/to/client-key-file'"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Script:")," ",(0,n.kt)("inlineCode",{parentName:"p"},"check_for_k3s_etcd.sh")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},'#!/bin/bash\n\n# This script is used to ensure that k3s is actually running etcd (and not other databases like sqlite3)\n# before it checks the requirement\nset -eE\n\nhandle_error() {\n echo "false"\n}\n\ntrap \'handle_error\' ERR\n\n\nif [[ "$(journalctl -D /var/log/journal -u k3s | grep \'Managed etcd cluster initializing\' | grep -v grep | wc -l)" -gt 0 ]]; then\n case $1 in \n "1.1.11")\n echo $(stat -c %a /var/lib/rancher/k3s/server/db/etcd);;\n "1.2.29")\n echo $(journalctl -D /var/log/journal -u k3s | grep \'Running kube-apiserver\' | tail -n1 | grep \'etcd-\');;\n "2.1")\n echo $(grep -A 5 \'client-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep -E \'cert-file|key-file\');;\n "2.2")\n echo $(grep -A 5 \'client-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep \'client-cert-auth\');;\n "2.3")\n echo $(grep \'auto-tls\' /var/lib/rancher/k3s/server/db/etcd/config);;\n "2.4")\n echo $(grep -A 5 \'peer-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep -E \'cert-file|key-file\');;\n "2.5")\n echo $(grep -A 5 \'peer-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep \'client-cert-auth\');;\n "2.6")\n echo $(grep \'peer-auto-tls\' /var/lib/rancher/k3s/server/db/etcd/config);;\n "2.7")\n echo $(grep \'trusted-ca-file\' /var/lib/rancher/k3s/server/db/etcd/config);;\n esac\nelse\n# If another database is running, return whatever is required to pass the scan\n case $1 in\n "1.1.11")\n echo "700";;\n "1.2.29")\n echo "--etcd-certfile AND --etcd-keyfile";;\n "2.1")\n echo "cert-file AND key-file";;\n "2.2")\n echo "--client-cert-auth=true";;\n "2.3")\n echo "false";;\n "2.4")\n echo "peer-cert-file AND peer-key-file";;\n "2.5")\n echo "--client-cert-auth=true";;\n "2.6")\n echo "--peer-auto-tls=false";;\n "2.7")\n echo "--trusted-ca-file";;\n esac\nfi\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_k3s_etcd.sh 1.2.29\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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"1229-ensure-that-the---tls-cert-file-and---tls-private-key-file-arguments-are-set-as-appropriate-automated"},"1.2.29 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--tls-cert-file='path/to/tls-certificate-file'\n--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"},"journalctl -D /var/log/journal -u k3s | grep -A1 'Running kube-apiserver' | tail -n2\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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key" Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-scheduler --authentication-kubeconfig=/var/lib/rancher/k3s/server/cred/scheduler.kubeconfig --authorization-kubeconfig=/var/lib/rancher/k3s/server/cred/scheduler.kubeconfig --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/kube-scheduler --kubeconfig=/var/lib/rancher/k3s/server/cred/scheduler.kubeconfig --profiling=false --secure-port=10259"\n')),(0,n.kt)("h3",{id:"1230-ensure-that-the---client-ca-file-argument-is-set-as-appropriate-automated"},"1.2.30 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--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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'client-ca-file'\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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"1231-ensure-that-the---etcd-cafile-argument-is-set-as-appropriate-automated"},"1.2.31 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--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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'etcd-cafile'\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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"1232-ensure-that-the---encryption-provider-config-argument-is-set-as-appropriate-manual"},"1.2.32 Ensure that the --encryption-provider-config argument is set as appropriate (Manual)"),(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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'encryption-provider-config'\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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"1233-ensure-that-encryption-providers-are-appropriately-configured-manual"},"1.2.33 Ensure that encryption providers are appropriately configured (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 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:")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"grep aescbc /path/to/encryption-config.json\n")),(0,n.kt)("h3",{id:"1234-ensure-that-the-api-server-only-makes-use-of-strong-cryptographic-ciphers-manual"},"1.2.34 Ensure that the API Server only makes use of Strong Cryptographic Ciphers (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 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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'tls-cipher-suites'\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-manual"},"1.3.1 Ensure that the --terminated-pod-gc-threshold argument is set as appropriate (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 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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-controller-manager' | tail -n1 | grep 'terminated-pod-gc-threshold'\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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-controller-manager' | tail -n1 | grep 'profiling'\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"},"'--profiling' 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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-controller-manager --allocate-node-cidrs=true --authentication-kubeconfig=/var/lib/rancher/k3s/server/cred/controller.kubeconfig --authorization-kubeconfig=/var/lib/rancher/k3s/server/cred/controller.kubeconfig --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/kube-controller-manager --cluster-cidr=10.42.0.0/16 --cluster-signing-kube-apiserver-client-cert-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --cluster-signing-kube-apiserver-client-key-file=/var/lib/rancher/k3s/server/tls/client-ca.key --cluster-signing-kubelet-client-cert-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --cluster-signing-kubelet-client-key-file=/var/lib/rancher/k3s/server/tls/client-ca.key --cluster-signing-kubelet-serving-cert-file=/var/lib/rancher/k3s/server/tls/server-ca.crt --cluster-signing-kubelet-serving-key-file=/var/lib/rancher/k3s/server/tls/server-ca.key --cluster-signing-legacy-unknown-cert-file=/var/lib/rancher/k3s/server/tls/server-ca.crt --cluster-signing-legacy-unknown-key-file=/var/lib/rancher/k3s/server/tls/server-ca.key --configure-cloud-routes=false --controllers=*,-service,-route,-cloud-node-lifecycle --feature-gates=JobTrackingWithFinalizers=true --kubeconfig=/var/lib/rancher/k3s/server/cred/controller.kubeconfig --profiling=false --root-ca-file=/var/lib/rancher/k3s/server/tls/server-ca.crt --secure-port=10257 --service-account-private-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-controller-manager' | tail -n1 | grep 'use-service-account-credentials'\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"},"'--use-service-account-credentials' 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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-controller-manager --allocate-node-cidrs=true --authentication-kubeconfig=/var/lib/rancher/k3s/server/cred/controller.kubeconfig --authorization-kubeconfig=/var/lib/rancher/k3s/server/cred/controller.kubeconfig --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/kube-controller-manager --cluster-cidr=10.42.0.0/16 --cluster-signing-kube-apiserver-client-cert-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --cluster-signing-kube-apiserver-client-key-file=/var/lib/rancher/k3s/server/tls/client-ca.key --cluster-signing-kubelet-client-cert-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --cluster-signing-kubelet-client-key-file=/var/lib/rancher/k3s/server/tls/client-ca.key --cluster-signing-kubelet-serving-cert-file=/var/lib/rancher/k3s/server/tls/server-ca.crt --cluster-signing-kubelet-serving-key-file=/var/lib/rancher/k3s/server/tls/server-ca.key --cluster-signing-legacy-unknown-cert-file=/var/lib/rancher/k3s/server/tls/server-ca.crt --cluster-signing-legacy-unknown-key-file=/var/lib/rancher/k3s/server/tls/server-ca.key --configure-cloud-routes=false --controllers=*,-service,-route,-cloud-node-lifecycle --feature-gates=JobTrackingWithFinalizers=true --kubeconfig=/var/lib/rancher/k3s/server/cred/controller.kubeconfig --profiling=false --root-ca-file=/var/lib/rancher/k3s/server/tls/server-ca.crt --secure-port=10257 --service-account-private-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --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--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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-controller-manager' | tail -n1 | grep 'service-account-private-key-file'\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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-controller-manager --allocate-node-cidrs=true --authentication-kubeconfig=/var/lib/rancher/k3s/server/cred/controller.kubeconfig --authorization-kubeconfig=/var/lib/rancher/k3s/server/cred/controller.kubeconfig --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/kube-controller-manager --cluster-cidr=10.42.0.0/16 --cluster-signing-kube-apiserver-client-cert-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --cluster-signing-kube-apiserver-client-key-file=/var/lib/rancher/k3s/server/tls/client-ca.key --cluster-signing-kubelet-client-cert-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --cluster-signing-kubelet-client-key-file=/var/lib/rancher/k3s/server/tls/client-ca.key --cluster-signing-kubelet-serving-cert-file=/var/lib/rancher/k3s/server/tls/server-ca.crt --cluster-signing-kubelet-serving-key-file=/var/lib/rancher/k3s/server/tls/server-ca.key --cluster-signing-legacy-unknown-cert-file=/var/lib/rancher/k3s/server/tls/server-ca.crt --cluster-signing-legacy-unknown-key-file=/var/lib/rancher/k3s/server/tls/server-ca.key --configure-cloud-routes=false --controllers=*,-service,-route,-cloud-node-lifecycle --feature-gates=JobTrackingWithFinalizers=true --kubeconfig=/var/lib/rancher/k3s/server/cred/controller.kubeconfig --profiling=false --root-ca-file=/var/lib/rancher/k3s/server/tls/server-ca.crt --secure-port=10257 --service-account-private-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --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`.\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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-controller-manager' | tail -n1 | grep 'root-ca-file'\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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-controller-manager --allocate-node-cidrs=true --authentication-kubeconfig=/var/lib/rancher/k3s/server/cred/controller.kubeconfig --authorization-kubeconfig=/var/lib/rancher/k3s/server/cred/controller.kubeconfig --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/kube-controller-manager --cluster-cidr=10.42.0.0/16 --cluster-signing-kube-apiserver-client-cert-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --cluster-signing-kube-apiserver-client-key-file=/var/lib/rancher/k3s/server/tls/client-ca.key --cluster-signing-kubelet-client-cert-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --cluster-signing-kubelet-client-key-file=/var/lib/rancher/k3s/server/tls/client-ca.key --cluster-signing-kubelet-serving-cert-file=/var/lib/rancher/k3s/server/tls/server-ca.crt --cluster-signing-kubelet-serving-key-file=/var/lib/rancher/k3s/server/tls/server-ca.key --cluster-signing-legacy-unknown-cert-file=/var/lib/rancher/k3s/server/tls/server-ca.crt --cluster-signing-legacy-unknown-key-file=/var/lib/rancher/k3s/server/tls/server-ca.key --configure-cloud-routes=false --controllers=*,-service,-route,-cloud-node-lifecycle --feature-gates=JobTrackingWithFinalizers=true --kubeconfig=/var/lib/rancher/k3s/server/cred/controller.kubeconfig --profiling=false --root-ca-file=/var/lib/rancher/k3s/server/tls/server-ca.crt --secure-port=10257 --service-account-private-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --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)("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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-controller-manager' | tail -n1 | grep 'bind-address'\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"},"'--bind-address' 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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-controller-manager --allocate-node-cidrs=true --authentication-kubeconfig=/var/lib/rancher/k3s/server/cred/controller.kubeconfig --authorization-kubeconfig=/var/lib/rancher/k3s/server/cred/controller.kubeconfig --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/kube-controller-manager --cluster-cidr=10.42.0.0/16 --cluster-signing-kube-apiserver-client-cert-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --cluster-signing-kube-apiserver-client-key-file=/var/lib/rancher/k3s/server/tls/client-ca.key --cluster-signing-kubelet-client-cert-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --cluster-signing-kubelet-client-key-file=/var/lib/rancher/k3s/server/tls/client-ca.key --cluster-signing-kubelet-serving-cert-file=/var/lib/rancher/k3s/server/tls/server-ca.crt --cluster-signing-kubelet-serving-key-file=/var/lib/rancher/k3s/server/tls/server-ca.key --cluster-signing-legacy-unknown-cert-file=/var/lib/rancher/k3s/server/tls/server-ca.crt --cluster-signing-legacy-unknown-key-file=/var/lib/rancher/k3s/server/tls/server-ca.key --configure-cloud-routes=false --controllers=*,-service,-route,-cloud-node-lifecycle --feature-gates=JobTrackingWithFinalizers=true --kubeconfig=/var/lib/rancher/k3s/server/cred/controller.kubeconfig --profiling=false --root-ca-file=/var/lib/rancher/k3s/server/tls/server-ca.crt --secure-port=10257 --service-account-private-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-scheduler' | tail -n1\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"},"'--profiling' 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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-scheduler --authentication-kubeconfig=/var/lib/rancher/k3s/server/cred/scheduler.kubeconfig --authorization-kubeconfig=/var/lib/rancher/k3s/server/cred/scheduler.kubeconfig --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/kube-scheduler --kubeconfig=/var/lib/rancher/k3s/server/cred/scheduler.kubeconfig --profiling=false --secure-port=10259"\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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-scheduler' | tail -n1 | grep 'bind-address'\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"},"'--bind-address' 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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-scheduler --authentication-kubeconfig=/var/lib/rancher/k3s/server/cred/scheduler.kubeconfig --authorization-kubeconfig=/var/lib/rancher/k3s/server/cred/scheduler.kubeconfig --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/kube-scheduler --kubeconfig=/var/lib/rancher/k3s/server/cred/scheduler.kubeconfig --profiling=false --secure-port=10259"\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--cert-file='/path/to/ca-file'\n--key-file='/path/to/key-file'"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Script:")," ",(0,n.kt)("inlineCode",{parentName:"p"},"check_for_k3s_etcd.sh")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},'#!/bin/bash\n\n# This script is used to ensure that k3s is actually running etcd (and not other databases like sqlite3)\n# before it checks the requirement\nset -eE\n\nhandle_error() {\n echo "false"\n}\n\ntrap \'handle_error\' ERR\n\n\nif [[ "$(journalctl -D /var/log/journal -u k3s | grep \'Managed etcd cluster initializing\' | grep -v grep | wc -l)" -gt 0 ]]; then\n case $1 in \n "1.1.11")\n echo $(stat -c %a /var/lib/rancher/k3s/server/db/etcd);;\n "1.2.29")\n echo $(journalctl -D /var/log/journal -u k3s | grep \'Running kube-apiserver\' | tail -n1 | grep \'etcd-\');;\n "2.1")\n echo $(grep -A 5 \'client-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep -E \'cert-file|key-file\');;\n "2.2")\n echo $(grep -A 5 \'client-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep \'client-cert-auth\');;\n "2.3")\n echo $(grep \'auto-tls\' /var/lib/rancher/k3s/server/db/etcd/config);;\n "2.4")\n echo $(grep -A 5 \'peer-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep -E \'cert-file|key-file\');;\n "2.5")\n echo $(grep -A 5 \'peer-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep \'client-cert-auth\');;\n "2.6")\n echo $(grep \'peer-auto-tls\' /var/lib/rancher/k3s/server/db/etcd/config);;\n "2.7")\n echo $(grep \'trusted-ca-file\' /var/lib/rancher/k3s/server/db/etcd/config);;\n esac\nelse\n# If another database is running, return whatever is required to pass the scan\n case $1 in\n "1.1.11")\n echo "700";;\n "1.2.29")\n echo "--etcd-certfile AND --etcd-keyfile";;\n "2.1")\n echo "cert-file AND key-file";;\n "2.2")\n echo "--client-cert-auth=true";;\n "2.3")\n echo "false";;\n "2.4")\n echo "peer-cert-file AND peer-key-file";;\n "2.5")\n echo "--client-cert-auth=true";;\n "2.6")\n echo "--peer-auto-tls=false";;\n "2.7")\n echo "--trusted-ca-file";;\n esac\nfi\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_k3s_etcd.sh 2.1\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"},"cert-file: /var/lib/rancher/k3s/server/tls/etcd/server-client.crt key-file: /var/lib/rancher/k3s/server/tls/etcd/server-client.key\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 /var/lib/rancher/k3s/server/db/etcd/config 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 Script:")," ",(0,n.kt)("inlineCode",{parentName:"p"},"check_for_k3s_etcd.sh")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},'#!/bin/bash\n\n# This script is used to ensure that k3s is actually running etcd (and not other databases like sqlite3)\n# before it checks the requirement\nset -eE\n\nhandle_error() {\n echo "false"\n}\n\ntrap \'handle_error\' ERR\n\n\nif [[ "$(journalctl -D /var/log/journal -u k3s | grep \'Managed etcd cluster initializing\' | grep -v grep | wc -l)" -gt 0 ]]; then\n case $1 in \n "1.1.11")\n echo $(stat -c %a /var/lib/rancher/k3s/server/db/etcd);;\n "1.2.29")\n echo $(journalctl -D /var/log/journal -u k3s | grep \'Running kube-apiserver\' | tail -n1 | grep \'etcd-\');;\n "2.1")\n echo $(grep -A 5 \'client-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep -E \'cert-file|key-file\');;\n "2.2")\n echo $(grep -A 5 \'client-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep \'client-cert-auth\');;\n "2.3")\n echo $(grep \'auto-tls\' /var/lib/rancher/k3s/server/db/etcd/config);;\n "2.4")\n echo $(grep -A 5 \'peer-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep -E \'cert-file|key-file\');;\n "2.5")\n echo $(grep -A 5 \'peer-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep \'client-cert-auth\');;\n "2.6")\n echo $(grep \'peer-auto-tls\' /var/lib/rancher/k3s/server/db/etcd/config);;\n "2.7")\n echo $(grep \'trusted-ca-file\' /var/lib/rancher/k3s/server/db/etcd/config);;\n esac\nelse\n# If another database is running, return whatever is required to pass the scan\n case $1 in\n "1.1.11")\n echo "700";;\n "1.2.29")\n echo "--etcd-certfile AND --etcd-keyfile";;\n "2.1")\n echo "cert-file AND key-file";;\n "2.2")\n echo "--client-cert-auth=true";;\n "2.3")\n echo "false";;\n "2.4")\n echo "peer-cert-file AND peer-key-file";;\n "2.5")\n echo "--client-cert-auth=true";;\n "2.6")\n echo "--peer-auto-tls=false";;\n "2.7")\n echo "--trusted-ca-file";;\n esac\nfi\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_k3s_etcd.sh 2.2\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 'client-cert-auth' 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"},"client-cert-auth: true\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 /var/lib/rancher/k3s/server/db/etcd/config 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 Script:")," ",(0,n.kt)("inlineCode",{parentName:"p"},"check_for_k3s_etcd.sh")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},'#!/bin/bash\n\n# This script is used to ensure that k3s is actually running etcd (and not other databases like sqlite3)\n# before it checks the requirement\nset -eE\n\nhandle_error() {\n echo "false"\n}\n\ntrap \'handle_error\' ERR\n\n\nif [[ "$(journalctl -D /var/log/journal -u k3s | grep \'Managed etcd cluster initializing\' | grep -v grep | wc -l)" -gt 0 ]]; then\n case $1 in \n "1.1.11")\n echo $(stat -c %a /var/lib/rancher/k3s/server/db/etcd);;\n "1.2.29")\n echo $(journalctl -D /var/log/journal -u k3s | grep \'Running kube-apiserver\' | tail -n1 | grep \'etcd-\');;\n "2.1")\n echo $(grep -A 5 \'client-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep -E \'cert-file|key-file\');;\n "2.2")\n echo $(grep -A 5 \'client-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep \'client-cert-auth\');;\n "2.3")\n echo $(grep \'auto-tls\' /var/lib/rancher/k3s/server/db/etcd/config);;\n "2.4")\n echo $(grep -A 5 \'peer-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep -E \'cert-file|key-file\');;\n "2.5")\n echo $(grep -A 5 \'peer-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep \'client-cert-auth\');;\n "2.6")\n echo $(grep \'peer-auto-tls\' /var/lib/rancher/k3s/server/db/etcd/config);;\n "2.7")\n echo $(grep \'trusted-ca-file\' /var/lib/rancher/k3s/server/db/etcd/config);;\n esac\nelse\n# If another database is running, return whatever is required to pass the scan\n case $1 in\n "1.1.11")\n echo "700";;\n "1.2.29")\n echo "--etcd-certfile AND --etcd-keyfile";;\n "2.1")\n echo "cert-file AND key-file";;\n "2.2")\n echo "--client-cert-auth=true";;\n "2.3")\n echo "false";;\n "2.4")\n echo "peer-cert-file AND peer-key-file";;\n "2.5")\n echo "--client-cert-auth=true";;\n "2.6")\n echo "--peer-auto-tls=false";;\n "2.7")\n echo "--trusted-ca-file";;\n esac\nfi\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_k3s_etcd.sh 2.3\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_AUTO_TLS' is not present OR 'ETCD_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"},"error: process ID list syntax error Usage: ps [options] Try 'ps --help 'simple|list|output|threads|misc|all'' or 'ps --help 's|l|o|t|m|a'' for additional help text. For more details see ps(1). cat: /proc//environ: No such file or directory\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 /var/lib/rancher/k3s/server/db/etcd/config on the\nmaster node and set the below parameters.\n--peer-client-file='/path/to/peer-cert-file'\n--peer-key-file='/path/to/peer-key-file'"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Script:")," ",(0,n.kt)("inlineCode",{parentName:"p"},"check_for_k3s_etcd.sh")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},'#!/bin/bash\n\n# This script is used to ensure that k3s is actually running etcd (and not other databases like sqlite3)\n# before it checks the requirement\nset -eE\n\nhandle_error() {\n echo "false"\n}\n\ntrap \'handle_error\' ERR\n\n\nif [[ "$(journalctl -D /var/log/journal -u k3s | grep \'Managed etcd cluster initializing\' | grep -v grep | wc -l)" -gt 0 ]]; then\n case $1 in \n "1.1.11")\n echo $(stat -c %a /var/lib/rancher/k3s/server/db/etcd);;\n "1.2.29")\n echo $(journalctl -D /var/log/journal -u k3s | grep \'Running kube-apiserver\' | tail -n1 | grep \'etcd-\');;\n "2.1")\n echo $(grep -A 5 \'client-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep -E \'cert-file|key-file\');;\n "2.2")\n echo $(grep -A 5 \'client-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep \'client-cert-auth\');;\n "2.3")\n echo $(grep \'auto-tls\' /var/lib/rancher/k3s/server/db/etcd/config);;\n "2.4")\n echo $(grep -A 5 \'peer-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep -E \'cert-file|key-file\');;\n "2.5")\n echo $(grep -A 5 \'peer-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep \'client-cert-auth\');;\n "2.6")\n echo $(grep \'peer-auto-tls\' /var/lib/rancher/k3s/server/db/etcd/config);;\n "2.7")\n echo $(grep \'trusted-ca-file\' /var/lib/rancher/k3s/server/db/etcd/config);;\n esac\nelse\n# If another database is running, return whatever is required to pass the scan\n case $1 in\n "1.1.11")\n echo "700";;\n "1.2.29")\n echo "--etcd-certfile AND --etcd-keyfile";;\n "2.1")\n echo "cert-file AND key-file";;\n "2.2")\n echo "--client-cert-auth=true";;\n "2.3")\n echo "false";;\n "2.4")\n echo "peer-cert-file AND peer-key-file";;\n "2.5")\n echo "--client-cert-auth=true";;\n "2.6")\n echo "--peer-auto-tls=false";;\n "2.7")\n echo "--trusted-ca-file";;\n esac\nfi\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_k3s_etcd.sh 2.4\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"},"cert-file: /var/lib/rancher/k3s/server/tls/etcd/peer-server-client.crt key-file: /var/lib/rancher/k3s/server/tls/etcd/peer-server-client.key\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 /var/lib/rancher/k3s/server/db/etcd/config 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 Script:")," ",(0,n.kt)("inlineCode",{parentName:"p"},"check_for_k3s_etcd.sh")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},'#!/bin/bash\n\n# This script is used to ensure that k3s is actually running etcd (and not other databases like sqlite3)\n# before it checks the requirement\nset -eE\n\nhandle_error() {\n echo "false"\n}\n\ntrap \'handle_error\' ERR\n\n\nif [[ "$(journalctl -D /var/log/journal -u k3s | grep \'Managed etcd cluster initializing\' | grep -v grep | wc -l)" -gt 0 ]]; then\n case $1 in \n "1.1.11")\n echo $(stat -c %a /var/lib/rancher/k3s/server/db/etcd);;\n "1.2.29")\n echo $(journalctl -D /var/log/journal -u k3s | grep \'Running kube-apiserver\' | tail -n1 | grep \'etcd-\');;\n "2.1")\n echo $(grep -A 5 \'client-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep -E \'cert-file|key-file\');;\n "2.2")\n echo $(grep -A 5 \'client-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep \'client-cert-auth\');;\n "2.3")\n echo $(grep \'auto-tls\' /var/lib/rancher/k3s/server/db/etcd/config);;\n "2.4")\n echo $(grep -A 5 \'peer-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep -E \'cert-file|key-file\');;\n "2.5")\n echo $(grep -A 5 \'peer-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep \'client-cert-auth\');;\n "2.6")\n echo $(grep \'peer-auto-tls\' /var/lib/rancher/k3s/server/db/etcd/config);;\n "2.7")\n echo $(grep \'trusted-ca-file\' /var/lib/rancher/k3s/server/db/etcd/config);;\n esac\nelse\n# If another database is running, return whatever is required to pass the scan\n case $1 in\n "1.1.11")\n echo "700";;\n "1.2.29")\n echo "--etcd-certfile AND --etcd-keyfile";;\n "2.1")\n echo "cert-file AND key-file";;\n "2.2")\n echo "--client-cert-auth=true";;\n "2.3")\n echo "false";;\n "2.4")\n echo "peer-cert-file AND peer-key-file";;\n "2.5")\n echo "--client-cert-auth=true";;\n "2.6")\n echo "--peer-auto-tls=false";;\n "2.7")\n echo "--trusted-ca-file";;\n esac\nfi\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_k3s_etcd.sh 2.5\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 'client-cert-auth' 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"},"client-cert-auth: true\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 /var/lib/rancher/k3s/server/db/etcd/config 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 Script:")," ",(0,n.kt)("inlineCode",{parentName:"p"},"check_for_k3s_etcd.sh")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},'#!/bin/bash\n\n# This script is used to ensure that k3s is actually running etcd (and not other databases like sqlite3)\n# before it checks the requirement\nset -eE\n\nhandle_error() {\n echo "false"\n}\n\ntrap \'handle_error\' ERR\n\n\nif [[ "$(journalctl -D /var/log/journal -u k3s | grep \'Managed etcd cluster initializing\' | grep -v grep | wc -l)" -gt 0 ]]; then\n case $1 in \n "1.1.11")\n echo $(stat -c %a /var/lib/rancher/k3s/server/db/etcd);;\n "1.2.29")\n echo $(journalctl -D /var/log/journal -u k3s | grep \'Running kube-apiserver\' | tail -n1 | grep \'etcd-\');;\n "2.1")\n echo $(grep -A 5 \'client-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep -E \'cert-file|key-file\');;\n "2.2")\n echo $(grep -A 5 \'client-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep \'client-cert-auth\');;\n "2.3")\n echo $(grep \'auto-tls\' /var/lib/rancher/k3s/server/db/etcd/config);;\n "2.4")\n echo $(grep -A 5 \'peer-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep -E \'cert-file|key-file\');;\n "2.5")\n echo $(grep -A 5 \'peer-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep \'client-cert-auth\');;\n "2.6")\n echo $(grep \'peer-auto-tls\' /var/lib/rancher/k3s/server/db/etcd/config);;\n "2.7")\n echo $(grep \'trusted-ca-file\' /var/lib/rancher/k3s/server/db/etcd/config);;\n esac\nelse\n# If another database is running, return whatever is required to pass the scan\n case $1 in\n "1.1.11")\n echo "700";;\n "1.2.29")\n echo "--etcd-certfile AND --etcd-keyfile";;\n "2.1")\n echo "cert-file AND key-file";;\n "2.2")\n echo "--client-cert-auth=true";;\n "2.3")\n echo "false";;\n "2.4")\n echo "peer-cert-file AND peer-key-file";;\n "2.5")\n echo "--client-cert-auth=true";;\n "2.6")\n echo "--peer-auto-tls=false";;\n "2.7")\n echo "--trusted-ca-file";;\n esac\nfi\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_k3s_etcd.sh 2.6\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_PEER_AUTO_TLS' is not present OR 'ETCD_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"},"error: process ID list syntax error Usage: ps [options] Try 'ps --help 'simple|list|output|threads|misc|all'' or 'ps --help 's|l|o|t|m|a'' for additional help text. For more details see ps(1). cat: /proc//environ: No such file or directory\n")),(0,n.kt)("h3",{id:"27-ensure-that-a-unique-certificate-authority-is-used-for-etcd-manual"},"2.7 Ensure that a unique Certificate Authority is used for etcd (Manual)"),(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 /var/lib/rancher/k3s/server/db/etcd/config on the\nmaster node and set the below parameter.\n--trusted-ca-file='/path/to/ca-file'"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"Audit Script:")," ",(0,n.kt)("inlineCode",{parentName:"p"},"check_for_k3s_etcd.sh")),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},'#!/bin/bash\n\n# This script is used to ensure that k3s is actually running etcd (and not other databases like sqlite3)\n# before it checks the requirement\nset -eE\n\nhandle_error() {\n echo "false"\n}\n\ntrap \'handle_error\' ERR\n\n\nif [[ "$(journalctl -D /var/log/journal -u k3s | grep \'Managed etcd cluster initializing\' | grep -v grep | wc -l)" -gt 0 ]]; then\n case $1 in \n "1.1.11")\n echo $(stat -c %a /var/lib/rancher/k3s/server/db/etcd);;\n "1.2.29")\n echo $(journalctl -D /var/log/journal -u k3s | grep \'Running kube-apiserver\' | tail -n1 | grep \'etcd-\');;\n "2.1")\n echo $(grep -A 5 \'client-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep -E \'cert-file|key-file\');;\n "2.2")\n echo $(grep -A 5 \'client-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep \'client-cert-auth\');;\n "2.3")\n echo $(grep \'auto-tls\' /var/lib/rancher/k3s/server/db/etcd/config);;\n "2.4")\n echo $(grep -A 5 \'peer-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep -E \'cert-file|key-file\');;\n "2.5")\n echo $(grep -A 5 \'peer-transport-security\' /var/lib/rancher/k3s/server/db/etcd/config | grep \'client-cert-auth\');;\n "2.6")\n echo $(grep \'peer-auto-tls\' /var/lib/rancher/k3s/server/db/etcd/config);;\n "2.7")\n echo $(grep \'trusted-ca-file\' /var/lib/rancher/k3s/server/db/etcd/config);;\n esac\nelse\n# If another database is running, return whatever is required to pass the scan\n case $1 in\n "1.1.11")\n echo "700";;\n "1.2.29")\n echo "--etcd-certfile AND --etcd-keyfile";;\n "2.1")\n echo "cert-file AND key-file";;\n "2.2")\n echo "--client-cert-auth=true";;\n "2.3")\n echo "false";;\n "2.4")\n echo "peer-cert-file AND peer-key-file";;\n "2.5")\n echo "--client-cert-auth=true";;\n "2.6")\n echo "--peer-auto-tls=false";;\n "2.7")\n echo "--trusted-ca-file";;\n esac\nfi\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_k3s_etcd.sh 2.7\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"},"trusted-ca-file: /var/lib/rancher/k3s/server/tls/etcd/server-ca.crt trusted-ca-file: /var/lib/rancher/k3s/server/tls/etcd/peer-ca.crt\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-manual"},"3.2.1 Ensure that a minimal audit policy is created (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 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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'audit-policy-file'\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:"),"\nRun the below command (based on the file location on your system) on the each worker node.\nFor example,\nchmod 644 /etc/systemd/system/kubelet.service.d/10-kubeadm.conf"),(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:"),"\nRun the below command (based on the file location on your system) on the each worker node.\nFor example,\nchown root:root /etc/systemd/system/kubelet.service.d/10-kubeadm.conf"),(0,n.kt)("h3",{id:"413-if-proxy-kubeconfig-file-exists-ensure-permissions-are-set-to-644-or-more-restrictive-manual"},"4.1.3 If proxy kubeconfig file exists ensure permissions are set to 644 or more restrictive (Manual)"),(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 /var/lib/rancher/k3s/agent/kubeproxy.kubeconfig"),(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 /var/lib/rancher/k3s/agent/kubeproxy.kubeconfig\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 present OR '/var/lib/rancher/k3s/agent/kubeproxy.kubeconfig' 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"},"644\n")),(0,n.kt)("h3",{id:"414-if-proxy-kubeconfig-file-exists-ensure-ownership-is-set-to-rootroot-manual"},"4.1.4 If proxy kubeconfig file exists ensure ownership is set to root:root (Manual)"),(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 /var/lib/rancher/k3s/agent/kubeproxy.kubeconfig"),(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 /var/lib/rancher/k3s/agent/kubeproxy.kubeconfig\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 present OR '/var/lib/rancher/k3s/agent/kubeproxy.kubeconfig' 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:root\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 /var/lib/rancher/k3s/server/cred/admin.kubeconfig"),(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 /var/lib/rancher/k3s/agent/kubelet.kubeconfig\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 equal to '644'\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"},"644\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 /var/lib/rancher/k3s/server/cred/admin.kubeconfig"),(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 /var/lib/rancher/k3s/agent/kubelet.kubeconfig\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-manual"},"4.1.7 Ensure that the certificate authorities file permissions are set to 644 or more restrictive (Manual)"),(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--client-ca-file chmod 644 '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"},"stat -c %a /var/lib/rancher/k3s/server/tls/server-ca.crt\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 equal to '644' OR '640' is present OR '600' is present 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"},"644\n")),(0,n.kt)("h3",{id:"418-ensure-that-the-client-certificate-authorities-file-ownership-is-set-to-rootroot-manual"},"4.1.8 Ensure that the client certificate authorities file ownership is set to root:root (Manual)"),(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.\nchown root:root '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"},"stat -c %U:%G /var/lib/rancher/k3s/server/tls/client-ca.crt\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:"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)("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)("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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'anonymous-auth' | 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"},"'--anonymous-auth' 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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver' | tail -n1 | grep 'authorization-mode' | 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"},"'--authorization-mode' does 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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\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--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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kube-apiserver'| tail -n1 | grep 'client-ca-file' | 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"},'Oct 04 22:42:18 node-01 k3s[15833]: time="2022-10-04T22:42:18Z" level=info msg="Running kube-apiserver --advertise-port=6443 --allow-privileged=true --anonymous-auth=false --api-audiences=https://kubernetes.default.svc.cluster.local,k3s --audit-log-maxage=30 --audit-log-maxbackup=10 --audit-log-maxsize=100 --audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log --audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml --authorization-mode=Node,RBAC --bind-address=127.0.0.1 --cert-dir=/var/lib/rancher/k3s/server/tls/temporary-certs --client-ca-file=/var/lib/rancher/k3s/server/tls/client-ca.crt --egress-selector-config-file=/var/lib/rancher/k3s/server/etc/egress-selector-config.yaml --enable-admission-plugins=NodeRestriction,PodSecurityPolicy,ServiceAccount --enable-aggregator-routing=true --encryption-provider-config=/var/lib/rancher/k3s/server/cred/encryption-config.json --etcd-cafile=/var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --etcd-certfile=/var/lib/rancher/k3s/server/tls/etcd/client.crt --etcd-keyfile=/var/lib/rancher/k3s/server/tls/etcd/client.key --etcd-servers=https://127.0.0.1:2379 --feature-gates=JobTrackingWithFinalizers=true --kubelet-certificate-authority=/var/lib/rancher/k3s/server/tls/server-ca.crt --kubelet-client-certificate=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.crt --kubelet-client-key=/var/lib/rancher/k3s/server/tls/client-kube-apiserver.key --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --profiling=false --proxy-client-cert-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.crt --proxy-client-key-file=/var/lib/rancher/k3s/server/tls/client-auth-proxy.key --request-timeout=300s --requestheader-allowed-names=system:auth-proxy --requestheader-client-ca-file=/var/lib/rancher/k3s/server/tls/request-header-ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --secure-port=6444 --service-account-issuer=https://kubernetes.default.svc.cluster.local --service-account-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-account-lookup=true --service-account-signing-key-file=/var/lib/rancher/k3s/server/tls/service.key --service-cluster-ip-range=10.43.0.0/16 --service-node-port-range=30000-32767 --storage-backend=etcd3 --tls-cert-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt --tls-private-key-file=/var/lib/rancher/k3s/server/tls/serving-kube-apiserver.key"\n')),(0,n.kt)("h3",{id:"424-ensure-that-the---read-only-port-argument-is-set-to-0-manual"},"4.2.4 Ensure that the --read-only-port argument is set to 0 (Manual)"),(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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kubelet' | tail -n1 | grep 'read-only-port'\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"},"'--read-only-port' is equal to '0' OR '--read-only-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"},'Oct 04 22:42:19 node-01 k3s[15833]: time="2022-10-04T22:42:19Z" level=info msg="Running kubelet --address=0.0.0.0 --anonymous-auth=false --authentication-token-webhook=true --authorization-mode=Webhook --cgroup-driver=systemd --client-ca-file=/var/lib/rancher/k3s/agent/client-ca.crt --cloud-provider=external --cluster-dns=10.43.0.10 --cluster-domain=cluster.local --container-runtime-endpoint=unix:///run/k3s/containerd/containerd.sock --containerd=/run/k3s/containerd/containerd.sock --eviction-hard=imagefs.available\'5%,nodefs.available\'5% --eviction-minimum-reclaim=imagefs.available=10%,nodefs.available=10% --fail-swap-on=false --healthz-bind-address=127.0.0.1 --hostname-override=node-01 --kubeconfig=/var/lib/rancher/k3s/agent/kubelet.kubeconfig --make-iptables-util-chains=true --node-labels=cattle.io/os=linux,rke.cattle.io/machine=c94666fd-3d6a-40a4-81d7-7a14f6ec1117 --pod-infra-container-image=rancher/mirrored-pause:3.6 --pod-manifest-path=/var/lib/rancher/k3s/agent/pod-manifests --protect-kernel-defaults=true --read-only-port=0 --resolv-conf=/run/systemd/resolve/resolv.conf --serialize-image-pulls=false --tls-cert-file=/var/lib/rancher/k3s/agent/serving-kubelet.crt --tls-private-key-file=/var/lib/rancher/k3s/agent/serving-kubelet.key"\n')),(0,n.kt)("h3",{id:"425-ensure-that-the---streaming-connection-idle-timeout-argument-is-not-set-to-0-manual"},"4.2.5 Ensure that the --streaming-connection-idle-timeout argument is not set to 0 (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 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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kubelet' | tail -n1 | grep 'streaming-connection-idle-timeout'\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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kubelet' | tail -n1 | grep 'protect-kernel-defaults'\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"},"'--protect-kernel-defaults' 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"},'Oct 04 22:42:19 node-01 k3s[15833]: time="2022-10-04T22:42:19Z" level=info msg="Running kubelet --address=0.0.0.0 --anonymous-auth=false --authentication-token-webhook=true --authorization-mode=Webhook --cgroup-driver=systemd --client-ca-file=/var/lib/rancher/k3s/agent/client-ca.crt --cloud-provider=external --cluster-dns=10.43.0.10 --cluster-domain=cluster.local --container-runtime-endpoint=unix:///run/k3s/containerd/containerd.sock --containerd=/run/k3s/containerd/containerd.sock --eviction-hard=imagefs.available\'5%,nodefs.available\'5% --eviction-minimum-reclaim=imagefs.available=10%,nodefs.available=10% --fail-swap-on=false --healthz-bind-address=127.0.0.1 --hostname-override=node-01 --kubeconfig=/var/lib/rancher/k3s/agent/kubelet.kubeconfig --make-iptables-util-chains=true --node-labels=cattle.io/os=linux,rke.cattle.io/machine=c94666fd-3d6a-40a4-81d7-7a14f6ec1117 --pod-infra-container-image=rancher/mirrored-pause:3.6 --pod-manifest-path=/var/lib/rancher/k3s/agent/pod-manifests --protect-kernel-defaults=true --read-only-port=0 --resolv-conf=/run/systemd/resolve/resolv.conf --serialize-image-pulls=false --tls-cert-file=/var/lib/rancher/k3s/agent/serving-kubelet.crt --tls-private-key-file=/var/lib/rancher/k3s/agent/serving-kubelet.key"\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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kubelet' | tail -n1 | grep 'make-iptables-util-chains'\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"},"'--make-iptables-util-chains' is equal to 'true' OR '--make-iptables-util-chains' 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"},'Oct 04 22:42:19 node-01 k3s[15833]: time="2022-10-04T22:42:19Z" level=info msg="Running kubelet --address=0.0.0.0 --anonymous-auth=false --authentication-token-webhook=true --authorization-mode=Webhook --cgroup-driver=systemd --client-ca-file=/var/lib/rancher/k3s/agent/client-ca.crt --cloud-provider=external --cluster-dns=10.43.0.10 --cluster-domain=cluster.local --container-runtime-endpoint=unix:///run/k3s/containerd/containerd.sock --containerd=/run/k3s/containerd/containerd.sock --eviction-hard=imagefs.available\'5%,nodefs.available\'5% --eviction-minimum-reclaim=imagefs.available=10%,nodefs.available=10% --fail-swap-on=false --healthz-bind-address=127.0.0.1 --hostname-override=node-01 --kubeconfig=/var/lib/rancher/k3s/agent/kubelet.kubeconfig --make-iptables-util-chains=true --node-labels=cattle.io/os=linux,rke.cattle.io/machine=c94666fd-3d6a-40a4-81d7-7a14f6ec1117 --pod-infra-container-image=rancher/mirrored-pause:3.6 --pod-manifest-path=/var/lib/rancher/k3s/agent/pod-manifests --protect-kernel-defaults=true --read-only-port=0 --resolv-conf=/run/systemd/resolve/resolv.conf --serialize-image-pulls=false --tls-cert-file=/var/lib/rancher/k3s/agent/serving-kubelet.crt --tls-private-key-file=/var/lib/rancher/k3s/agent/serving-kubelet.key"\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)("h3",{id:"429-ensure-that-the---event-qps-argument-is-set-to-0-or-a-level-which-ensures-appropriate-event-capture-manual"},"4.2.9 Ensure that the --event-qps argument is set to 0 or a level which ensures appropriate event capture (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 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 containerd\n")),(0,n.kt)("h3",{id:"4210-ensure-that-the---tls-cert-file-and---tls-private-key-file-arguments-are-set-as-appropriate-manual"},"4.2.10 Ensure that the --tls-cert-file and --tls-private-key-file arguments are set as appropriate (Manual)"),(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--tls-cert-file='path/to/tls-certificate-file'\n--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"},"journalctl -D /var/log/journal -u k3s | grep 'Running kubelet' | tail -n1\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"},'Oct 04 22:42:19 node-01 k3s[15833]: time="2022-10-04T22:42:19Z" level=info msg="Running kubelet --address=0.0.0.0 --anonymous-auth=false --authentication-token-webhook=true --authorization-mode=Webhook --cgroup-driver=systemd --client-ca-file=/var/lib/rancher/k3s/agent/client-ca.crt --cloud-provider=external --cluster-dns=10.43.0.10 --cluster-domain=cluster.local --container-runtime-endpoint=unix:///run/k3s/containerd/containerd.sock --containerd=/run/k3s/containerd/containerd.sock --eviction-hard=imagefs.available\'5%,nodefs.available\'5% --eviction-minimum-reclaim=imagefs.available=10%,nodefs.available=10% --fail-swap-on=false --healthz-bind-address=127.0.0.1 --hostname-override=node-01 --kubeconfig=/var/lib/rancher/k3s/agent/kubelet.kubeconfig --make-iptables-util-chains=true --node-labels=cattle.io/os=linux,rke.cattle.io/machine=c94666fd-3d6a-40a4-81d7-7a14f6ec1117 --pod-infra-container-image=rancher/mirrored-pause:3.6 --pod-manifest-path=/var/lib/rancher/k3s/agent/pod-manifests --protect-kernel-defaults=true --read-only-port=0 --resolv-conf=/run/systemd/resolve/resolv.conf --serialize-image-pulls=false --tls-cert-file=/var/lib/rancher/k3s/agent/serving-kubelet.crt --tls-private-key-file=/var/lib/rancher/k3s/agent/serving-kubelet.key"\n')),(0,n.kt)("h3",{id:"4211-ensure-that-the---rotate-certificates-argument-is-not-set-to-false-manual"},"4.2.11 Ensure that the --rotate-certificates argument is not set to false (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 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 containerd\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)("h3",{id:"4212-verify-that-the-rotatekubeletservercertificate-argument-is-set-to-true-manual"},"4.2.12 Verify that the RotateKubeletServerCertificate argument is set to true (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 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)("h3",{id:"4213-ensure-that-the-kubelet-only-makes-use-of-strong-cryptographic-ciphers-manual"},"4.2.13 Ensure that the Kubelet only makes use of Strong Cryptographic Ciphers (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 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 containerd\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-manual"},"5.1.5 Ensure that default service accounts are not actively 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:"),"\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)("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)("h3",{id:"517-avoid-use-of-systemmasters-group-manual"},"5.1.7 Avoid use of system:masters group (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:"),"\nRemove the system:masters group from all users in the cluster."),(0,n.kt)("h3",{id:"518-limit-use-of-the-bind-impersonate-and-escalate-permissions-in-the-kubernetes-cluster-manual"},"5.1.8 Limit use of the Bind, Impersonate and Escalate permissions in the Kubernetes cluster (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 the impersonate, bind and escalate rights from subjects."),(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-automated"},"5.2.1 Minimize the admission of privileged containers (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:"),"\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:")," 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.hostPID field is omitted or set to false."),(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:")," 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.hostIPC field is omitted or set to false."),(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:")," 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.hostNetwork field is omitted or set to false."),(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:")," 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.allowPrivilegeEscalation field is omitted or set to false."),(0,n.kt)("h3",{id:"526-minimize-the-admission-of-root-containers-automated"},"5.2.6 Minimize the admission of root containers (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:"),"\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-automated"},"5.2.7 Minimize the admission of containers with the NET_RAW capability (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:"),"\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-automated"},"5.2.8 Minimize the admission of containers with added capabilities (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:"),"\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 running 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-manual"},"5.3.2 Ensure that all Namespaces have Network Policies defined (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 NetworkPolicy objects as you need them."),(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:"),"\nUse security context to enable the docker/default seccomp profile in your pod definitions.\nAn example is as below:\nsecurityContext:\nseccompProfile:\ntype: RuntimeDefault"),(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-manual"},"5.7.4 The default namespace should not be 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:"),"\nEnsure that namespaces are created to allow for appropriate segregation of Kubernetes\nresources and that all new resources are created in a specific namespace."))}p.isMDXComponent=!0}}]);