Fix missing /etc/sysctl.d directory on some systems

Create the directory before writing to it to avoid errors on
systems like CentOS Stream 9 containers where it may not exist.
This commit is contained in:
Stanislas Lange
2025-12-07 23:18:44 +01:00
parent 8a672e744f
commit c7acd32946

View File

@@ -1113,6 +1113,7 @@ verb 3" >>/etc/openvpn/server.conf
# Enable routing # Enable routing
log_info "Enabling IP forwarding..." log_info "Enabling IP forwarding..."
mkdir -p /etc/sysctl.d
echo 'net.ipv4.ip_forward=1' >/etc/sysctl.d/99-openvpn.conf echo 'net.ipv4.ip_forward=1' >/etc/sysctl.d/99-openvpn.conf
if [[ $IPV6_SUPPORT == 'y' ]]; then if [[ $IPV6_SUPPORT == 'y' ]]; then
echo 'net.ipv6.conf.all.forwarding=1' >>/etc/sysctl.d/99-openvpn.conf echo 'net.ipv6.conf.all.forwarding=1' >>/etc/sysctl.d/99-openvpn.conf