infranet/nebula-start.sh

24 lines
685 B
Bash
Raw Normal View History

2022-04-02 17:09:06 +01:00
#!/bin/sh
BIN_DIR=/app
DATA_DIR=/etc/nebula
# Build host certs if they don't exist
if ! test -f ${DATA_DIR}/host.crt; then
cd ${DATA_DIR} || exit 1
# Generate a CSR if it doesn't already exist
if ! test -d ${DATA_DIR}/host.csr; then
"${BIN_DIR}/nebula-cert" keygen -out-key host.key -out-pub host.csr
# shellcheck disable=SC2016
echo 'You will need to get the `host.csr` file signed by a cluster admin'
exit 3
else
# shellcheck disable=SC2016
echo 'Awaiting for `host.csr` to be signed by a cluster admin'
exit 4
fi
fi
# Run the platform-specific binary
"${BIN_DIR}/nebula" -config ${DATA_DIR}/config.yaml