Skip to content

Instantly share code, notes, and snippets.

@vinodc
Forked from david-thorman/ke_config_skel.sh
Created June 27, 2019 00:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vinodc/24c8badbc326d8137870f3d856f6c286 to your computer and use it in GitHub Desktop.
Save vinodc/24c8badbc326d8137870f3d856f6c286 to your computer and use it in GitHub Desktop.
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