LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 05-12-2003, 03:47 PM   #1
vexer
Member
 
Registered: Jan 2003
Location: Sudbury Ontario, Canada
Distribution: Slackware
Posts: 388

Rep: Reputation: 30
rc.firewall


I created an rc.firewall added the following rules

iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT

# Get 2 to 3 packets fragments before checking.
iptables -A INPUT -f

# Rules for TCP
iptables -A INPUT -p tcp --dport 22 -j DROP
iptables -A INPUT -p tcp --dport 23 -j DROP
iptables -A INPUT -p tcp --dport 21 -j DROP
iptables -A INPUT -p tcp --dport 489 -j DROP

# Rules for UDP
iptables -A INPUT -p udp --dport 412 -j DROP

# Stop the icmp whores
iptables -A INPUT -p icmp --icmp-type

# Rules for out going packets

and when I rebooted a got a shit load of errors
 
Old 05-12-2003, 04:03 PM   #2
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
like what
 
Old 05-12-2003, 04:07 PM   #3
vexer
Member
 
Registered: Jan 2003
Location: Sudbury Ontario, Canada
Distribution: Slackware
Posts: 388

Original Poster
Rep: Reputation: 30
Hmm, I think they are related to some insmod problems...
 
Old 05-12-2003, 04:41 PM   #4
vexer
Member
 
Registered: Jan 2003
Location: Sudbury Ontario, Canada
Distribution: Slackware
Posts: 388

Original Poster
Rep: Reputation: 30
The full line (dmesg doesn't show the error) is
modprobe: Can't locate module ip_tables
iptables v1.2.8: can't initialize iptables table `filter': iptables who? (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

I have followed the instructions from the iptables 1.2.8 INSTALL file, minus the patch-o-matic part, recompiled my kernel and then it still didn't work.

There were no new config options in my kernel to modulate ipt_filter and all that, and modprobe ipt_filter fails to find anything.
 
Old 05-12-2003, 05:03 PM   #5
vexer
Member
 
Registered: Jan 2003
Location: Sudbury Ontario, Canada
Distribution: Slackware
Posts: 388

Original Poster
Rep: Reputation: 30
Ok, found the error of the above... didn't add module support for netfilter configuration parts.

But now I get a failure of the rc.firewall file at line 2 and i get
bash-2.05b# iptables -A INPUT -p tcp -j ALLOW
iptables v1.2.8: Couldn't load target `ALLOW':/usr/local/lib/iptables/libipt_ALLOW.so: cannot open shared object file: No such file or directory

Try `iptables -h' or 'iptables --help' for more information.
 
Old 05-12-2003, 05:06 PM   #6
green_dragon37
Member
 
Registered: Oct 2002
Location: Lower Alabama
Distribution: Slackware, OpenBSD 3.9
Posts: 344

Rep: Reputation: 31
i believe that should be ACCEPT, not ALLOW.

Ian
 
Old 05-12-2003, 05:54 PM   #7
vexer
Member
 
Registered: Jan 2003
Location: Sudbury Ontario, Canada
Distribution: Slackware
Posts: 388

Original Poster
Rep: Reputation: 30
I still get a line 2 failed with
# Required Modules
/sbin/modprobe ip_tables
/sbin/modprobe ip_conntrack
/sbin/modprobe iptable_filter
/sbin/modprobe iptable_mangle
/sbin/modprobe iptable_nat
/sbin/modprobe ipt_LOG
/sbin/modprobe ipt_limit
/sbin/modprobe ipt_state
/sbin/modprobe ipt_REJECT

# Required proc configuration

echo "1" > /proc/sys/net/ipv4/ip_forward

# Start the RULES

# Add chains for tcp packets, udp packets and icmp packets

$IPTABLES -P INPUT ACCEPT
$IPTABLES -P OUTPUT ACCEPT

# Get 2 to 3 packets fragments before checking.
$IPTABLES -A INPUT -f

# Rules for TCP
$IPTABLES -A INPUT -p tcp --dport 22 -j DROP
$IPTABLES -A INPUT -p tcp --dport 23 -j DROP
$IPTABLES -A INPUT -p tcp --dport 21 -j DROP
$IPTABLES -A INPUT -p tcp --dport 489 -j DROP
$IPTABLES -A INPUT -p tcp --dport 100:65535

# Rules for UDP
$IPTABLES -A INPUT -p udp --dport 412 -j DROP

# Stop the icmp whores
$IPTABLES -A INPUT -p icmp --icmp-type

# Rules for out going packets

# Drop all packets not conforming to the above rules
# $IPTABLES -A INPUT -j DROP
 
Old 05-12-2003, 06:06 PM   #8
green_dragon37
Member
 
Registered: Oct 2002
Location: Lower Alabama
Distribution: Slackware, OpenBSD 3.9
Posts: 344

Rep: Reputation: 31
Is ip_tables.o in /lib/modules/*kernel version*/kernel/net/ipv4/netfilter/ ?
 
Old 05-12-2003, 06:12 PM   #9
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
line 2 as in this line


/sbin/modprobe ip_conntrack

try running the command from a shell, maybe try them all one at a time to see what the errors are.

also the file format may be corrupted, what editor are you using?
 
Old 05-12-2003, 06:17 PM   #10
vexer
Member
 
Registered: Jan 2003
Location: Sudbury Ontario, Canada
Distribution: Slackware
Posts: 388

Original Poster
Rep: Reputation: 30
I removed the /sbin/modprobe parts (all of them) and it just ended up giving me errors for each line


bash-2.05b# lsmod
Module Size Used by Tainted: P
nvidia 1539840 20
bcm4400 27040 1
emu10k1 70376 1
ac97_codec 10472 0 [emu10k1]
ppp_synctty 6752 0 (unused)
ppp_async 8064 1
ppp_generic 22144 3 [ppp_synctty ppp_async]
slhc 5472 0 [ppp_generic]
ipt_REJECT 3032 0 (unused)
ipt_state 568 0 (unused)
ipt_limit 1016 0 (unused)
ipt_LOG 3512 0 (unused)
iptable_nat 16632 0 (unused)
iptable_filter 1740 0
ip_conntrack 21312 2 [ipt_state iptable_nat]
ip_tables 12600 8 [ipt_REJECT ipt_state ipt_limit ipt_LOG iptable_nat iptable_filter]
usb-uhci 24236 0 (unused)
 
Old 05-12-2003, 06:23 PM   #11
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
try this...

modprobe ip_tables

iptables -L

errors can be generated if rules are already loaded, and other reasons.

you really need to be specific to get much help. saying I get errors is next to useless.
 
Old 05-12-2003, 06:23 PM   #12
vexer
Member
 
Registered: Jan 2003
Location: Sudbury Ontario, Canada
Distribution: Slackware
Posts: 388

Original Poster
Rep: Reputation: 30
Would it be possibly for you guys to paste part (mostly the beggining) of your rc.firewall / iptables ruleset?
 
Old 05-12-2003, 06:26 PM   #13
green_dragon37
Member
 
Registered: Oct 2002
Location: Lower Alabama
Distribution: Slackware, OpenBSD 3.9
Posts: 344

Rep: Reputation: 31
Here ya go. I am using mine for masq, but it could help anyways.

#
#rc.firewall-2.4
FWVER=0.73
#
#
#
echo -e "\n\nLoading simple rc.firewall version $FWVER..\n"
#
#
#
IPTABLES=/sbin/iptables
DEPMOD=/sbin/depmod
INSMOD=/sbin/insmod
#
#
#
#
EXTIF="eth0"
INTIF="eth1"
#
echo " External Interface: $EXTIF"
echo " Internal Interface: $INTIF"
echo -en " Loading Modules: "
echo " - Verifying that all kernel modules are OK"
$DEPMOD -a
#
#
#
echo "-----------------------------------------------------------------------"
#
echo -en "ip_tables, "
$INSMOD ip_tables
#
echo -en "ip_conntrack, "
$INSMOD ip_conntrack
#
echo -en "ip_conntrack_ftp, "
$INSMOD ip_connftack_ftp
#
echo -en "ip_conntrack_irc, "
$INSMOD in_conntrack_irc
#
echo -en "iptable_nat, "
$INSMOD iptable_nat
#
echo -en "ip_nat_ftp, "
$INSMOD ip_nat_ftp
#
echo -en "ip_nat_irc, "
$INSMOD ip_nat_irc
echo "-----------------------------------------------------------------------"
#
#echo -en "
echo -e " Done Loading Modules.\n"
#---------------------------------------------------------------------
echo " Enabling fowarding..."
echo 1 > /proc/sys/net/ipv4/ip_forward
#
echo "Clearing any existing rules and setting default policy.."
$IPTABLES -P INPUT DROP
$IPTABLES -F INPUT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -F OUTPUT
$IPTABLES -P FORWARD DROP
$IPTABLES -F FORWARD
$IPTABLES -t nat -F
#.....

Ian
 
Old 05-12-2003, 06:29 PM   #14
vexer
Member
 
Registered: Jan 2003
Location: Sudbury Ontario, Canada
Distribution: Slackware
Posts: 388

Original Poster
Rep: Reputation: 30
manually adding the iptable rules works no problem. But loading rc.firewall when the pc boots or with iptables-restore /etc/rc.d/rc.firewall

Also, I can't find any logs of the error so posting the error messege from boot gets a little hard
 
Old 05-12-2003, 06:34 PM   #15
vexer
Member
 
Registered: Jan 2003
Location: Sudbury Ontario, Canada
Distribution: Slackware
Posts: 388

Original Poster
Rep: Reputation: 30
ok, problem fixed as long as I sh rc.firewall

added #! /usr/sh
 
  


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
BSD Firewall vs Linux Firewall ? rootlinux Linux - Security 5 08-29-2007 07:38 AM
Firewall lets ips which are not in the firewall ... why ? sys7em Linux - Networking 2 06-30-2005 12:50 PM
Firewall with features of a Sidewinder firewall? abcampa Linux - Security 4 04-22-2005 04:24 PM
slackware's /etc/rc.d/rc.firewall equivalent ||| firewall script startup win32sux Debian 1 03-06-2004 09:15 PM
Firewall Builder sample firewall policy file ? (.xml) nuwanguy Linux - Networking 0 09-13-2003 12:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 10:18 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