Skip to content

Commit

Permalink
Add IPTABLES_EXTRA_FILE variable to specify additional iptable rules (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
StarGate01 authored Apr 12, 2022
1 parent d0aca36 commit 9b087e8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Configuration is via environmental variables. Here's a list, along with the def
* `OVPN_VERBOSITY` (4): The verbosity of OpenVPN's logs.
* `OVPN_DEFAULT_SERVER` (true): If true, the OpenVPN `server <network> <netmask>` directive will be generated in the server configuration file. If `false`, you have to configure the server yourself by using `OVPN_EXTRA`.
* `OVPN_EXTRA` (_undefined_): Additional configuration options which will be appended verbatim to the server configuration.
* `IPTABLES_EXTRA_FILE` (_undefined_): Path of a file containing additional network rules which will be appended to the iptables configuration. Uses the `iptables-save` / `iptables-restore` syntax.

* `OVPN_MANAGEMENT_ENABLE` (false): Enable the TCP management interface on port 5555. This service allows raw TCP and telnet connections, check [the OpenVPN documentation](https://openvpn.net/community-resources/management-interface/) for further information.
* `OVPN_MANAGEMENT_NOAUTH` (false): Allow access to the management interface without any authentication. Note that this option should only be enabled if the management port is not accessible to the internet.
Expand Down
12 changes: 12 additions & 0 deletions files/configuration/setup_networking.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,15 @@ else
fi

fi

# Append extra iptables rules from a file if specified
if [ "${IPTABLES_EXTRA_FILE}x" != "x" ] ; then

if [ -f "$IPTABLES_EXTRA_FILE" ]; then
echo "IPTABLES_EXTRA_FILE was set, appending iptables rules from $IPTABLES_EXTRA_FILE"
iptables-restore -nv "$IPTABLES_EXTRA_FILE"
else
echo "IPTABLES_EXTRA_FILE was set but the specified file $IPTABLES_EXTRA_FILE cannot be found!"
fi

fi

0 comments on commit 9b087e8

Please sign in to comment.