istro

System

Security

Firewall, blocked addresses, secrets, users, a security check, privacy mode and the audit log.

The Security page gathers the tools that protect your server. It has a Security Check, Defense, Firewall, Open Ports, Blocked Addresses, Secrets and Users.

#Security Check

The check finds weak spots and gives a score from 0 to 100. Each urgent finding costs 20 points, each warning 8 and each note 2. It looks at ssh logins, firewall, fail2ban, updates, open ports, certificates, disk encryption and more.

sudo bistro secaudit            # every finding and the score
bistro secaudit fix ssh-password
bistro secaudit inbox           # put each urgent and warning finding in the inbox

Fix works only for a fixed list: ssh-password, ssh-root-login, firewall-off, fail2ban-off, unattended-off and security-updates. Bistro refuses to turn off ssh passwords when no ssh key is set up.

#Firewall

The firewall uses its own nftables table and never touches others. With it on, everything not allowed is blocked. ssh (22) and the dashboard (2045) stay open to the LAN, so you cannot lock yourself out.

bistro firewall status
bistro firewall enable          # disable allows everything again
bistro firewall allow 8096/tcp from lan jellyfin
bistro firewall deny 23/tcp
bistro firewall remove 3        # the number shown in status

Allow defaults to the LAN. Deny defaults to any source. A source can be lan, any or a CIDR. Every change applies at once. If the new rules fail a check, the old rules stay.

#Block a Country

bistro firewall geoip-update cn # download the address list
bistro firewall block-country cn
bistro firewall unblock-country cn

#Blocked Addresses

Two tools ban addresses that attack you. They never block your own network or your current ssh session.

Fail2ban bans an address after 5 failed ssh or dashboard logins in 10 minutes.

bistro firewall fail2ban on
bistro firewall unban 203.0.113.9

Shield is the Defense card. It blocks an address after a number of failed logins and keeps a threat log. It also sets safe kernel options and a random number helper.

bistro shield defend on 10 24   # after 10 failures in 15 minutes, block for 24 hours
bistro shield harden on
bistro shield entropy on
bistro shield bans
bistro shield ban 203.0.113.9 12
bistro shield unban 203.0.113.9
bistro shield threats 24        # the last 24 hours

#Secrets

The vault holds passwords and API keys, encrypted at rest. Values never appear in a list or on a command line. Grant a secret to an app and systemd hands it over at start.

echo -n "s3cret" | sudo bistro vault set DB_PASSWORD
sudo bistro vault grant DB_PASSWORD myapp
sudo bistro vault revoke DB_PASSWORD myapp
sudo bistro vault remove DB_PASSWORD
sudo bistro vault rotate-key    # re-encrypt every secret

#Users and Roles

RoleCan do
adminFull control.
operatorStart, stop and restart apps and services without a password.
readonlyLook, never change.
bistro users add sam operator   # then set a password with: sudo passwd sam
bistro users role sam readonly
bistro users 2fa sam on         # codes from an authenticator app at login
bistro users folder /srv/data/media sam rw
bistro users remove sam         # keeps the home folder

Bistro never removes the last admin. ssh key logins skip the 2FA code.

#Privacy Mode

Privacy mode lets an app reach your LAN but never the internet. It uses its own nftables table, so it holds with the firewall on or off. Apps on the host network cannot use it.

bistro privacy on jellyfin
bistro privacy report jellyfin  # blocked attempts since it went on
bistro privacy off jellyfin

#Audit Log

The audit log records who did what, from the web UI, the CLI, the assistant, MCP or the autopilot. See Maintenance.

bistro audit --days 7
bistro audit --source assistant --grep restart
bistro audit export

#New Device Alerts

Bistro scans your network every 15 minutes. A device it has not seen before raises an alert and an inbox item. See Network.

bistro scan list
bistro scan name AA:BB:CC:DD:EE:FF printer
bistro scan forget AA:BB:CC:DD:EE:FF