-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IPTables is currently too open (maybe not safe) shouldn't it be set to DROP by default? #710
Comments
This issue needs more attention. I tried different config and it seems working for know. I have doubts about its strictness. *filter
:INPUT DROP [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
# Keep state
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Loopback
-A INPUT -i lo -j ACCEPT
# SSH
-A INPUT -i eth0 -p tcp --dport 22 -j ACCEPT
# VPN-INPUT
-A INPUT -i tun0 -j ACCEPT
-A INPUT -i eth0 -p <openvpn_protocol> --dport <openvpn_port> -j ACCEPT
# VPN ACCESS TO INTERNET
-A FORWARD -i tun0 -o eth0 -j ACCEPT
-A FORWARD -o tun0 -i eth0 -j ACCEPT
COMMIT
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
# VPN ACCESS TO INTERNET
-A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
COMMIT More strict version here https://gist.github.com/Tristor/ed0f6867d2b0fa4c1f80300af6e0e12e |
Thanks, feel free to open a PR |
Anybody can supply me the iptables and ip6tables commands from the linked article to make it more strict? I am not familiar with iptables only used ufw and its not working very well with this script. Thanks. |
Some of those are already in the script. As a note, I have to say you should not rely on firewall rules you found on internet without checking if it suits your use case. If you don't know how to set firewall rules, you should learn it initially. |
Thanks for your answer, this file must be overwritten, right Thanks in advance for your help :) |
You can compare content of the service file created by script before overwrite it. You can see repository script uses two shell script, one to load rules at system start and one other to remove rules when systemctl asks for. My approach is using If you want IPv6 rules too, maybe original approach (with shell script) could be better since If you want the stick with original approach, don't create the file I suggested to you, instead, modify the content of |
Maybe something like this:
And the same inverted for the remove script. |
I don't have any expertise with IPv6 rules for OpenVPN. Are you sure you are using the |
I don't know at this point because the cloud-server is not buyed actually but I make preparations 😉 And the above is only for example, but normally it is eth0. But thats not a problem can be adjusted the problem is more the whole conception of the rules 🙈 |
@omexlu Then it could be better to delete |
This is only an example nothing is setting up until now 😊 I only want to know how to make the openvpn-server not so wide open like this install script does 🙈 But I need ipv4 and ipv6 support. I can not really find something on the net related to openvpn with one more strict configuration. Maybe @angristan can help here or adjust his script because in default is very a security risk. |
Checklist
Describe the issue
The current firewall settings seem to be too open. It is pretty much accepting anything. I don't think that's safe.
Shouldn't the INPUT and FORWARD policies rather be set to DROP by default and only allow specific ports and traffic to come through?
Current Firewall Setting:
iptables-save
The text was updated successfully, but these errors were encountered: