From 250857f10f52c2f5b0d427adc2c7ad3eb60bc7ad Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Thu, 31 Oct 2019 23:58:29 +0200 Subject: [PATCH] Dehydrated: add cron helper --- board/common/overlay/etc/crontabs/root | 2 +- board/common/overlay/usr/sbin/dehydrated-wrapper | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100755 board/common/overlay/usr/sbin/dehydrated-wrapper diff --git a/board/common/overlay/etc/crontabs/root b/board/common/overlay/etc/crontabs/root index b106e1c3a3..bf0d404956 100644 --- a/board/common/overlay/etc/crontabs/root +++ b/board/common/overlay/etc/crontabs/root @@ -1,2 +1,2 @@ 14 3 * * * /usr/sbin/logrotate /etc/logrotate.conf - +0 2 * * 0 /usr/sbin/dehydrated-wrapper diff --git a/board/common/overlay/usr/sbin/dehydrated-wrapper b/board/common/overlay/usr/sbin/dehydrated-wrapper new file mode 100755 index 0000000000..2d31c273af --- /dev/null +++ b/board/common/overlay/usr/sbin/dehydrated-wrapper @@ -0,0 +1,16 @@ +#!/bin/bash + +PROG="/usr/bin/dehydrated" +BASE_DIR="/var/lib/dehydrated" +TMP_DIR="/tmp/dehydrated" +SSL_DIR="/data/etc/ssl" + +if ! [[ -x "${PROG}" && -r "${SSL_DIR}/domain" && -r "${SSL_DIR}/email" ]]; then + exit 0 # not installed or not configured +fi + +mkdir -p "${BASE_DIR}" +mkdir -p "${TMP_DIR}" + +logger -t dehydrated "checking for certificate renewal" +dehydrated -c