Skip to content

πŸ›‘οΈ Security

πŸ—ΊοΈ Overview

Core CogStack-NiFi services use TLS certificates generated locally for each deployment. A shared root Certificate Authority (CA) signs dedicated service leaf certificates, while native Elasticsearch uses its own certificate-generation tooling.

This ensures full end-to-end encryption across the stack for essential operations, including service-to-service communication and user-facing endpoints.

Security is achieved through:

  • A unified root Certificate Authority (CA),
  • Per-service certificate generation and signing targets,
  • Environment-file management for local development credentials, and
  • Optional reverse-proxy enforcement via NGINX.

Warning

Generated certificates and private keys are deployment-local and ignored by Git. Run make -C deploy init-security before starting services. The tracked security/env/*.env files contain public development defaults only; never use those values as production secrets.

🧩 Components secured with TLS

Service Certificate location Supported initialization target
NiFi security/certificates/nifi/ make -C deploy init-security-nifi
PostgreSQL samples and databank security/certificates/postgresql/ make -C deploy init-security-postgresql
Elasticsearch security/certificates/elastic/elasticsearch/ make -C deploy init-security-elasticsearch
OpenSearch and Dashboards security/certificates/elastic/opensearch/ make -C deploy init-security-opensearch
Gitea security/certificates/gitea/ make -C deploy init-security-gitea

The root CA private key must be used only to sign leaf certificates. Services trust root-ca.pem; they must never serve root-ca.key as their TLS private key.


πŸ“‚ Folder structure

The security/ directory centralizes all certificate, credential, and role management for CogStack-NiFi.
Below is the high-level structure with explanations for each sub-folder.

security/
β”œβ”€β”€ certificates/                               # All generated certificates and keystores
β”‚   β”œβ”€β”€ elastic/                                # Elasticsearch / OpenSearch + Kibana certs
β”‚   β”œβ”€β”€ nifi/                                   # Apache NiFi leaf certificate and Java stores
β”‚   β”œβ”€β”€ gitea/                                  # Gitea leaf certificate
β”‚   β”œβ”€β”€ postgresql/                             # Samples and databank PostgreSQL TLS bundles
β”‚   └── root/                                   # Root CA files and truststores
β”‚               
β”œβ”€β”€ env/                                        # Environment variable definitions for certs and users
β”‚   β”œβ”€β”€ certificates_*.env                      # Variables controlling certificate generation
β”‚   └── users_*.env                             # Public local-development defaults only
β”‚               
β”œβ”€β”€ es_roles/                                   # Role and role mapping definitions for ES / OpenSearch
β”‚   β”œβ”€β”€ elasticsearch/                          # Native Elasticsearch roles
β”‚   └── opensearch/                             # OpenSearch Security Plugin configs
β”‚           
β”œβ”€β”€ scripts/                                    # Shell utilities for creating certs and credentials
β”‚   β”œβ”€β”€ create_root_ca_cert.sh                  # Generates the shared root CA (trust anchor)
β”‚   β”œβ”€β”€ create_es_native_certs.sh               # Elasticsearch node and client certs
β”‚   β”œβ”€β”€ create_es_native_credentials.sh         # Runs post-deployment to create default Elasticsearch system users and tokens
β”‚   β”œβ”€β”€ create_opensearch_node_cert.sh          # Generates certificates and JKS stores for each OpenSearch node
β”‚   β”œβ”€β”€ create_opensearch_client_admin_certs.sh # Creates admin + client certificates for OpenSearch Dashboards
β”‚   β”œβ”€β”€ create_opensearch_internal_passwords.sh # Generates bcrypt password hashes for OpenSearch internal_users.yml
β”‚   β”œβ”€β”€ update_opensearch_users.sh              # Updates password hashes for every user in OpenSearch internal_users.yml
β”‚   β”œβ”€β”€ create_opensearch_users.sh              # Creates OpenSearch internal users and role mappings (manual execution post-startup)
β”‚   β”œβ”€β”€ create_nifi_certs.sh                    # Generates NiFi 2.x leaf certificates and Java stores
β”‚   β”œβ”€β”€ create_gitea_certs.sh                   # Generates a dedicated Gitea leaf certificate
β”‚   β”œβ”€β”€ nifi_init_create_user_auth.sh           # Bootstraps a temporary NiFi container to create a single-user authentication file
β”‚   β”œβ”€β”€ nifi_create_single_user_auth.sh         # Helper script executed inside the container to generate NiFi single-user credentials
β”‚   β”œβ”€β”€ es_native_cert_generator.sh             # Helper called by create_es_native_certs.sh to assemble ES cert bundles
β”‚   └── create_keystore.sh                      # Builds Java keystores from a certificate and private key
β”‚
└── templates/                                  # OpenSSL / X.509 configuration templates
    └── ssl-extensions-x509.cnf                 # SAN extensions used across certificate scripts