Skip to content

Commit

Permalink
Improve nf_tables test for OVZ
Browse files Browse the repository at this point in the history
This test is more reliable and flexible.
  • Loading branch information
Nyr committed May 5, 2020
1 parent 2852150 commit 0724918
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions openvpn-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,9 @@ crl-verify crl.pem" >> /etc/openvpn/server/server.conf
# Create a service to set up persistent iptables rules
iptables_path=$(command -v iptables)
ip6tables_path=$(command -v ip6tables)
# Old OpenVZ kernels don't have nf_tables support
# iptables-nft is the default in Debian 10, but we need to use iptables-legacy
if [[ "$os" == "debian" && "$os_version" -eq 10 && "$(systemd-detect-virt)" == "openvz" ]]; then
# nf_tables is not available as standard in OVZ kernels. So use iptables-legacy
# if we are in OVZ, with a nf_tables backend and iptables-legacy is available.
if [[ $(systemd-detect-virt) == "openvz" ]] && readlink -f $(command -v iptables) | grep -q "nft" && hash iptables-legacy 2>/dev/null; then
iptables_path=$(command -v iptables-legacy)
ip6tables_path=$(command -v ip6tables-legacy)
fi
Expand Down

0 comments on commit 0724918

Please sign in to comment.