0

I am using a script (one that I have created with fwbuilder) to set up my iptables firewall. Since the device we are talking about is a notbook rather than a server in a quasi static network, I need to run the script whenever the interfaces change, e.g. because I switch wifi on and of.

How do I achieve that reliably way, such that my notebook does not stay unprotected, e.g. at boot time or during initialization of any of the interfaces.

Edit

How about placing a symlink to the script in /etc/NetworkManager/dispatcher.d/pre-up.d/ (https://people.freedesktop.org/~lkundrak/nm-docs/NetworkManager.html). Does that make sense?

  • Your interface name is always the same aka wlan0. You need script based on ip address range? You need fw rules for service on notebook? You need rules based on connected SSID? What you wish to do? – 2707974 Jun 11 '17 at 8:31
  • No, if I e.g. deactivate wifi on my notebook the corresponding interface (wlp3s0) disappears according to ifconfig. Note that I could e.g. also connect/deconect external network adapters. What I need is a mechanism that runs the script at boot and whenever the interfaces or their connection status changes such that the rules are always apt, as defined in the script, no matter where I am. – highsciguy Jun 11 '17 at 12:23
  • You could adapt my net-o-matic script, git clone https://github.com/waltinator/net-o-matic.git – waltinator Jun 11 '17 at 14:47
  • Possible duplicate of askubuntu.com/q/66890/423684 – derHugo Jun 12 '17 at 13:40

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.