summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg2021-08-30 21:35:53 +0200
committerGeorg2021-08-30 21:35:53 +0200
commit4f67e2895215cc4df21f5d7b1909b2e1952fa23c (patch)
tree1dbdf171956c0670776195d613d120e461de8de2
parentf5c4d50f0c8d6af3b03b8e9ef52b6854ad36aa9c (diff)
downloadsystem-4f67e2895215cc4df21f5d7b1909b2e1952fa23c.tar.gz
system-4f67e2895215cc4df21f5d7b1909b2e1952fa23c.tar.bz2
system-4f67e2895215cc4df21f5d7b1909b2e1952fa23c.zip
Adding domain.sh
Signed-off-by: Georg <georg@lysergic.dev>
-rw-r--r--scripts/sh/pdns/domain.sh47
1 files changed, 47 insertions, 0 deletions
diff --git a/scripts/sh/pdns/domain.sh b/scripts/sh/pdns/domain.sh
new file mode 100644
index 0000000..0fe8a57
--- /dev/null
+++ b/scripts/sh/pdns/domain.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+PDNSGROUP="pdns"
+
+if id -nG $(id -un) | grep -qw "$PDNSGROUP"; then
+
+if [ $# -eq 0 ] || [ $1 == "help" ] || [ $1 == "h" ] || [ $1 == "-h" ] || [ $1 == "-help" ] || [ $1 == "--help" ]; then
+ echo "======================================================="
+ echo "This script will create and secure a new zone in the Lysergic PowerDNS cluster."
+ echo "Please run it by specifying the desired domain name as an argument."
+ echo "Syntax: $ bash domain.sh example.com"
+ echo "Warning: No syntax check will be performed. Make sure you type the domain name exactly right or you'll cause a deep fucking mess."
+ echo "======================================================="
+ exit 1
+fi
+
+else
+ echo "You do not belong to the group $PDNSGROUP and hence are not allowed to run this program."
+ echo "Assign yourself to the group or contact someone who is authorized to do so."
+ exit 1
+fi
+
+DOMAIN=$1
+NS1="ns1.3zy.de"
+NS2="ns2.3zy.de"
+NS3="ns3.3zy.de"
+
+echo "==================================================="
+echo "===== CREATING ZONE FOR DOMAIN $DOMAIN ====="
+echo "==================================================="
+/usr/bin/pdnsutil create-zone $DOMAIN $NS1
+#/usr/bin/pdnsutil add-record $DOMAIN . SOA '$NS1 system.lysergic.dev 1 010800 3600 604800 3600'
+#/usr/bin/pdnsutil add-record $DOMAIN . NS $NS1
+/usr/bin/pdnsutil add-record $DOMAIN . NS $NS2
+/usr/bin/pdnsutil add-record $DOMAIN . NS $NS3
+echo "==================================================="
+echo "================= ENABLING DNSSEC ================="
+echo "==================================================="
+/usr/bin/pdnsutil secure-zone $DOMAIN
+/usr/bin/pdnsutil set-nsec3 $DOMAIN '1 0 1 ab'
+/usr/bin/pdnsutil rectify-zone $DOMAIN
+echo "==================================================="
+/usr/bin/pdnsutil show-zone $DOMAIN
+echo "==================================================="
+/usr/bin/pdnsutil list-zone $DOMAIN
+echo "==================================================="
+