mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-09-20 13:02:21 +02:00
use new selfsignedcert if no lnd tls.cert present
This commit is contained in:
@@ -201,11 +201,27 @@ EOF
|
|||||||
sudo apt-get install -y python3-jinja2
|
sudo apt-get install -y python3-jinja2
|
||||||
sudo -H python3 -m pip install j2cli
|
sudo -H python3 -m pip install j2cli
|
||||||
|
|
||||||
# use LND cert by default
|
if [ -f /mnt/hdd/app-data/nginx/tls.cert ];then
|
||||||
sudo ln -sf /mnt/hdd/lnd/tls.cert /mnt/hdd/app-data/nginx/tls.cert
|
if [ -f /mnt/hdd/lnd/tls.cert ]; then
|
||||||
sudo ln -sf /mnt/hdd/lnd/tls.key /mnt/hdd/app-data/nginx/tls.key
|
# use LND cert by default
|
||||||
sudo ln -sf /mnt/hdd/lnd/tls.cert /mnt/hdd/app-data/nginx/tor_tls.cert
|
sudo ln -sf /mnt/hdd/lnd/tls.cert /mnt/hdd/app-data/nginx/tls.cert
|
||||||
sudo ln -sf /mnt/hdd/lnd/tls.key /mnt/hdd/app-data/nginx/tor_tls.key
|
sudo ln -sf /mnt/hdd/lnd/tls.key /mnt/hdd/app-data/nginx/tls.key
|
||||||
|
sudo ln -sf /mnt/hdd/lnd/tls.cert /mnt/hdd/app-data/nginx/tor_tls.cert
|
||||||
|
sudo ln -sf /mnt/hdd/lnd/tls.key /mnt/hdd/app-data/nginx/tor_tls.key
|
||||||
|
else
|
||||||
|
# create a self-signed cert if the LND cert is not present
|
||||||
|
/home/admin/config.scripts/internet.selfsignedcert.sh
|
||||||
|
|
||||||
|
sudo ln -sf /mnt/hdd/app-data/selfsignedcert/selfsigned.cert \
|
||||||
|
/mnt/hdd/app-data/nginx/tls.cert
|
||||||
|
sudo ln -sf /mnt/hdd/app-data/selfsignedcert/selfsigned.key \
|
||||||
|
/mnt/hdd/app-data/nginx/tls.key
|
||||||
|
sudo ln -sf /mnt/hdd/app-data/selfsignedcert/selfsigned.cert \
|
||||||
|
/mnt/hdd/app-data/nginx/tor_tls.cert
|
||||||
|
sudo ln -sf /mnt/hdd/app-data/selfsignedcert/selfsigned.key \
|
||||||
|
/mnt/hdd/app-data/nginx/tor_tls.key
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# config
|
# config
|
||||||
sudo cp /home/admin/assets/blitzweb.conf /etc/nginx/sites-available/blitzweb.conf
|
sudo cp /home/admin/assets/blitzweb.conf /etc/nginx/sites-available/blitzweb.conf
|
||||||
|
@@ -1,41 +1,33 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
# script to create a self-signed SSL certificate
|
# script to create a self-signed SSL certificate
|
||||||
|
|
||||||
echo ""
|
sudo -u bitcoin mkdir /mnt/hdd/app-data/selfsignedcert
|
||||||
echo "***"
|
cd /mnt/hdd/app-data/selfsignedcert || exit 1
|
||||||
echo "installing Nginx"
|
|
||||||
echo "***"
|
|
||||||
echo ""
|
|
||||||
sudo apt-get install -y nginx
|
|
||||||
sudo /etc/init.d/nginx start 2>/dev/null
|
|
||||||
|
|
||||||
# Only generate if there is none. Or Electrum will not connect if the cert changed.
|
echo "# Create a self signed SSL certificate"
|
||||||
if [ -f /etc/ssl/certs/localhost.crt ] ; then
|
localip=$(ip addr | grep 'state UP' -A2 | egrep -v 'docker0|veth' | grep 'eth0\|wlan0\|enp0' | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||||
echo "A self-signed certificate is already present"
|
|
||||||
else
|
sudo -u bitcoin openssl genrsa -out selfsigned.key 2048
|
||||||
echo ""
|
#https://www.humankode.com/ssl/create-a-selfsigned-certificate-for-nginx-in-5-minutes
|
||||||
echo "***"
|
#https://stackoverflow.com/questions/8075274/is-it-possible-making-openssl-skipping-the-country-common-name-prompts
|
||||||
echo "Create a self signed SSL certificate"
|
|
||||||
echo "***"
|
echo "
|
||||||
echo ""
|
|
||||||
|
|
||||||
#https://www.humankode.com/ssl/create-a-selfsigned-certificate-for-nginx-in-5-minutes
|
|
||||||
#https://stackoverflow.com/questions/8075274/is-it-possible-making-openssl-skipping-the-country-common-name-prompts
|
|
||||||
echo "
|
|
||||||
[req]
|
[req]
|
||||||
prompt = no
|
prompt = no
|
||||||
default_bits = 2048
|
default_bits = 2048
|
||||||
default_keyfile = localhost.key
|
default_keyfile = selfsigned.key
|
||||||
distinguished_name = req_distinguished_name
|
distinguished_name = req_distinguished_name
|
||||||
req_extensions = req_ext
|
req_extensions = req_ext
|
||||||
x509_extensions = v3_ca
|
x509_extensions = v3_ca
|
||||||
|
|
||||||
[req_distinguished_name]
|
[req_distinguished_name]
|
||||||
C = US
|
C = US
|
||||||
ST = California
|
ST = Texas
|
||||||
L = Los Angeles
|
L = Lightning Network
|
||||||
O = Our Company Llc
|
O = RaspiBlitz
|
||||||
#OU = Org Unit Name
|
#OU = Org Unit Name
|
||||||
CN = Our Company Llc
|
CN = RaspiBlitz
|
||||||
#emailAddress = info@example.com
|
#emailAddress = info@example.com
|
||||||
|
|
||||||
[req_ext]
|
[req_ext]
|
||||||
@@ -47,9 +39,8 @@ subjectAltName = @alt_names
|
|||||||
[alt_names]
|
[alt_names]
|
||||||
DNS.1 = localhost
|
DNS.1 = localhost
|
||||||
DNS.2 = 127.0.0.1
|
DNS.2 = 127.0.0.1
|
||||||
" | tee localhost.conf
|
DNS.3 = $localip
|
||||||
|
" | sudo -u bitcoin tee localhost.conf
|
||||||
|
|
||||||
openssl req -x509 -nodes -days 1825 -newkey rsa:2048 -keyout localhost.key -out localhost.crt -config localhost.conf
|
sudo -u bitcoin openssl req -new -x509 -sha256 -key selfsigned.key \
|
||||||
sudo mv localhost.crt /etc/ssl/certs/localhost.crt
|
-out selfsigned.cert -days 3650 -config localhost.conf
|
||||||
sudo mv localhost.key /etc/ssl/private/localhost.key
|
|
||||||
fi
|
|
||||||
|
Reference in New Issue
Block a user