{
echo "#!/usr/sbin/nft -f"
echo "# brisk /${name}/ - nftables rules of the daemon machine."
- echo "# Generated by INSTALL.sh, do not edit: run "INSTALL.sh system" again instead."
- echo "# Copy it into /etc/nftables.d/, include that directory from"
- echo '# /etc/nftables.conf (include "/etc/nftables.d/*.nft") and load it:'
- echo "# $(as_root "nft -c -f /etc/nftables.d/${name}.nft") && $(as_root "nft -f /etc/nftables.d/${name}.nft")"
+ echo "# Generated by INSTALL.sh, do not edit: run \"INSTALL.sh system\" again instead."
+ echo "# Copy it into /etc/nftables.d/ - it cannot be included where it is,"
+ echo "# because nftables.service runs with ProtectHome=true and reads nothing"
+ echo "# under /home - include that directory from /etc/nftables.conf and load it:"
+ echo "# $(as_root "mkdir -p /etc/nftables.d") ; $(as_root "cp <this file> /etc/nftables.d/")"
+ echo "# add include \"/etc/nftables.d/*.nft\" to /etc/nftables.conf"
+ echo "# $(as_root "nft -c -f /etc/nftables.conf") && $(as_root "systemctl enable --now nftables")"
+ echo "# /etc/nftables.d is not a directory of the nftables package: it exists"
+ echo "# only because of that include. And /etc/nftables.conf begins with"
+ echo "# \"flush ruleset\", so loading it replaces whatever is active: look at"
+ echo "# \"nft list ruleset\" first."
echo "#"
echo "# The table accepts by default and drops only the ports of brisk. With a"
echo "# firewall whose policy is drop, an accept here is not enough: the two"
tmp="$(mktemp)"
{
echo "# brisk ${pfx}/ - nginx, http level. Generated by INSTALL.sh, do not edit:"
- echo "# run "INSTALL.sh system" again instead. Include it at http level, for example"
+ echo "# run \"INSTALL.sh system\" again instead. Include it at http level, for example"
echo "# $(as_root "ln -s $http_f /etc/nginx/conf.d/")"
echo
echo "map \$http_upgrade \$${var}_connection_upgrade {"
tmp="$(mktemp)"
{
echo "# brisk ${pfx}/ - nginx, inside the server {} that terminates the tls."
- echo "# Generated by INSTALL.sh, do not edit: run "INSTALL.sh system" again instead."
+ echo "# Generated by INSTALL.sh, do not edit: run \"INSTALL.sh system\" again instead."
echo "# server {"
echo "# listen 443 ssl;"
echo "# ..."
else
echo "nftables rules:"
nft_conf_gen
- sys_todo="${sys_todo} $(as_root "cp $etc_path/${scrname}.nft /etc/nftables.d/")\n"
- sys_todo="${sys_todo} $(as_root "nft -c -f /etc/nftables.d/${scrname}.nft") && $(as_root "nft -f /etc/nftables.d/${scrname}.nft")\n"
+ sys_todo="${sys_todo} $(as_root "mkdir -p /etc/nftables.d") ; $(as_root "cp $etc_path/${scrname}.nft /etc/nftables.d/")\n"
+ sys_todo="${sys_todo} add include \"/etc/nftables.d/*.nft\" to /etc/nftables.conf (once)\n"
+ sys_todo="${sys_todo} $(as_root "nft -c -f /etc/nftables.conf") && $(as_root "systemctl enable --now nftables")\n"
fi
# --- how the daemon is started ---
With the daemon on a machine of its own (-m server -U tcp://...), pass -I
with the address of the front and the same action writes in Etc <name>.nft,
the nftables rules that leave the daemon ports, and php-fpm when it listens
-on tcp there, reachable by the front alone. Copy it into /etc/nftables.d/.
+on tcp there, reachable by the front alone. It has to be copied out of Etc,
+into /etc/nftables.d/: nftables.service runs with ProtectHome=true and reads
+nothing under /home. That directory is not part of the nftables package, so
+it has to be created and included from /etc/nftables.conf, with the include
+AFTER the "flush ruleset" that file begins with - as its last line, say.
Everything that belongs to the machine rather than to the tree of the site -
these files and the way the daemon is started - comes from that one action,