TOWERBY CETMIX
← Hangar / jet_template_ufw

UFW Host Firewall with SSH and Service Allowlists

Install UFW and apply a host firewall policy with restricted SSH, HTTP and HTTPS, and optional source-specific TCP rules.

↓ Download↓ 0 downloads

Summary

Category
Jet Templates
Tags
System
Authors
Cetmix OÜ
License
AGPL-3
Version
1.0.0
Call sign
jet_template_ufw

This snippet imports a UFW Jet Template for an apt-based Linux host. It allows one firewall Jet per server and requires Tower Core, which is included and handles SSH checks, host key capture and package updates. Installing the UFW template installs the ufw package. Build renders a firewall configuration script for the host.

Configure and enable

  1. Import the YAML and install the template. Set ssh_allow_list to a comma-separated list of source addresses that must retain access to TCP port 22, including the address Tower connects from. The script exits if this list is empty.
  2. Optionally set ufw_allow_list to comma-separated IP:PORT entries for additional inbound TCP traffic, such as access from Prometheus to a host exporter.
  3. Create the Jet and run Start to apply the policy. Start resets existing UFW rules, sets default deny for incoming traffic and default allow for outgoing traffic, and allows SSH only from the listed sources. It opens TCP 80 and 443, adds optional inbound rules and explicit outgoing SMTP, IMAP and POP3 rules, enables UFW and sets low-level logging.

Operate

Check the Start plan output for the resulting policy and use UFW Log to inspect /var/log/ufw.log. Stop disables UFW. Remove, available from Stopped, cleans up the Jet's deployment files. Confirm the SSH source list and required inbound rules before starting because the reset replaces the host's existing UFW policy.