2020-01-12 19:52:38 +00:00
|
|
|
#!/usr/bin/env bash
|
2018-11-22 23:51:16 +00:00
|
|
|
|
2019-11-27 13:04:30 +00:00
|
|
|
opensslConf=${1:-openssl.cnf}
|
2018-11-22 23:51:16 +00:00
|
|
|
|
2020-01-12 19:52:38 +00:00
|
|
|
makePasswordSecret() {
|
|
|
|
[[ -e $1 ]] || apg -m 20 -x 20 -M Ncl -n 1 > "$1"
|
|
|
|
}
|
|
|
|
|
|
|
|
makePasswordSecret bitcoin-rpcpassword
|
|
|
|
makePasswordSecret lnd-wallet-password
|
|
|
|
makePasswordSecret liquid-rpcpassword
|
|
|
|
makePasswordSecret lightning-charge-token
|
|
|
|
makePasswordSecret spark-wallet-password
|
|
|
|
|
|
|
|
[[ -e lightning-charge-env ]] || echo "API_TOKEN=$(cat lightning-charge-token)" > lightning-charge-env
|
|
|
|
[[ -e nanopos-env ]] || echo "CHARGE_TOKEN=$(cat lightning-charge-token)" > nanopos-env
|
|
|
|
[[ -e spark-wallet-login ]] || echo "login=spark-wallet:$(cat spark-wallet-password)" > spark-wallet-login
|
2018-11-22 23:51:16 +00:00
|
|
|
|
2020-01-12 19:52:38 +00:00
|
|
|
if [[ ! -e lnd-key || ! -e lnd-cert ]]; then
|
|
|
|
openssl ecparam -genkey -name prime256v1 -out lnd-key
|
|
|
|
openssl req -config $opensslConf -new -sha256 -key lnd-key -out lnd.csr -subj '/CN=localhost/O=lnd'
|
|
|
|
openssl req -config $opensslConf -x509 -sha256 -days 1825 -key lnd-key -in lnd.csr -out lnd-cert
|
2019-11-27 13:04:29 +00:00
|
|
|
rm lnd.csr
|
2019-08-22 17:23:53 +00:00
|
|
|
fi
|