Security#

All the standards#

There are several features that will enhance the security of your system:

  • all components are running rootless by default
  • all components drop all privileges
  • all components deny escalation
  • all components have read only file systems

On top of that, you can restrict the access with NetworkPolicies. They are off by default, see NetworkPolicies below.

Additional: The backend Protocol#

Additionally, you can increase security by encrypting communication in the backend. Depending on your network driver, this might already been done automatically beween the Kubernetes Nodes. But you can double that even within a single node by switching the backend Protocol to https:

global:
  nappl:
    port: 8443
    ssl: true

# Web and PAM do not speak https by default yet, CRs have been filed.

nappl:
  ingress:
    backendProtocol: https
cmis:
  ingress:
    backendProtocol: https
ilm:
  ingress:
    backendProtocol: https
webdav:
  ingress:
    backendProtocol: https
rs:
  ingress:
    backendProtocol: https
mon:
  ingress:
    backendProtocol: https
administrator:
  ingress:
    backendProtocol: https

This will turn every communication to https, but leave the unencrypted ports (http) open for inter-pod communication.

Zero Trust Mode#

This will basically do the same as above, but also turn off any unencrypted port (like http): pods, services and ingress rules only offer the encrypted ports. Zero trust does not switch on NetworkPolicies. If you switch them on as well (see below), with excludeUnusedPorts: true their rules also only open the encrypted ports.

This will also affect the way how probes are checking the pods health: nplus will switch them to use https instead, so even the very internal Healtch Check infrastructure will be encrypted in zero trust mode:

components:
  pam: false  #TODO: ITSMSD-8771: PAM does not yet support https backend.
global:
  security:
    zeroTrust: true
  nappl:
    port: 8443
    ssl: true

NetworkPolicies#

NetworkPolicies are not created by default. Switch them on for the environment (recommended) or per instance:

global:
  environment:
    security:
      cni:
        createNetworkPolicy: true
        defaultIngressPolicy: deny
        defaultEgressPolicy: deny
  • createNetworkPolicy: true lets every component render its own NetworkPolicy, and the instance a policy that allows DNS. Without it, none of the settings below has any effect.
  • defaultIngressPolicy and defaultEgressPolicy (deny or allow, empty: none) add one policy per instance for all its pods: deny blocks everything that no other policy allows, allow lets everything through. Use deny for both, unless you have a reason not to.

What the policies of the components allow:

  • Within the instance, a component only accepts the pods that are meant to use it, for example the storage layer only the application layer, and only from the same instance group (nplus/group, by default the instance name). Everything else is blocked.

  • From the ingress controller, in the namespaces listed in ingress.namespace.

  • To the ingress controller, in the same namespaces, from the Application Layer (nappl) only: it sends its nscale AI requests to the instance domain (since 26.4.1006). The rule names no port, because a policy sees the port of the controller pod, not the one of its service.

  • From the nscale Administrator, the Monitoring Console and nscale Process Automation Modeler, by default the ones of the same instance in the same namespace. If you run them centrally, in another instance or namespace, set where they come from:

    global:
      security:
        cni:
          administratorNamespace: central
          administratorInstance: central-admin
          monitoringNamespace: central
          monitoringInstance: central-mon
          pamNamespace: central
          pamInstance: central-pam

    Since 26.4.1003 the namespace and the labels of the pods must both match.

  • To systems outside the cluster, only to the ranges you set (CIDR notation, none by default):

    ValueComponentAllows
    nappl.security.cni.dbIpRangenapplaccess to an external database
    nappl.security.cni.sapIpRangenapplaccess to SAP systems (only with snc.enabled)
    nstl.security.cni.nstlIpRangenstlaccess to a storage layer outside the cluster
    rms.security.cni.adminIpRangermsaccess from the desktops of your administrators (default 0.0.0.0/0)
    global.security.cni.llmIpRangeaibackendaccess to the language model of nscale AI
    global.security.cni.idpIpRangeaiauthaccess to the identity provider of the nscale AI sign-in

    The nscale AI components get their own policies like every other component (since 26.4.1006): the paths between them, to the Application Layer and to Elasticsearch are open, the ECK operator reaches Elasticsearch from security.cni.elasticOperatorNamespace (default elastic-system). The way to the language model stays closed until llmIpRange is set, see the ai sample.

Your own pods in the namespace (a backup job, a migration client, a sidecar of another tool) are not covered by these rules. Give them NetworkPolicies of their own, see the migration in the postgres sample for an example.

Files#

Download all files of this sample

build.sh#

#!/bin/bash
#
# This sample script builds the example as described. It is also used to build the test environment in our lab,
# so it should be well tested.
#

# Make sure it fails immediately, if anything goes wrong
set -e

# -- ENVironment variables:
# CHARTS: The path to the source code
# DEST: The path to the build destination
# SAMPLE: The directory of the sample
# NAME: The name of the sample, used as the .Release.Name
# KUBE_CONTEXT: The name of the kube context, used to build this sample depending on where you run it against. You might have different Environments such as lab, dev, qa, prod, demo, local, ...

# Check, if we have the source code available
if [ ! -d "$CHARTS" ]; then
    echo "ERROR Building $SAMPLE example: The Charts Sources folder is not set. Please make sure to run this script with the full Source Code available"
    exit 1
fi
if [ ! -d "$DEST" ]; then
    echo "ERROR Building $SAMPLE example: DEST folder not found."
    exit 1
fi
if [ ! -d "$CHARTS/instance" ]; then
    echo "ERROR Building $SAMPLE example: Chart Sources in $CHARTS/instance not found. Are you running this script as a subscriber?"
    exit 1
fi

# Set the Variables
SAMPLE="encrypt"
NAME="sample-$SAMPLE"

# Output what is happening
echo "Building $NAME"

# Create the manifest
mkdir -p $DEST/instance
helm template --debug \
     --values $SAMPLES/security/encrypt.yaml \
     --values $SAMPLES/application/empty.yaml \
     --values $SAMPLES/environment/$KUBE_CONTEXT.yaml \
     --values $SAMPLES/resources/$KUBE_CONTEXT.yaml \
     $NAME $CHARTS/instance > $DEST/instance/$SAMPLE.yaml

# creating the Argo manifest
mkdir -p $DEST/instance-argo
helm template --debug \
     --values $SAMPLES/security/encrypt.yaml \
     --values $SAMPLES/application/empty.yaml \
     --values $SAMPLES/environment/$KUBE_CONTEXT.yaml \
     --values $SAMPLES/resources/$KUBE_CONTEXT.yaml \
     $NAME-argo $CHARTS/instance-argo > $DEST/instance-argo/$SAMPLE-argo.yaml




# Set the Variables
SAMPLE="zerotrust"
NAME="sample-$SAMPLE"

# Output what is happening
echo "Building $NAME"

# Create the manifest
mkdir -p $DEST/instance
helm template --debug \
     --values $SAMPLES/ha/values.yaml \
     --values $SAMPLES/security/zerotrust.yaml \
     --values $SAMPLES/application/empty.yaml \
     --values $SAMPLES/environment/$KUBE_CONTEXT.yaml \
     --values $SAMPLES/resources/$KUBE_CONTEXT.yaml \
     $NAME $CHARTS/instance > $DEST/instance/$SAMPLE.yaml

# creating the Argo manifest
mkdir -p $DEST/instance-argo
helm template --debug \
     --values $SAMPLES/ha/values.yaml \
     --values $SAMPLES/security/zerotrust.yaml \
     --values $SAMPLES/application/empty.yaml \
     --values $SAMPLES/environment/$KUBE_CONTEXT.yaml \
     --values $SAMPLES/resources/$KUBE_CONTEXT.yaml \
     $NAME-argo $CHARTS/instance-argo > $DEST/instance-argo/$SAMPLE-argo.yaml

encrypt.yaml#

global:
  nappl:
    port: 8443
    ssl: true

# Web and PAM do not speak https by default yet, CRs have been filed.

nappl:
  ingress:
    backendProtocol: https
cmis:
  ingress:
    backendProtocol: https
ilm:
  ingress:
    backendProtocol: https
webdav:
  ingress:
    backendProtocol: https
rs:
  ingress:
    backendProtocol: https
mon:
  ingress:
    backendProtocol: https
administrator:
  ingress:
    backendProtocol: https

zerotrust.yaml#

components:
  pam: false  # #TODO: ITSMSD-8771: PAM does not yet support https backend.
global:
  security:
    zeroTrust: true
  nappl:
    port: 8443
    ssl: true