diff --git a/dnssec-trigger-0.12-nm-script.patch b/dnssec-trigger-0.12-nm-script.patch index 870c163..0e2404c 100644 --- a/dnssec-trigger-0.12-nm-script.patch +++ b/dnssec-trigger-0.12-nm-script.patch @@ -1,20 +1,17 @@ diff --git a/dnssec-trigger-script.in b/dnssec-trigger-script.in -index b572dd1..0b4a49f 100644 +index b572dd1..d031ffd 100644 --- a/dnssec-trigger-script.in +++ b/dnssec-trigger-script.in -@@ -5,8 +5,10 @@ - @author: Pavel Šimerda +@@ -6,7 +6,7 @@ """ -+from __future__ import print_function -+ from gi.repository import NMClient -import os, sys, shutil, subprocess +import os, sys, shutil, glob, subprocess import logging, logging.handlers import socket, struct -@@ -15,8 +17,7 @@ DEVNULL = open("/dev/null", "wb") +@@ -15,8 +15,7 @@ DEVNULL = open("/dev/null", "wb") log = logging.getLogger() log.setLevel(logging.INFO) log.addHandler(logging.handlers.SysLogHandler()) @@ -24,13 +21,15 @@ index b572dd1..0b4a49f 100644 # NetworkManager reportedly doesn't pass the PATH environment variable. os.environ['PATH'] = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" -@@ -53,11 +54,10 @@ class ConnectionList: +@@ -53,18 +52,17 @@ class ConnectionList: nm_connections = None - def __init__(self, only_default=False, skip_wifi=False): + def __init__(self, client, only_default=False, skip_wifi=False): # Cache the active connection list in the class ++ if not client.get_manager_running(): ++ raise UserError("NetworkManager is not running.") if self.nm_connections is None: - self.__class__.client = NMClient.Client() - self.__class__.nm_connections = self.client.get_active_connections() @@ -38,7 +37,14 @@ index b572dd1..0b4a49f 100644 self.skip_wifi = skip_wifi self.only_default = only_default log.debug(self) -@@ -190,7 +190,7 @@ class UnboundZoneConfig: + + def __repr__(self): +- if not list(self): +- raise Exception("!!!") + return "".format(list(self), **vars(self)) + + def __iter__(self): +@@ -190,7 +188,7 @@ class UnboundZoneConfig: if fields.pop(0) in ('forward', 'forward:'): fields.pop(0) secure = False @@ -47,7 +53,7 @@ index b572dd1..0b4a49f 100644 secure = True fields.pop(0) self.cache[name] = set(fields[3:]), secure -@@ -255,7 +255,7 @@ class Store: +@@ -255,7 +253,7 @@ class Store: line = line.strip() if line: self.cache.add(line) @@ -56,7 +62,7 @@ index b572dd1..0b4a49f 100644 pass log.debug(self) -@@ -277,10 +277,16 @@ class Store: +@@ -277,10 +275,16 @@ class Store: log.debug(self) def update(self, zones): @@ -76,7 +82,7 @@ index b572dd1..0b4a49f 100644 def remove(self, zone): """Remove zone from the cache.""" -@@ -309,7 +315,7 @@ class GlobalForwarders: +@@ -309,7 +313,7 @@ class GlobalForwarders: line = line.strip() if line: self.cache.add(line) @@ -85,7 +91,7 @@ index b572dd1..0b4a49f 100644 pass class Application: -@@ -328,17 +334,24 @@ class Application: +@@ -328,17 +332,24 @@ class Application: except AttributeError: self.usage() self.config = Config() @@ -112,20 +118,8 @@ index b572dd1..0b4a49f 100644 return True def usage(self): -@@ -351,9 +364,19 @@ class Application: - def run_prepare(self): - """Prepare for dnssec-trigger.""" +@@ -353,7 +364,7 @@ class Application: -+ old_zones = glob.glob("/var/run/dnssec-trigger/????????-????-????-????-????????????") -+ if old_zones: -+ log.info("Converting to new zone cache format") -+ with open("/var/run/dnssec-trigger/zones", "a") as target: -+ for filename in old_zones: -+ with open(filename) as source: -+ for line in source: -+ print(line.strip(), file=target) -+ os.remove(filename) -+ if not self.nm_handles_resolv_conf(): log.info("Backing up /etc/resolv.conf") - shutil.copy("/etc/resolv.conf", "/var/run/dnssec-trigger/resolv.conf.bak") @@ -133,6 +127,25 @@ index b572dd1..0b4a49f 100644 def run_cleanup(self): """Clean up after dnssec-trigger.""" +@@ -361,6 +372,18 @@ class Application: + stored_zones = Store('zones') + unbound_zones = UnboundZoneConfig() + ++ # provide upgrade path for previous versions ++ old_zones = glob.glob("/var/run/dnssec-trigger/????????-????-????-????-????????????") ++ if old_zones: ++ log.info("Reading zones from the legacy zone store") ++ with open("/var/run/dnssec-trigger/zones", "a") as target: ++ for filename in old_zones: ++ with open(filename) as source: ++ log.debug("Reading zones from {}".format(filename)) ++ for line in source: ++ stored_zones.add(line.strip()) ++ os.remove(filename) ++ + log.debug("clearing unbound configuration") + for zone in stored_zones: + unbound_zones.remove(zone) @@ -370,7 +393,10 @@ class Application: log.debug("recovering /etc/resolv.conf") subprocess.check_call(["chattr", "-i", "/etc/resolv.conf"]) diff --git a/dnssec-trigger-0.12-service.patch b/dnssec-trigger-0.12-service.patch new file mode 100644 index 0000000..c731d47 --- /dev/null +++ b/dnssec-trigger-0.12-service.patch @@ -0,0 +1,12 @@ +diff --git a/dnssec-triggerd.service b/dnssec-triggerd.service +index db6af13..f2a37ca 100644 +--- a/dnssec-triggerd.service ++++ b/dnssec-triggerd.service +@@ -1,6 +1,6 @@ + [Unit] + Description=Reconfigure local DNSSEC resolver on connectivity changes +-After=unbound.service dnssec-triggerd-keygen.service ++After=NetworkManager.service unbound.service dnssec-triggerd-keygen.service + Requires=unbound.service + Wants=dnssec-triggerd-keygen.service + diff --git a/dnssec-trigger.spec b/dnssec-trigger.spec index f090991..51f710d 100644 --- a/dnssec-trigger.spec +++ b/dnssec-trigger.spec @@ -3,7 +3,7 @@ Summary: NetworkManager plugin to update/reconfigure DNSSEC resolving Name: dnssec-trigger Version: 0.12 -Release: 6%{?dist} +Release: 7%{?dist} License: BSD Url: http://www.nlnetlabs.nl/downloads/dnssec-trigger/ Source0: http://www.nlnetlabs.nl/downloads/dnssec-trigger/%{name}-%{version}.tar.gz @@ -18,10 +18,15 @@ Source2: dnssec-trigger.tmpfiles.d # updating the patch. # # https://bugzilla.redhat.com/show_bug.cgi?id=1100794 -# https://bugzilla.redhat.com/show_bug.cgi?id=1100794 +# https://bugzilla.redhat.com/show_bug.cgi?id=1100796 # https://bugzilla.redhat.com/show_bug.cgi?id=1105896 +# https://bugzilla.redhat.com/show_bug.cgi?id=842455 # https://bugzilla.redhat.com/show_bug.cgi?id=1111143 Patch2: dnssec-trigger-0.12-nm-script.patch +# Fix dnssec-triggerd.service +# +# https://bugzilla.redhat.com/show_bug.cgi?id=1112248 +Patch3: dnssec-trigger-0.12-service.patch Requires(postun): initscripts Requires: ldns >= 1.6.10, NetworkManager, NetworkManager-glib, unbound, xdg-utils @@ -48,6 +53,7 @@ sed -i "s/ Panel//" panel/dnssec-trigger-panel.desktop.in sed -i "s/-panel//" panel/dnssec-trigger-panel.desktop.in %patch2 -p1 +%patch3 -p1 # change default RSA key between deamon/control from 1536 to 3072 sed -i "s/BITS=1536/BITS=3072/" dnssec-trigger-control-setup.sh.in @@ -126,6 +132,9 @@ fi %systemd_postun_with_restart %{name}d.service %changelog +* Mon Jun 23 2014 Pavel Šimerda - 0.12-7 +- Resolves: #1112248, #1111143 - update dnssec-trigger-script and dnssec-triggerd.service + * Fri Jun 20 2014 Pavel Šimerda - 0.12-6 - Resolves: #1111143 - fix for python2