server

by deployment-aqua

Helm chartv2022.4.36App 2022.4Apache-2.0

A Helm chart for the Aqua Console components

About this chart

Aqua Security Server Helm Chart

These are Helm charts for installation and maintenance of Aqua Container Security Platform: Console Server, Gateway & Database.

Contents

  • Aqua Security Server Helm Chart
    • Prerequisites
      • Container Registry Credentials
      • Service Account
      • PostgreSQL database
    • Installing the Chart
      • Installing Aqua Web from Helm Private Repository
    • Advanced Configuration
    • Envoy
    • Database
    • Configuring HTTPS for Aqua's server
    • Configuring mTLS/TLS for Aqua Server and Aqua Gateway
      • Create Root CA (Done once)
      • Create the certificate key for Aqua server, gateway
      • Create secrets with generated certs and change values.yaml as mentioned below
    • Configure mTLS between server/gateway and external DB
    • Setting active-active mode
    • Configurable Variables
    • Issues and feedback

Prerequisites

Container Registry Credentials

Link

Service Account

By default, the chart will create a SA named aqua-sa, and will deploy the resources using it.

There are 3 scenarios for the service account usage:

  1. Using the default SA aqua-sa, this is the default option, no additional values need to be provided.

  2. Using a custom name for SA, in this scenario the following values need to be provided: serviceAccount.name and gateway.serviceAccount.name containing the desired name.

  3. Using an existing SA or imperatively created one: For example the SA can be created and patched with these commands:

    # Create the ServiceAccount
    kubectl create serviceaccount aqua-custom-sa -n aqua
    # Patch the ServiceAccount with the pull secret
    kubectl patch serviceaccount aqua-custom-sa -n aqua -p '{"imagePullSecrets": [{"name": "aqua-registry-secret"}]}'
    

    and the values that need to be provided are:

    • serviceAccount.name and gateway.serviceAccount.name containing the value aqua-custom-sa.
    • serviceAccount.create with the valuefalse
  4. By default imagePullSecrets are attached to the service account. This handles all child resources of the server chart such Web, DB ,checkDBupgrade and Envoy. The attachement policy can be changed in the corresponding values.

PostgreSQL database

Aqua Security recommends implementing a highly-available PostgreSQL database. By default, the console chart will install a PostgreSQL database and attach it to persistent storage for POC usage and testing. For production use, one may override this default behavior and specify an existing PostgreSQL database by setting the following variables in values.yaml:

global:
  db:
    external:
      enabled: true
      name: example-aquasec
      host: aquasec-db
      port: 5432
      user: aquasec-db-username
      password: verysecret

Installing the Chart

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

Installing Aqua Web 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/server --versions
  • Install Aqua
helm upgrade --install --namespace aqua <RELEASE_NAME> aqua-helm/server --set imageCredentials.username=<>,imageCredentials.password=<>,global.platform=<>

Advanced Configuration

Envoy

In order to support L7 / gRPC communication between gateway and enforcers Aqua recommends that customers use the Envoy load balancer. Following are the detailed steps to enable and deploy a secure envoy based load balancer.

  1. Generate TLS certificates signed by a public CA or Self-Signed CA

    # Self-Signed Root CA (Optional)
    #####################################################################################
    
    # Create Root Key
    # If you want a non password protected key just remove the -des3 option
    openssl genrsa -des3 -out rootCA.key 4096
    
    # Create and self sign the Root Certificate
    openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1024 -out rootCA.crt
    
    #####################################################################################
    # Create a certificate
    #####################################################################################
    
    # Create the certificate key
    openssl genrsa -out myDomain.com.key 2048
    # Create the signing (csr)
    openssl req -new -key myDomain.com.key -out myDomain.com.csr
    # Verify the csr content
    openssl req -in myDomain.com.csr -noout -text
    
    #####################################################################################
    # Generate the certificate using the myDomain csr and key along with the CA Root key
    #####################################################################################
    
    openssl x509 -req -in myDomain.com.csr -CA rootCA.crt -CAkey rootCA.key -CAcreateserial -out myDomain.com.crt -days 500 -sha256
    
    #####################################################################################
    # If you wish to use a Public CA like GoDaddy or LetsEncrypt please
    # submit the myDomain csr to the respective CA to generate myDomain crt
    
  2. Create TLS cert secret

    kubectl create secret generic aqua-lb-tls --from-file=myDomain.com.crt --from-file=myDomain.com.key --from-file=rootCA.crt -n aqua
    
  3. Edit the values.yaml file to include above secret

        TLS:
          listener:
             secretName: "aqua-lb-tls"
             publicKey_fileName: "myDomain.com.crt"
             privateKey_fileName: "myDomain.com.key"
             rootCA_fileName: "rootCA.crt"
    
  4. [Optional] If Gateway requires client certificate authentication edit the values.yaml to include those secrets as well:

        TLS:
          ...
          cluster:
             enabled: true
             secretName: "aqua-lb-tls-custer"
             publicKey_fileName: "envoy.crt"
             privateKey_fileName: "envoy.key"
             rootCA_fileName: "rootCA.crt"
    
  5. For more customizations please refer to Configurable Variables

