summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--CHANGELOG.txt9
-rw-r--r--VERSION.txt2
-rwxr-xr-xdehydrated/share/hooks/deploy_cert.extra4
-rwxr-xr-xknot-resolver/bin/kresd-cache-clear29
-rwxr-xr-xknot/bin/knot-zones-reset84
5 files changed, 48 insertions, 80 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 5772167..ecf2274 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,3 +1,12 @@
+2022-11-08 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+
+ * Releasing version 20221108.
+
+ [ Daniel Baumann ]
+ * Only restarting knot if it was running before in knot-zones-reset.
+ * Correcting cosmetic typo in dehydrated extra-cert hook output.
+ * Removing ssh remote part from knot related commands.
+
2022-11-01 Daniel Baumann <daniel.baumann@open-infrastructure.net>
* Releasing version 20221101.
diff --git a/VERSION.txt b/VERSION.txt
index 3950253..f47121e 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -1 +1 @@
-20221101
+20221108
diff --git a/dehydrated/share/hooks/deploy_cert.extra b/dehydrated/share/hooks/deploy_cert.extra
index b33f562..47a8391 100755
--- a/dehydrated/share/hooks/deploy_cert.extra
+++ b/dehydrated/share/hooks/deploy_cert.extra
@@ -40,11 +40,11 @@ echo " done."
for EXTRA in fullchain-privkey privkey-fullchain
do
- echo -n " + creating ${EXTRA1}-${EXTRA2}:"
-
EXTRA1="$(echo ${EXTRA} | awk -F- '{ print $1 }')"
EXTRA2="$(echo ${EXTRA} | awk -F- '{ print $2 }')"
+ echo -n " + creating ${EXTRA1}-${EXTRA2}:"
+
cat "${DIRECTORY}/${EXTRA1}-${TIMESTAMP}.pem" "${DIRECTORY}/${EXTRA2}-${TIMESTAMP}.pem" > "${DIRECTORY}/${EXTRA1}-${EXTRA2}-${TIMESTAMP}.pem"
ln -sf "${EXTRA1}-${EXTRA2}-${TIMESTAMP}.pem" "${DIRECTORY}/cert.${EXTRA1}-${EXTRA2}.pem"
diff --git a/knot-resolver/bin/kresd-cache-clear b/knot-resolver/bin/kresd-cache-clear
index 49c2462..5b9a0e1 100755
--- a/knot-resolver/bin/kresd-cache-clear
+++ b/knot-resolver/bin/kresd-cache-clear
@@ -21,31 +21,10 @@
set -e
-HOSTS="${*:-localhost}"
+NUMBER="$(systemctl | grep -c 'kresd@[0-9].service')"
-for HOST in ${HOSTS}
+for NUMBER in $(seq 1 "${NUMBER}")
do
- case "${HOST}" in
- localhost)
- NUMBER="$(systemctl | grep -c 'kresd@[0-9].service')"
-
- for NUMBER in $(seq 1 "${NUMBER}")
- do
- echo "Flushing localhost, resolver ${NUMBER}"
- echo "cache.clear()" | sudo socat - UNIX-CONNECT:/run/knot-resolver/control/"${NUMBER}"
- done
- ;;
-
- *)
- NUMBER="$(ssh "${HOST}" sudo systemctl | grep -c 'kresd@[0-9].service')"
-
- for NUMBER in $(seq 1 "${NUMBER}")
- do
- echo "Flushing ${HOST}, resolver ${NUMBER}"
- echo "cache.clear()" | ssh "${HOST}" sudo socat - UNIX-CONNECT:/run/knot-resolver/control/"${NUMBER}"
- done
- ;;
- esac
+ echo "Flushing localhost, resolver ${NUMBER}"
+ echo "cache.clear()" | sudo socat - UNIX-CONNECT:/run/knot-resolver/control/"${NUMBER}"
done
-
-echo
diff --git a/knot/bin/knot-zones-reset b/knot/bin/knot-zones-reset
index 6471cf4..8ab2dca 100755
--- a/knot/bin/knot-zones-reset
+++ b/knot/bin/knot-zones-reset
@@ -21,55 +21,35 @@
set -e
-HOSTS="${*:-localhost}"
-
-for HOST in ${HOSTS}
-do
- case "${HOST}" in
- localhost)
- echo "Resetting in-memory data for all zones..."
-
- sudo service knot stop
-
- sudo rm -rf /var/lib/knot/journal/*.mdb
- sudo rm -rf /var/lib/knot/timers/*.mdb
-
- if [ -e /var/lib/knot/zones/.git ]
- then
- sudo chown -R root:root /var/lib/knot/zones/
-
- cd /var/lib/knot/zones
- sudo git clean -dxf
- sudo git checkout -f
-
- sudo chown -R knot:knot /var/lib/knot/zones/
- fi
-
- sudo service knot start
-
- echo
- echo "done."
- ;;
-
- *)
- echo "'${HOST}': Resetting in-memory data for all zones..."
-
- ssh "${HOST}" \
- "sudo service knot stop && \
- sudo rm -rf /var/lib/knot/journal/*.mdb && \
- sudo rm -rf /var/lib/knot/timers/*.mdb && \
- if [ -e /var/lib/knot/zones/.git ]; \
- then \
- sudo chown -R root:root /var/lib/knot/zones/; \
- cd /var/lib/knot/zones; \
- sudo git clean -dxf; \
- sudo git checkout -f; \
- sudo chown -R knot:knot /var/lib/knot/zones/; \
- fi; \
- sudo service knot start"
-
- echo
- echo "done."
- ;;
- esac
-done
+echo "Resetting in-memory data for all zones..."
+
+if systemctl status knot | grep -qs 'Active: active'
+then
+ START="true"
+ sudo service knot stop
+else
+ START="false"
+fi
+
+sudo rm -rf /var/lib/knot/journal/*.mdb
+sudo rm -rf /var/lib/knot/timers/*.mdb
+
+if [ -e /var/lib/knot/zones/.git ]
+then
+ sudo chown -R root:root /var/lib/knot/zones/
+
+ cd /var/lib/knot/zones
+ sudo git clean -dxf
+ sudo git checkout -f
+
+ sudo chown -R knot:knot /var/lib/knot/zones/
+fi
+
+case "${START}" in
+ true)
+ sudo service knot start
+ ;;
+esac
+
+echo
+echo "done."