Description
Motivation
Let's enumerate some key points:
- Yggdrasil is very helpful for a bunch of users, especially for users behind NAT;
- Yggdrasil is easy-to-use solution for non-experts;
- Yggdrasil exposes local services unconditionally to the network;
- exposing ports is dangerous;
- it's easy to forget about the firewall;
- configuring a system-level firewall is hard;
- configuring a system-level firewall correctly is nearly impossible;
- the firewall can easily be misconfigured later while the Yggdrasil instance is still running
Together, these points make Yggdrasil an easy-to-use tool that also shoots unprepared users in the foot by default. And I think easy-to-use tools mustn't shoot users by default despite their declared experimental status, so addressing these security concerns is critical for any networking tool and for Yggdrasil in particular. Basically, the principle of least privilege is currently violated
What I propose
To address these concerns, I propose adding new options to the configuration file that will control the behavior of Yggdrasil over incoming connections. Below are their detailed descriptions
UnrestrictedClients
A list of IPv6 netmasks. Incoming connections from their addresses will be allowed to any local port
If left undefined, then anyone can connect to any local port. The same as now. Should emit a warning, which can be suppressed with 200::/7
mask. If left empty, only connections from AllowedClients to ExposedPorts are accepted. The only reason to have a different behavior for undefined and empty option is backward compatibility with old configs. Should be empty in newly generated configs
AllowedClients
A list of IPv6 netmasks. Incoming connections from their addresses will be allowed to ports specified in ExposedPorts option
If left empty/undefined, then all incoming connections are denied (except connections from UnrestrictedClients). Should be empty in newly generated configs
ExposedPorts
A list of ports exposed to AllowedClients. Maybe it could support port ranges, but I think it's beyond basic functionality and can be implemented later
If left empty/undefined, then all ports are exposed. Should be empty in newly generated configs
Conclusion?
There are two type of users: users struggling to start using Yggdrasil since it requires very broad technical knowledge to ensure their safety and users who don't even bother about the security and readily put themself in danger
Without having to rack their brains about security concerns, the first type is more likely to engage within the project. And, with significantly improved security of newly generated configs, the second type will be secured. Old configurations won't be affected, but the project and both user types will benefit from the changes
P.S. I might consider digging into the code and creating pull request, but firstly I'd like to confirm the feature has a chance