[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [ascension] 04/09: bugfixes, improved config file
From: |
gnunet |
Subject: |
[GNUnet-SVN] [ascension] 04/09: bugfixes, improved config file |
Date: |
Fri, 10 May 2019 15:24:24 +0200 |
This is an automated email from the git hooks/post-receive script.
rexxnor pushed a commit to branch master
in repository ascension.
commit 3d9b0cb2a4cb7f0a86d128c6a8afc8e006e0e1cb
Author: rexxnor <address@hidden>
AuthorDate: Fri May 10 00:27:06 2019 +0200
bugfixes, improved config file
---
ascension/ascension.py | 3 +
.../ascension-bind/installed-by-dh_installdocs | 0
.../debian/ascension-bind.config | 18 ++++-
.../debian/ascension-bind.postrm.debhelper | 2 +-
.../debian/ascension-bind.templates | 1 -
.../debian/ascension-bind/DEBIAN/config | 92 ++++++++++++++--------
.../debian/ascension-bind/DEBIAN/templates | 1 -
.../debian/debhelper-build-stamp | 1 -
8 files changed, 76 insertions(+), 42 deletions(-)
diff --git a/ascension/ascension.py b/ascension/ascension.py
index 56d76b7..cf8d7b4 100644
--- a/ascension/ascension.py
+++ b/ascension/ascension.py
@@ -136,6 +136,9 @@ class Ascender():
except dns.resolver.NXDOMAIN:
logging.warning("The domain '%s' is not publicly resolvable.",
domain)
+ except Exception:
+ logging.warning("The domain '%s' is not publicly resolvable.",
+ domain)
try:
if resolver:
diff --git
a/debian/ascension-bind-0.0.1/debian/.debhelper/generated/ascension-bind/installed-by-dh_installdocs
b/debian/ascension-bind-0.0.1/debian/.debhelper/generated/ascension-bind/installed-by-dh_installdocs
new file mode 100644
index 0000000..e69de29
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 4b92649..d178dee 100644
--- a/debian/ascension-bind-0.0.1/debian/ascension-bind.config
+++ b/debian/ascension-bind-0.0.1/debian/ascension-bind.config
@@ -15,7 +15,7 @@ ${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
#read -r zones < installedzones
zonelist=$(grep "^zone" < /etc/bind/named.conf.local | grep -vE
"(arpa|localhost|\"\.\")" | cut -d '"' -f2)
-zonelist=${zonelist// /, /}
+zonelist=$(echo $zonelist | sed 's/\n/ /g' | sed 's/ /, /g')
#altzonelist=$(named-checkconf -z | grep -P "\d{4,}$")
#altzones=("$altzonelist")
@@ -37,6 +37,7 @@ db_subst ascension-bind/zones choices "$zonelist"
db_fset ascension-bind/zones seen false
db_input high ascension-bind/zones || true
db_go || true
+
# fix the zone selection
db_get ascension-bind/zones
echo "$RET" | sed 's/ //g' | sed 's/,/\n/g' > selectedzones
@@ -46,9 +47,14 @@ 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
+ echo "$ZONE" | hexdump -C
+ ZONE=echo "$ZONE" | tr -d '\n'
+ echo "$ZONE" | hexdump -C
+ exit 1
zonestatus=zonestatus && ascension "$ZONE" -n localhost
done
@@ -66,6 +72,7 @@ if [ -z $zonestatus ]; then
zonestatus=true
for ZONE in "address@hidden"
do
+ ZONE=${ZONE} | tr -d '\n'
zonestatus=zonestatus && ascension "$ZONE" -n localhost
done
if [ -z $zonestatus ]; then
@@ -81,6 +88,7 @@ fi
mkdir -p /etc/ascension.d/
for ZONE in "address@hidden"
do
+ ZONE=${ZONE} | tr -d '\n'
echo "Creating ascension import config files for $ZONE"
cat > "/etc/ascension.d/bind-import-$ZONE.conf" << EOF
[ascension]
@@ -107,10 +115,14 @@ EOF
ln -sf "/etc/ascension.d/ascension-bind-$ZONE.service"
"/lib/systemd/system/ascension-bind-$ZONE.service"
done
+for ZONE in "address@hidden"
do
+ ZONE=${ZONE} | tr -d '\n'
echo "Starting and enabling ascension-bind-$ZONE"
- deb-systemd-invoke start "ascension-bind-$ZONE"
- deb-systemd-invoke enable "ascension-bind-$ZONE"
+ systemctl start "ascension-bind-$ZONE"
+ systemctl enable "ascension-bind-$ZONE"
+ #deb-systemd-invoke start "ascension-bind-$ZONE"
+ #deb-systemd-invoke enable "ascension-bind-$ZONE"
done
exit 0
diff --git a/debian/ascension-bind-0.0.1/debian/ascension-bind.postrm.debhelper
b/debian/ascension-bind-0.0.1/debian/ascension-bind.postrm.debhelper
index bc035b9..c2ab326 100644
--- a/debian/ascension-bind-0.0.1/debian/ascension-bind.postrm.debhelper
+++ b/debian/ascension-bind-0.0.1/debian/ascension-bind.postrm.debhelper
@@ -1,4 +1,4 @@
-# Automatically added by dh_installdebconf
+# Automatically added by dh_installdebconf/12.1.1~bpo9+1
if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then
. /usr/share/debconf/confmodule
db_purge
diff --git a/debian/ascension-bind-0.0.1/debian/ascension-bind.templates
b/debian/ascension-bind-0.0.1/debian/ascension-bind.templates
index 28d9db4..e8663cc 100644
--- a/debian/ascension-bind-0.0.1/debian/ascension-bind.templates
+++ b/debian/ascension-bind-0.0.1/debian/ascension-bind.templates
@@ -4,7 +4,6 @@ Choices: ${zonelist}
Description: Which zones do you want to migrate to the GNU Name System?
Please select the zones you want to have migrated into the GNU Name System.
-
Template: ascension-bind/publishing
Type: boolean
Default: true
diff --git a/debian/ascension-bind-0.0.1/debian/ascension-bind/DEBIAN/config
b/debian/ascension-bind-0.0.1/debian/ascension-bind/DEBIAN/config
index f96bba0..656fc39 100755
--- a/debian/ascension-bind-0.0.1/debian/ascension-bind/DEBIAN/config
+++ b/debian/ascension-bind-0.0.1/debian/ascension-bind/DEBIAN/config
@@ -14,53 +14,82 @@ ${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*"
1>&2 }
#grep "Zone dump" /var/cache/bind/named_dump.db | grep -v "arpa" | grep "IN" |
grep -v localhost > installedzones
#read -r zones < installedzones
-zonelist=$(grep "^zone" < /etc/bind/named.conf.local | grep -vE
"(arpa|localhost|\"\.\")" | grep -v "allow-transfer" | cut -d '"' -f2)
-zonelist=$(echo $zonelist | sed 's/ /, /g')
+zonelist=$(grep "^zone" < /etc/bind/named.conf.local | grep -vE
"(arpa|localhost|\"\.\")" | cut -d '"' -f2)
+zonelist=$(echo $zonelist | sed 's/\n/ /g' | sed 's/ /, /g')
#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 [ -n "$(ls -A /etc/ascension.d/)" ]; then
- echo "there seem to be config files already"
-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"
db_fset ascension-bind/zones seen false
db_input high ascension-bind/zones || true
db_go || true
+
# fix the zone selection
db_get ascension-bind/zones
-
-echo "$RET" | sed 's/ //g' | sed 's/,/\n/g' | sed '/^ *$/d' > selectedzones
+echo "$RET" | sed 's/ //g' | sed 's/,/\n/g' > selectedzones
readarray zones < selectedzones
-rm selectedzones
-
-if [ address@hidden -eq 0 ]; then
- echo "No zones to enable zonetransfer on"
- exit 0
-fi
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
+ echo "$ZONE" | hexdump -C
+ ZONE=echo "$ZONE" | tr -d '\n'
+ echo "$ZONE" | hexdump -C
+ exit 1
+ 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
+ ZONE=${ZONE} | tr -d '\n'
+ 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
- ZONE=$(echo "$ZONE" | tr -d '\n' | tr '.' '_')
- echo "creating ascension import config files"
+ ZONE=${ZONE} | tr -d '\n'
+ echo "Creating ascension import config files for $ZONE"
cat > "/etc/ascension.d/bind-import-$ZONE.conf" << EOF
[ascension]
ZONE = $ZONE
@@ -68,11 +97,9 @@ 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
@@ -85,22 +112,17 @@ ExecStart=/usr/bin/ascension $ZONE -n localhost
[Install]
WantedBy=multi-user.target
EOF
-ln -sf "/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 systemctl reload bind9; then
- echo "reconfiguring failed, restoring original state"
- mv /etc/bind/named.conf.local.backup /etc/bind/named.conf.local
- systemctl reload bind9
- exit 1
-fi
-
for ZONE in "address@hidden"
do
- ZONE=$(echo "$ZONE" | tr -d '\n' | tr '.' '_')
- echo "starting and enabling ascension-bind-$ZONE"
+ ZONE=${ZONE} | tr -d '\n'
+ echo "Starting and enabling ascension-bind-$ZONE"
systemctl start "ascension-bind-$ZONE"
systemctl enable "ascension-bind-$ZONE"
+ #deb-systemd-invoke start "ascension-bind-$ZONE"
+ #deb-systemd-invoke enable "ascension-bind-$ZONE"
done
exit 0
diff --git a/debian/ascension-bind-0.0.1/debian/ascension-bind/DEBIAN/templates
b/debian/ascension-bind-0.0.1/debian/ascension-bind/DEBIAN/templates
index 28d9db4..e8663cc 100644
--- a/debian/ascension-bind-0.0.1/debian/ascension-bind/DEBIAN/templates
+++ b/debian/ascension-bind-0.0.1/debian/ascension-bind/DEBIAN/templates
@@ -4,7 +4,6 @@ Choices: ${zonelist}
Description: Which zones do you want to migrate to the GNU Name System?
Please select the zones you want to have migrated into the GNU Name System.
-
Template: ascension-bind/publishing
Type: boolean
Default: true
diff --git a/debian/ascension-bind-0.0.1/debian/debhelper-build-stamp
b/debian/ascension-bind-0.0.1/debian/debhelper-build-stamp
deleted file mode 100644
index d664a51..0000000
--- a/debian/ascension-bind-0.0.1/debian/debhelper-build-stamp
+++ /dev/null
@@ -1 +0,0 @@
-ascension-bind
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [ascension] branch master updated (7e1e8df -> 5dc85dc), gnunet, 2019/05/10
- [GNUnet-SVN] [ascension] 01/09: fixed a double implemented issue, gnunet, 2019/05/10
- [GNUnet-SVN] [ascension] 03/09: fixed exception not catching all, gnunet, 2019/05/10
- [GNUnet-SVN] [ascension] 02/09: updated config file for ascension-bind, gnunet, 2019/05/10
- [GNUnet-SVN] [ascension] 07/09: fixed up gitlabci, gnunet, 2019/05/10
- [GNUnet-SVN] [ascension] 09/09: updated gitlabci to include correct postinst and prerm files, gnunet, 2019/05/10
- [GNUnet-SVN] [ascension] 04/09: bugfixes, improved config file,
gnunet <=
- [GNUnet-SVN] [ascension] 06/09: first working version of ascension-bind, gnunet, 2019/05/10
- [GNUnet-SVN] [ascension] 08/09: make linter and lintian happier, fixed logic errors, gnunet, 2019/05/10
- [GNUnet-SVN] [ascension] 05/09: ascension dry-run fixes, packaging, ascension-bind, gnunet, 2019/05/10