Skip to content

Commit 1593812

Browse files
ADubhlaoichpre-commit-ci[bot]shaun-nx
authored
Rewrite "Security recommendations" page. (#5342)
This commit restructures and rewrites the Security recommendations page, reducing it to the critical information and ensuring it adheres to contemporary Hugo conventions and style guide standards. --------- Signed-off-by: Alan Dooley <[email protected]> Signed-off-by: Alan Dooley <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Shaun <[email protected]>
1 parent 7221d68 commit 1593812

File tree

1 file changed

+46
-58
lines changed

1 file changed

+46
-58
lines changed

docs/content/configuration/security.md

Lines changed: 46 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,68 +2,54 @@
22
docs: DOCS-597
33
doctypes:
44
- ''
5-
title: Security Recommendations
5+
title: Security recommendations
66
toc: true
77
weight: 1500
88
---
99

10-
The security of NGINX Ingress Controller is paramount to the success of our Users, however, NGINX Ingress Controller is deployed by a User in their environment, and as such, the User takes responsibility
11-
for securing a deployment of NGINX Ingress Controller.
12-
We strongly recommend every User read and understand the following security concerns.
10+
NGINX Ingress Controller follows Kubernetes best practices: this page outlines configuration specific to NGINX Ingress Controller you may require, including links to examples in the [GitHub repository](https://github.com/nginxinc/kubernetes-ingress/tree/release-3.5).
1311

14-
## Kubernetes
12+
For general guidance, we recommend the official Kubernetes documentation for [Securing a Cluster](https://kubernetes.io/docs/tasks/administer-cluster/securing-a-cluster/).
1513

16-
We recommend the Kubernetes [guide to securing a cluster](https://kubernetes.io/docs/tasks/administer-cluster/securing-a-cluster/).
17-
In addition, the following relating more specifically to Ingress Controller.
14+
## Kubernetes recommendations
1815

19-
### RBAC and Service Account
16+
### RBAC and Service Accounts
2017

21-
The Ingress Controller is deployed within a Kubernetes environment, this environment must be secured.
22-
Kubernetes uses [RBAC](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) to control the resources and operations available to different types of users.
23-
The Ingress Controller requires a service account which is configured using RBAC.
24-
We strongly recommend using the [RBAC configuration](https://github.com/nginxinc/kubernetes-ingress/blob/v3.5.0/deployments/rbac/rbac.yaml) provided in our standard deployment configuration. It is configured with the least amount of privilege required for the Ingress Controller to work.
18+
Kubernetes uses [RBAC](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) to control the resources and operations available to different types of users.
2519

26-
We strongly recommend inspecting the RBAC configuration for [Manifests](https://github.com/nginxinc/kubernetes-ingress/blob/v3.5.0/deployments/rbac/rbac.yaml)
27-
or for [Helm](https://github.com/nginxinc/kubernetes-ingress/blob/v3.5.0/charts/nginx-ingress/templates/clusterrole.yaml) to understand what access the Ingress Controller service account has and to which resources. For example, by default the service account has access to all Secret resources in the cluster.
20+
NGINX Ingress Controller requires RBAC to configure a [ServiceUser](https://kubernetes.io/docs/concepts/security/service-accounts/#default-service-accounts), and provides least privilege access in its standard deployment configurations:
2821

29-
### Certificates and Privacy Keys
22+
- [Helm](https://github.com/nginxinc/kubernetes-ingress/blob/v3.5.0/deployments/rbac/rbac.yaml)
23+
- [Manifests](https://github.com/nginxinc/kubernetes-ingress/blob/v3.5.0/deployments/rbac/rbac.yaml)
3024

31-
Secrets are required by the Ingress Controller for some configurations.
32-
[Secrets](https://kubernetes.io/docs/concepts/configuration/secret/) are stored by Kubernetes unencrypted by default.
33-
We strongly recommend configuring Kubernetes to store these Secrets encrypted at rest.
34-
Kubernetes has [documentation](https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/) on how to configure this.
25+
By default, the ServiceAccount has access to all Secret resources in the cluster.
3526

36-
## Ingress Controller
27+
### Secrets
3728

38-
### Recommended Secure Defaults
29+
[Secrets](https://kubernetes.io/docs/concepts/configuration/secret/) are required by NGINX Ingress Controller for certificates and privacy keys, which Kubernetes stores unencrypted by default. We recommend following the [Kubernetes documentation](https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/) to store these Secrets using at-rest encryption.
3930

40-
We recommend the following for the most secure configuration:
4131

42-
- If Prometheus metrics are [enabled](/nginx-ingress-controller/configuration/global-configuration/command-line-arguments/#cmdoption-enable-prometheus-metrics),
43-
we recommend [configuring HTTPS](/nginx-ingress-controller/configuration/global-configuration/command-line-arguments/#cmdoption-prometheus-tls-secret) for Prometheus.
32+
## NGINX Ingress Controller recommendations
4433

45-
### Snippets
34+
### Configure root filesystem as read-only
4635

47-
Snippets allow you to insert raw NGINX config into different contexts of NGINX configuration and are supported for [Ingress](/nginx-ingress-controller/configuration/ingress-resources/advanced-configuration-with-snippets/), [VirtualServer/VirtualServerRoute](/nginx-ingress-controller/configuration/virtualserver-and-virtualserverroute-resources/#using-snippets), and [TransportServer](/nginx-ingress-controller/configuration/transportserver-resource/#using-snippets) resources. Additionally, the [ConfigMap](/nginx-ingress-controller/configuration/global-configuration/configmap-resource#snippets-and-custom-templates) resource configures snippets globally.
36+
{{< caution >}}
37+
This feature is not compatible with [NGINX App Protect WAF](https://docs.nginx.com/nginx-app-protect-waf/) or [NGINX App Protect DoS](https://docs.nginx.com/nginx-app-protect-dos/).
38+
{{< /caution >}}
4839

49-
Snippets are disabled by default. To use snippets, set the [`enable-snippets`](/nginx-ingress-controller/configuration/global-configuration/command-line-arguments#cmdoption-enable-snippets) command-line argument. Note that for the ConfigMap resource, snippets are always enabled.
40+
NGINX Ingress Controller is designed to be resilient against attacks in various ways, such as running the service as non-root to avoid changes to files. We recommend setting filesystems to read-only so that the attack surface is further reduced by limiting changes to binaries and libraries.
5041

51-
### Configure root filesystem as read-only
52-
>
53-
> **Note**: This feature is available for both the NGINX and NGINX Plus editions. NGINX AppProtect WAF and NGINX AppProtect DoS are not yet supported by this feature.
42+
This is not enabled by default, but can be enabled with **Helm** using the [**controller.readOnlyRootFilesystem**]({{< relref "installation/installing-nic/installation-with-helm.md#configuration" >}}) argument.
5443

55-
The F5 Nginx Ingress Controller (NIC) has various protections against attacks, such as running the service as non-root to avoid changes to files. An additional industry best practice is having root filesystems set as read-only so that the attack surface is further reduced by limiting changes to binaries and libraries.
44+
For **Manifests**, uncomment the following sections of the deployment:
5645

57-
Currently, we do not set read-only root filesystem as default. Instead, this is an opt-in feature available on the [helm-chart](/nginx-ingress-controller/installation/installation-with-helm/#configuration) via `controller.readOnlyRootFilesystem`.
58-
When using manifests instead of Helm, uncomment the following sections of the deployment:
46+
- `readOnlyRootFilesystem: true`
47+
- The entire **volumeMounts** section
48+
- The entire **initContainers** section
5949

60-
- `readOnlyRootFilesystem: true`,
61-
- The entire `volumeMounts` section,
62-
- The entire `initContainers` section,
63-
- For `initContainers:image:`, use exact same image used for regular NIC installation.
64-
Refer to the below code-block for guidance:
50+
The block below shows the code you will look for:
6551

66-
```
52+
```yaml
6753
# volumes:
6854
# - name: nginx-etc
6955
# emptyDir: {}
@@ -89,23 +75,25 @@ Refer to the below code-block for guidance:
8975
# name: nginx-lib
9076
# - mountPath: /var/log/nginx
9177
# name: nginx-log
92-
.
93-
.
94-
.
95-
# initContainers:
96-
# - image: <repository>:<tag>
97-
# imagePullPolicy: IfNotPresent
98-
# name: init-nginx-ingress
99-
# command: ['cp', '-vdR', '/etc/nginx/.', '/mnt/etc']
100-
# securityContext:
101-
# allowPrivilegeEscalation: false
102-
# readOnlyRootFilesystem: true
103-
# runAsUser: 101 #nginx
104-
# runAsNonRoot: true
105-
# capabilities:
106-
# drop:
107-
# - ALL
108-
# volumeMounts:
109-
# - mountPath: /mnt/etc
110-
# name: nginx-etc
11178
```
79+
80+
### Prometheus
81+
82+
If Prometheus metrics are [enabled]({{< relref "/logging-and-monitoring/prometheus.md" >}}), we recommend [using HTTPS]({{< relref "configuration/global-configuration/command-line-arguments.md#cmdoption-prometheus-tls-secret" >}}).
83+
84+
### Snippets
85+
86+
Snippets allow raw NGINX configuration to be inserted into resources. They are intended for advanced NGINX users and could create vulnerabilities in a cluster if misused.
87+
88+
Snippets are disabled by default. To use snippets, set the [**enable-snippets**]({{< relref"configuration/global-configuration/command-line-arguments.md#cmdoption-enable-snippets" >}}) command-line argument.
89+
90+
{{< caution >}}
91+
Snippets are **always** enabled for ConfigMap.
92+
{{< /caution >}}
93+
94+
For more information, read the following:
95+
96+
- [Advanced Configuration using Snippets]({{< relref "/configuration/ingress-resources/advanced-configuration-with-snippets.md" >}})
97+
- [Using Snippets with VirtualServer/VirtualServerRoute]({{< relref "configuration/virtualserver-and-virtualserverroute-resources.md#using-snippets" >}})
98+
- [Using Snippets with TransportServer]({{< relref "/configuration/transportserver-resource.md#using-snippets" >}})
99+
- [ConfigMap Snippets and Custom Templates]({{< relref "configuration/global-configuration/configmap-resource.md#snippets-and-custom-templates" >}})

0 commit comments

Comments
 (0)