Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Kloudless Enterprise configuration file skeleton generator
#!/bin/bash
set -eu -o pipefail
gen_priv() {
openssl genrsa 2048 2> /dev/null
}
gen_pub() {
echo "${1}" | openssl rsa -pubout 2> /dev/null
}
indent() {
echo "$1" | sed 's/^/ /'
}
API_SECRET=$(head -c 66 /dev/urandom | base64)
API_AES=$(head -c 24 /dev/urandom | base64 | head -c 16)
DEVS_SECRET=$(head -c 66 /dev/urandom | base64)
CREDENTIALS_PRIV=$(gen_priv)
CREDENTIALS_PUB=$(gen_pub "${CREDENTIALS_PRIV}")
SERVICES_PRIV=$(gen_priv)
SERVICES_PUB=$(gen_pub "${SERVICES_PRIV}")
cat <<EOF
---
hostname: null
license_code: null
ssl:
is_configured: false
redis: 'redis://localhost:6379/0'
db:
name: 'platform'
user: 'platform'
password: 'insecure password'
host: '127.0.0.1'
port: '5432'
api:
secret_key: '${API_SECRET}'
aes_key: '${API_AES}'
devs:
secret_key: '${DEVS_SECRET}'
pki:
credentials:
private: |
$(indent "${CREDENTIALS_PRIV}")
public: |
$(indent "${CREDENTIALS_PUB}")
services:
private: |
$(indent "${SERVICES_PRIV}")
public: |
$(indent "${SERVICES_PUB}")
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.