mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: ptxdist@pengutronix.de
Cc: Gavin Schenk <g.schenk@eckelmann.de>
Subject: Re: [ptxdist] [PATCH] Add persistant iptable-rules via systemd
Date: Thu, 7 Apr 2016 10:11:35 +0200	[thread overview]
Message-ID: <20160407081135.GU10108@pengutronix.de> (raw)
In-Reply-To: <1460013866-29763-1-git-send-email-g.schenk@eckelmann.de>

Hello,

On Thu, Apr 07, 2016 at 09:24:26AM +0200, Gavin Schenk wrote:
> Supports ipv4 and ipv6 and both options can be selected in menuconfig
> IPTABLES_IPV6_SYSTEMD_UNIT and IPTABLES_IPV4_SYSTEMD_UNIT
> 
> If you select IPTABLES_IPV4_SYSTEMD_UNIT a systemd unit is started on
> multiuser.target that set the iptable rules from file
> /etc/iptables/rules.v4.
> If you select IPTABLES_IPV6_SYSTEMD_UNIT a systemd unit is started on
> multiuser.target that set the iptable rules from the file
> /etc/iptables/rules.v6.

would it make sense to add a call to install_alternative for the rule
files?

> You have to provide this files. Both files can easily be generated
> with the utils iptables-save ip6tables-save from the iptables package.
> 
> e.g: Generating a rulefile, that drops port 5000 on interface eth0 ipv4
> 1.) iptables -A INPUT -i eth0 -p TCP --dport 5000 -j DROP
> 2.) iptables-save > /etc/iptables/rules.v4
> ---
>  .../0001-Added-files-for-systemd-support.patch     | 93 ++++++++++++++++++++++
>  patches/iptables-1.4.21/series                     |  4 +
>  rules/iptables.in                                  | 10 +++
>  rules/iptables.make                                | 15 ++++
>  4 files changed, 122 insertions(+)
>  create mode 100644 patches/iptables-1.4.21/0001-Added-files-for-systemd-support.patch
>  create mode 100644 patches/iptables-1.4.21/series
> 
> diff --git a/patches/iptables-1.4.21/0001-Added-files-for-systemd-support.patch b/patches/iptables-1.4.21/0001-Added-files-for-systemd-support.patch
> new file mode 100644
> index 0000000..6b055f4
> --- /dev/null
> +++ b/patches/iptables-1.4.21/0001-Added-files-for-systemd-support.patch
> @@ -0,0 +1,93 @@
> +From: Gavin Schenk <g.schenk@eckelmann.de>
> +Date: Wed, 6 Apr 2016 10:19:52 +0200
> +Subject: [PATCH] Added files for systemd support
> +
> +---
> + scripts/ip6tables-flush          | 13 +++++++++++++
> + scripts/iptables-flush           | 13 +++++++++++++
> + systemd/system/ip6tables.service | 14 ++++++++++++++
> + systemd/system/iptables.service  | 14 ++++++++++++++
> + 4 files changed, 54 insertions(+)
> + create mode 100755 scripts/ip6tables-flush
> + create mode 100755 scripts/iptables-flush
> + create mode 100755 systemd/system/ip6tables.service
> + create mode 100755 systemd/system/iptables.service
> +
> +diff --git a/scripts/ip6tables-flush b/scripts/ip6tables-flush
> +new file mode 100755
> +index 000000000000..95086b0470d3
> +--- /dev/null
> ++++ b/scripts/ip6tables-flush
> +@@ -0,0 +1,13 @@
> ++#!/bin/sh
> ++ip6tables -F
> ++ip6tables -X
> ++ip6tables -Z
> ++for table in $(</proc/net/ip6_tables_names)

What happens if there is no ipv6 iptables support in the kernel? Maybe
catch that with an error message?

> ++do
> ++        ip6tables -t $table -F
> ++        ip6tables -t $table -X
> ++        ip6tables -t $table -Z
> ++done
> ++ip6tables -P INPUT ACCEPT
> ++ip6tables -P OUTPUT ACCEPT
> ++ip6tables -P FORWARD ACCEPT

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

  reply	other threads:[~2016-04-07  8:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-07  7:24 Gavin Schenk
2016-04-07  8:11 ` Uwe Kleine-König [this message]
2016-04-07  9:14   ` Schenk, Gavin
2016-04-07  9:20     ` Uwe Kleine-König
2016-04-07  9:25       ` Schenk, Gavin
2016-04-07 10:10 Gavin Schenk
2016-04-07 11:59 ` Uwe Kleine-König
2016-04-07 12:24 ` Michael Olbrich
2016-04-07 12:21 Gavin Schenk
2016-04-08 13:04 Gavin Schenk
2016-04-11 10:00 ` Michael Olbrich
2016-04-11 12:08   ` Schenk, Gavin
2016-04-11 12:44     ` Michael Olbrich
2016-04-11 12:19 Gavin Schenk
2016-04-11 17:46 ` Uwe Kleine-König
2016-04-12  8:35   ` Michael Olbrich

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=20160407081135.GU10108@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=g.schenk@eckelmann.de \
    --cc=ptxdist@pengutronix.de \
    /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