20 lines
760 B
Shell
20 lines
760 B
Shell
|
|
#!/usr/bin/env bash
|
||
|
|
# Install the WAL-archive inbound guard on the Linode hub. Idempotent.
|
||
|
|
#
|
||
|
|
# sudo ./install-wal-archive-firewall.sh
|
||
|
|
#
|
||
|
|
# Verifies the table afterwards instead of trusting `systemctl start`'s exit 0.
|
||
|
|
set -euo pipefail
|
||
|
|
|
||
|
|
here=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||
|
|
|
||
|
|
install -D -m 0644 "$here/wal-archive-firewall.nft" /etc/nftables.d/wal_archive_guard.nft
|
||
|
|
install -D -m 0644 "$here/wal-archive-firewall.service" /etc/systemd/system/wal-archive-firewall.service
|
||
|
|
|
||
|
|
systemctl daemon-reload
|
||
|
|
systemctl enable --now wal-archive-firewall.service
|
||
|
|
|
||
|
|
nft list table inet wal_archive_guard >/dev/null
|
||
|
|
nft list table inet wal_archive_guard | grep -q 'dport { 3900, 3903 }'
|
||
|
|
echo "OK: wal_archive_guard loaded"
|
||
|
|
nft list table inet wal_archive_guard
|