LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 09-23-2003, 08:40 AM   #1
radix
Member
 
Registered: May 2002
Location: Okinawa, Japan
Distribution: Slackware 9, FreeBSD 5.1, Gentoo 1.4
Posts: 38

Rep: Reputation: 15
iptables script help


im asking this as a last resort. im looking for some one that would be willing to write me an iptables script for slackware 9 on 2.4.22 kernel w/ static dsl connection. i need to have passive ftp enabled with primary connections on port 5150. also irc with dcc send and chat available, all forwarded to a win xp box behind the nat. ive looked all over but im to stupid to understand 99% of the howto's for setting up iptables. if you could provide a link to a faq/howto that breakes it down to complete retard level that would be apperciated also. thanks
 
Old 09-23-2003, 09:10 AM   #2
tangle
Senior Member
 
Registered: Apr 2002
Location: Arbovale, WV
Distribution: Slackware
Posts: 1,761

Rep: Reputation: 78
Goto freshmeat and download arno-iptables. There is an easy to understand config script.
 
Old 09-23-2003, 07:35 PM   #3
yocompia
Member
 
Registered: Apr 2003
Location: Chicago, IL
Distribution: openbsd 3.6, slackware 10.0
Posts: 244

Rep: Reputation: 30
isn't there documentation in japanese for this already?

http://www.netfilter.org/documentati...ilter-faq.html

ok, maybe it's complicated, but here's how you start:

1) take a very basic firewall (i'll provide it and comment it)

2) look through each of the rules to understand how packets get through or get stopped (there's not that many)

3) add rules as necessary. one at a time preferably

if you have further specific questions, ask after reading through this:

(all this goes where your usual firewall script goes)
# begin radix's firewall script

# variable definitions

IPTABLES="/usr/sbin/iptables"
LOG_LEVEL="info"

# load appropriate modules to do the filtering (i've loaded a
# bunch, but you won't need all of them immediately)

/sbin/depmod -a

/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_mac
/sbin/modprobe ipt_owner
/sbin/modprobe ipt_REJECT
/sbin/modprobe ipt_MASQUERADE
/sbin/modprobe ip_conntrack_ftp
/sbin/modprobe ip_conntrack_irc
#/sbin/modprobe ip_nat_ftp
#/sbin/modprobe ip_nat_irc


# /proc setup

# you'll need this if you have a network setup where
# more than one computer is "behind" the linux firewall
echo "1" > /proc/sys/net/ipv4/ip_forward

# flushing old rulesets

$IPTABLES -F
$IPTABLES -F INPUT
$IPTABLES -F FORWARD
$IPTABLES -F OUTPUT
$IPTABLES -X

# setting default policies for base chains

$IPTABLES -P INPUT DROP
$IPTABLES -P FORWARD DROP
$IPTABLES -P OUTPUT DROP



##################
# rules for INPUT
##################

# accept inbound packets from the loopback
$IPTABLES -A INPUT -i lo -s 127.0.0.1 -j ACCEPT

# this only allows established and related connections inbound
# from the interface eth0; this is to stop people from making
# NEW connections to your computer (that's GOOD)
$IPTABLES -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT


###################
# rules for OUTPUT
###################

# allow the loopback packets out
$IPTABLES -A OUTPUT -p ALL -s 127.0.0.1 -j ACCEPT

# let all traffic that is not (!) INVALID out the interface eth0
$IPTABLES -A OUTPUT -p ALL -o eth0 -m state ! --state INVALID -j ACCEPT

(EOF)

from here add your own rules, it's not that hard :P.

cheers,
y-p
 
Old 09-25-2003, 07:57 AM   #4
radix
Member
 
Registered: May 2002
Location: Okinawa, Japan
Distribution: Slackware 9, FreeBSD 5.1, Gentoo 1.4
Posts: 38

Original Poster
Rep: Reputation: 15
ok, any idea why these wont load? i got 1.2.8, installed it to the dir i built the kernel in, recompiled but nothing.


#/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_mac
#/sbin/modprobe ipt_owner
#/sbin/modprobe ipt_REJECT
#/sbin/modprobe ipt_MASQUERADE
 
Old 09-25-2003, 08:03 AM   #5
radix
Member
 
Registered: May 2002
Location: Okinawa, Japan
Distribution: Slackware 9, FreeBSD 5.1, Gentoo 1.4
Posts: 38

Original Poster
Rep: Reputation: 15
i found the modules under /lib/modules/2.4.22/build/net/ipv4/netfilter but it doesnt look like they got linked. also, i think that the modules that are being loaded are comming from the 2.4.20 dir....... how can i change that?
 
Old 09-25-2003, 02:45 PM   #6
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
Did you run make modules_install

The directory /lib/modules/2.4.22/build/net/ipv4/netfilter is actually pointing back to your kernel source tree. If you do make modules_install the modules should be put in.
/lib/modules/2.4.22/kernel/net/ipv4/netfilter.
 
Old 09-25-2003, 02:48 PM   #7
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
As for your original question, go to www.linuxguruz.com/iptables and start downloading firewall scripts. There are alot to choose from, and I'm sure one will work for you.
 
  


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
Iptables (with masq) troubleshooting, very simple script attached script and logs. xinu Linux - Networking 13 11-01-2007 04:19 AM
iptables script tomsasse Linux - Networking 3 09-17-2005 05:25 PM
my first iptables script sh1ft Linux - Security 1 02-24-2005 04:17 PM
IPTABLES script help closer Linux - Networking 18 11-04-2002 09:48 AM
My iptables script is /etc/sysconfig/iptables. How do i make this baby execute on boo ForumKid Linux - General 3 01-22-2002 07:36 AM

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

All times are GMT -5. The time now is 04:17 PM.

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