From: "Stephen Isard" <y8ju2p902@sneakemail.com>
To: netfilter@vger.kernel.org
Subject: Re: iptables rules for cups printer discovery
Date: Fri, 15 Aug 2008 09:10:41 -0400 (EDT) [thread overview]
Message-ID: <30978-20009@sneakemail.com> (raw)
In-Reply-To: <alpine.LNX.1.10.0808142202380.25617@fbirervta.pbzchgretzou.qr>
On Thu, 14 Aug 2008, Jan Engelhardt jengelh-at-medozas.de |netfilter| wrote:
...
> You can specify --rsrc/--rdest (patch just merged that documents them).
> But somehow I am not sure...
>
> -A INPUT -d 192.168.0.255 -p udp --dport 161 -m recent --name snmp
> --rsrc --set
>
> -A OUTPUT -p udp --sport 161 -m recent --name snmp
> --rdest --rcheck
>
> Try?
I've tried, but my system doesn't seem to like --rsrc/--rdest.
Just to make sure I'm not completely confused, you've made a typo and
reversed INPUT and OUTPUT, right? That is, I think we want --set to
happen on output when we broadcast to the destination port 161.
After making that adjustment, when I try to load the rules, I get an
error message:
Applying iptables firewall rules: iptables-restore v1.3.5: Unknown arg
`--rsrc'
This is on Scientific Linux 5.2 with its latest kernel,
2.6.18-92.1.10.el5. So do I need a much more recent kernel? If so, I
can set up a virtual machine for a test. Can you recommend a
reasonably lightweight distribution that would serve? Obviously it
needs a fairly recent cups as well. The latest KNOPPIX?
Can you comment on my understanding of the "recent" rules as set out
below?
"-m recent --set" stores an address, just as an address, not marked as
source or dest. This address is taken from either the source or
destination address of a packet, depending on the use of --rsrc/--rdest.
In order for the rules to do what we want them to, the address has to
include the port number as well as the ip address.
"-m recent --rcheck" looks to see whether the stored address is the same
as either the source or destination address on a packet, depending on
the use of --rsrc/--rdest.
If that is correct and the port is stored as part of the address, then
the logic of your rules looks good to me. If the port isn't stored,
then all we are storing is the address of our own interface and we match
any packet coming in from a port 161. That's still an improvement
because we only let in the packets during a relatively short window
after a broadcast, but it's not quite what we'd really like.
By the way, googling around for help on this issue, I came across a
forum thread from 2004 discussing the same problem with respect to
samba. Evidently samba uses the same broadcast/response tactic.
Unfortunately the thread seemed to peter out without resolution. But is
there an approved firewall setup for samba these days? (I don't use
samba myself.) If so, maybe we could adapt it.
next prev parent reply other threads:[~2008-08-15 13:10 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-14 18:51 iptables rules for cups printer discovery Stephen Isard
2008-08-14 20:00 ` Jan Engelhardt
2008-08-14 20:23 ` Stephen Isard
2008-08-14 20:37 ` Jan Engelhardt
[not found] ` <11653-43715@sneakemail.com>
[not found] ` <alpine.LNX.1.10.0808141744490.18538@fbirervta.pbzchgretzou.qr>
2008-08-14 23:01 ` Stephen Isard
2008-08-15 1:35 ` Grant Taylor
2008-08-15 1:53 ` Jan Engelhardt
2008-08-15 2:00 ` Grant Taylor
2008-08-15 2:04 ` Jan Engelhardt
2008-08-15 2:14 ` Grant Taylor
2008-08-15 2:26 ` Jan Engelhardt
2008-08-15 13:10 ` Stephen Isard [this message]
2008-08-15 13:23 ` Jan Engelhardt
2008-08-15 14:17 ` Stephen Isard
2008-08-15 15:21 ` Grant Taylor
2008-08-15 15:38 ` Stephen Isard
2008-08-15 16:16 ` Grant Taylor
2008-08-15 16:28 ` Stephen Isard
2008-08-15 18:01 ` Grant Taylor
2008-08-15 15:16 ` Grant Taylor
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=30978-20009@sneakemail.com \
--to=y8ju2p902@sneakemail.com \
--cc=netfilter@vger.kernel.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