LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 12-31-2010, 04:24 AM   #1
igsen
Member
 
Registered: Mar 2009
Location: Phil. Is.
Distribution: Ubuntu 18.04
Posts: 80

Rep: Reputation: 15
slackware firewall


Upon searching the net I've stumbled upon this site.

http://www.dedoimedo.com/computers/i...ackware_6.html

And I found this rc.firewall file

Code:
#!/bin/bash

# These two rules set the default policies, i.e. what to do if a
# packet doesn't match any other rule, to drop any packet coming
# into (INPUT) or routing through (FORWARD) the box.
iptables -P INPUT DROP
iptables -P FORWARD DROP

# These rules are added (-A) to the INPUT chain. They allow packets
# from any previously established connections and accept anything
# from the loopback interface.
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -s 127.0.0.1 -d 127.0.0.1 -i lo -j ACCEPT

# Below rule is needed ONLY if you want to have ssh connections.
# Comment this line if you do NOT want to use ssh connections.

# This rule added to the INPUT chain accepts any ssh connections.
# Change ethx to reflect your network setup, i.e. use the name
# of the device that connects to the Internet (e.g. eth0).
iptables -A INPUT -p tcp --dport 22 -i ethx -j ACCEPT
(Honestly, I can't understand this script.)
Is it really necessary for a newly intalled slackware to have this firewall script?
 
Old 12-31-2010, 04:57 AM   #2
Ramurd
Member
 
Registered: Mar 2009
Location: Rotterdam, the Netherlands
Distribution: Slackwarelinux
Posts: 703

Rep: Reputation: 111Reputation: 111
Necessary? That depends on your definition ;-)

In the commented part, you can read exactly what the rules do. It's a very well documented script, so read the comments and you understand what it does.

For security reasons, it is advisable to have a script like this one, to prevent unwanted connections from the outside world to services you have running locally and listening on ports. (httpd, cups, samba are some things that come to mind as services that one may commonly find running)

For more information on iptables: man iptables

In essence, it is a firewall that builds a wall on your network device(s) with "peekholes" for the ports that you open up. As far as I know, you can't do content scanning / validation. (if anyone knows about such setups, I'd be interested to see how ISA servers can easily be replaced ;-)
 
Old 12-31-2010, 06:06 AM   #3
igsen
Member
 
Registered: Mar 2009
Location: Phil. Is.
Distribution: Ubuntu 18.04
Posts: 80

Original Poster
Rep: Reputation: 15
Please bear with my inquisitiveness, what do you mean by

Quote:
As far as I know, you can't do content scanning / validation.
part?
Something to do with virus scanning?

Last edited by igsen; 12-31-2010 at 06:36 AM.
 
Old 12-31-2010, 09:55 AM   #4
rpedrica
Member
 
Registered: Nov 2008
Location: Cape Town
Distribution: Slackware64 -current
Posts: 281

Rep: Reputation: 42
I used MonMotha's script for many years as it's easy and quick to setup. However recently, I've moved to Vuurmuur due to its greater flexibility.
 
Old 12-31-2010, 10:20 AM   #5
hitest
Guru
 
Registered: Mar 2004
Location: Canada
Distribution: Void, Debian, Slackware, VMs
Posts: 7,342

Rep: Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746
Here is another solid firewall script generator.

http://connie.slackware.com/~alien/efg/
 
Old 12-31-2010, 10:49 AM   #6
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018
Quote:
Originally Posted by hitest View Post
Here is another solid firewall script generator.

http://connie.slackware.com/~alien/efg/
bad day to post that considering slackware.com's dns is up the swanny.

Here's the one I've been using for a while now:
Code:
#!/bin/sh

IPT='/usr/sbin/iptables'
MODPROBE="/sbin/modprobe"

########################################################################
#  Load FTP connection tracking helper modules
#    (needed for proper operation of ftp client connections)

$MODPROBE nf_conntrack 
$MODPROBE nf_conntrack_ftp 


########################################################################
#  Set default policies for packets that get to the end of a chain
#  without matching a rule.

#  DROP packets on reaching end of INPUT, FORWARD and OUTPUT chain
#  (a.k.a "Better safe than sorry" mode)

$IPT -P INPUT DROP
$IPT -P FORWARD DROP
$IPT -P OUTPUT DROP

#  These next ones aren't strictly necessary as we're not using these
#  chains, but setting them to a known state is never a bad idea.

$IPT -t nat -P PREROUTING ACCEPT
$IPT -t nat -P POSTROUTING ACCEPT
$IPT -t nat -P OUTPUT ACCEPT

$IPT -t mangle -P PREROUTING ACCEPT
$IPT -t mangle -P INPUT ACCEPT
$IPT -t mangle -P FORWARD ACCEPT
$IPT -t mangle -P OUTPUT ACCEPT
$IPT -t mangle -P POSTROUTING ACCEPT

$IPT -t raw -P PREROUTING ACCEPT
$IPT -t raw -P OUTPUT ACCEPT


########################################################################
#  Flush any existing rules and chains
#    

$IPT -F
$IPT -F -t nat
$IPT -F -t mangle
$IPT -F -t raw

$IPT -X
$IPT -X -t nat
$IPT -X -t mangle
$IPT -X -t raw


########################################################################
#  Now insert our own ruleset
#    

#  INPUT CHAIN

$IPT -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

$IPT -A INPUT -i lo -j ACCEPT

   #  Example of opening up ports to new incoming connections
   #  $IPT -A INPUT -p tcp -i eth0 -m multiport --dports 21,22,25,80,443 \
   #  --syn -m state --state NEW -j ACCEPT


#  OUTPUT CHAIN

$IPT -A OUTPUT -j ACCEPT

########################################################################
 
Old 12-31-2010, 10:57 AM   #7
hitest
Guru
 
Registered: Mar 2004
Location: Canada
Distribution: Void, Debian, Slackware, VMs
Posts: 7,342

Rep: Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746
Quote:
Originally Posted by GazL View Post
bad day to post that considering slackware.com's dns is up the swanny.
Yeah just read about that. My DNS has not updated yet so I am still able to resolve slackware.com. Hopefully they resolve this issue soon.
 
Old 12-31-2010, 11:14 AM   #8
multios
Member
 
Registered: Mar 2006
Location: Homer, Alaska USA
Distribution: OpenBSD, FreeBSD, Slackware64-current
Posts: 276

Rep: Reputation: 58
Robby also has some firewall scripts here:
http://rlworkman.net/conf/firewall/
 
Old 12-31-2010, 11:18 AM   #9
stormtracknole
Senior Member
 
Registered: Aug 2005
Distribution: Slackware, RHEL
Posts: 1,259

Rep: Reputation: 231Reputation: 231Reputation: 231
Quote:
Originally Posted by multios View Post
Robby also has some firewall scripts here:
http://rlworkman.net/conf/firewall/
Robby's firewall scripts are pretty awesome! He provides enough scripts to at least get you going regardless of your set up. They are very easy to follow too!
 
Old 01-02-2011, 05:50 AM   #10
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,969

Rep: Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548
Quote:
Originally Posted by igsen View Post
Is it really necessary for a newly intalled slackware to have this firewall script?
Depends. If you are behind a router, I'd say not really.

The only time I would enable the firewall would be a computer; I want to isolate on my LAN, running in the DMZ, running open ports, or direct (ISP box) connection to the Internet.
 
  


Reply



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
rc.firewall on slackware 11.0 soylentgreen Linux - Networking 4 05-07-2007 06:55 PM
Does Slackware Come with Firewall on? UltimaGuy Slackware 14 11-29-2004 07:11 AM
Firewall in Slackware 10.0 nickbird Linux - Newbie 3 07-29-2004 04:51 PM
Firewall on Slackware ? jamaso Linux - General 11 01-30-2002 11:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 01:13 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration