public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Mick <michaelkintzios@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Help with script for iptables
Date: Wed, 15 Nov 2006 23:15:04 +0000	[thread overview]
Message-ID: <200611152315.17728.michaelkintzios@gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0611151557290.31856@becky16.halibutdepot.org>

[-- Attachment #1: Type: text/plain, Size: 1790 bytes --]

Thanks Joe,

On Wednesday 15 November 2006 21:25, Flophouse Joe wrote:
> On Wed, 15 Nov 2006, Mick wrote:
> >        iptables -P INPUT DROP
> >        iptables -A INPUT -i ! ${UPLINK} -j ACCEPT

> > I would like to define more than one iface in UPLINK, e.g. eth0, wlan0,
> > ppp0.
>
> It sounds like you want to write a rule that says,
>
> "If the packet arrives on any of the interfaces eth0, wlan0, or ppp0,
> then do ${something} with it."

Yes. I was thinking is it possible to define the interfaces like:

UPLINK="eth0 wlan0 ppp0"

and then add something like:
=====================================================
 for x in ${INTERFACES}
	do
		iptables -A INPUT -i ! ${x} -j ACCEPT
		. . . more rules . . .
		iptables -A INPUT -p tcp -i ${x} -j DROP
	fi
=====================================================
type of think.  Not sure if the syntax is correct, but the idea is that we 
define multiple interfaces, but only write the rules once with the 
variable 'x' where the interface is meant to go.

> Here is one of the easiest of the bad ways:
>
> Make separate rules which effectively test for each of the interfaces
> you're interested in.  If the rules match, then make the packets jump to
> a new chain for further testing.

That's a simple enough way although as you say it can quickly get complicated 
especially so if you want to modify rules, change chains and so on.

> It's entirely possible that I'm misunderstanding the design of
> netfilter, but it seems to me that the solution to complicated rulesets
> is to permit boolean logic in rules like so:
>
>  	iptables -A INPUT \
>  	\(-i eth0 -or -i wlan0) -and \(-p tcp --dport ssh\) \
>  	-j ACCEPT

Is there a legit way of specifying such rules?
-- 
Regards,
Mick

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2006-11-15 23:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-15 20:29 [gentoo-user] Help with script for iptables Mick
2006-11-15 21:25 ` Flophouse Joe
2006-11-15 23:15   ` Mick [this message]
2006-11-16  1:15     ` Flophouse Joe
2006-11-16  9:20       ` Mick
2006-11-16 15:19         ` Nangus Garba
2006-11-16 18:05           ` Mick
2006-11-16  0:26 ` Iain Buchanan

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=200611152315.17728.michaelkintzios@gmail.com \
    --to=michaelkintzios@gmail.com \
    --cc=gentoo-user@lists.gentoo.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