From 212b64d9770c7cb151b99674f597faf6646cbce2 Mon Sep 17 00:00:00 2001 From: k8s-ci-robot Date: Tue, 1 Sep 2020 21:19:11 +0000 Subject: [PATCH] Deploy GitHub Pages --- 404.html | 12 + deploy/baremetal/index.html | 12 + deploy/hardening-guide/index.html | 1859 +++++++++++++++++ deploy/index.html | 12 + deploy/rbac/index.html | 12 + deploy/upgrade/index.html | 16 +- development/index.html | 12 + e2e-tests/index.html | 12 + .../20190724-only-dynamic-ssl/index.html | 12 + .../20190815-zone-aware-routing/index.html | 12 + enhancements/YYYYMMDD-kep-template/index.html | 12 + enhancements/index.html | 12 + examples/PREREQUISITES/index.html | 12 + examples/affinity/cookie/index.html | 12 + examples/auth/basic/index.html | 12 + examples/auth/client-certs/index.html | 12 + examples/auth/external-auth/index.html | 12 + examples/auth/oauth-external-auth/index.html | 12 + .../configuration-snippets/index.html | 12 + .../custom-configuration/index.html | 12 + .../customization/custom-errors/index.html | 12 + .../customization/custom-headers/index.html | 12 + .../external-auth-headers/index.html | 12 + .../customization/ssl-dh-param/index.html | 12 + examples/customization/sysctl/index.html | 12 + examples/docker-registry/index.html | 12 + examples/grpc/index.html | 12 + examples/index.html | 12 + examples/multi-tls/index.html | 12 + examples/psp/index.html | 12 + examples/rewrite/index.html | 12 + examples/static-ip/index.html | 12 + examples/tls-termination/index.html | 12 + how-it-works/index.html | 12 + index.html | 12 + kubectl-plugin/index.html | 12 + search/search_index.json | 2 +- sitemap.xml | 102 +- sitemap.xml.gz | Bin 678 -> 686 bytes troubleshooting/index.html | 12 + user-guide/basic-usage/index.html | 12 + user-guide/cli-arguments/index.html | 12 + user-guide/custom-errors/index.html | 12 + user-guide/default-backend/index.html | 12 + .../exposing-tcp-udp-services/index.html | 12 + user-guide/external-articles/index.html | 12 + user-guide/fcgi-services/index.html | 12 + user-guide/ingress-path-matching/index.html | 12 + user-guide/miscellaneous/index.html | 12 + user-guide/monitoring/index.html | 12 + user-guide/multiple-ingress/index.html | 12 + .../annotations/index.html | 12 + .../nginx-configuration/configmap/index.html | 12 + .../custom-template/index.html | 12 + user-guide/nginx-configuration/index.html | 16 +- .../nginx-configuration/log-format/index.html | 12 + .../third-party-addons/modsecurity/index.html | 12 + .../third-party-addons/opentracing/index.html | 12 + user-guide/tls/index.html | 12 + 59 files changed, 2577 insertions(+), 54 deletions(-) create mode 100644 deploy/hardening-guide/index.html diff --git a/404.html b/404.html index 2bb8f1c53..e7465ff6d 100644 --- a/404.html +++ b/404.html @@ -411,6 +411,18 @@ + + + + + +
  • + + Hardening guide + +
  • + + diff --git a/deploy/baremetal/index.html b/deploy/baremetal/index.html index 4b80fc897..6950d349b 100644 --- a/deploy/baremetal/index.html +++ b/deploy/baremetal/index.html @@ -492,6 +492,18 @@ + + + + + +
  • + + Hardening guide + +
  • + + diff --git a/deploy/hardening-guide/index.html b/deploy/hardening-guide/index.html new file mode 100644 index 000000000..f70849095 --- /dev/null +++ b/deploy/hardening-guide/index.html @@ -0,0 +1,1859 @@ + + + + + + + + + + + + + + + + + + + + Hardening guide - NGINX Ingress Controller + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + Skip to content + + +
    +
    + +
    + +
    + +
    + +
    + + + + + + + + + + + + +
    +
    + + +
    +
    +
    + +
    +
    +
    + + +
    +
    +
    + + +
    +
    +
    + + +
    +
    + + + + + + + + + + +

    Hardening Guide

    +

    Overview

    +

    There are several ways to do hardening and securing of nginx. In this documentation two guides are used, the guides are +overlapping in some points:

    + +

    This guide describes, what of the different configurations described in those guides is already implemented as default +in the nginx implementation of kubernetes ingress, what needs to be configured, what is obsolete due to the fact that +the nginx is running as container (the CIS benchmark relates to a non-containerized installation) and what is difficult +or not possible.

    +

    Be aware that this is only a guide and you are responsible for your own implementation. Some of the configurations may +lead to have specific clients unable to reach your site or similar consequences.

    +

    This guide refers to chapters in the CIS Benchmark. For full explanation you should refer to the benchmark document itself

    +

    Configuration Guide

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Chapter in CIS benchmarkStatusDefaultAction to do if not default
    1 Initial Setup
    1.1 Installation
    1.1.1 Ensure NGINX is installed (Scored)OKdone through helm charts / following documentation to deploy nginx ingress
    1.1.2 Ensure NGINX is installed from source (Not Scored)OKdone through helm charts / following documentation to deploy nginx ingress
    1.2 Configure Software Updates
    1.2.1 Ensure package manager repositories are properly configured (Not Scored)OKdone via helm, nginx version could be overwritten, however compability is not ensured then
    1.2.2 Ensure the latest software package is installed (Not Scored)ACTION NEEDEDdone via helm, nginx version could be overwritten, however compability is not ensured thenPlan for periodic updates
    2 Basic Configuration
    2.1 Minimize NGINX Modules
    2.1.1 Ensure only required modules are installed (Not Scored)OKAlready only needed modules are installed, however proposals for further reduction are welcome
    2.1.2 Ensure HTTP WebDAV module is not installed (Scored)RISK TO BE ACCEPTEDIt is installed, see compile options here. Disabling that would require building own image for nginx ingress controller. The effort is too high in comparison to the achieved effect
    2.1.3 Ensure modules with gzip functionality are disabled (Scored)RISK TO BE ACCEPTEDSee previous answer
    2.1.4 Ensure the autoindex module is disabled (Scored)OKNo autoindex configs so far in ingress defaults
    2.2 Account Security
    2.2.1 Ensure that NGINX is run using a non-privileged, dedicated service account (Not Scored)OKPod configured as user www-data: See this line in helm chart values. Compiled with user www-data: See this line in build script
    2.2.2 Ensure the NGINX service account is locked (Scored)OKDocker design ensures this
    2.2.3 Ensure the NGINX service account has an invalid shell (Scored)OKShell is nologin: see this line in build script
    2.3 Permissions and Ownership
    2.3.1 Ensure NGINX directories and files are owned by root (Scored)OKObsolete through docker-design and ingress controller needs to update the configs dynamically
    2.3.2 Ensure access to NGINX directories and files is restricted (Scored)OKSee previous answer
    2.3.3 Ensure the NGINX process ID (PID) file is secured (Scored)OKNo PID-File due to docker design
    2.3.4 Ensure the core dump directory is secured (Not Scored)OKNo working_directory configured by default
    2.4 Network Configuration
    2.4.1 Ensure NGINX only listens for network connections on authorized ports (Not Scored)OKEnsured by automatic nginx.conf configuration
    2.4.2 Ensure requests for unknown host names are rejected (Not Scored)OKThey are not rejected but send to the "default backend" delivering approriate errors (mostly 404)
    2.4.3 Ensure keepalive_timeout is 10 seconds or less, but not 0 (Scored)ACTION NEEDEDDefault is 75sconfigure keep-alive to 10 seconds according to this documentation
    2.4.4 Ensure send_timeout is set to 10 seconds or less, but not 0 (Scored)RISK TO BE ACCEPTEDNot configured, however the nginx default is 60sNot configurable
    2.5 Information Disclosure
    2.5.1 Ensure server_tokens directive is set to off (Scored)OKserver_tokens is configured to off by defaukt
    2.5.2 Ensure default error and index.html pages do not reference NGINX (Scored)ACTION NEEDED404 shows no version at all, 503 and 403 show "nginx", which is hardcoded see this line in nginx source codeconfigure custom error pages at least for 403, 404 and 503 and 500
    2.5.3 Ensure hidden file serving is disabled (Not Scored)ACTION NEEDEDconfig not setconfigure a config.server-snippet Snippet, but beware of .well-known challenges or similar. Refer to the benchmark here please
    2.5.4 Ensure the NGINX reverse proxy does not enable information disclosure (Scored)ACTION NEEDEDhide not configuredconfigure hide-headers with array of "X-Powered-By" and "Server": according to this documentation
    3 Logging
    3.1 Ensure detailed logging is enabled (Not Scored)OKNingx ingress has a very detailled log format by default
    3.2 Ensure access logging is enabled (Scored)OKAccess log is enabled by default
    3.3 Ensure error logging is enabled and set to the info logging level (Scored)OKError log is configured by default. The log level does not matter, because it is all sent to STDOUT anyway
    3.4 Ensure log files are rotated (Scored)OBSOLETELog file handling is not part of the nginx ingress and should be handled separatly
    3.5 Ensure error logs are sent to a remote syslog server (Not Scored)OBSOLETESee previous answer
    3.6 Ensure access logs are sent to a remote syslog server (Not Scored)OBSOLETESee previous answer
    3.7 Ensure proxies pass source IP information (Scored)OKHeaders are set by default
    4 Encryption
    4.1 TLS / SSL Configuration
    4.1.1 Ensure HTTP is redirected to HTTPS (Scored)OKRedirect to TLS is default
    4.1.2 Ensure a trusted certificate and trust chain is installed (Not Scored)ACTION NEEDEDFor installing certs there are enough manuals in the web. A good way is to use lets encrypt through cert-managerInstall proper certificates or use lets encrypt with cert-manager
    4.1.3 Ensure private key permissions are restricted (Scored)ACTION NEEDEDSee previous answer
    4.1.4 Ensure only modern TLS protocols are used (Scored)OK/ACTION NEEDEDDefault is TLS 1.2 + 1.3, while this is okay for CIS Benchmark, cipherlist.eu only recommends 1.3. This may cut off old OS'sSet controller.config.ssl-protocols to "TLSv1.3"
    4.1.5 Disable weak ciphers (Scored)ACTION NEEDEDDefault ciphers are already good, but cipherlist.eu recommends even stronger ciphersSet controller.config.ssl-ciphers to "EECDH+AESGCM:EDH+AESGCM"
    4.1.6 Ensure custom Diffie-Hellman parameters are used (Scored)ACTION NEEDEDNo custom DH parameters are generatedGenerate dh parameters for each ingress deployment you use - see here for a how to
    4.1.7 Ensure Online Certificate Status Protocol (OCSP) stapling is enabled (Scored)ACTION NEEDEDNot enabledset via this configuration parameter
    4.1.8 Ensure HTTP Strict Transport Security (HSTS) is enabled (Scored)OKHSTS is enabled by default
    4.1.9 Ensure HTTP Public Key Pinning is enabled (Not Scored)ACTION NEEDED / RISK TO BE ACCEPTEDHKPK not enabled by defaultIf lets encrypt is not used, set correct HPKP header. There are several ways to implement this - with the helm charts it works via controller.add-headers. If lets encrypt is used, this is complicated, a solution here is yet unknown
    4.1.10 Ensure upstream server traffic is authenticated with a client certificate (Scored)DEPENDS ON BACKENDHighly dependend on backends, not every backend allows configuring this, can also be mitigated via a service meshIf backend allows it, manual is here
    4.1.11 Ensure the upstream traffic server certificate is trusted (Not Scored)DEPENDS ON BACKENDHighly dependend on backends, not every backend allows configuring this, can also be mitigated via a service meshIf backend allows it, see configuration here
    4.1.12 Ensure your domain is preloaded (Not Scored)ACTION NEEDEDPreload is not active by defaultSet controller.config.hsts-preload to true
    4.1.13 Ensure session resumption is disabled to enable perfect forward security (Scored)ACTION NEEDEDSession tickets are enabled by defaultSet controller.config.ssl-session-tickets to false
    4.1.14 Ensure HTTP/2.0 is used (Not Scored)OKhttp2 is set by default
    5 Request Filtering and Restrictions
    5.1 Access Control
    5.1.1 Ensure allow and deny filters limit access to specific IP addresses (Not Scored)OK/ACTION NEEDEDDepends on use case, geo ip module is compiled into nginx ingress controller, there are several ways to use itIf needed set IP restrictions via annotations or work with config snippets (be careful with lets-encrypt-http-challenge!)
    5.1.2 Ensure only whitelisted HTTP methods are allowed (Not Scored)OK/ACTION NEEDEDDepends on use caseIf required it can be set via config snippet
    5.2 Request Limits
    5.2.1 Ensure timeout values for reading the client header and body are set correctly (Scored)ACTION NEEDEDDefault timeout is 60sSet via this configuration parameter and respective body aequivalent
    5.2.2 Ensure the maximum request body size is set correctly (Scored)ACTION NEEDEDDefault is 1mset via this configuration parameter
    5.2.3 Ensure the maximum buffer size for URIs is defined (Scored)ACTION NEEDEDDefault is 4 8kSet via this configuration parameter
    5.2.4 Ensure the number of connections per IP address is limited (Not Scored)OK/ACTION NEEDEDNo limit setDepends on use case, limit can be set via these annotations
    5.2.5 Ensure rate limits by IP address are set (Not Scored)OK/ACTION NEEDEDNo limit setDepends on use case, limit can be set via these annotations
    5.3 Browser Security
    5.3.1 Ensure X-Frame-Options header is configured and enabled (Scored)ACTION NEEDEDHeader not set by defaultSeveral ways to implement this - with the helm charts it works via controller.add-headers
    5.3.2 Ensure X-Content-Type-Options header is configured and enabled (Scored)ACTION NEEDEDSee previous answerSee previous answer
    5.3.3 Ensure the X-XSS-Protection Header is enabled and configured properly (Scored)ACTION NEEDEDSee previous answerSee previous answer
    5.3.4 Ensure that Content Security Policy (CSP) is enabled and configured properly (Not Scored)ACTION NEEDEDSee previous answerSee previous answer
    5.3.5 Ensure the Referrer Policy is enabled and configured properly (Not Scored)ACTION NEEDEDDepends on application. It should be handled in the applications webserver itself, not in the load balancing ingresscheck backend webserver
    6 Mandatory Access Controln/atoo high level, depends on backends
    + + + + + + + +
    +
    +
    +
    + + + + +
    + + + + + + + + + \ No newline at end of file diff --git a/deploy/index.html b/deploy/index.html index 0cf6b07c3..bc758228e 100644 --- a/deploy/index.html +++ b/deploy/index.html @@ -587,6 +587,18 @@ + + + + + +
  • + + Hardening guide + +
  • + + diff --git a/deploy/rbac/index.html b/deploy/rbac/index.html index 0091a27ed..00d627660 100644 --- a/deploy/rbac/index.html +++ b/deploy/rbac/index.html @@ -505,6 +505,18 @@ + + + + + +
  • + + Hardening guide + +
  • + + diff --git a/deploy/upgrade/index.html b/deploy/upgrade/index.html index 224b63d3b..c29eef2ae 100644 --- a/deploy/upgrade/index.html +++ b/deploy/upgrade/index.html @@ -484,6 +484,18 @@ + + + + + +
  • + + Hardening guide + +
  • + + @@ -1296,13 +1308,13 @@ you should be able to upgrade using

    -