summaryrefslogtreecommitdiffstats
path: root/dehydrated
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dehydrated/Makefile2
-rw-r--r--dehydrated/TODO4
-rwxr-xr-xdehydrated/bin/dehydrated-cron19
-rwxr-xr-xdehydrated/bin/dehydrated-hook.d19
-rwxr-xr-xdehydrated/bin/dehydrated-nsupdate38
-rwxr-xr-xdehydrated/share/hooks/deploy_cert.fullchain-privkey19
-rwxr-xr-xdehydrated/share/hooks/deploy_ocsp.fullchain-privkey19
-rwxr-xr-xdehydrated/share/hooks/exit_hook.fix-permissions19
-rwxr-xr-xdehydrated/share/hooks/exit_hook.service-reload19
9 files changed, 152 insertions, 6 deletions
diff --git a/dehydrated/Makefile b/dehydrated/Makefile
index 0c9da96..5a6239d 100644
--- a/dehydrated/Makefile
+++ b/dehydrated/Makefile
@@ -50,7 +50,7 @@ test:
then \
for SCRIPT in $(SCRIPTS); \
do \
- shellcheck -e SC2039 $${SCRIPT}; \
+ shellcheck -e SC1090 -e SC2039 $${SCRIPT}; \
echo -n "."; \
done; \
else \
diff --git a/dehydrated/TODO b/dehydrated/TODO
new file mode 100644
index 0000000..0025e8a
--- /dev/null
+++ b/dehydrated/TODO
@@ -0,0 +1,4 @@
+TODO
+====
+
+ * add hmac/tsig support
diff --git a/dehydrated/bin/dehydrated-cron b/dehydrated/bin/dehydrated-cron
index 09e1a44..8264761 100755
--- a/dehydrated/bin/dehydrated-cron
+++ b/dehydrated/bin/dehydrated-cron
@@ -1,5 +1,24 @@
#!/bin/sh
+# Open Infrastructure: service-tools
+
+# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+#
+# SPDX-License-Identifier: GPL-3.0+
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
set -e
mkdir -p /var/log/dehydrated
diff --git a/dehydrated/bin/dehydrated-hook.d b/dehydrated/bin/dehydrated-hook.d
index 2d9a5af..4e7b7ff 100755
--- a/dehydrated/bin/dehydrated-hook.d
+++ b/dehydrated/bin/dehydrated-hook.d
@@ -1,5 +1,24 @@
#!/bin/sh
+# Open Infrastructure: service-tools
+
+# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+#
+# SPDX-License-Identifier: GPL-3.0+
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
set -e
HOOKS="/etc/dehydrated/hook.d"
diff --git a/dehydrated/bin/dehydrated-nsupdate b/dehydrated/bin/dehydrated-nsupdate
index f901d2e..ec8cf7f 100755
--- a/dehydrated/bin/dehydrated-nsupdate
+++ b/dehydrated/bin/dehydrated-nsupdate
@@ -1,5 +1,24 @@
#!/bin/sh
+# Open Infrastructure: service-tools
+
+# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+#
+# SPDX-License-Identifier: GPL-3.0+
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
set -e
HOOK="$(basename "${0}")"
@@ -50,18 +69,27 @@ else
exit 1
fi
+# config
+for FILE in /etc/default/dehydrated-nsupdate /etc/default/dehydrated-nsupdate.d/*
+do
+ if [ -e "${FILE}" ]
+ then
+ . "${FILE}"
+ fi
+done
+
# find txt record to update
CNAME="$(${DIG} "_acme-challenge.${DOMAIN}" 2>&1 | awk '/CNAME/ { print $5 }' | tail -n1)"
if [ -n "${CNAME}" ]
then
- UPDATE_DOMAIN="${CNAME}"
+ TXT_RECORD="${CNAME}"
else
- UPDATE_DOMAIN="_acme-challenge.${DOMAIN}"
+ TXT_RECORD="_acme-challenge.${DOMAIN}"
fi
# find nameservers to update
-ZONE="${UPDATE_DOMAIN}"
+ZONE="${TXT_RECORD}"
while true
do
@@ -80,12 +108,12 @@ NAMESERVERS="$(${DIG} +short NS "${ZONE}")"
# update nameservers
for NAMESERVER in ${NAMESERVERS}
do
- echo -n " + Adding TXT record (${UPDATE_DOMAIN})..."
+ echo -n " + sending '${HOOK_ACTION}' for ${TXT_RECORD} to ${NAMESERVER}..."
echo "server ${NAMESERVER}
zone ${ZONE}
ttl 0
-update ${HOOK_ACTION} ${UPDATE_DOMAIN} 0 TXT ${TOKEN_VALUE}
+update ${HOOK_ACTION} ${TXT_RECORD} 0 TXT ${TOKEN_VALUE}
send" | "${NSUPDATE}"
echo " done."
diff --git a/dehydrated/share/hooks/deploy_cert.fullchain-privkey b/dehydrated/share/hooks/deploy_cert.fullchain-privkey
index 5457036..95f0aa7 100755
--- a/dehydrated/share/hooks/deploy_cert.fullchain-privkey
+++ b/dehydrated/share/hooks/deploy_cert.fullchain-privkey
@@ -1,5 +1,24 @@
#!/bin/sh
+# Open Infrastructure: service-tools
+
+# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+#
+# SPDX-License-Identifier: GPL-3.0+
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
set -e
DIRECTORY="$(dirname "${FULLCHAINFILE}")"
diff --git a/dehydrated/share/hooks/deploy_ocsp.fullchain-privkey b/dehydrated/share/hooks/deploy_ocsp.fullchain-privkey
index e68716b..70af6dc 100755
--- a/dehydrated/share/hooks/deploy_ocsp.fullchain-privkey
+++ b/dehydrated/share/hooks/deploy_ocsp.fullchain-privkey
@@ -1,5 +1,24 @@
#!/bin/sh
+# Open Infrastructure: service-tools
+
+# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+#
+# SPDX-License-Identifier: GPL-3.0+
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
set -e
FILE="$(readlink "${OCSPFILE}")"
diff --git a/dehydrated/share/hooks/exit_hook.fix-permissions b/dehydrated/share/hooks/exit_hook.fix-permissions
index c5bb646..d19c8e6 100755
--- a/dehydrated/share/hooks/exit_hook.fix-permissions
+++ b/dehydrated/share/hooks/exit_hook.fix-permissions
@@ -1,5 +1,24 @@
#!/bin/sh
+# Open Infrastructure: service-tools
+
+# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+#
+# SPDX-License-Identifier: GPL-3.0+
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
set -e
echo " + Fixing permissions..."
diff --git a/dehydrated/share/hooks/exit_hook.service-reload b/dehydrated/share/hooks/exit_hook.service-reload
index 2da8c1b..f7bc8e4 100755
--- a/dehydrated/share/hooks/exit_hook.service-reload
+++ b/dehydrated/share/hooks/exit_hook.service-reload
@@ -1,5 +1,24 @@
#!/bin/sh
+# Open Infrastructure: service-tools
+
+# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+#
+# SPDX-License-Identifier: GPL-3.0+
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
set -e
echo " + Reloading services..."