We make sure that your MiniBolt is secured against unauthorized remote access.
The MiniBolt needs to be secured against online attacks using various methods.

admin, check your IPv6 availabilityping6 -c2 2001:858:2:2:aabb:0:563b:1526 && ping6 -c2 2620:13:4000:6000::1000:118 && ping6 -c2 2001:67c:289c::9 && ping6 -c2 2001:678:558:1000::244 && ping6 -c2 2001:638:a000:4140::ffff:189 && echo OK.
-> 2 output options:
{% tabs %}
{% tab title="First (more common)" %}
If you obtain ping6: connect: Network is unreachable, you don't have IPv6 availability, don't worry, IPv6 adoption is new, you will use your internet connection using the common IPv4. Additionally, you can obtain your public IPv4 address with: curl -s ipv4.icanhazip.com
{% tab title="Second" %}
If you obtain the "OK." output, you have IPv6 availability. Additionally, you can obtain your IPv6 with: curl -s ipv6.icanhazip.com you are OK, continue the guide without modifications
A Firewall controls what kind of outside traffic your machine accepts and which applications can send data out. By default, many network ports are open and listening for incoming connections. Closing unnecessary ports can mitigate many potential system vulnerabilities.
For now, only SSH should be reachable from the outside. Bitcoin Core and LND are using Tor and don't need incoming ports. We'll open the port for Fulcrum and web applications later if needed.
If you don't have IPv6 availability, you can disable IPv6 on UFW to avoid the creation of rules related to it.
sudo nano /etc/default/ufw
IPV6=yes to IPV6=no. Save and exitIPV6=no
sudo ufw logging off
{% hint style="warning" %}
Attention! Don't forget the next step!
sudo ufw allow 22/tcp comment 'allow SSH from anywhere'
"Command may disrupt existing ssh connections. Proceed with operation (y|n)?", press "y" and entersudo ufw enable
Expected output:
Firewall is active and enabled on system startup
sudo ufw status verbose
Status: active
Logging: off
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip
To Action From
-- ------ ----
22 ALLOW Anywhere # allow SSH from anywhere
{% hint style="info" %}
If you find it locked out by mistake, you can connect a keyboard and screen to your PC to log in locally and fix these settings (especially for the SSH port 22)
More info: UFW Essentials
sudo tail -f /var/log/auth.log
sudo tail --lines 500 /var/log/auth.log | grep sshd
-7days option to do whatever you wantlast -s -7days -t today
In this way, you can detect a possible brute-force attack and take appropriate mitigation measures
{% hint style="info" %}
Do this regularly to get security-related incidents
Several components of this guide will expose a communication port, for example, the Block Explorer, or the ThunderHub web interface for your Lightning node. Even if you use these services only within your home network, communication should always be encrypted. Otherwise, any device in the same network can listen to the exchanged data, including passwords.
We use Nginx to encrypt the communication with SSL/TLS (Transport Layer Security). This setup is called a "reverse proxy": Nginx provides secure communication to the outside and routes the traffic back to the internal service without encryption.
admin, update and upgrade the OS. Press "y" and enter or directly enter when the prompt asks yousudo apt update && sudo apt full-upgrade
enter or directly enter when the prompt asks yousudo apt install nginx
nginx -v
Example of expected output:
nginx version: nginx/1.18.0 (Ubuntu)
sudo openssl req -x509 -nodes -newkey rsa:4096 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt -subj "/CN=localhost" -days 3650
Example of expected output:
.......+......+...+..+....+.....+......++++++........
sudo mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
sudo nano /etc/nginx/nginx.conf
nginx.conf file. Save and exituser www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
}
http {
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
ssl_session_cache shared:HTTP-TLS:1m;
ssl_session_timeout 4h;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
include /etc/nginx/sites-enabled/*.conf;
include /etc/nginx/mime.types;
default_type application/octet-stream;
}
stream {
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
ssl_session_cache shared:STREAM-TLS:1m;
ssl_session_timeout 4h;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
include /etc/nginx/streams-enabled/*.conf;
}
streams-available and streams-enabled directories for future configuration filessudo mkdir /etc/nginx/streams-available
sudo mkdir /etc/nginx/streams-enabled
site available and site enabled default configuration filessudo rm /etc/nginx/sites-available/default
sudo rm /etc/nginx/sites-enabled/default
sudo nginx -t
Expected output:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
sudo systemctl reload nginx
{% hint style="info" %}
(Optional) You can monitor the Nginx logs by entering this command. Exit with Ctrl + C
journalctl -fu nginx
Expected output:
Jun 04 18:21:09 minibolt systemd[1]: Starting A high performance web server and a reverse proxy server...
Jun 04 18:21:09 minibolt systemd[1]: Started A high performance web server and a reverse proxy server.
Jun 04 18:25:18 minibolt systemd[1]: Reloading A high performance web server and a reverse proxy server...
Jun 04 18:25:18 minibolt systemd[1]: Reloaded A high performance web server and a reverse proxy server.
(Optional) You can monitor Nginx error logs by entering the following command. Exit with Ctrl + C
sudo tail -f /var/log/nginx/error.log
admin type this command. Press "y" and enter or directly enter when the prompt asks yousudo apt update && sudo apt upgrade
admin stopping thenginx.servicesudo systemctl stop nginx
enter or directly enter when the prompt asks yousudo apt autoremove nginx
sudo rm -rf /etc/nginx && sudo rm -f /etc/ssl/certs/nginx-selfsigned.crt && sudo rm -f /etc/ssl/private/nginx-selfsigned.key
{% hint style="info" %}
For privacy and security reasons, you could want to enable Option 1: DoT (DNS over TLS) or Option 2: DoH (DNS over HTTPS) to encrypt DNS requests from your MiniBolt to the selected DNS servers, and validate the authenticity and ensure the integrity of DNS responses by enabling DNSSEC.
Note: you can only enable DNSSEC validation if you follow Option 1 (recommended)