Skip to content

Instantly share code, notes, and snippets.

@mcint
Forked from david-thorman/ke_config_skel.sh
Last active July 3, 2019 22:11
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 mcint/3a0b2bcdcefcb6806d830383d4ef0d05 to your computer and use it in GitHub Desktop.
Save mcint/3a0b2bcdcefcb6806d830383d4ef0d05 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
---
# See /data/kloudless-defaults.yml for examples and brief explanation
# Visit https://developers.kloudless.com/guides/enterprise/config.html
# for the complete guide to configuration.
hostname: null
license_code: null
ssl:
is_configured: false
#local: true
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