diff options
author | root <root@rshg054.dnsready.net> | 2011-08-02 04:35:55 +0000 |
---|---|---|
committer | root <root@rshg054.dnsready.net> | 2011-08-02 04:35:55 +0000 |
commit | bf35116f9d203dcafce808a6c7b3dd5a0db8afbc (patch) | |
tree | f9551a1d3c67d2113cc5fc5c3f8816bcbaad0540 /core/iptables | |
parent | 1173ff2dba7d0fd3c45f170a5e353a76b7a5da2f (diff) |
Tue Aug 2 04:35:55 UTC 2011
Diffstat (limited to 'core/iptables')
-rw-r--r-- | core/iptables/PKGBUILD | 56 | ||||
-rw-r--r-- | core/iptables/empty-filter.rules | 6 | ||||
-rw-r--r-- | core/iptables/empty-mangle.rules | 8 | ||||
-rw-r--r-- | core/iptables/empty-nat.rules | 7 | ||||
-rw-r--r-- | core/iptables/empty-raw.rules | 5 | ||||
-rw-r--r-- | core/iptables/empty-security.rules | 6 | ||||
-rwxr-xr-x | core/iptables/ip6tables | 38 | ||||
-rwxr-xr-x | core/iptables/iptables | 31 | ||||
-rw-r--r-- | core/iptables/iptables.conf.d | 14 |
9 files changed, 83 insertions, 88 deletions
diff --git a/core/iptables/PKGBUILD b/core/iptables/PKGBUILD index b4d6939b4..799f19ad6 100644 --- a/core/iptables/PKGBUILD +++ b/core/iptables/PKGBUILD @@ -1,53 +1,67 @@ -# $Id: PKGBUILD 131995 2011-07-18 20:27:00Z ronald $ +# $Id: PKGBUILD 133073 2011-07-27 15:33:16Z dan $ # Maintainer: Ronald van Haren <ronald.archlinux.org> # Contributor: Thomas Baechler <thomas@archlinux.org> pkgname=iptables -pkgver=1.4.11.1 -pkgrel=1 +pkgver=1.4.12 +pkgrel=2 pkgdesc="A Linux kernel packet control tool" arch=('i686' 'x86_64') license=('GPL2') -url="http://www.netfilter.org/" +url="http://www.netfilter.org/projects/iptables/index.html" depends=('glibc' 'bash') +makedepends=('linux-api-headers') options=('!libtool') source=(http://www.iptables.org/projects/iptables/files/${pkgname}-${pkgver}.tar.bz2 iptables ip6tables empty.rules simple_firewall.rules - iptables.conf.d) + iptables.conf.d + empty-filter.rules + empty-mangle.rules + empty-nat.rules + empty-raw.rules + empty-security.rules) backup=(etc/conf.d/iptables) -sha1sums=('2aa0d215485133f2817973b0914a132f628d9f3a' - 'd7540316581bb66c5594885882a14ba394e95098' - '70d70113e3a23f0fe99404c5536507a887a4ca5c' +sha1sums=('6c3f6eceadf5dab570d757d74a7194ef75be3ee3' + '5bb6fa526665cdd728c26f0f282f5a51f220cf88' + '2db68906b603e5268736f48c8e251f3a49da1d75' '83b3363878e3660ce23b2ad325b53cbd6c796ecf' '9907f9e815592837abc7fa3264a401567b7606ab' - '1c52444ffbecc09f56bb325db49e924dd32f9213') + 'cdb830137192bbe002c6d01058656bd053ed0ddd' + 'd9f9f06b46b4187648e860afa0552335aafe3ce4' + 'c45b738b5ec4cfb11611b984c21a83b91a2d58f3' + '1694d79b3e6e9d9d543f6a6e75fed06066c9a6c6' + '7db53bb882f62f6c677cc8559cff83d8bae2ef73' + 'ebbd1424a1564fd45f455a81c61ce348f0a14c2e') build() { - cd ${srcdir}/${pkgname}-${pkgver} + cd "${srcdir}/${pkgname}-${pkgver}" # http://bugs.archlinux.org/task/17046 sed -i '87 i libxt_RATEEST.so: libxt_RATEEST.oo' extensions/GNUmakefile.in sed -i '88 i \\t${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -lm -shared ${LDFLAGS} -o $@ $<;\n' extensions/GNUmakefile.in - ./configure --prefix=/usr --with-kernel=usr/src/linux-$(uname -r) \ - --libexecdir=/usr/lib/iptables --sysconfdir=/etc \ - --with-xtlibdir=/usr/lib/iptables \ - --enable-devel --enable-libipq + ./configure --prefix=/usr \ + --libexecdir=/usr/lib/iptables --sysconfdir=/etc \ + --with-xtlibdir=/usr/lib/iptables \ + --enable-devel --enable-libipq make } package() { - cd ${srcdir}/${pkgname}-${pkgver} + cd "${srcdir}/${pkgname}-${pkgver}" + make DESTDIR="${pkgdir}" install - make DESTDIR=${pkgdir} install + cd "${srcdir}" + install -D -m755 iptables "${pkgdir}"/etc/rc.d/iptables + install -D -m755 ip6tables "${pkgdir}"/etc/rc.d/ip6tables + install -D -m644 empty.rules "${pkgdir}"/etc/iptables/empty.rules + install -D -m644 simple_firewall.rules "${pkgdir}"/etc/iptables/simple_firewall.rules + install -D -m644 iptables.conf.d "${pkgdir}"/etc/conf.d/iptables - install -D -m755 ../iptables ${pkgdir}/etc/rc.d/iptables - install -D -m755 ../ip6tables ${pkgdir}/etc/rc.d/ip6tables - install -D -m644 ../empty.rules ${pkgdir}/etc/iptables/empty.rules - install -D -m644 ../simple_firewall.rules ${pkgdir}/etc/iptables/simple_firewall.rules - install -D -m644 ../iptables.conf.d ${pkgdir}/etc/conf.d/iptables + mkdir -p "${pkgdir}/var/lib/iptables" + install -m644 empty-{filter,mangle,nat,raw,security}.rules ${pkgdir}/var/lib/iptables/ } diff --git a/core/iptables/empty-filter.rules b/core/iptables/empty-filter.rules new file mode 100644 index 000000000..5a4de4876 --- /dev/null +++ b/core/iptables/empty-filter.rules @@ -0,0 +1,6 @@ +# Empty iptables filter table rule file +*filter +:INPUT ACCEPT [0:0] +:FORWARD ACCEPT [0:0] +:OUTPUT ACCEPT [0:0] +COMMIT diff --git a/core/iptables/empty-mangle.rules b/core/iptables/empty-mangle.rules new file mode 100644 index 000000000..49d493c4d --- /dev/null +++ b/core/iptables/empty-mangle.rules @@ -0,0 +1,8 @@ +# Empty iptables mangle table rules file +*mangle +:PREROUTING ACCEPT [0:0] +:INPUT ACCEPT [0:0] +:FORWARD ACCEPT [0:0] +:OUTPUT ACCEPT [0:0] +:POSTROUTING ACCEPT [0:0] +COMMIT diff --git a/core/iptables/empty-nat.rules b/core/iptables/empty-nat.rules new file mode 100644 index 000000000..437e96411 --- /dev/null +++ b/core/iptables/empty-nat.rules @@ -0,0 +1,7 @@ +# Empty iptables nat table rules file +*nat +:PREROUTING ACCEPT [0:0] +:INPUT ACCEPT [0:0] +:OUTPUT ACCEPT [0:0] +:POSTROUTING ACCEPT [0:0] +COMMIT diff --git a/core/iptables/empty-raw.rules b/core/iptables/empty-raw.rules new file mode 100644 index 000000000..8dc50d23e --- /dev/null +++ b/core/iptables/empty-raw.rules @@ -0,0 +1,5 @@ +# Empty iptables raw table rules file +*raw +:PREROUTING ACCEPT [0:0] +:OUTPUT ACCEPT [0:0] +COMMIT diff --git a/core/iptables/empty-security.rules b/core/iptables/empty-security.rules new file mode 100644 index 000000000..4531fa13f --- /dev/null +++ b/core/iptables/empty-security.rules @@ -0,0 +1,6 @@ +# Empty iptables security table rules file +*security +:INPUT ACCEPT [0:0] +:FORWARD ACCEPT [0:0] +:OUTPUT ACCEPT [0:0] +COMMIT diff --git a/core/iptables/ip6tables b/core/iptables/ip6tables index 1733db281..2d119e3ed 100755 --- a/core/iptables/ip6tables +++ b/core/iptables/ip6tables @@ -4,7 +4,6 @@ [ -f /etc/conf.d/iptables ] && . /etc/conf.d/iptables # Set defaults if settings are missing -[ -z "$IP6TABLES" ] && IP6TABLES=/usr/sbin/ip6tables [ -z "$IP6TABLES_CONF" ] && IP6TABLES_CONF=/etc/iptables/ip6tables.rules . /etc/rc.conf @@ -12,14 +11,14 @@ case "$1" in start) - if [ ! -f $IP6TABLES_CONF ]; then - echo "Cannot load iptables rules: $IP6TABLES_CONF is missing!" >&2 + if [ ! -f "$IP6TABLES_CONF" ]; then + echo "Cannot load ip6tables rules: $IP6TABLES_CONF is missing!" >&2 exit 1 fi stat_busy "Starting IP6 Tables" if [ "$IPTABLES_FORWARD" = "1" ]; then - echo 1 >/proc/sys/net/ipv6/conf/default/forwarding - echo 1 >/proc/sys/net/ipv6/conf/all/forwarding + echo 1 >/proc/sys/net/ipv6/conf/default/forwarding + echo 1 >/proc/sys/net/ipv6/conf/all/forwarding fi if ck_daemon ip6tables; then /usr/sbin/ip6tables-restore < $IP6TABLES_CONF @@ -35,42 +34,16 @@ case "$1" in ;; stop) stat_busy "Stopping IP6 Tables" - echo 0 >/proc/sys/net/ipv6/conf/all/forwarding - echo 0 >/proc/sys/net/ipv6/conf/default/forwarding if ! ck_daemon ip6tables; then fail=0 for table in $(cat /proc/net/ip6_tables_names); do - $IP6TABLES -t $table -F &>/dev/null && \ - $IP6TABLES -t $table -X &>/dev/null && \ - $IP6TABLES -t $table -Z &>/dev/null + ip6tables-restore < /var/lib/iptables/empty-$table.rules [ $? -gt 0 ] && fail=1 done if [ $fail -gt 0 ]; then stat_fail else rm_daemon ip6tables - # reset policies - for table in filter mangle raw; do - if grep -qw $table /proc/net/ip6_tables_names; then - $IP6TABLES -t $table -P OUTPUT ACCEPT - fi - done - for table in filter mangle; do - if grep -qw $table /proc/net/ip6_tables_names; then - $IP6TABLES -t $table -P INPUT ACCEPT - $IP6TABLES -t $table -P FORWARD ACCEPT - fi - done - for table in mangle raw; do - if grep -qw $table /proc/net/ip6_tables_names; then - $IP6TABLES -t $table -P PREROUTING ACCEPT - fi - done - for table in mangle; do - if grep -qw $table /proc/net/ip6_tables_names; then - $IP6TABLES -t $table -P POSTROUTING ACCEPT - fi - done stat_done fi else @@ -79,7 +52,6 @@ case "$1" in ;; restart) $0 stop - sleep 2 $0 start ;; save) diff --git a/core/iptables/iptables b/core/iptables/iptables index 50c13d5c1..fbb02face 100755 --- a/core/iptables/iptables +++ b/core/iptables/iptables @@ -4,7 +4,6 @@ [ -f /etc/conf.d/iptables ] && . /etc/conf.d/iptables # Set defaults if settings are missing -[ -z "$IPTABLES" ] && IPTABLES=/usr/sbin/iptables [ -z "$IPTABLES_CONF" ] && IPTABLES_CONF=/etc/iptables/iptables.rules . /etc/rc.conf @@ -12,7 +11,7 @@ case "$1" in start) - if [ ! -f $IPTABLES_CONF ]; then + if [ ! -f "$IPTABLES_CONF" ]; then echo "Cannot load iptables rules: $IPTABLES_CONF is missing!" >&2 exit 1 fi @@ -34,41 +33,16 @@ case "$1" in ;; stop) stat_busy "Stopping IP Tables" - echo 0 >/proc/sys/net/ipv4/ip_forward if ! ck_daemon iptables; then fail=0 for table in $(cat /proc/net/ip_tables_names); do - $IPTABLES -t $table -F &>/dev/null && \ - $IPTABLES -t $table -X &>/dev/null && \ - $IPTABLES -t $table -Z &>/dev/null + iptables-restore < /var/lib/iptables/empty-$table.rules [ $? -gt 0 ] && fail=1 done if [ $fail -gt 0 ]; then stat_fail else rm_daemon iptables - # reset policies - for table in filter nat mangle raw; do - if grep -qw $table /proc/net/ip_tables_names; then - $IPTABLES -t $table -P OUTPUT ACCEPT - fi - done - for table in filter mangle; do - if grep -qw $table /proc/net/ip_tables_names; then - $IPTABLES -t $table -P INPUT ACCEPT - $IPTABLES -t $table -P FORWARD ACCEPT - fi - done - for table in nat mangle raw; do - if grep -qw $table /proc/net/ip_tables_names; then - $IPTABLES -t $table -P PREROUTING ACCEPT - fi - done - for table in nat mangle; do - if grep -qw $table /proc/net/ip_tables_names; then - $IPTABLES -t $table -P POSTROUTING ACCEPT - fi - done stat_done fi else @@ -77,7 +51,6 @@ case "$1" in ;; restart) $0 stop - sleep 2 $0 start ;; save) diff --git a/core/iptables/iptables.conf.d b/core/iptables/iptables.conf.d index 07bc11aa1..1c6cc7b5d 100644 --- a/core/iptables/iptables.conf.d +++ b/core/iptables/iptables.conf.d @@ -1,8 +1,12 @@ # Configuration for iptables rules - -IPTABLES=/usr/sbin/iptables -IP6TABLES=/usr/sbin/ip6tables - IPTABLES_CONF=/etc/iptables/iptables.rules IP6TABLES_CONF=/etc/iptables/ip6tables.rules -IPTABLES_FORWARD=0 # enable IP forwarding? + +# Enable IP forwarding (both IPv4 and IPv6) +# NOTE: this is not the recommended way to do this, and is supported only for +# backward compatibility. Instead, use /etc/sysctl.conf and set the following +# options: +# * net.ipv4.ip_forward=1 +# * net.ipv6.conf.default.forwarding=1 +# * net.ipv6.conf.all.forwarding=1 +#IPTABLES_FORWARD=0 |