LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 01-19-2012, 09:40 AM   #1
allend
Senior Member
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 3,409

Rep: Reputation: 835Reputation: 835Reputation: 835Reputation: 835Reputation: 835Reputation: 835Reputation: 835
When using NetworkManager in KDE 4.7.4, how do you manage iptables?


I have been using the KDE NetworkManager widget in KDE 4.7.4 supplied by Alien_Bob http://alien.slackbook.org/blog/kde-...he-4-7-series/. (Again Eric,Thanks!)

It is very welcome as I can manage all my network devices from the one screen.

On my netbook, I would like to able adjust my firewall settings depending on the interface used. If I connect using a USB modem on ppp0 then I want all incoming ports closed. If I connect by wireless on wlan0 to my home system then I want NFS ports open. If I connect by a wired connection on eth0 then I want Samba ports open.

I have found the Manage Connections... -> Other -> Configure Notifications... -> Network Connection Succeeded -> Run Command setting and tried running /etc/rc.d/rc.firewall, but it does not succeed, probably due to permissions.

Any thoughts on how to handle this?
 
Old 01-19-2012, 09:48 AM   #2
bonixavier
Member
 
Registered: Sep 2010
Distribution: Slackware
Posts: 320

Rep: Reputation: 60
Can't you keep rc.firewall.iface scripts? You switch from wireless to USB modem and do a rc.firewall.wlan0 stop && rc.firewal.ppp0 start? You then symlink the most commonly used interface to rc.firewall.
 
Old 01-20-2012, 08:14 AM   #3
allend
Senior Member
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 3,409

Original Poster
Rep: Reputation: 835Reputation: 835Reputation: 835Reputation: 835Reputation: 835Reputation: 835Reputation: 835
Found an answer on the ArchWiki https://wiki.archlinux.org/index.php/NetworkManager

Created a file 25_SetFirewall in /etc/NetworkManager/dispatcher.d/ containing this script that runs suitable iptables firewall scripts.
Code:
#!/bin/sh

# Script to load appropriate firewall based on interface in use

INTERFACE=$1 # The interface which is brought up or down
STATUS=$2 # The new state of the interface

case "$STATUS" in
  'up') # an interface has been brought up
    case "$INTERFACE" in
      'eth0')
        exec /etc/rc.d/rc.firewall_eth0
      ;;
      'wlan0')
        exec /etc/rc.d/rc.firewall_wlan0
      ;;
      'ppp0')
        exec /etc/rc.d/rc.firewall_ppp0
      ;;
    esac
    ;;
  'down') # an interface has been brought down
    # Load default if there is no active interface
    if [ ! `nm-tool|grep State|cut -f2 -d' '` = "connected" ]; then
      exec /etc/rc.d/rc.firewall
    fi
  ;;
esac
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] No wifi after updated NetworkManager (Fedora14/KDE) MrAngel Linux - Laptop and Netbook 11 03-23-2011 03:14 AM
centrally manage KDE desktops DaveQB Linux - Desktop 0 08-18-2010 05:30 PM
web panel to manage iptables and tc - secure the implementation of changes bor1904 Linux - Newbie 1 03-21-2010 09:27 AM
Unlock keyring at login for NetworkManager and wireless in KDE michael.guerrero Linux - Software 0 05-08-2009 02:50 PM
KDE manage incorectly my mouse. shydra *BSD 1 03-31-2006 12:08 AM


All times are GMT -5. The time now is 11:58 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration