Below is a complete, “from-zero-to-working” recipe for putting a very small Certificate-Authority (CA) server on Alpine Linux and using it to issue TLS certificates for an OpenSearch cluster.
The guide uses step-ca (from Smallstep) because:
• it is in the official Alpine repos
• it is lightweight and easy to automate
• it supports ACME if you later want automatic renewal
If you prefer OpenSSL/CFSSL only, see the Appendix at the end.
────────────────────────────────────────────────────────
- Prepare Alpine
────────────────────────────────────────────────────────
# As root
apk update
apk add --no-cache \
step-ca step-cli \
openjdk17-jre-headless # (or the JDK your OpenSearch build needs)
(step-ca and step-cli pull in NSS tools and a minimal Go runtime, only a few MB.)
Create a dedicated user (good practice):
adduser -D -H -s /sbin/nologin step
────────────────────────────────────────────────────────
2. Initialise the CA
────────────────────────────────────────────────────────
# All files will live in /etc/step-ca
mkdir -p /etc/step-ca
chown step:step /etc/step-ca
sudo -u step \
step ca init \
--name "OpenSearch Local CA" \
--dns "os-ca.local" \
--address ":9000" \
--provisioner "admin" \
--provisioner-password-file /dev/null # removes the interactive pw prompt
What the flags do
--dns sets the Common Name of the CA certificate
--address ":9000" means the CA server will listen on 0.0.0.0:9000
--provisioner creates an initial JWK provisioner called admin (used later to sign leaf certs)
After running, you will have:
/etc/step-ca/config/ca.json ← main config
/etc/step-ca/certs/root_ca.crt
/etc/step-ca/secrets/root_ca_key ← protect this!
...
────────────────────────────────────────────────────────
3. Make step-ca start on boot
────────────────────────────────────────────────────────
Create a simple OpenRC service /etc/init.d/step-ca:
#!/sbin/openrc-run
name="step-ca"
command=/usr/bin/step-ca
command_args="/etc/step-ca/config/ca.json"
command_user="step:step"
pidfile=/run/step-ca.pid
depend() {
need net
}
chmod +x /etc/init.d/step-ca
rc-update add step-ca default
rc-service step-ca start
Verify it’s running:
curl -sk https://localhost:9000/health
# {"status":"ok"}
────────────────────────────────────────────────────────
4. Issue the certificates OpenSearch needs
────────────────────────────────────────────────────────
You usually want one cert per node plus an admin or dashboard cert.
Create a little helper directory:
mkdir /etc/opensearch/certs
cd /etc/opensearch/certs
Example: 1 node + 1 admin certificate
# 4.1 Get a token (valid 15 min by default)
TOKEN=$(step ca token opensearch-node-01 --kid admin)
# 4.2 Issue the node cert (add every DNS/IP your cluster will use)
step ca certificate \
opensearch-node-01 \
node-01.crt node-01.key \
--san opensearch-node-01 \
--san 10.0.0.11 \
--token "${TOKEN}"
# 4.3 Do the same for admin (or Dashboard)
TOKEN=$(step ca token opensearch-admin --kid admin)
step ca certificate \
opensearch-admin \
admin.crt admin.key \
--san opensearch-admin \
--token "${TOKEN}"
Copy the root CA so OpenSearch can trust it:
cp /etc/step-ca/certs/root_ca.crt .
chmod 640 *.key
chown opensearch:opensearch *
────────────────────────────────────────────────────────
5. Wire certificates into OpenSearch
────────────────────────────────────────────────────────
Edit opensearch.yml (usually /etc/opensearch/opensearch.yml):
# --- TLS between nodes (transport) ---
plugins.security.ssl.transport.pemcert_filepath: certs/node-01.crt
plugins.security.ssl.transport.pemkey_filepath: certs/node-01.key
plugins.security.ssl.transport.pemtrustedcas_filepath: certs/root_ca.crt
plugins.security.ssl.transport.enforce_hostname_verification: true
# --- TLS to clients (REST) ---
plugins.security.ssl.http.enabled: true
plugins.security.ssl.http.pemcert_filepath: certs/node-01.crt
plugins.security.ssl.http.pemkey_filepath: certs/node-01.key
plugins.security.ssl.http.pemtrustedcas_filepath: certs/root_ca.crt
Optional: allow only client-cert authenticated users:
plugins.security.authcz.admin_dn:
- "CN=opensearch-admin"
plugins.security.ssl.http.clientauth_mode: OPTIONAL # or REQUIRE
Restart:
rc-service opensearch restart
Test:
curl --cacert /etc/opensearch/certs/root_ca.crt \
--cert /etc/opensearch/certs/admin.crt \
--key /etc/opensearch/certs/admin.key \
https://opensearch-node-01:9200/_cluster/health?pretty
────────────────────────────────────────────────────────
6. Add the CA to the Alpine trust store (so curl, git, etc. trust it)
────────────────────────────────────────────────────────
cp /etc/step-ca/certs/root_ca.crt /usr/local/share/ca-certificates/opensearch-ca.crt
update-ca-certificates
────────────────────────────────────────────────────────
Appendix A – Same thing with CFSSL
────────────────────────────────────────────────────────
apk add --no-cache cfssl cfssl-certinfo
mkdir cfssl && cd cfssl
-
Create ca-csr.json and generate the CA
cfssl gencert -initca ca-csr.json | cfssljson -bare ca
-
Create ca-config.json (expiry, profiles)
-
For each node:
cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json \ -hostname="opensearch-node-01,10.0.0.11" \ node-csr.json | cfssljson -bare node-01
Copy the resulting *.pem the same way as above.
────────────────────────────────────────────────────────
Appendix B – Quick-n-dirty OpenSSL one-liner CA
────────────────────────────────────────────────────────
openssl req -x509 -newkey rsa:4096 -days 3650 -nodes \
-keyout root.key -out root.crt -subj "/CN=OpenSearch Local CA"
Then sign CSRs with:
openssl x509 -req -in node.csr -CA root.crt -CAkey root.key \
-CAcreateserial -days 825 -out node.crt -sha256
(Not automated, but good for small labs.)
────────────────────────────────────────────────────────
That’s it! You now have a functioning CA server on Alpine Linux, issuing and renewing certificates for your OpenSearch cluster 💪.