enforcer

by deployment-aqua

Helm chartv2022.4.30App 2022.4Apache-2.0

A Helm chart for the Aqua Enforcer

About this chart

Aqua Security Enforcer Helm Chart

These are Helm charts for installation and maintenance of Aqua Container Security Enforcer

Contents

  • Aqua Security Enforcer Helm Chart
    • Contents
    • Prerequisites
      • Container Registry Credentials
    • Installing the Chart
      • Installing Aqua Enforcer from Helm Private Repository
    • Migrating from Aqua Operator
    • Configuring Enforcer mTLS with Gateway/Envoy
      • Create Root CA (Done once)
      • Create the certificate and key for enforcer from existing rootca cert
      • Create secrets with generated certs and change values.yaml as mentioned below
    • Guide how to create enforcer group in Kubernetes
    • Integrate Aqua Enforcer with Hashicorp Vault to Load Token
    • Configurable Variables
      • Enforcer
    • Special cases
    • Issues and feedback

Prerequisites

Container Registry Credentials

Link

Installing the Chart

Follow the steps in this section for production grade deployments. You can either clone aqua-helm git repo or you can add our helm private repository (https://helm.aquasec.com)

Installing Aqua Enforcer from Helm Private Repository

  • Add Aqua Helm Repository
helm repo add aqua-helm https://helm.aquasec.com
helm repo update
  • Check for available chart versions either from Changelog or by running the below command
helm search repo aqua-helm/enforcer --versions
  • Install Aqua Enforcer
    • Install enforcer on linux nodes:

      helm upgrade --install --namespace aqua aqua-enforcer aqua-helm/enforcer --set global.imageCredentials.create=<>,global.imageCredentials.username=<>,global.imageCredentials.password=<>,global.platform=<>,enforcerToken=<aquasec-token>
      

      (or)

    • Install enforcer on combination of linux and windows nodes:

        helm upgrade --install --namespace aqua aqua-enforcer aqua-helm/enforcer --set global.imageCredentials.create=<>,global.imageCredentials.username=<>,global.imageCredentials.password=<>,global.platform=<>,enforcerToken=<aquasec-token>,windowsEnforcer.WinLinuxNodes.enable=true,windowsEnforcer.enforcerToken=<windows-enforcer-token>,windowsEnforcer.nodeSelector.key1=value1
      

      (or)

    • Install enforcer on windows nodes only:

        helm upgrade --install --namespace aqua aqua-enforcer aqua-helm/enforcer --set global.imageCredentials.create=<>,global.imageCredentials.username=<>,global.imageCredentials.password=<>,global.platform=<>,enforcerToken=<aquasec-token>,windowsEnforcer.allWinNodes.enable=true,windowsEnforcer.enforcerToken=<windows-enforcer-token>,windowsEnforcer.nodeSelector.key1=value1
      

Migrating from Aqua Operator

When migrating from the Aqua Operator to the Helm chart, you can reuse existing RBAC resources (ClusterRole, ClusterRoleBinding, ServiceAccount) created by the operator. This avoids permission conflicts and allows for a smoother transition.

Migration Steps

  1. Identify existing RBAC resources created by the operator:

    kubectl get clusterrole,clusterrolebinding,serviceaccount -n aqua | grep -i enforcer
    
  2. Install the Helm chart with RBAC creation disabled:

    helm upgrade --install --namespace aqua aqua-enforcer aqua-helm/enforcer \
      --set clusterRole.create=false \
      --set serviceAccount.create=false \
      --set serviceAccount.name=<existing-sa-name> \
      --set global.platform=<platform> \
      --set enforcerToken=<token>
    
  3. If you need to reference a specific existing ClusterRole for the binding:

    helm upgrade --install --namespace aqua aqua-enforcer aqua-helm/enforcer \
      --set clusterRole.create=false \
      --set clusterRole.roleRef=<existing-cluster-role-name> \
      --set serviceAccount.create=false \
      --set serviceAccount.name=<existing-sa-name> \
      --set global.platform=<platform> \
      --set enforcerToken=<token>
    
  4. After successful migration, you can clean up the operator resources:

    # Remove the AquaEnforcer CR (this will NOT delete the enforcer pods managed by Helm)
    kubectl delete aquaenforcer <name> -n aqua
    

Note: When clusterRole.create=false, no ClusterRole, ClusterRoleBinding, or platform-specific RBAC resources (OpenShift SCC, TKG RoleBinding) will be created by the chart. Ensure your existing RBAC setup has the required permissions.

Configuring Enforcer mTLS with Gateway/Envoy

By default, deploying Aqua Enterprise configures TLS-based encrypted communication, using self-signed certificates, between Aqua components. If you want to use self-signed certificates to establish mTLS between enforcer and gateway/envoy use the below instrictions to generate rootCA and component certificates

Note: mTLS communication and setup is only supported for self-hosted Aqua. It is not supported for Aqua ESE and Aqua SAAS

Create Root CA (Done once)

Important: The rootCA certificate used to generate the certificates for aqua server, gateway or envoy, use the same rootCA to generate enforcer certificates.

Create the certificate and key for enforcer from existing rootca cert

1. Create component key:

openssl genrsa -out aqua_enforcer.key 2048

2. Create the signing (csr):

The certificate signing request is where you specify the details for the certificate you want to generate. This request will be processed by the owner of the Root key (you in this case since you create it earlier) to generate the certificate.

Important: Please mind that while creating the signign request is important to specify the Common Name providing the IP address or domain name for the service, otherwise the certificate cannot be verified.

  • Generating aqua_enforcer csr:
openssl req -new -sha256 -key aqua_enforcer.key \
  -subj "/C=US/ST=MA/O=aqua/CN=aqua-agent" \
  -out aqua_enforcer.csr

3. Verify the CSR content:

  • verify the generated csr content(optional)
openssl req -in aqua_enforcer.csr -noout -text

4. Generate the certificate using the component csr and key along with the CA Root key:

openssl x509 -req -in aqua_enforcer.csr -CA rootCA.crt -CAkey rootCA.key -CAcreateserial -out aqua_enforcer.crt -days 500 -sha256

5. Verify the certificate content:

  • verify the generated certificate content(optional)
openssl x509 -in aqua_enforcer.crt -text -noout

Create secrets with generated certs and change values.yaml as mentioned below

  1. Create Kubernetes secret for enforcer using the generated SSL certificates.
# Example:
# Change < certificate filenames > respectively
kubectl create secret generic aqua-enforcer-certs --from-file aqua_enforcer.key --from-file aqua_enforcer.crt --from-file rootCA.crt -n aqua
  1. Enable TLS.enabled to true in values.yaml
  2. Add the certificates secret name TLS.secretName in values.yaml
  3. Add respective certificate file names to TLS.publicKey_fileName, TLS.privateKey_fileName and TLS.rootCA_fileName(Add rootCA if certsare self-signed) in values.yaml
  4. For enabling mTLS/TLS connection with self-signed or CA certificates between gateway and enforcer please setup mTLS/TLS config for gateway inserver chart as well server chart

Guide how to create enforcer group in Kubernetes

Please login into Aqua Web UI then go to Enforcers section under Administrator tab to create a new enforcer group. Following are the required parameters to create a new group

ParameterDescription
Enforcer TypeSelect Aqua Enforcer
Group NameEnter the name for the Enforcer Group; this name will appear in the list of Enforcer groups
OS TypeSelect the OS type for the host
OrchestratorSelect the orchestrator for which you are creating the Enforcer Group
Container RuntimeSelect the container runtime environment from the drop-down list
Aqua GatewaySelect the Aqua Gateway(s) that the Enforcer will use to communicate with the Aqua Server. If there is only one Gateway, you need not select anything.

For more details please visit Link

Integrate Aqua Enforcer with Hashicorp Vault to Load Token

  • Hashicorp Vault is a secrets management tools.
  • Aqua Enforcer charts supports to load token values from vault by vault-agent using annotations. To enable the Vault integration enable vaultSecret.enable=true, add vault secret filepath vaultSecret.vaultFilepath= "" and uncomment the vaultAnnotations.
  • vaultAnnotations - Change the vault annotations according as per your vault setup, Annotations support both self-hosted and SaaS Vault setups.

Configurable Variables

Enforcer

ParameterDescriptionDefaultMandatory
serviceAccount.createenable to create serviceaccountfalseYES - New cluster
serviceAccount.nameservice acccount nameaqua-saNO
serviceAccount.attachImagePullSecretattach image pull secret to created service account?trueNO
clusterRole.createSet to false to skip ClusterRole and ClusterRoleBinding creation (useful for operator migration)trueNO
clusterRole.roleRefcluster role reference name for cluster rolebindingunsetNO
platformOrchestration platform name (Allowed values are aks, eks, gke, gke-autopilot, openshift, tkg, tkgi, k8s, rancher, gs, k3s)unsetYES
vaultSecret.enableEnable to true once you have secrets in vault and annotations are enabled to load enforcer token from hashicorp vaultfalseNo
vaultSecret.vaultFilepathChange the path to "/vault/secrets/" as per the setup NO
enforcerTokenenforcer token valueenforcer-tokenYES if enforcerTokenSecretName is set to null
expressModeInstall enforcer in EXPRESS MODE or notfalseYES
enforcerTokenSecretNameenforcer token secret name if existsnullNO
enforcerTokenSecretKeyenforcer token secret key if existsnullNO
logicalNameSpecify the Logical Name the Aqua Enforcer will register under. if not specify the name will be spec.nodeNameunsetNO
nodelNameSpecify the Node Name the Aqua Enforcer will register under. if not specify the name will be spec.nodeNameunsetNO
securityContext.privilegeddetermines if any container in a pod can enable privileged mode.falseNO
securityContext.capabilitiesLinux capabilities provide a finer grained breakdown of the privileges traditionally associated with the superuser.add {}NO
podSecurityContextSet Pod Security Context ( see: https://kubernetes.io/docs/tasks/configure-pod-container/security-context )unsetNO
podSecurityPolicy.createEnable Pod Security Policies with the required enforcer capabilitiesfalseNO
podSecurityPolicy.privilegedEnable privileged permissions to the Enforcertrue if podSecurityPolicy.create is trueNO
global.imageCredentials.createSet if to create new pull image secretfalseYES - New cluster
global.imageCredentials.nameYour Docker pull image secret nameaqua-registry-secretYES - New cluster
global.imageCredentials.repositoryUriPrefixrepository uri prefix for dockerhub set docker.ioregistry.aquasec.comYES - New cluster
global.imageCredentials.registryset the registry url for dockerhub set index.docker.io/v1/registry.aquasec.comYES - New cluster
global.imageCredentials.usernameYour Docker registry (DockerHub, etc.) usernameaqua-registry-secretYES - New cluster
global.imageCredentials.passwordYour Docker registry (DockerHub, etc.) passwordunsetYES - New cluster
global.gateway.addressGateway host addressaqua-gateway-svcYES
global.gateway.portGateway host port8443YES
priorityClass.createIf true priority class will be createdFalseNO
priorityClass.nameDefine the name of priority class or default value will be used NO
priorityClass.preemptionPolicyPreemption policy for priority classPreemptLowerPriorityNO
priorityClass.valueThe integer value of the priority1000000NO
image.repositorythe docker image name to useenforcerYES
image.tagThe image tag to use.2022.4YES
image.pullPolicyThe kubernetes image pull policy.AlwaysNO
healthMonitor.enabledEnabling health monitoring for enforcer liveness and readinesstrueYES
resourcesResource requests and limits{}NO
nodeSelectorKubernetes node selector{}NO
tolerationsKubernetes node tolerations

Deploy enforcer with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has enforcer on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartenforcer is pinned at v2022.4.30 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply