Created
August 31, 2018 21:38
-
-
Save wesleyit/33441732270de3d201317296759d1323 to your computer and use it in GitHub Desktop.
Control/Block the internet access of specific programs and commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Com este script você cria uma forma de executar comandos | |
| # que não terão acesso à rede externa e Internet. | |
| # Por exemplo, se você quiser forçar o Spotify a fica offline: | |
| # offline spotify.bin | |
| sudo groupadd offline | |
| echo '#!/bin/bash' | sudo tee /usr/local/bin/offline | |
| echo 'sg offline "$*"' | sudo tee -a /usr/local/bin/offline | |
| sudo chmod a+x /usr/local/bin/offline | |
| echo '#!/bin/bash' | sudo tee /etc/network/if-pre-up.d/iptables_offline_rule | |
| echo 'iptables -A OUTPUT -m owner --gid-owner offline -j DROP' | sudo tee -a /etc/network/if-pre-up.d/iptables_offline_rule | |
| sudo chmod +x /etc/network/if-pre-up.d/iptables_offline_rule | |
| sudo /etc/network/if-pre-up.d/iptables_offline_rule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment