Native install: nftables script for VPN clients (masquerade, MSS clamp, TTL)
deploy/native/firewall.sh reads the server interfaces and applies, for traffic from the VPN network to all other networks: masquerade, TCP MSS clamping (path MTU tuning) and TTL tuning, in its own table `ip ovpmon`. Rules are persisted in /etc/ovpmon/nftables.nft and loaded at boot by the ovpmon-nft service (systemd and OpenRC). Opt-in: install.sh and update.sh do not call it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8371d889a4
commit
f95a0b63e6
9 files changed
+713
-3
No files matched your search
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/sbin/openrc-run
|
||||
# managed by ovpmon deploy/native (firewall.sh replaces this file only while this marker line is present)
|
||||
#
|
||||
# Loads the nftables rules of the VPN clients (masquerade, TCP MSS clamp, TTL) at boot, OpenRC (Alpine).
|
||||
# Install: `deploy/native/firewall.sh` renders this script into /etc/init.d/ovpmon-nft, adds it to the default
|
||||
# runlevel and starts it. Independent of the distribution's nftables service: only the table `ip ovpmon`
|
||||
# is loaded and removed. Guide: DOCS/Deployment/Scenario2_System_Services.md
|
||||
|
||||
name="ovpmon-nft"
|
||||
description="NAT, MSS and TTL rules for the VPN clients (nftables)"
|
||||
|
||||
rules="/etc/ovpmon/nftables.nft"
|
||||
|
||||
depend() {
|
||||
need localmount
|
||||
before net
|
||||
}
|
||||
|
||||
start() {
|
||||
ebegin "Loading $rules"
|
||||
nft -f "$rules"
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Removing the table ip ovpmon"
|
||||
nft delete table ip ovpmon 2>/dev/null
|
||||
eend 0
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
# managed by ovpmon deploy/native (firewall.sh replaces this file only while this marker line is present)
|
||||
#
|
||||
# Loads the nftables rules of the VPN clients (masquerade, TCP MSS clamp, TTL) at boot.
|
||||
# Install: `deploy/native/firewall.sh` renders and enables this unit together with /etc/ovpmon/nftables.nft.
|
||||
# Independent of the distribution's nftables.service: only the table `ip ovpmon` is loaded and removed.
|
||||
# Guide: DOCS/Deployment/Scenario2_System_Services.md
|
||||
[Unit]
|
||||
Description=OpenVPN Monitor: NAT, MSS and TTL rules for the VPN clients (nftables)
|
||||
Wants=network-pre.target
|
||||
Before=network-pre.target
|
||||
ConditionPathExists=/etc/ovpmon/nftables.nft
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/usr/sbin/nft -f /etc/ovpmon/nftables.nft
|
||||
ExecStop=-/usr/sbin/nft delete table ip ovpmon
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in new issue
Block a user