Skip to content

Commit

Permalink
fix(nslord): harden secure-zones script, fixes desec-io/desec-interna…
Browse files Browse the repository at this point in the history
…l#18

- Deal correctly with domain names starting with dashes or otherwise
  weird

- Also, don't use unnecessarily large amounts of entropy for salting
  • Loading branch information
peterthomassen authored and nils-wisiol committed Aug 19, 2017
1 parent e83550e commit 69a6444
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions nslord/cronhook/secure-zones.sh
Expand Up @@ -9,10 +9,13 @@ for ZONE in `echo "SELECT name FROM domains WHERE type = 'NATIVE' && id NOT IN(S
set -ex

PARENT=${ZONE#*.}
SALT=`head -c300 /dev/urandom | sha512sum | cut -b 1-16`
SALT=`head -c32 /dev/urandom | sha256sum | cut -b 1-16`

# Set up DNSSEC and switch zone type to MASTER
pdnsutil secure-zone $ZONE && pdnsutil set-nsec3 $ZONE "1 0 300 $SALT" && pdnsutil set-kind $ZONE MASTER && pdnsutil increase-serial $ZONE
# Set up DNSSEC, switch zone type to MASTER, and increase serial for notify
pdnsutil secure-zone -- "$ZONE" \
&& pdnsutil set-nsec3 -- "$ZONE" "1 0 300 $SALT" \
&& pdnsutil set-kind -- "$ZONE" MASTER \
&& pdnsutil increase-serial -- "$ZONE"

# Take care of delegations
if [ "$PARENT" == "dedyn.io" ]; then
Expand Down

0 comments on commit 69a6444

Please sign in to comment.