Debian Codegraph @

scripts/docker-entrypoint.sh

raw symbols SCIP
1 #!/bin/sh
2 set -e
3
4 # if we are not bind mounting in certs or the user has not already generated certs
5 # create self-signed certs
6 if [ ! -f $RO_CERTS ] || [ ! -f $RO_KEYS ]; then
7 mkdir -p $RO_DATA
8 chmod 700 $RO_DATA
9 chown -R redoctober:redoctober $RO_DATA
10
11 # Generate private key with password "$RO_CERTPASSWD"
12 openssl genrsa -aes128 -passout pass:$RO_CERTPASSWD -out $RO_KEYS 2048
13 # Remove password from private key
14 openssl rsa -passin pass:$RO_CERTPASSWD -in $RO_KEYS -out $RO_KEYS
15 # Generate CSR (make sure the common name CN field matches your server
16 # address. It's set to "RO_COMMONNAME" environment variable here.)
17 openssl req -new -key $RO_KEYS -out $RO_DATA/server.csr -subj "/C=US/ST=California/L=Everywhere/CN=${RO_COMMONNAME}"
18 # Sign the CSR and create certificate
19 openssl x509 -req -days 365 -in $RO_DATA/server.csr -signkey $RO_KEYS -out $RO_CERTS
20
21 # Clean up
22 rm $RO_DATA/server.csr
23 chmod 600 $RO_CERTS $RO_KEYS
24 chown -R redoctober $RO_CERTS $RO_KEYS
25
26 echo
27 echo "Generated default certificates for RedOctobeer at $RO_CERTS and $RO_KEYS"
28 echo
29 fi
30
31 if [ "$1" = 'redoctober' ]; then
32 exec chpst -u redoctober "$@"
33 fi
34
35 exec "$@"