Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Eric Ellis <eellis@mail.co.gilchrist.fl.us>
To: netfilter@lists.netfilter.org
Subject: More neqbie questions
Date: Mon, 02 Aug 2004 13:46:35 -0400	[thread overview]
Message-ID: <410E7DFB.9000505@mail.co.gilchrist.fl.us> (raw)

This is one of those things that's been hounding me for the past few 
weeks that I can't understand what's *exactly* going on...

I've been using the IPTables tutorial from 
http://iptables-tutorial.frozentux.net/chunkyhtml/index.html, as has 
been pointed out and recommended by many of the list's pros.  It's a 
great tutorial, and I highly recommend it.

However, I have either glossed something covered in it, or I have a 
fundamental misunderstanding of some part of IPTables.

I know that the route works.  I've verified it.  I can move IPTraffic 
when I set all of my policies on my filter script to accept.  However, 
when I set my policies on my script to drop, Nothing talks any more.  I 
have attached a cleaned up version of the script I'm using to invoke 
IPTables.  The only things that have been removed are comments that help 
me remember what I was doing.

<code>
eellis@firewall:~$ cat /etc/iptables/rc.iptables
#!/bin/bash
### Variables
IPT="/usr/local/sbin/iptables"
INT="eth0"
EXT="eth1"

### Flush everything
$IPT -t nat -F
$IPT -F

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

### INPUT chain
# SSH
$IPT -A INPUT -p tcp --dport 22 -j ACCEPT

# HTTP, on port 8000
$IPT -A INPUT -p tcp --dport 8000 -j ACCEPT

# DNS
$IPT -A INPUT -i $INT -p udp --dport 53 -j ACCEPT

### OUTPUT chain
# The only thing doing output on this box are proxy
# servers, and the occasional SSH and HTTP for
# testing.
# SQUID proxy, and local HTTP requests.
$IPT -A OUTPUT -p tcp --dport 80 -j ACCEPT

# SSH
$IPT -A OUTPUT -p tcp --dport 22 -j ACCEPT

### FORWARD chain 

$IPT -A OUTPUT -p tcp --dport 80 -j ACCEPT 


# SSH 

$IPT -A OUTPUT -p tcp --dport 22 -j ACCEPT 


### FORWARD chain 

# Accept anything from the inside requesting http 

# $IPT -A FORWARD -i $INT -p tcp --dport 80 -j ACCEPT 


# Accept anything from the inside requesting SSH 

$IPT -A FORWARD -i $INT -p tcp --dport 22 -j ACCEPT 


# Accept anything from the inside requesting FTP 

$IPT -A FORWARD -i $INT -p tcp --dport 21 -j ACCEPT 


# Accept anything from the inside for mail 

$IPT -A FORWARD -i $INT -p tcp --dport 25 -j ACCEPT 

$IPT -A FORWARD -i $INT -p tcp --dport 110 -j ACCEPT 

$IPT -A FORWARD -i $INT -p tcp --dport 143 -j ACCEPT 


# Accept anything else that's been established 

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


### NAT table 

# let's see what damage I can do here... 

# redirect all FORWARDED requests to SQUID 

$IPT -t nat -A PREROUTING -i $INT -p tcp --dport 80 -j REDIRECT 
--to-port 8080

$IPT -t nat -A POSTROUTING -p tcp -j MASQUERADE 


eellis@firewall:~$
</code>

Now, according to my understanding as it sits right now, that should 
masquerade all traffic in the nat table, and drop everything except 
ports 21, 22, 25, 80 (redirected to port 8080), 110, 143.  Firewall 
should accept ports 22 and 8000 input and should allow ports 22 and 80 
on output.  Thing is that it doesn't move packets.

Thanks for all your help.

-- 
Eric Ellis
Gilchrist County Sheriff's Office
IT Coordinator


             reply	other threads:[~2004-08-02 17:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-02 17:46 Eric Ellis [this message]
2004-08-02 19:03 ` More neqbie questions Antony Stone
2004-08-02 19:50   ` Eric Ellis
2004-08-02 20:02     ` Antony Stone
2004-08-02 20:08       ` Antony Stone
  -- strict thread matches above, loose matches on Subject: below --
2004-08-02 18:16 Jason Opperisano
2004-08-02 20:09 Jason Opperisano
2004-08-02 23:57 Jason Opperisano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=410E7DFB.9000505@mail.co.gilchrist.fl.us \
    --to=eellis@mail.co.gilchrist.fl.us \
    --cc=netfilter@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox