Closed MuffinCollector closed 4 years ago
Your command is almost good, but in some configuration it may return more than one line (for example on my machine it returns another line which refers to the link used for communicating with Docker).
A more general solution probably is trying to match against the name of the interface which is used in the default connection
This was also the cause for some connection problems (since the iptables were wrong due to this assumption)
As things currently are, your ip-ks.sh uses a rule which allows LAN access only if a user's network is configured 192.168.0.0/24. While this is common, other setups are not uncommon, and many routers default to 192.168.1.0/24. I'd love to see one of two solutions:
1) Allow a user to manually input an allowed range in CIDR notation. (less optimal- requires manual user adjustment) or 2) Find a way to programmatically determine the correct IP range to allow. I've looked into this just a bit and I've found a way to get my setup from bash, but I'm not familiar enough with different network configurations to know if this would be a universal approach or if it would vary heavily depending on network setup and easily break.
ip r | grep 'link[ \t]' | awk '{print $1}'