Database

  1. By default, the Aqua helm chart will deploy a database container. If you wish to use an external database please set global.db.external.enabled to true and the following with appropriate values.
    global.db.external.name
    global.db.external.host
    global.db.external.port
    global.db.external.user
    global.db.external.password
    
  2. By default, the same database (Packaged DB Container | Managed DB like AWS RDS) will be used to host both main DB and Audit DB. If you want to use a different database for audit db then set following variables in the values.yaml file
    global.db.external.auditName
    global.db.external.auditHost
    global.db.external.auditPort
    global.db.external.auditUser
    global.db.external.auditPassword
    
  3. If you are using packaged DB container then
    1. The AQUA_ENV_SIZE variable can be used to define the sizing of your DB container in terms of number of connections and optimized configuration but not the PV size. Please choose appropriate PV size as per your requirements.
    2. By default, AQUA_ENV_SIZE is set to "S" and the possible values are "M", "L"

Configuring HTTPS for Aqua's server

By default, Aqua will generate a self-signed cert and will use the same for HTTPS communication. If you wish to use your own SSL/TLS certs you can do this in two different ways

  1. Ingress(optional): Kubernetes ingress controller can be used to publicly expose aqua web UI over an HTTPS connection

  2. LoadBalancer(Default):

    1. Create Kubernetes secrets for server component using the respective SSL certificates.

      kubectl create secret generic aqua-web-certs --from-file aqua_web.key --from-file aqua_web.crt --from-file rootCA.crt -n aqua
      
      here: aqua_web.key    = privateKey
            aqua_web.crt    = publicKey
            rootCA.crt      = rootCA
            aqua-web-certs  = secret Name
      
    2. Enable web.TLS.enable to true in values.yaml

    3. Add the certificate's secret name web.TLS.secretName in values.yaml

    4. Add respective certificate file names to web.TLS.publicKey_fileName, web.TLS.privateKey_fileName and web.TLS.rootCA_fileName(Add rootCA if certs are self-signed) in values.yaml

    5. Proceed with the deployment.

Configuring mTLS/TLS for Aqua Server and Aqua Gateway

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 aqua components use the below instructions 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: Optional, If you have already the existing rootCA certs you can skip to generating [component certificates] step.(#create-the-certificate-key-for-aqua-server-gateway)

1. Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

  • Generating rootCA key
    openssl genrsa -des3 -out rootCA.key 4096
    

If you want a non-password-protected key just remove the -des3 option

2. Create and self sign the Root Certificate

  • Creating rootCA certificate
    openssl req -new -x509 -days 365 -key rootCA.key -sha256 -days 1024 -out rootCA.crt
    

Create the certificate key for Aqua server, gateway

After creating rootCA certs start generating component certificates.

3. Create keys and 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 signing request is important to specify the Common Name providing the IP address or domain name for the service, otherwise the certificate cannot be verified.

Important for multi-cluster: When using a multi-cluster setup like enforcer/kube-enforcers from various clusters or connecting over the internet with gateway/envoy, then SAN(subjectAltName) section should contain alternate domain/IP addresses of the component.

  1. Creating aqua_web key and csr:

    openssl req -newkey rsa:2048 -nodes -keyout aqua_web.key -subj "/C=US/ST=CA/O=MyOrg/CN=aqua-console-svc" -out aqua_web.csr
    
  2. Creating aqua_gateway key and csr:

    openssl req -newkey rsa:2048 -nodes -keyout aqua_gateway.key -subj "/C=US/ST=CA/O=MyOrg/CN=aqua-gateway-svc" -out aqua_gateway.csr
    

here, change the subjectAltName accordingly to your domain.

4. Verify the CSR's content:

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

5. Generate the certificate using the component CSR's and key along with the CA Root key:

  1. Creating aqua_web certificate

    openssl x509 -req \
       -extfile <(printf "subjectAltName=DNS:aqua-console-svc.aqua,DNS:aqua-console-svc,DNS:my-domain.com") \
       -days 365 -in aqua_web.csr \
       -CA rootCA.crt -CAkey rootCA.key -CAcreateserial \
       -out aqua_web.crt
    

    here, change the subjectAltName accordingly to your domain.

  2. Creating aqua_gateway certificate

    openssl x509 -req \
       -extfile <(printf "subjectAltName=DNS:aqua-gateway-svc.aqua,DNS:aqua-gateway-svc,DNS:my-domain.com") \
       -days 365 -in aqua_gateway.csr \
       -CA rootCA.crt -CAkey rootCA.key -CAcreateserial \
       -out aqua_gateway.crt
    

    here, change the subjectAltName accordingly to your domain.

6. Verify the certificate's content:

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

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

  1. Create Kubernetes secrets for server and gateway components using the generated SSL certificates.

    # Example:
    # Change < certificate filenames > respectively
    kubectl create secret generic aqua-web-certs --from-file aqua_web.key --from-file aqua_web.crt --from-file rootCA.crt -n aqua
    kubectl create secret generic aqua-gateway-certs --from-file aqua_gateway.key --from-file aqua_gateway.crt --from-file rootCA.crt -n aqua
    
  2. Enable web.TLS.enable and

Deploy server with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has server 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 chartserver is pinned at v2022.4.36 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