This commit is contained in:
rootzoll 2022-01-15 21:21:24 +01:00
commit 8e3c9774a2
10 changed files with 464 additions and 7 deletions

View File

@ -24,6 +24,7 @@ There are further Services that can be switched on:
* **SpecterDesktop** (Multisig Trezor, Ledger, COLDCARDwallet & Specter-DIY) [details](https://github.com/cryptoadvance/specter-desktop) [app connection guide](https://d11n.net/connect-specter-desktor-with-raspiblitz.html)
* **Lightning Terminal (Loop, Pool & Faraday)** (Manage Channel Liquidity) [details](https://github.com/lightninglabs/lightning-terminal#lightning-terminal-lit)
* **JoinMarket** (CoinJoin Service) [details](https://github.com/JoinMarket-Org/joinmarket-clientserver)
* **JoinMarket Web UI** (Browser-based interface for JoinMarket) [details](https://github.com/joinmarket-webui/joinmarket-webui)
* **ThunderHub** (Lightning Node Manager WebUI) [details](https://www.thunderhub.io/)
* **Balance Of Satoshis** (Commands for working with LND balances) [details](https://github.com/alexbosworth/balanceofsatoshis/blob/master/README.md)
* **Kindle Display** (Bitcoin Status Display made with a jailbroken Kindle) [details](https://github.com/dennisreimann/kindle-display)
@ -347,7 +348,7 @@ A RaspberryPi 3 has a very low power CPU and syncing+validating the blockchain d
#### 2. COPY - Copy from Laptop or another RaspiBlitz over Local Network
If you have a friend that is already running a synced RaspiBlitz or you have a laptop with enough free space on the hard drive that can download & validate the Blockchain much faster you can also choose the `COPY` option.
You can then delete existing blockchain your RaspiBlitz already started syncing for you
You can then delete existing blockchain your RaspiBlitz already started syncing for you
![SSH4](pictures/ssh4-copy.png)
@ -965,7 +966,7 @@ IP2TOR is a tunnel service where you can run your RaspiBlitz anonymously behind
You don't need to care about your local router or firewall settings.
You can pay for this service directly through Lightning from your RaspiBlitz as subscription.
At first you select what services of your RaspiBlitz you like to tunnel through a IP2TOR bridge.
At first you select what services of your RaspiBlitz you like to tunnel through a IP2TOR bridge.
You will get a list of available IP2TOR bridge offerings.
Select `OK` on an IP2TOR bridge offering and you will see more details on it, such as how many satoshis the subscription will cost you.
@ -983,7 +984,8 @@ To try out the IP2TOR tunnel choose in `MAINMENU` the extra menu point of the Se
If you want a web service, like BTCPay Server or LNbits, to be available to the outside internet (like with IP2TOR) people expect you to offer an HTTPS address so that the communication between the client and your RaspiBlitz is encrypted.
You could use the self-signed HTTPS certificate that RaspiBlitz is offering you, but this will give users Security Warnings in their browser and is not very user friendly.
That's where you can use a LetsEncrypt Subscription to get a free valid HTTPS certificate that is accepted without warning by most browsers.
That's where you can use a LetsEncrypt Subscription to get a free valid HTTPS certificate that is excepted without warning from almost all common browsers
Because you also need a domain name for that you will need to open a free account, the following are presently supported, would be good to add more with the help of the community:
[DuckDNS.org](https://www.duckdns.org)
@ -1173,7 +1175,7 @@ Instructions for Migration:
* shutdown your old node
* remove the SD card
* [download the latest Raspiblitz sd card image & flash it to your sd card](#downloading-the-software)
* if you want to use a HDMI monitor for status & progress, create a empty file called `hdmi` (without any ending) on the SD card while connected to your laptop
* if you want to use a HDMI monitor for status & progress, create a empty file called `hdmi` (without any ending) on the SD card while connected to your laptop
* [insert sd card, boot up & login by SSH](#boot-your-raspiblitz)
Now RaspiBlitz should show you that old data from your node was detected and offer to do the migration for you.
@ -1225,7 +1227,7 @@ The latest version of this file is needed to recover all your funds.
In case your HDD gets damaged RaspiBlitz always keeps a copy of the latest version of the `channel.backup` file on the SD card within the sub-directories of: `/home/admin/.lnd/data/chain/`.
If you want to go one step further in securing your funds against total loss of the RaspiBlitz (gets completely damaged, stolen or lost), then you can additionally set up an off-location or cloud backup of the `channel.backup` file.
The file itself is encrypted by your word seed so it's acceptable to store the file with untrusted third parties for backup purposes (if you want)
The file itself is encrypted by your word seed so it's acceptable to store the file with untrusted third parties for backup purposes (if you want)
This video explains in detail how you can set further back Static Channel information:

View File

@ -116,6 +116,10 @@ range_argument(){
fi
}
echo -e "\n*** SOFTWARE UPDATE ***"
general_utils="curl"
sudo apt install -y ${general_utils}
## use default values for variables if empty
# INTERACTION
@ -272,7 +276,7 @@ echo -e "\n*** SOFTWARE UPDATE ***"
# psmisc -> install killall, fuser
# ufw -> firewall
# sqlite3 -> database
general_utils="htop git curl bash-completion vim jq dphys-swapfile bsdmainutils autossh telnet vnstat parted dosfstools btrfs-progs fbi sysbench build-essential dialog bc python3-dialog"
general_utils="htop git curl bash-completion vim jq dphys-swapfile bsdmainutils autossh telnet vnstat parted dosfstools btrfs-progs fbi sysbench build-essential dialog bc python3-dialog unzip"
python_dependencies="python3-venv python3-dev python3-wheel python3-jinja2 python3-pip"
server_utils="rsync net-tools xxd netcat openssh-client openssh-sftp-server sshpass psmisc ufw sqlite3"
[ "${baseimage}" = "armbian" ] && armbian_dependencies="armbian-config" # add armbian-config

View File

@ -571,6 +571,15 @@ else
echo "Provisioning JoinMarket - keep default" >> ${logFile}
fi
# JoinMarket Web UI
if [ "${joinmarketWebUI}" = "on" ]; then
echo "Provisioning JoinMarket Web UI - run config script" >> ${logFile}
sudo sed -i "s/^message=.*/message='Setup JoinMarket Web UI'/g" ${infoFile}
sudo /home/admin/config.scripts/bonus.joinmarket-webui.sh on >> ${logFile} 2>&1
else
echo "Provisioning JoinMarket Web UI - keep default" >> ${logFile}
fi
# Specter
if [ "${specter}" = "on" ]; then
echo "Provisioning Specter - run config script" >> ${logFile}

View File

@ -0,0 +1,34 @@
## joinmarket_webui.conf
server {
listen 7500;
listen [::1]:7500;
server_name _;
access_log /var/log/nginx/access_joinmarket_webui.log;
error_log /var/log/nginx/error_joinmarket_webui.log;
gzip on;
gzip_types application/javascript application/json text/css image/svg+xml;
root /home/joinmarket/webui/build;
index index.html;
location /api/ {
include /etc/nginx/snippets/proxy-params.conf;
proxy_pass https://127.0.0.1:28183;
}
location /ws/ {
include /etc/nginx/snippets/proxy-params.conf;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_pass https://127.0.0.1:28183;
}
location / {
include /etc/nginx/snippets/proxy-params.conf;
try_files $uri $uri/ /index.html;
add_header Cache-Control no-cache;
}
}

View File

@ -0,0 +1,37 @@
## joinmarket_webui_ssl.conf
server {
listen 7501 ssl;
listen [::]:7501 ssl;
server_name _;
include /etc/nginx/snippets/ssl-params.conf;
include /etc/nginx/snippets/ssl-certificate-app-data.conf;
access_log /var/log/nginx/access_joinmarket_webui.log;
error_log /var/log/nginx/error_joinmarket_webui.log;
gzip on;
gzip_types application/javascript application/json text/css image/svg+xml;
root /home/joinmarket/webui/build;
index index.html;
location /api/ {
include /etc/nginx/snippets/ssl-proxy-params.conf;
proxy_pass https://127.0.0.1:28183;
}
location /ws/ {
include /etc/nginx/snippets/proxy-params.conf;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_pass https://127.0.0.1:28183;
}
location / {
include /etc/nginx/snippets/ssl-proxy-params.conf;
try_files $uri $uri/ /index.html;
add_header Cache-Control no-cache;
}
}

View File

@ -0,0 +1,34 @@
## joinmarket_webui_tor.conf
server {
listen 7502;
listen [::1]:7502;
server_name _;
access_log /var/log/nginx/access_joinmarket_webui.log;
error_log /var/log/nginx/error_joinmarket_webui.log;
gzip on;
gzip_types application/javascript application/json text/css image/svg+xml;
root /home/joinmarket/webui/build;
index index.html;
location /api/ {
include /etc/nginx/snippets/proxy-params.conf;
proxy_pass https://127.0.0.1:28183;
}
location /ws/ {
include /etc/nginx/snippets/proxy-params.conf;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_pass https://127.0.0.1:28183;
}
location / {
include /etc/nginx/snippets/proxy-params.conf;
try_files $uri $uri/ /index.html;
add_header Cache-Control no-cache;
}
}

View File

@ -0,0 +1,37 @@
## joinmarket_webui_tor_ssl.conf
server {
listen 7503 ssl;
listen [::1]:7503 ssl;
server_name _;
include /etc/nginx/snippets/ssl-params.conf;
include /etc/nginx/snippets/ssl-certificate-app-data-tor.conf;
access_log /var/log/nginx/access_joinmarket_webui.log;
error_log /var/log/nginx/error_joinmarket_webui.log;
gzip on;
gzip_types application/javascript application/json text/css image/svg+xml;
root /home/joinmarket/webui/build;
index index.html;
location /api/ {
include /etc/nginx/snippets/ssl-proxy-params.conf;
proxy_pass https://127.0.0.1:28183;
}
location /ws/ {
include /etc/nginx/snippets/proxy-params.conf;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_pass https://127.0.0.1:28183;
}
location / {
include /etc/nginx/snippets/ssl-proxy-params.conf;
try_files $uri $uri/ /index.html;
add_header Cache-Control no-cache;
}
}

View File

@ -49,6 +49,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
/home/admin/config.scripts/bonus.nodejs.sh on
source <(/home/admin/config.scripts/bonus.nodejs.sh info)
sudo npm install --global yarn
${NODEPATH}/yarn config set --home enableTelemetry 0
${NODEPATH}/yarn install
${NODEPATH}/yarn build

View File

@ -0,0 +1,299 @@
#!/bin/bash
# https://github.com/joinmarket-webui/joinmarket-webui
USERNAME=joinmarket
HOME_DIR=/home/$USERNAME
REPO=joinmarket-webui/joinmarket-webui
APP_DIR=webui
RASPIBLITZ_INFO=/home/admin/raspiblitz.info
RASPIBLITZ_CONF=/mnt/hdd/raspiblitz.conf
WEBUI_VERSION=0.0.2
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "config script to switch joinmarket_webui on or off"
echo "bonus.joinmarket-webui.sh [on|off|menu|update|update commit|precheck]"
exit 1
fi
# check and load raspiblitz config to know which network is running
source $RASPIBLITZ_INFO
source $RASPIBLITZ_CONF
# show info menu
if [ "$1" = "menu" ]; then
isInstalled=$(sudo ls $HOME_DIR 2>/dev/null | grep -c "$APP_DIR")
if [ ${isInstalled} -eq 1 ]; then
# get network info
localip=$(hostname -I | awk '{print $1}')
toraddress=$(sudo cat /mnt/hdd/tor/joinmarket-webui/hostname 2>/dev/null)
fingerprint=$(openssl x509 -in /mnt/hdd/app-data/nginx/tls.cert -fingerprint -noout | cut -d"=" -f2)
if [ "${runBehindTor}" = "on" ] && [ ${#toraddress} -gt 0 ]; then
# Info with TOR
/home/admin/config.scripts/blitz.display.sh qr "${toraddress}"
whiptail --title " JoinMarket Web UI " --msgbox "Open in your local web browser:
http://${localip}:7500\n
https://${localip}:7501 with Fingerprint:
${fingerprint}\n
Hidden Service address for TOR Browser (see LCD for QR):\n${toraddress}
" 16 67
/home/admin/config.scripts/blitz.display.sh hide
else
# Info without TOR
whiptail --title " JoinMarket Web UI " --msgbox "Open in your local web browser & accept self-signed cert:
http://${localip}:7500\n
https://${localip}:7501 with Fingerprint:
${fingerprint}\n
Activate TOR to access the web interface from outside your local network.
" 15 57
fi
echo "please wait ..."
else
echo "*** JOINMARKET WEB UI NOT INSTALLED ***"
fi
exit 0
fi
# switch on
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
isInstalled=$(sudo ls $HOME_DIR 2>/dev/null | grep -c "$APP_DIR")
if [ ${isInstalled} -eq 0 ]; then
# check if joinmarket is installed
if [ -f "/home/joinmarket/.joinmarket/joinamrket.cfg" ]; then
echo "# JoinMarket is already installed and configured."
else
sudo /home/admin/config.scripts/bonus.joinmarket.sh on
fi
echo "*** INSTALL JOINMARKET WEB UI ***"
# install nodeJS
/home/admin/config.scripts/bonus.nodejs.sh on
# install JoinMarket Web UI
cd $HOME_DIR
sudo -u $USERNAME wget https://github.com/$REPO/archive/refs/tags/v$WEBUI_VERSION.tar.gz
sudo -u $USERNAME tar -xzf v$WEBUI_VERSION.tar.gz
sudo -u $USERNAME rm v$WEBUI_VERSION.tar.gz
sudo -u $USERNAME mv joinmarket-webui-$WEBUI_VERSION $APP_DIR
cd $APP_DIR
sudo -u $USERNAME rm -rf docker
sudo -u $USERNAME npm install
if ! [ $? -eq 0 ]; then
echo "FAIL - npm install did not run correctly, aborting"
exit 1
fi
sudo -u $USERNAME npm run build
##################
# NGINX
##################
# setup nginx symlinks
if ! [ -f /etc/nginx/sites-available/joinmarket_webui_ssl.conf ]; then
sudo cp -f /home/admin/assets/nginx/sites-available/joinmarket_webui_ssl.conf /etc/nginx/sites-available/joinmarket_webui_ssl.conf
fi
if ! [ -f /etc/nginx/sites-available/joinmarket_webui_tor.conf ]; then
sudo cp /home/admin/assets/nginx/sites-available/joinmarket_webui_tor.conf /etc/nginx/sites-available/joinmarket_webui_tor.conf
fi
if ! [ -f /etc/nginx/sites-available/joinmarket_webui_tor_ssl.conf ]; then
sudo cp /home/admin/assets/nginx/sites-available/joinmarket_webui_tor_ssl.conf /etc/nginx/sites-available/joinmarket_webui_tor_ssl.conf
fi
sudo ln -sf /etc/nginx/sites-available/joinmarket_webui_ssl.conf /etc/nginx/sites-enabled/
sudo ln -sf /etc/nginx/sites-available/joinmarket_webui_tor.conf /etc/nginx/sites-enabled/
sudo ln -sf /etc/nginx/sites-available/joinmarket_webui_tor_ssl.conf /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
# open the firewall
echo "*** Updating Firewall ***"
sudo ufw allow from any to any port 7500 comment 'allow JoinMarket Web UI HTTP'
sudo ufw allow from any to any port 7501 comment 'allow JoinMarket Web UI HTTPS'
echo ""
# SSL
if ! [ -d $HOME_DIR/.joinmarket/ssl ]; then
sudo -u $USERNAME mkdir -p $HOME_DIR/.joinmarket/ssl
fi
if ! [ -f $HOME_DIR/.joinmarket/ssl/cert.pem ]; then
sudo ln -sf /mnt/hdd/app-data/nginx/tls.cert $HOME_DIR/.joinmarket/ssl/cert.pem
sudo chown $USERNAME:$USERNAME $HOME_DIR/.joinmarket/ssl/cert.pem
fi
if ! [ -f $HOME_DIR/.joinmarket/ssl/key.pem ]; then
sudo ln -sf /mnt/hdd/app-data/nginx/tls.key $HOME_DIR/.joinmarket/ssl/key.pem
sudo chown $USERNAME:$USERNAME $HOME_DIR/.joinmarket/ssl/key.pem
fi
##################
# SYSTEMD SERVICE
##################
echo "# Install JoinMarket API systemd"
echo "\
# Systemd unit for JoinMarket API
[Unit]
Description=JoinMarket API daemon
# Make sure lnd starts after bitcoind is ready
Requires=bitcoind.service
After=bitcoind.service
[Service]
WorkingDirectory=$HOME_DIR/joinmarket-clientserver/scripts/
ExecStartPre=/home/admin/config.scripts/bonus.joinmarket-webui.sh precheck
ExecStart=/bin/sh -c '. $HOME_DIR/joinmarket-clientserver/jmvenv/bin/activate && python jmwalletd.py'
User=joinmarket
Group=joinmarket
Restart=always
TimeoutSec=120
RestartSec=30
# Hardening measures
PrivateTmp=true
ProtectSystem=full
NoNewPrivileges=true
PrivateDevices=true
[Install]
WantedBy=multi-user.target
" | sudo tee /etc/systemd/system/joinmarket-api.service
sudo systemctl enable joinmarket-api
# setting value in raspiblitz config
sudo sed -i "s/^joinmarketWebUI=.*/joinmarketWebUI=on/g" $RASPIBLITZ_CONF
# Hidden Service for joinmarket-webui if Tor is active
if [ "${runBehindTor}" = "on" ]; then
# make sure to keep in sync with internet.tor.sh script
/home/admin/config.scripts/tor.onion-service.sh joinmarket-webui 80 7502 443 7503
fi
source $RASPIBLITZ_INFO
if [ "${state}" == "ready" ]; then
echo "# OK - the joinmarket-api.service is enabled, system is ready so starting service"
sudo systemctl start joinmarket-api
else
echo "# OK - the joinmarket-api.service is enabled, to start manually use: 'sudo systemctl start joinmarket-api'"
fi
else
echo "*** JOINMARKET WEB UI ALREADY INSTALLED ***"
fi
exit 0
fi
# precheck
if [ "$1" = "precheck" ]; then
if [ $(/usr/local/bin/bitcoin-cli -conf=/mnt/hdd/bitcoin/bitcoin.conf listwallets | grep -c wallet.dat) -eq 0 ];then
echo "# Create wallet.dat"
/usr/local/bin/bitcoin-cli -conf=/mnt/hdd/bitcoin/bitcoin.conf createwallet wallet.dat
else
echo "# The wallet.dat is loaded in bitcoind."
fi
exit 0
fi
# update
if [ "$1" = "update" ]; then
isInstalled=$(sudo ls $HOME_DIR 2>/dev/null | grep -c "$APP_DIR")
if [ ${isInstalled} -eq 1 ]; then
echo "*** UPDATE JOINMARKET WEB UI ***"
cd $HOME_DIR
if [ "$2" = "commit" ]; then
echo "# Updating to the latest commit in the default branch"
sudo -u $USERNAME wget https://github.com/$REPO/archive/refs/heads/master.tar.gz
sudo -u $USERNAME tar -xzf master.tar.gz
sudo -u $USERNAME rm -rf master.tar.gz
sudo -u $USERNAME mv joinmarket-webui-master $APP_DIR-update
else
version=$(curl --silent "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
cd $APP_DIR
current=$(node -p "require('./package.json').version")
cd ..
if [ "$current" = "$version" ]; then
echo "*** JOINMARKET WEB UI IS ALREADY UPDATED TO LATEST VERSION ***"
exit 0
fi
sudo -u $USERNAME wget https://github.com/$REPO/archive/refs/tags/v$version.tar.gz
sudo -u $USERNAME tar -xzf v$version.tar.gz
sudo -u $USERNAME rm v$version.tar.gz
sudo -u $USERNAME mv joinmarket-webui-$version $APP_DIR-update
fi
cd $APP_DIR-update
sudo -u $USERNAME rm -rf docker
sudo -u $USERNAME npm install
if ! [ $? -eq 0 ]; then
echo "FAIL - npm install did not run correctly, aborting"
exit 1
fi
sudo -u $USERNAME npm run build
if ! [ $? -eq 0 ]; then
echo "FAIL - npm run build did not run correctly, aborting"
exit 1
fi
cd ..
sudo -u $USERNAME rm -rf $APP_DIR
sudo -u $USERNAME mv $APP_DIR-update $APP_DIR
echo "*** JOINMARKET WEB UI UPDATED ***"
else
echo "*** JOINMARKET WEB UI NOT INSTALLED ***"
fi
exit 0
fi
# switch off
if [ "$1" = "0" ] || [ "$1" = "off" ]; then
isInstalled=$(sudo ls $HOME_DIR 2>/dev/null | grep -c "$APP_DIR")
if [ ${isInstalled} -eq 1 ]; then
echo "*** UNINSTALL JOINMARKET WEB UI ***"
# remove systemd service
sudo systemctl stop joinmarket-api
sudo systemctl disable joinmarket-api
sudo rm -f /etc/systemd/system/joinmarket-api.service
# close ports on firewall
sudo ufw delete allow from any to any port 7500 comment 'allow JoinMarket Web UI HTTP'
sudo ufw delete allow from any to any port 7501 comment 'allow JoinMarket Web UI HTTPS'
# remove nginx symlinks
sudo rm -f /etc/nginx/sites-enabled/joinmarket_webui_*
sudo rm -f /etc/nginx/sites-available/joinmarket_webui_*
sudo nginx -t
sudo systemctl reload nginx
# Hidden Service if Tor is active
if [ "${runBehindTor}" = "on" ]; then
/home/admin/config.scripts/internet.hiddenservice.sh off joinmarket-webui
fi
# remove the app
sudo rm -rf $HOME_DIR/$APP_DIR
# remove SSL
sudo rm -rf $HOME_DIR/.joinmarket/ssl
# setting value in raspi blitz config
sudo sed -i "s/^joinmarketWebUI=.*/joinmarketWebUI=off/g" $RASPIBLITZ_CONF
echo "OK JOINMARKET WEB UI removed."
else
echo "*** JOINMARKET WEB UI NOT INSTALLED ***"
fi
exit 0
fi
echo "FAIL - Unknown Parameter $1"
exit 1

View File

@ -11,10 +11,10 @@ if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ];then
fi
source <(/home/admin/config.scripts/network.aliases.sh getvars cl $2)
plugin="feeadjuster"
if [ "$1" = "on" ];then
plugin="feeadjuster"
if [ ! -f "/home/bitcoin/cl-plugins-available/plugins/${plugin}/${plugin}.py" ]; then
cd /home/bitcoin/cl-plugins-available || exit 1
sudo -u bitcoin git clone https://github.com/lightningd/plugins.git