From: Robert Nichols <rnicholsNOSPAM@comcast.net>
To: netfilter@lists.netfilter.org
Subject: Re: stateful UDP with unknown source port on INPUT?
Date: Mon, 02 Apr 2007 00:28:58 -0500 [thread overview]
Message-ID: <euq4ar$m1l$1@sea.gmane.org> (raw)
In-Reply-To: <BAY121-F1848947AF48B36B0E9D801A9610@phx.gbl>
noa levy wrote:
> Thanks!
> I forgot to mention, though, that my source port for the SNMP informs is
> also random, so I can't match against the destination port for the
> incoming packet - does the recent target also maintain a port list or is
> it IP addresses only?
How about something like this:
iptables -t nat -A POSTROUTING -p udp --dport 162 -j SNAT --to-source :29999
iptables -t mangle -A PREROUTING -p udp --dport 29999 -j MARK --set-mark 99
iptables -A input -p udp -dport ! 29999 -m mark --mark 99 -j ACCEPT
That 29999 source port is an arbitrary number outside the bounds set in
/proc/sys/net/ipv4/ip_local_port_range. The mark number is also arbitrary.
The overall effect is that your SNMP inform packets will all appear to
come from port 29999. Replies to that port will be marked prior to being
de-SNAT-ed. Now, in the filter table you can ACCEPT marked packets that
have been recognized by de-SNAT and thus no longer have a destination
port of 29999. Any bogus packets sent to port 29999 will still contain
that port number when they hit the filter rule, and thus will not be
accepted.
I have no way to test any of the above, so view it all with appropriate
suspicion.
--
Bob Nichols Yes, "NOSPAM" is really part of my email address.
next prev parent reply other threads:[~2007-04-02 5:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-21 17:30 stateful UDP with unknown source port on INPUT? noa levy
2007-03-29 23:06 ` Martijn Lievaart
2007-04-01 12:39 ` noa levy
2007-04-01 13:24 ` Franck Joncourt
2007-04-02 5:28 ` Robert Nichols [this message]
2007-04-02 12:35 ` Robert Nichols
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='euq4ar$m1l$1@sea.gmane.org' \
--to=rnicholsnospam@comcast.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.