-
-
Save vinodc/24c8badbc326d8137870f3d856f6c286 to your computer and use it in GitHub Desktop.
Kloudless Enterprise configuration file skeleton generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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