Security checks
One list of what is exposed, attacked, unpatched, unhardened or changed on the host.
The security list
seawall security # every row
seawall security listener # one row's detail and its fix
seawall --check security # exit 1 on any finding
The list has five parts. Each row is marked ! for a finding, ✓ for a pass or · for information. A source seawall can't read is shown as information and never as a pass.
| Part | Rows |
|---|---|
| Exposure | Published ports and whether DOCKER-USER stops them, stray listeners, the firewall, privileged containers, Docker socket mounts, admin screens published off 127.0.0.1, host mounts, sites behind Cloudflare that answer directly, paths a site should never serve (its .env, .git, metrics or debug log) and ports a stopped stack publishes again when it starts. |
| Attacks, 24h | CrowdSec state and bans, which logs CrowdSec reads, failed SSH logins and their addresses. |
| Patching | Image updates with Critical or High fixes, unfixed Critical CVEs, host security updates and how long they have waited, a pending reboot and Livepatch. |
| Hardening | Split stacks, lint errors per stack, root processes, readable secrets, files anyone on the host can read, writable and orphaned data, cloud image template accounts, accounts no one uses, the owner and mode of Docker's own files, kernel settings and the temp folders' mount options. |
| Integrity, 24h | SSH logins, auditd changes, seawall changes outside a known session, the config capture, failed units and certificate expiry. |
The SSH, login, audit and change rows read Loki through Grafana. Without a Loki data source they say "no answer from Loki".
In the Security tab the selected row's key runs its fix as a dry run. y confirms it.
| Key | Runs |
|---|---|
enter | seawall security <row>, with each Do line as a number key |
f | The row's fix, such as ports add on an unexpected port or accept listener on a stray listener |
u | stack update <stack> --container <c>, stack run-as <stack> or host upgrade, by row |
p | stack harden <stack> --pid1 |
l | proxy login |
h | stack harden <stack> |
c | cloud cover, which adds an uncovered file to the config repo's manifest |
A row's key exists only when every part of its command checks out. A process name with spaces, quotes or a leading - gets no key. When a reload moves a different row under the cursor, keys do nothing. Select the row again to use them.
Origins, accounts and patching
seawall's facts timer works out each row as you. Source names where its input comes from. The root unit is what seawall-facts-root writes to /run/seawall-firewall each minute, which only root can write. Your account means seawall reads it as you. Loki is the audit log as Grafana's Loki holds it. Root unit output older than 3 minutes makes a row say "can't tell" and never pass. seawall init installs the unit and keeps it to this version's.
| Row | Source | Checks | Can't tell when | Fix |
|---|---|---|---|---|
origin | Root unit, your account | A proxied name whose every address is in Cloudflare's ranges answers only through Cloudflare. It does when DOCKER-USER drops 80 and 443 from everyone else or NPM asks for Cloudflare's client certificate (Authenticated Origin Pulls). IPv6 counts only where the host has a global IPv6 address and route. A name that doesn't resolve or resolves outside Cloudflare isn't judged. | The proxy isn't running, DOCKER-USER has a rule it can't read before a verdict or NPM's config for the host can't be read. | Keep 80 and 443 to Cloudflare's ranges in DOCKER-USER, or turn on Authenticated Origin Pulls. |
docker-user | Root unit, your account | Each port a container publishes to anyone that the allowlist doesn't expect, walked through DOCKER-USER for IPv4 and IPv6 as a packet from the internet. | A rule that accepts, returns or jumps with a match it can't read. A rule that drops is passed by when it can't be read, as it can only drop more. | Publish it on 127.0.0.1, or drop it in DOCKER-USER. |
template users | Root unit | Cloud image accounts such as ubuntu, debian and ec2-user that can still log in with keys or a password and are privileged by group or a sudoers file. Says how it logs in and what sudo gives it (passwordless root); the sudo row leaves it out. Keys are counted as the account itself and never shown. An account whose expiry date has passed can't log in, keys included, and passes. | Its keys can't be read as the account, for example a linked or unreadable .ssh or keys sshd takes from somewhere else. | f ends it (seawall host fix expire). Or remove its keys, or delete it. usermod -L alone leaves keys working. |
accounts | Root unit, your account | People's accounts that can log in but haven't for 90 days, from the login record. Only logins with a terminal are recorded, so a host reached only by ssh host command stays at can't tell. A login from before the account was made counts as never. An account whose expiry date has passed can't log in, keys included, and isn't listed. | The login record hasn't been written since boot, the only login is from the day the account was made with no birth time to compare or its keys can't be read. | If no one uses it, f ends it (seawall host fix expire), or remove its keys. |
docker files | Your account | Owner and mode of Docker's units, socket, /etc/docker, daemon.json, registry certificates, /etc/default/docker and containerd's socket, against CIS Docker section 3. A link is judged as a link and never followed. | A file it can't stat. | chown and chmod as root. |
kernel settings | Your account | The 30 kernel settings CIS Ubuntu asks for, read from /proc/sys every 15 minutes. They cover address randomisation, ptrace, core dumps of setuid programs, kernel pointers, link and FIFO protection, redirects, source routing, SYN cookies and the like. IP forwarding is left out, as Docker needs it. A gap is a finding. Ubuntu's own looser defaults (rp_filter 2, router advertisements, logging martians) are notes. The header counts what f sets; the rest are one line, kept as most hosts do. | A setting it can't read. One the kernel doesn't have is passed over. | The line for a file in /etc/sysctl.d/, named for each setting that's off. seawall never writes it. |
apparmor | Root unit | Whether AppArmor is on (its module and the boot line) and its loaded profiles by mode, from the root facts unit every minute. On with nothing enforced is a finding. Profiles in complain mode are a note, named, 20 at most. | The profiles list can't be read. | When it's off, check the boot line has no apparmor=0 or other security=, then systemctl enable --now apparmor. When nothing is enforced, f loads the profiles (seawall host fix apparmor). For a complain profile, aa-enforce with its name, where it doesn't break what it guards. |
tls | Your account | Each TLS route's certificate as the proxy serves it, probed every hour. The nearest expiry, a finding under 14 days, and any probe that fails. A Cloudflare origin certificate shows the year it ends and never counts as nearest. | No certificate is watched, as there's no proxy or no route with TLS. | Renew it in the proxy. seawall proxy certs lists each. |
auditd | Loki | Changes to keys, sudoers, cron, units and accounts in 24 hours, from the audit log in Loki, by key, program and account. A change is a finding. One seawall made itself (a program it writes with, under the accounts or units key, within a minute of a seawall line that says init or host fix) is listed and leaves the mark alone. Keys, sudoers, modules and the canary always count. | Grafana or its Loki data source doesn't answer. | None for a change you made. For one you didn't make, its key's lines in the audit log say what made it. |
temp mounts | Your account | The mount options of /tmp, /dev/shm and /var/tmp, from the mount table every 15 minutes. nodev or nosuid missing is a finding. noexec missing, a folder that isn't its own mount and Docker's data or the logs on the root filesystem are notes. | The mount table can't be read. | The options for the mount, in /etc/fstab or its systemd unit. |
readable | Your account | How many files in the stacks folder anyone on the host can read, where others can reach the folder at all. Information only. Secrets have their own row. | Without host facts the row isn't shown. | None. It's a count to know. |
stopped ports | Your account | Ports a stopped stack's compose file publishes again when it starts, such as a game server. Information only. | Shown only when a stopped stack publishes a port. | None until it starts. The ports row judges them then. |
host | Your account | Security updates waiting. A finding once one has waited a day, as unattended-upgrades takes them sooner. | seawall's state folder can't keep when they were first seen or there are no host facts. | sudo apt upgrade or let unattended-upgrades run. |
reboot | Your account | A reboot the system is waiting for and for how long. Information only. | Never. No flag reads as no reboot waiting. | Reboot when it suits you. |
livepatch | Your account | Whether Livepatch covers the running kernel or why not. Information only. | Its state can't be read. | None needed. A reboot covers what Livepatch doesn't. |
Three of these rows have alerts in the security rule pack, at sev2. OriginReachable fires after 1 hour, PublishedPortUnguarded after 30 minutes and TemplateAccountActive after 1 hour. Each one's Check line is the row's seawall security command.
Cloudflare's ranges come from cloudflare.com once an hour within 5 seconds. Offline the last kept copy is used, then a list built into seawall with its date. The row's detail says which.
Ports and listeners
seawall ports ls # what facts expects
seawall ports add 7777/udp # expect a port
seawall ports rm 7777/udp
seawall accept listener node --reason "dev server" --port 3000 --yes
seawall facts # run the security facts now
seawall facts runs every minute from its timer. It reports published ports outside the allowlist, privileged containers, Docker socket and host mounts, readable secrets, orphaned stack data and failed units. A root unit reads ufw status and iptables -S DOCKER-USER for it.
A stray listener is a port a login user opened by hand. That covers one started from a shell and one left running after logout. Units and containers are not strays. A listener counts after it has been up an hour, and the listeners check runs every 15 minutes. SeawallStrayListener fires about 1 hour 30 minutes to 1 hour 50 minutes after a listener starts. The Security tab shows strays at once. accept listener marks one as expected in the config.