#!/bin/sh set -e if [ x"$1" = "xconfigure" ]; then # create the CurveDNS user if necessary if ! getent passwd curvedns >/dev/null ; then adduser --quiet --system --no-create-home --disabled-password \ --home /nonexistent --group --gecos "curvedns user" curvedns # generate a file containing the numeric user and group id the CurveDNS # binary will use after dropping its privileges (CurveDNS needs this to # be numeric) cat <<-EOF >/var/lib/curvedns/numeric_uid_gid UID=$(id -u curvedns) GID=$(id -g curvedns) EOF fi # if no (private) key exists, generate a new one if [ ! -s /etc/curvedns/curvedns_private_key.hex ] ; then # run curvedns-keygen to generate a new key CURVE_KEYS=`curvedns-keygen` # extract public and private keys from the output DNSPUBKEY=`echo "$CURVE_KEYS" | awk '/DNS public key:/ {print $4}'` HEXPUBKEY=`echo "$CURVE_KEYS" | awk '/Hex public key:/ {print $4}'` HEXSECRETKEY=`echo "$CURVE_KEYS" | awk '/Hex secret key:/ {print $4}'` # write the secret key to file (with appropriate permissions) ( umask 077 echo "CURVEDNS_PRIVATE_KEY=$HEXSECRETKEY" \ >/etc/curvedns/curvedns_private_key.hex ) # write information about the public key to README cat <<-EOF >/etc/curvedns/README Your DNScurve public key is $DNSPUBKEY (DNS encoding) $HEXPUBKEY (hexadecimal) You need to publish this public key as part of your authoritative nameserver's DNS records. See /usr/share/doc/curvedns/README.Debian for more information. EOF fi fi # Automatically added by dh_installinit/13.14.1 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -z "${DPKG_ROOT:-}" ] && [ -x "/etc/init.d/curvedns" ]; then update-rc.d curvedns defaults >/dev/null if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi invoke-rc.d --skip-systemd-native curvedns $_dh_action || exit 1 fi fi # End automatically added section # Automatically added by dh_installsystemd/13.14.1 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then # The following line should be removed in trixie or trixie+1 deb-systemd-helper unmask 'curvedns.service' >/dev/null || true # was-enabled defaults to true, so new installations run enable. if deb-systemd-helper --quiet was-enabled 'curvedns.service'; then # Enables the unit on first installation, creates new # symlinks on upgrades if the unit file has changed. deb-systemd-helper enable 'curvedns.service' >/dev/null || true else # Update the statefile to add new symlinks (if any), which need to be # cleaned up on purge. Also remove old symlinks. deb-systemd-helper update-state 'curvedns.service' >/dev/null || true fi fi # End automatically added section # Automatically added by dh_installsystemd/13.14.1 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -d /run/systemd/system ]; then systemctl --system daemon-reload >/dev/null || true if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi deb-systemd-invoke $_dh_action 'curvedns.service' >/dev/null || true fi fi # End automatically added section