I have set up a VPN client and I'm using iptables to block all connections not tunneled through the VPN. An example of the iptables rules I am using can be found here.
Unfortunately with this configuration RStudio does not start up.
In fact the RStudio guide says:
Check firewall, proxy settings, and antimalware
Although RStudio does not require internet access, it does use a localhost connection to link your R session with the RStudio IDE. As a result, it is possible a (software-based) firewall, network setting, or antimalware program is blocking access to RStudio. If you have a firewall, HTTP or HTTPS proxy configured, add localhost and 127.0.0.1 to the list of approved Hosts and Domains. After this, try restarting RStudio. If you have antimalware software configured that may be blocking RStudio, please check its settings and whitelist RStudio if necessary.
I had already allowed outgoing connections on the loopback interface:
-A OUTPUT -o lo -j ACCEPT
By experimentation I have discovered that adding this line to the rules would make RStudio work again:
# Accept localhost -A INPUT -d 127.0.0.1/24 -j ACCEPT
From a security perspective, is such a rule safe?
Can such a rule be exploited by malware/spyware?
Will such a rule leak my private IP address despite the VPN connection?
EDIT: Is the rule:
-A INPUT -s 127.0.0.1/24 -d 127.0.0.1/24 -j ACCEPT
safer? Also this rule would make RStudio work
EDIT2: Should the mask be /8 and not /24?