From: "Daniel Tiebler" <daniel.tiebler@tik.uni-stuttgart.de>
To: netfilter@vger.kernel.org
Subject: iptables-normalizet: argument normalization and DNS resolution?
Date: Wed, 09 Apr 2014 14:10:53 +0200 [thread overview]
Message-ID: <web-181154039@uni-stuttgart.de> (raw)
Hello,
I found a thread on the mailing list "netfilter", where
somebody else was also looking for a normalization (see
http://marc.info/?t=127538152000002&r=1&w=2 ), but there
was no solution.
I am looking for the features
* normalization of commandline arguments and
* resolution of DNS names
to convert a configuration file into iptables-save format.
As the manpage constitutes using DNS has its quirks, but
we want to introduce monitoring against our running
configuration for cases, where we do see a benefit of
using DNS names.
If this has been already discussed or fixed elsewhere,
please do not hesitate to point me to any relevant
documentation. I'll be happy to RTFM.
The current state of the firewall can be obtained using
iptables-save. That's clear. But our configuration files
are calling iptables, so that we cannot compare the output
of iptables-save with our configuration files directly. We
could save the state of the firewall immediately after a
new configuration, but we also want to track changes of IP
adresses resolved from DNS names. The resulting diff would
also catch cases, where some "hotfix" has been accidently
rolled out to the machine, however not yet been added to
the configuration.
We started to implement a tool, that is parsing the
commandline arguments of iptables and generating an output
comparable to the output of iptables-save. However, the
more complex the rules are the more expensive is the
development. So we thought of reusing the iptables source
code.
The idea is the following: Use the parser of iptables and,
instead of loading the rules into the kernel, output them
with the generator of iptables-save. I tried the following
(with version 1.4.12 of iptables on Ubuntu Server 12.04.4
LTS): I copied the do_output() function from
iptables-save.c to iptables-restore.c and added the
missing includes and variable declarations. Then I added
the struct iptc_handle as an additional argument to this
function. When iptables-restore reaches the COMMIT line,
instead of iptc_commit() the function do_output() is
called. Well, this works pretty well, at first glance.
But, there are still many calls to the kernel loading the
data structure iptc_handle and this normalization should
happen without touching the data structures of the kernel.
It would be great, if there would be an API, that provides
this functionality, or even a programm (called
iptables-convert?).
So our questions are:
* Does a program exists, that can parse calls to iptables
and output something comparable to iptables-save?
* Is there another solution to our problem?
* Is something similar possible with nftables?
Many thanks in advance.
With kind regards,
Daniel Tiebler
next reply other threads:[~2014-04-09 12:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-09 12:10 Daniel Tiebler [this message]
2014-04-09 14:00 ` iptables-normalizet: argument normalization and DNS resolution? Arturo Borrero Gonzalez
2014-04-10 13:16 ` Daniel Tiebler
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=web-181154039@uni-stuttgart.de \
--to=daniel.tiebler@tik.uni-stuttgart.de \
--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;
as well as URLs for NNTP newsgroup(s).