@aibulat/ctl-ufw
Configure ufw from a JSON list of ports: allow each one, set the default policy to deny, then enable the firewall.
Written with zx, but the published bin runs under plain node and imports zx/globals itself.
WARNING
This closes every inbound port you did not list. Run it over a console you will not lose if SSH is cut off, and make sure your SSH port is in the file.
Install
bash
sudo npm i -g @aibulat/ctl-ufwInput file
A JSON array of ports to allow:
json
[22, 443, 8080]Run
bash
sudo ctl-ufw fw.jsonIt must run as root and refuses otherwise. In order, it:
- reads and validates the port list,
- runs
ufw allow <port>for each entry, - runs
ufw default deny, - runs
ufw enable, - prints
ufw versionandufw status.