2019-03-25 13:29:05 +00:00
|
|
|
#!/bin/sh
|
2018-11-22 23:51:16 +00:00
|
|
|
|
|
|
|
SECRETSFILE=secrets/secrets.nix
|
|
|
|
|
|
|
|
if [ -e "$SECRETSFILE" ]; then
|
2019-01-01 20:17:07 +00:00
|
|
|
echo $SECRETSFILE already exists. No new secrets were generated.
|
2018-11-22 23:51:16 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-12-01 16:36:07 +00:00
|
|
|
echo Write secrets to $SECRETSFILE
|
|
|
|
{
|
|
|
|
echo \{
|
|
|
|
echo " bitcoinrpcpassword = \"$(apg -m 20 -x 20 -M Ncl -n 1)\";"
|
2019-08-05 08:44:38 +00:00
|
|
|
echo " lnd-wallet-password = \"$(apg -m 20 -x 20 -M Ncl -n 1)\";"
|
2018-12-01 16:36:07 +00:00
|
|
|
echo " lightning-charge-api-token = \"$(apg -m 20 -x 20 -M Ncl -n 1)\";"
|
2018-12-03 22:33:21 +00:00
|
|
|
echo " liquidrpcpassword = \"$(apg -m 20 -x 20 -M Ncl -n 1)\";"
|
2018-12-10 16:34:41 +00:00
|
|
|
echo " spark-wallet-password = \"$(apg -m 20 -x 20 -M Ncl -n 1)\";"
|
2018-12-01 16:36:07 +00:00
|
|
|
echo \}
|
|
|
|
} >> $SECRETSFILE
|
2018-11-22 23:51:16 +00:00
|
|
|
echo Done
|
2019-04-26 09:09:55 +00:00
|
|
|
|
|
|
|
echo Generate Self-Signed Cert
|
2019-08-13 20:57:59 +00:00
|
|
|
openssl genrsa -out secrets/nginx.key 2048
|
|
|
|
openssl req -new -key secrets/nginx.key -out secrets/nginx.csr -subj "/C=KN"
|
|
|
|
openssl x509 -req -days 1825 -in secrets/nginx.csr -signkey secrets/nginx.key -out secrets/nginx.cert
|
2019-08-13 21:22:41 +00:00
|
|
|
rm secrets/nginx.csr
|
2019-04-26 09:09:55 +00:00
|
|
|
echo Done
|
2019-08-05 08:44:38 +00:00
|
|
|
|
|
|
|
echo Generate LND compatible TLS Cert
|
|
|
|
openssl ecparam -genkey -name prime256v1 -out secrets/lnd.key
|
|
|
|
openssl req -config secrets/openssl.cnf -new -sha256 -key secrets/lnd.key -out secrets/lnd.csr -subj '/CN=localhost/O=lnd'
|
|
|
|
openssl req -config secrets/openssl.cnf -x509 -sha256 -days 1825 -key secrets/lnd.key -in secrets/lnd.csr -out secrets/lnd.cert
|
|
|
|
rm secrets/lnd.csr
|
|
|
|
echo Done
|