Commit 8eadd11f authored by Girish Ramakrishnan's avatar Girish Ramakrishnan

Add logs in start.sh

parent 369db0e5
...@@ -2,4 +2,6 @@ ...@@ -2,4 +2,6 @@
source /app/code/easyrsa/easyrsa-vars.sh source /app/code/easyrsa/easyrsa-vars.sh
echo "Updating CRL"
KEY_ALTNAMES="" KEY_CN="" ${OPENSSL} ca -gencrl -out /app/data/keys/crl.pem -config "$KEY_CONFIG" KEY_ALTNAMES="" KEY_CN="" ${OPENSSL} ca -gencrl -out /app/data/keys/crl.pem -config "$KEY_CONFIG"
...@@ -6,16 +6,17 @@ export NODE_ENV=production ...@@ -6,16 +6,17 @@ export NODE_ENV=production
# Creating a secret for web sessions # Creating a secret for web sessions
if [ ! -f /app/data/session.secret ]; then if [ ! -f /app/data/session.secret ]; then
echo "==> Generating session secret"
dd if=/dev/urandom bs=256 count=1 | base64 > /app/data/session.secret dd if=/dev/urandom bs=256 count=1 | base64 > /app/data/session.secret
fi fi
# Generate random management token for admin api # Generate random management token for admin api
dd if=/dev/urandom bs=256 count=1 | base64 > /run/admin-token dd if=/dev/urandom bs=256 count=1 | base64 > /run/admin-token
source /app/code/easyrsa/easyrsa-vars.sh
# The first time this is run, initialize OpenVPN keys # The first time this is run, initialize OpenVPN keys
if [ ! -d /app/data/keys ]; then if [ ! -d /app/data/keys ]; then
echo "==> Init OpenVPN CA"
source /app/code/easyrsa/easyrsa-vars.sh
/app/code/easyrsa/clean-all /app/code/easyrsa/clean-all
/app/code/easyrsa/pkitool --initca /app/code/easyrsa/pkitool --initca
openvpn --genkey --secret /app/data/keys/ta.key openvpn --genkey --secret /app/data/keys/ta.key
...@@ -24,9 +25,11 @@ if [ ! -d /app/data/keys ]; then ...@@ -24,9 +25,11 @@ if [ ! -d /app/data/keys ]; then
fi fi
# initializing / regenerating CRL file # initializing / regenerating CRL file
./regen-crl.sh echo "==> Creating CRL"
/app/code/regen-crl.sh
# Writing OpenVPN config # Writing OpenVPN config
echo "==> Generating OpenVPN config"
sed -e "s/##VPN_TCP_PORT/${VPN_TCP_PORT:-}/" \ sed -e "s/##VPN_TCP_PORT/${VPN_TCP_PORT:-}/" \
-e "s/##CLOUDRON_APP_DOMAIN/${CLOUDRON_APP_DOMAIN}/" \ -e "s/##CLOUDRON_APP_DOMAIN/${CLOUDRON_APP_DOMAIN}/" \
/app/code/openvpn.conf.template > /run/openvpn.conf /app/code/openvpn.conf.template > /run/openvpn.conf
...@@ -38,7 +41,8 @@ iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE ...@@ -38,7 +41,8 @@ iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
mkdir -p /run/dnsmasq/hosts mkdir -p /run/dnsmasq/hosts
# Fix permissions # Fix permissions
echo "==> Fixing permissions"
chown -R cloudron:cloudron /app/data /tmp /run chown -R cloudron:cloudron /app/data /tmp /run
echo "Starting server" echo "Starting OpenVPN"
exec /usr/bin/supervisord --configuration /etc/supervisor/supervisord.conf --nodaemon -i OpenVPN exec /usr/bin/supervisord --configuration /etc/supervisor/supervisord.conf --nodaemon -i OpenVPN
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment