• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Plesk Firewall tunneling VPN not working

muckie89

New Pleskian
hi out there :)
i have the following problem. if i switch on the plesk firewall i am not able to connect to websites through my vpn. if i turn the firewall off and put that in the shell everything is working normaly.

Code:
sysctl -w net.ipv4.ip_forward=1
iptables -A FORWARD -o eth0 -i tun0 -s 10.8.0.0/24 -m conntrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

That is written in
opt/psa/var/modules/firewall/firewall-active.sh
Code:
#!/bin/sh
#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.

set -e

echo 0 > /proc/sys/net/ipv4/ip_forward
([ -f /var/lock/subsys/ipchains ] && /etc/init.d/ipchains stop) >/dev/null 2>&1 || true
(rmmod ipchains) >/dev/null 2>&1 || true
/sbin/iptables-save  -t filter | grep -- "-A INPUT" |  grep -v fail2ban | sed -e "s#^-A#/sbin/iptables -D#g" | sh
/sbin/iptables -F FORWARD
/sbin/iptables -F OUTPUT
/sbin/iptables -Z FORWARD
/sbin/iptables -Z OUTPUT
/sbin/iptables -P INPUT DROP
/sbin/iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -A INPUT -p tcp ! --syn  -m state --state NEW -j REJECT --reject-with tcp-reset
/sbin/iptables -A INPUT -m state --state INVALID -j DROP
/sbin/iptables -P OUTPUT DROP
/sbin/iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -A OUTPUT -p tcp ! --syn  -m state --state NEW -j REJECT --reject-with tcp-reset
/sbin/iptables -A OUTPUT -m state --state INVALID -j DROP
/sbin/iptables -P FORWARD DROP
/sbin/iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -A FORWARD -p tcp ! --syn  -m state --state NEW -j REJECT --reject-with tcp-reset
/sbin/iptables -A FORWARD -m state --state INVALID -j DROP
/sbin/iptables -A INPUT -i lo  -j ACCEPT
/sbin/iptables -A OUTPUT -o lo -j ACCEPT
/sbin/iptables -A FORWARD -i lo -o lo -j ACCEPT
/sbin/iptables -t mangle -F
/sbin/iptables -t mangle -Z
/sbin/iptables -t mangle -P PREROUTING ACCEPT
/sbin/iptables -t mangle -P OUTPUT ACCEPT
/sbin/iptables -t mangle -P INPUT ACCEPT
/sbin/iptables -t mangle -P FORWARD ACCEPT
/sbin/iptables -t mangle -P POSTROUTING ACCEPT
/sbin/ip6tables-save  -t filter | grep -- "-A INPUT" |  grep -v fail2ban | sed -e "s#^-A#/sbin/ip6tables -D#g" | sh
/sbin/ip6tables -F FORWARD
/sbin/ip6tables -F OUTPUT
/sbin/ip6tables -Z FORWARD
/sbin/ip6tables -Z OUTPUT
/sbin/ip6tables -P INPUT DROP
/sbin/ip6tables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
/sbin/ip6tables -A INPUT -p tcp ! --syn  -m state --state NEW -j REJECT --reject-with tcp-reset
/sbin/ip6tables -A INPUT -m state --state INVALID -j DROP
/sbin/ip6tables -P OUTPUT DROP
/sbin/ip6tables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
/sbin/ip6tables -A OUTPUT -p tcp ! --syn  -m state --state NEW -j REJECT --reject-with tcp-reset
/sbin/ip6tables -A OUTPUT -m state --state INVALID -j DROP
/sbin/ip6tables -P FORWARD DROP
/sbin/ip6tables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
/sbin/ip6tables -A FORWARD -p tcp ! --syn  -m state --state NEW -j REJECT --reject-with tcp-reset
/sbin/ip6tables -A FORWARD -m state --state INVALID -j DROP
/sbin/ip6tables -A INPUT -i lo  -j ACCEPT
/sbin/ip6tables -A OUTPUT -o lo -j ACCEPT
/sbin/ip6tables -A FORWARD -i lo -o lo -j ACCEPT
/sbin/ip6tables -t mangle -F
/sbin/ip6tables -t mangle -Z
/sbin/ip6tables -t mangle -P PREROUTING ACCEPT
/sbin/ip6tables -t mangle -P OUTPUT ACCEPT
/sbin/ip6tables -t mangle -P INPUT ACCEPT
/sbin/ip6tables -t mangle -P FORWARD ACCEPT
/sbin/ip6tables -t mangle -P POSTROUTING ACCEPT
/sbin/iptables -t nat -F
/sbin/iptables -t nat -Z
/sbin/iptables -t nat -P PREROUTING ACCEPT
/sbin/iptables -t nat -P OUTPUT ACCEPT
/sbin/iptables -t nat -P POSTROUTING ACCEPT

/sbin/iptables -A INPUT -p udp --dport 1194 -j ACCEPT
/sbin/ip6tables -A INPUT -p udp --dport 1194 -j ACCEPT

/sbin/iptables -A INPUT -p tcp --dport 55558 -j ACCEPT
/sbin/ip6tables -A INPUT -p tcp --dport 55558 -j ACCEPT

/sbin/iptables -A INPUT -p tcp --dport 12443 -j ACCEPT
/sbin/ip6tables -A INPUT -p tcp --dport 12443 -j ACCEPT

/sbin/iptables -A INPUT -p tcp --dport 11443 -j ACCEPT
/sbin/iptables -A INPUT -p tcp --dport 11444 -j ACCEPT
/sbin/ip6tables -A INPUT -p tcp --dport 11443 -j ACCEPT
/sbin/ip6tables -A INPUT -p tcp --dport 11444 -j ACCEPT
/sbin/iptables -A INPUT -p tcp --dport 8447 -j ACCEPT
/sbin/ip6tables -A INPUT -p tcp --dport 8447 -j ACCEPT

/sbin/iptables -A INPUT -p tcp --dport 8443 -j ACCEPT
/sbin/iptables -A INPUT -p tcp --dport 8880 -j ACCEPT
/sbin/ip6tables -A INPUT -p tcp --dport 8443 -j ACCEPT
/sbin/ip6tables -A INPUT -p tcp --dport 8880 -j ACCEPT

/sbin/iptables -A INPUT -p tcp --dport 80 -j ACCEPT
/sbin/iptables -A INPUT -p tcp --dport 443 -j ACCEPT
/sbin/ip6tables -A INPUT -p tcp --dport 80 -j ACCEPT
/sbin/ip6tables -A INPUT -p tcp --dport 443 -j ACCEPT

/sbin/iptables -A INPUT -p tcp --dport 21 -j ACCEPT
/sbin/ip6tables -A INPUT -p tcp --dport 21 -j ACCEPT

/sbin/iptables -A INPUT -p tcp --dport 22 -j DROP
/sbin/ip6tables -A INPUT -p tcp --dport 22 -j DROP

/sbin/iptables -A INPUT -p tcp --dport 587 -j ACCEPT
/sbin/ip6tables -A INPUT -p tcp --dport 587 -j ACCEPT

/sbin/iptables -A INPUT -p tcp --dport 25 -j ACCEPT
/sbin/iptables -A INPUT -p tcp --dport 465 -j ACCEPT
/sbin/ip6tables -A INPUT -p tcp --dport 25 -j ACCEPT
/sbin/ip6tables -A INPUT -p tcp --dport 465 -j ACCEPT

/sbin/iptables -A INPUT -p tcp --dport 110 -j ACCEPT
/sbin/iptables -A INPUT -p tcp --dport 995 -j ACCEPT
/sbin/ip6tables -A INPUT -p tcp --dport 110 -j ACCEPT
/sbin/ip6tables -A INPUT -p tcp --dport 995 -j ACCEPT

/sbin/iptables -A INPUT -p tcp --dport 143 -j ACCEPT
/sbin/iptables -A INPUT -p tcp --dport 993 -j ACCEPT
/sbin/ip6tables -A INPUT -p tcp --dport 143 -j ACCEPT
/sbin/ip6tables -A INPUT -p tcp --dport 993 -j ACCEPT

/sbin/iptables -A INPUT -p tcp --dport 106 -j ACCEPT
/sbin/ip6tables -A INPUT -p tcp --dport 106 -j ACCEPT

/sbin/iptables -A INPUT -p tcp --dport 3306 -s 127.0.0.1 -j ACCEPT
/sbin/iptables -A INPUT -p tcp --dport 3306 -j DROP
/sbin/ip6tables -A INPUT -p tcp --dport 3306 -s ::ffff:127.0.0.1 -j ACCEPT
/sbin/ip6tables -A INPUT -p tcp --dport 3306 -j DROP

/sbin/iptables -A INPUT -p tcp --dport 5432 -j ACCEPT
/sbin/ip6tables -A INPUT -p tcp --dport 5432 -j ACCEPT

/sbin/iptables -A INPUT -p tcp --dport 9008 -j ACCEPT
/sbin/iptables -A INPUT -p tcp --dport 9080 -j ACCEPT
/sbin/ip6tables -A INPUT -p tcp --dport 9008 -j ACCEPT
/sbin/iptables -A INPUT -p udp --dport 137 -j DROP
/sbin/iptables -A INPUT -p udp --dport 138 -j DROP
/sbin/iptables -A INPUT -p tcp --dport 139 -j DROP
/sbin/iptables -A INPUT -p tcp --dport 445 -j DROP
/sbin/ip6tables -A INPUT -p udp --dport 137 -j DROP
/sbin/ip6tables -A INPUT -p udp --dport 138 -j DROP
/sbin/ip6tables -A INPUT -p tcp --dport 139 -j DROP
/sbin/ip6tables -A INPUT -p tcp --dport 445 -j DROP

/sbin/iptables -A INPUT -p udp --dport 1194 -j ACCEPT
/sbin/ip6tables -A INPUT -p udp --dport 1194 -j ACCEPT

/sbin/iptables -A INPUT -p udp --dport 53 -j ACCEPT
/sbin/iptables -A INPUT -p tcp --dport 53 -j ACCEPT
/sbin/ip6tables -A INPUT -p udp --dport 53 -j ACCEPT
/sbin/ip6tables -A INPUT -p tcp --dport 53 -j ACCEPT

/sbin/ip6tables -A INPUT -p icmpv6 --icmpv6-type 134/0 -j ACCEPT
/sbin/ip6tables -A INPUT -p icmpv6 --icmpv6-type 135/0 -j ACCEPT
/sbin/ip6tables -A INPUT -p icmpv6 --icmpv6-type 136/0 -j ACCEPT
/sbin/ip6tables -A INPUT -p icmpv6 --icmpv6-type 137/0 -j ACCEPT

/sbin/iptables -A INPUT -p icmp --icmp-type 8/0 -j ACCEPT
/sbin/ip6tables -A INPUT -p icmpv6 --icmpv6-type 128/0 -j ACCEPT
/sbin/ip6tables -A INPUT -p icmpv6 --icmpv6-type 129/0 -j ACCEPT

/sbin/iptables -A INPUT -j DROP
/sbin/ip6tables -A INPUT -j DROP

/sbin/iptables -A OUTPUT -j ACCEPT
/sbin/ip6tables -A OUTPUT -j ACCEPT

/sbin/iptables -A FORWARD -j DROP
/sbin/ip6tables -A FORWARD -j DROP

echo 1 > /proc/sys/net/ipv4/ip_forward
#
# End of script
#

so i have to combine the first part of the code into the firewall-active.sh file, but thats not possible, however :/

is some one out there who can help ?

best regards :)
 
Back
Top