~jdstrand/ufw/ufw-xenial

« back to all changes in this revision

Viewing changes to src/backend_iptables.py

  • Committer: Jamie Strandboge
  • Date: 2014-02-24 23:20:53 UTC
  • Revision ID: jamie@ubuntu.com-20140224232053-ker7x0hio7igo3ux
Sync with Debian unstable

* debian/control: python-ufw should Breaks/Replaces on ufw << 0.32-0ubuntu1
  (Closes: 731863)
* New upstream release (Closes: 711711, Closes: 691135, Closes: 704728).
  Sync back up with Ubuntu (all changes here except for Polish debconf
  translation and Standards-Version already in Ubuntu). Add the following
  patches from Ubuntu which can be dropped in 0.34:
  - debian/patches/0002-lp1044361.patch: move netfilter capabilities
    checking into initcaps(), and call initcaps() only when we need it
  - 0003-fix-typeerror-on-error.patch: fix TypeError on error when using
    zh_CN
  - debian/patches/0004-lp1039729.patch: Skip get_netfilter_capabilities()
    with ipv6 if ipv6 is disabled
  - debian/patches/0005-lp1191197.patch: add check for -m rt --rt-type 0
* debian/po/pl.po: add Polish translation of debconf templates. Thanks to
  Michal Kulach (Closes: 667942)
  - update Standards-Version to 3.9.4
* Simplify unload of firewall and play nicely with other firewall tools by
  using ufw-init instead of iptables directly. 'ufw-init stop' by design
  leaves a few empty chains around, but they won't get in the way of
  anything and are gone after the next reboot. Using upstream's ufw-init has
  the important benefit of always cleaning what it needs. (Closes: 672439).
  - debian/prerm: call '/lib/ufw/ufw-init stop' on removal
  - debian/postrm: don't flush the chains on purge

Show diffs side-by-side

added added

removed removed

Lines of Context:
160
160
            out += "> " + _("Checking raw ip6tables\n")
161
161
            return out
162
162
 
 
163
        # Initialize the capabilities database
 
164
        self.initcaps()
 
165
 
163
166
        args = ['-n', '-v', '-x', '-L']
164
167
        items = []
165
168
        items6 = []
470
473
        if self.dryrun:
471
474
            return False
472
475
 
 
476
        # Initialize the capabilities database
 
477
        self.initcaps()
 
478
 
473
479
        prefix = "ufw"
474
480
        exe = self.iptables
475
481
        if v6:
684
690
        except Exception:
685
691
            raise
686
692
 
 
693
        # Initialize the capabilities database
 
694
        self.initcaps()
 
695
 
687
696
        chain_prefix = "ufw"
688
697
        rules = self.rules
689
698
        if v6:
830
839
        * updating user rules file
831
840
        * reloading the user rules file if rule is modified
832
841
        '''
 
842
 
 
843
        # Initialize the capabilities database
 
844
        self.initcaps()
 
845
 
833
846
        rstr = ""
834
847
 
835
848
        if rule.v6:
1062
1075
            exe = self.ip6tables
1063
1076
        (rc, out) = cmd([exe] + args)
1064
1077
        if rc != 0:
1065
 
            err_msg = _("Could not perform '%s'") % (args)
 
1078
            err_msg = _("Could not perform '%s'" % (args))
1066
1079
            if fail_ok:
1067
1080
                debug("FAILOK: " + err_msg)
1068
1081
            else:
1073
1086
        if self.dryrun:
1074
1087
            return
1075
1088
 
 
1089
        # Initialize the capabilities database
 
1090
        self.initcaps()
 
1091
 
1076
1092
        rules_t = []
1077
1093
        try:
1078
1094
            rules_t = self._get_logging_rules(level)