lnproxy: fix api access through nginx (#3671)

* lnproxy: fix api access through nginx
* fix tor config and fit the menu
* add to the menu and provision
This commit is contained in:
openoms 2023-02-15 08:49:21 +00:00 committed by GitHub
parent b91506b4fb
commit 52cb52271f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 41 additions and 9 deletions

View File

@ -132,6 +132,9 @@ fi
if [ "${bos}" == "on" ]; then
OPTIONS+=(BOS "Balance of Satoshis")
fi
if [ "${lnproxy}" == "on" ]; then
OPTIONS+=(LNPROXY "lnproxy server")
fi
if [ "${pyblock}" == "on" ]; then
OPTIONS+=(PYBLOCK "PyBlock")
fi
@ -307,6 +310,9 @@ case $CHOICE in
;;
BOS)
sudo /home/admin/config.scripts/bonus.bos.sh menu
;;
LNPROXY)
sudo /home/admin/config.scripts/bonus.lnproxy.sh menu
;;
PYBLOCK)
sudo /home/admin/config.scripts/bonus.pyblock.sh menu

View File

@ -19,6 +19,7 @@ if [ ${#jam} -eq 0 ]; then jam="off"; fi
if [ ${#LNBits} -eq 0 ]; then LNBits="off"; fi
if [ ${#mempoolExplorer} -eq 0 ]; then mempoolExplorer="off"; fi
if [ ${#bos} -eq 0 ]; then bos="off"; fi
if [ ${#lnproxy} -eq 0 ]; then lnproxy="off"; fi
if [ ${#pyblock} -eq 0 ]; then pyblock="off"; fi
if [ ${#thunderhub} -eq 0 ]; then thunderhub="off"; fi
if [ ${#sphinxrelay} -eq 0 ]; then sphinxrelay="off"; fi
@ -68,6 +69,7 @@ if [ "${lightning}" == "lnd" ] || [ "${lnd}" == "on" ]; then
OPTIONS+=(la 'LND LIT (loop, pool, faraday)' ${lit})
OPTIONS+=(gb 'LND LNDg (auto-rebalance, auto-fees)' ${lndg})
OPTIONS+=(oa 'LND Balance of Satoshis' ${bos})
OPTIONS+=(lp 'LND lnproxy server' ${lnproxy})
OPTIONS+=(ya 'LND PyBLOCK' ${pyblock})
OPTIONS+=(ha 'LND ChannelTools (Fund Rescue)' ${chantools})
OPTIONS+=(xa 'LND Sphinx-Relay' ${sphinxrelay})
@ -339,6 +341,21 @@ else
echo "Balance of Satoshis setting unchanged."
fi
# lnproxy process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "lp")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${lnproxy}" != "${choice}" ]; then
echo "lnproxy setting changed .."
anychange=1
sudo -u admin /home/admin/config.scripts/bonus.lnproxy.sh ${choice}
source /mnt/hdd/raspiblitz.conf
if [ "${lnproxy}" = "on" ]; then
sudo -u admin /home/admin/config.scripts/bonus.lnproxy.sh menu
fi
else
echo "lnproxy setting unchanged."
fi
# PyBLOCK process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "ya")
if [ ${check} -eq 1 ]; then choice="on"; fi

View File

@ -643,6 +643,15 @@ else
echo "Provisioning Balance of Satoshis - keep default" >> ${logFile}
fi
# LNPROXY
if [ "${lnproxy}" = "on" ]; then
echo "Provisioning lnproxy - run config script" >> ${logFile}
/home/admin/_cache.sh set message "Setup lnproxy"
sudo -u admin /home/admin/config.scripts/bonus.lnproxy.sh on >> ${logFile} 2>&1
else
echo "Provisioning lnproxy - keep default" >> ${logFile}
fi
# thunderhub
if [ "${thunderhub}" = "on" ]; then
echo "Provisioning ThunderHub - run config script" >> ${logFile}

View File

@ -14,7 +14,7 @@ server {
error_log /var/log/nginx/error_lnproxy.log;
location /api/ {
proxy_pass http://127.0.0.1:4747;
proxy_pass http://127.0.0.1:4747/;
include /etc/nginx/snippets/ssl-proxy-params.conf;
}

View File

@ -13,7 +13,7 @@ server {
error_log /var/log/nginx/error_lnproxy.log;
location /api/ {
proxy_pass http://127.0.0.1:4747;
proxy_pass http://127.0.0.1:4747/;
include /etc/nginx/snippets/ssl-proxy-params.conf;
}

View File

@ -13,7 +13,7 @@ server {
error_log /var/log/nginx/error_lnproxy.log;
location /api/ {
proxy_pass http://127.0.0.1:4747;
proxy_pass http://127.0.0.1:4747/;
include /etc/nginx/snippets/ssl-proxy-params.conf;
}

View File

@ -38,7 +38,7 @@ To use the API:
curl -k https://${localip}:4749/api/{invoice}?routing_msat={budget}\n
The Tor Hidden Service address to share for using the API:
${torAddress}/api
" 19 67
" 20 70
sudo /home/admin/config.scripts/blitz.display.sh hide
else
# Info without Tor
@ -204,7 +204,6 @@ EOF
sudo nginx -t
sudo systemctl reload nginx
sudo ufw allow 4747 comment lnproxy-HTTP
sudo ufw allow 4748 comment lnproxy-webui-HTTP
sudo ufw allow 4749 comment lnproxy-HTTPS
@ -214,9 +213,11 @@ EOF
/home/admin/config.scripts/blitz.conf.sh set lnproxy "on"
echo "# API:"
echo "curl http://${localip}:4747/{your_invoice}?routing_msat={routing_budget}"
echo "curl http://127.0.0.1:4747/{your_invoice}?routing_msat={routing_budget}"
echo "curl -k https://${localip}:4749/api/{your_invoice}?routing_msat={routing_budget}"
echo "# WebUI:"
echo "http://${localip}:4748"
echo "https://${localip}:4749"
echo "# More info at:"
echo "https://github.com/lnproxy/lnproxy"
@ -231,15 +232,14 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
# remove systemd services
sudo systemctl disable --now lnproxy
/etc/systemd/system/lnproxy.service
sudo rm -f /etc/systemd/system/lnproxy.service
sudo systemctl disable --now lnproxy-webui
/etc/systemd/system/lnproxy-webui.service
sudo rm -f /etc/systemd/system/lnproxy-webui.service
# remove Tor service
/home/admin/config.scripts/tor.onion-service.sh off lnproxy
# close ports on firewall
sudo ufw delete allow 4747
sudo ufw delete allow 4748
sudo ufw delete allow 4749