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

Allow opening ports only for local network #2030

Closed
navanchauhan opened this issue Jun 30, 2022 · 2 comments
Closed

Allow opening ports only for local network #2030

navanchauhan opened this issue Jun 30, 2022 · 2 comments

Comments

@navanchauhan
Copy link

It shouldn't be too difficult to add a flag like --local-network-only to the yunohost firewall command which then adds similar rules [0]

# iptables -A INPUT -p tcp --dport 22 -s 192.168.0.0/16 -j ACCEPT
# iptables -A INPUT -p tcp --dport 22 -s 127.0.0.0/8 -j ACCEPT
# iptables -A INPUT -p tcp --dport 22 -j DROP

Use Case

I have been working on timemachine_ynh which creates a time machine backup target. Under the hood it uses a Samba server, by default if I open the required port it is also exposed to the public. I can definitely just setup the correct fail2ban config to ban IPs, but exposing something like Samba is never recommended. Having a --local-network-only flag will be better in cases like this.

If this seems like a simple enough suggestion, I am more than happy to start working on this PR

[0] https://serverfault.com/questions/835010/how-to-allow-ssh-only-from-local-network-via-iptables

@alexAubin
Copy link
Member

« by default if I open the required port it is also exposed to the public. »

That is not correct ... unless you are using a DMZ

The classic setup is that your router is a NAT and unless your port-forward a specific port, that port ain't publicly expose ...

@alexAubin
Copy link
Member

Also cf https://forum.yunohost.org/t/yunohost-and-samba/3128/15 to enable Samba on local network only

Imho if there's only the samba use case, it's not worth it to implement a local-network-only option for firewall...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants