gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [ascension] 02/09: updated config file for ascension-bind


From: gnunet
Subject: [GNUnet-SVN] [ascension] 02/09: updated config file for ascension-bind
Date: Fri, 10 May 2019 15:24:22 +0200

This is an automated email from the git hooks/post-receive script.

rexxnor pushed a commit to branch master
in repository ascension.

commit 9aa95158e4919de450783feeec102329ffcb1367
Author: rexxnor <address@hidden>
AuthorDate: Thu May 9 22:56:23 2019 +0200

    updated config file for ascension-bind
---
 .../debian/ascension-bind.config                   | 78 +++++++++++++---------
 1 file changed, 48 insertions(+), 30 deletions(-)

diff --git a/debian/ascension-bind-0.0.1/debian/ascension-bind.config 
b/debian/ascension-bind-0.0.1/debian/ascension-bind.config
index c77bc11..4b92649 100644
--- a/debian/ascension-bind-0.0.1/debian/ascension-bind.config
+++ b/debian/ascension-bind-0.0.1/debian/ascension-bind.config
@@ -19,22 +19,18 @@ zonelist=${zonelist// /, /}
 #altzonelist=$(named-checkconf -z | grep -P "\d{4,}$")
 #altzones=("$altzonelist")
 
-#echo $zonelist
-#echo $altzonelist
-#echo $altzones
-
 #if [ address@hidden -eq address@hidden ]; then
 #db_metaget ascension-bind/zones choices
 #echo "$RET"
 #db_set ascension-bind/zones 'foo.bar, this.does.not.work'
 #db_subst ascension-bind/zones choices "mine, this.does.work"
 #db_set ascension-bind/zones "foo.bar, this.does.not.work"
-if grep allow-transfer < /etc/bind/named.conf.local &> /dev/null; then
-       db_fset ascension-bind/transfer-allowed seen false
-       db_input high ascension-bind/transfer-allowed
-       db_go || true
-       exit 1
-fi
+#if grep allow-transfer < /etc/bind/named.conf &> /dev/null; then
+#   db_fset ascension-bind/transfer-allowed seen false
+#   db_input high ascension-bind/transfer-allowed
+#   db_go || true
+#   exit 1
+#fi
 
 db_set ascension-bind/zones "$zonelist"
 db_subst ascension-bind/zones choices "$zonelist"
@@ -50,23 +46,52 @@ db_fset ascension-bind/publishing seen false
 db_input medium ascension-bind/publishing || true
 db_go || true
 PUBLIC=$RET
+zonestatus=true
+for ZONE in "address@hidden"
+do
+    zonestatus=zonestatus && ascension "$ZONE" -n localhost
+done
+
+if [ -z $zonestatus ]; then
+    echo "Some zones don't allow zone transfer"
+    if grep allow-transfer /etc/bind/named.conf* &> /dev/null; then
+        db_fset ascension-bind/transfer-allowed seen false
+        db_input high ascension-bind/transfer-allowed
+        db_go || true
+        exit 1
+    else
+        echo "Trying to allow zone transfer on localhost in global 
configuration"
+        sed -i.backup -r 's|(^[^\n\S]*options\s?{)|\1 allow\-transfer { 
localhost; }; |g' /etc/bind/named.conf.options
+        systemctl reload bind9
+        zonestatus=true
+        for ZONE in "address@hidden"
+        do
+            zonestatus=zonestatus && ascension "$ZONE" -n localhost
+        done
+        if [ -z $zonestatus ]; then
+            db_fset ascension-bind/transfer-allowed seen false
+            db_input high ascension-bind/transfer-allowed
+            db_go || true
+            exit 1
+        fi
+        echo "Zone transfer possible, continuing"
+    fi
+fi
 
 mkdir -p /etc/ascension.d/
 for ZONE in "address@hidden"
 do
-       echo "creating ascension import config files"
-       cat > "/etc/ascension.d/bind-import-$ZONE.conf" << EOF
+    echo "Creating ascension import config files for $ZONE"
+    cat > "/etc/ascension.d/bind-import-$ZONE.conf" << EOF
 [ascension]
 ZONE = $ZONE
 TRANSFERNS = localhost
 PORT = 53
 PUBLIC = $PUBLIC
 EOF
-       touch "/etc/ascension.d/bind-import-$ZONE.conf"
-       echo "editing config to allow local zone transfer"
-       sed -i.backup -r 's|(^[^\n\S]*zone\s\"[a-zA-Z.]*\".*\{)|\1 
allow\-transfer { localhost; }; |g' /etc/bind/named.conf.local
-       echo "creating systemd unit file"
-       cat > "/etc/ascension.d/ascension-bind-$ZONE.service" << EOF
+    touch "/etc/ascension.d/bind-import-$ZONE.conf"
+    echo "Creating systemd unit file."
+    cat > "/etc/ascension.d/ascension-bind-$ZONE.service" << EOF
 [Unit]
 Description=Ascension-bind for $ZONE
 After=gnunet-ascension.service
@@ -79,21 +104,14 @@ ExecStart=/usr/bin/ascension $ZONE -n localhost
 [Install]
 WantedBy=multi-user.target
 EOF
-       ln -s "/etc/ascension.d/ascension-bind-$ZONE.service" 
"/lib/systemd/system/ascension-bind-$ZONE.service"
+    ln -sf "/etc/ascension.d/ascension-bind-$ZONE.service" 
"/lib/systemd/system/ascension-bind-$ZONE.service"
 done
 
-#if deb-systemd-invoke reload bind9; then
-#      echo "reconfiguring failed, restoring original state"
-#      mv /etc/bind/named.conf.local.backup /etc/bind/named.conf.local
-#      exit 1
-#fi
-#
-#for ZONE in "address@hidden"
-#do
-#      echo "starting and enabling ascension-bind-$ZONE"
-#      deb-systemd-invoke start "ascension-bind-$ZONE"
-#      deb-systemd-invoke enable "ascension-bind-$ZONE"
-#done
+do
+    echo "Starting and enabling ascension-bind-$ZONE"
+    deb-systemd-invoke start "ascension-bind-$ZONE"
+    deb-systemd-invoke enable "ascension-bind-$ZONE"
+done
 
 exit 0
 #DEBHELPER#

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]