1

I'm using a backup internet connection on my Pi (using latest Raspbian) where bandwidth is very expensive (let's say a roamed 3G connection in a foreign country). I thus want to configure my Pi as follows:

  • Don't consume any internet bandwidth without notice (or explicitly knowing about).
  • Especially, don't automatically download any system or software updates.
  • Don't run any background processes which will connect to the internet and consume bandwidth.
  • One exception: obtaining the current system time via NTP from a time server is OK.

Which system settings do I have to change for that? Do I need to configure (or maybe even remove) some of the pre-installed software which will otherwise connect to the internet sometimes?

  • look at iptables, you can block everything except the ntp port – rob Oct 8 '14 at 13:14
  • Have a look there or there. – Morgan Courbet Oct 8 '14 at 13:23
  • @rob Thanks, but I'd still like to be able to e.g. use a web browser. So, I'd just like to block any potential background internet connections. – emkey08 Oct 8 '14 at 13:31
  • While not explicitly off-topic here, as you are attempting to do this on the Raspberry Pi, this question might fit better on Unix & Linux. That's a Unix/Linux-specific site, whereas this site is Raspberry Pi-specific. We would love to help you, but I believe you will get better answers on Unix & Linux. – RPiAwesomeness Oct 9 '14 at 1:51
1

As far as I know, there is no software that allows to block the network access for background processes.

You can use AppArmor to block the Internet access for every software. You should be able to put every programs in a blacklist, and then put ntpd in the whitelist. But it will surely be painful!

For the blacklist, you can use rules similar to this (you'll have to find every paths!):

/usr/bin/* {
    # block ipv4 access
    deny network inet,
    # block ipv6 access
    deny network inet6,
    # lock raw socket
    deny network raw
}

For the whitelist:

/usr/bin/ntpd {
    # allow ipv4 access
    allow network inet
}
| improve this answer | |
  • You should know however that AppArmor is not compile in the Kernel officially release by the Raspberry Pi foundation and which is used by Raspbian. It is totally possible to install AppArmor on Rasbian but if you run aa-status it will report that the module is not loaded, but there is no module for it. You can have AppArmor support, but you need to compile your own Kernel. – Huygens Oct 10 '16 at 14:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.