Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DNSSEC ZSK Rollover #22

Open
ShaneMcC opened this issue Sep 24, 2017 · 2 comments
Open

DNSSEC ZSK Rollover #22

ShaneMcC opened this issue Sep 24, 2017 · 2 comments

Comments

@ShaneMcC
Copy link
Member

ZSKs should rollover automatically.

@ShaneMcC
Copy link
Member Author

@ShaneMcC
Copy link
Member Author

ShaneMcC commented Nov 7, 2018

In case the page referenced above vanishes:

#!/bin/sh

KEYGEN="/usr/sbin/dnssec-keygen"
SETTIME="/usr/sbin/dnssec-settime"
DNSSEC_KEYS="/var/named/chroot/etc/pki/dnssec-keys"
ZONEFILES="/var/named/chroot/var/named/master"

DOMAIN="$1"

if [ $# -eq 0 ]
then
	echo "Syntax: ./$(basename $0) mydomain.tld"
	exit 1
fi

ZONEFILE="${ZONEFILES}/${DOMAIN}.zone"

if [ ! -f $ZONEFILE ]
then
    echo "File ${DOMAIN}.zone not found!"
    exit 1
fi

OLDKEYS="$(grep -l "zone-signing key" $DNSSEC_KEYS/K$DOMAIN.*)"

if [ -z "$OLDKEYS" ]
then
   echo "Unable to find an existing zone-signing key, exiting."
   exit 1
fi

ACTIVEKEY="$(grep -L "Inactive" $OLDKEYS)"

if [ -z "$ACTIVEKEY" ]
then
   echo "Unable to find an active zone-signing key, exiting."
   exit 1
fi

if (( $(grep -c . <<<"$ACTIVEKEY") > 1 ))
then
   echo "Found multiple active zone-signing keys, exiting."
   exit 1
fi

echo "Found key: $ACTIVEKEY"

$SETTIME -I +172800 -D +345600 $ACTIVEKEY

KEYNAME="$($KEYGEN -K $DNSSEC_KEYS -S $ACTIVEKEY -i 172800)"

echo "Generated key: ${KEYNAME}"

echo "Setting owner on generated key"
chown "named:named" "$DNSSEC_KEYS/$KEYNAME.key"
chown "named:named" "$DNSSEC_KEYS/$KEYNAME.private"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant