Skip to content
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 Rules for selfhosting #201

Open
nico2511 opened this issue Sep 14, 2024 · 0 comments
Open

Iptables Rules for selfhosting #201

nico2511 opened this issue Sep 14, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@nico2511
Copy link

Hello,

Would like an advise for iptables rules used for ireguard ocnfiguration and selfhosting.

According to chatgpt my local network is not safe with the default rules applied for wireguard

On the logs can see this
[#] iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;

Chatgtp recommande to add thoses rules to be more secure.

Block traffic > local network
iptables -A FORWARD -i wg0 -o eth0 -j DROP

Accept traffic > outside

iptables -A FORWARD -i wg0 -o eth0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT  # Autoriser le trafic de retour (Internet)
iptables -A FORWARD -i wg0 -o eth0 -p tcp --dport 80 -j ACCEPT  # Autoriser le trafic HTTP
iptables -A FORWARD -i wg0 -o eth0 -p tcp --dport 443 -j ACCEPT  # Autoriser le trafic HTTPS
iptables -A FORWARD -i wg0 -o eth0 -j DROP  # Bloquer tout autre trafic

ip6tables -A FORWARD -i wg0 -o eth0 -j DROP  # Bloquer le trafic IPv6 vers le réseau local

My question by a noob on networking, is the local network is secure with the default rules applied

Regards.

@nico2511 nico2511 added the bug Something isn't working label Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant