summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-09-23 10:45:38 +0200
committerErich Eckner <git@eckner.net>2019-09-23 10:45:38 +0200
commit491682978b3434153cf51c68ef0721828d0d1c07 (patch)
tree2c9b10f306ec452203b0aa16376055d952822247
parent8e447f5e3a2e7080d2194e8dac453119e2a39be4 (diff)
downloadsimple-pki-491682978b3434153cf51c68ef0721828d0d1c07.tar.xz
rotate-keys: abort if tmp_dir cannot be created
-rw-r--r--rotate-keys.in7
1 files changed, 6 insertions, 1 deletions
diff --git a/rotate-keys.in b/rotate-keys.in
index 970d533..952595b 100644
--- a/rotate-keys.in
+++ b/rotate-keys.in
@@ -82,7 +82,12 @@ if trap \
exit 1
fi
-tmp_dir=$(mktemp -d "${webserver_dir}"'/tmp.XXXXXXXXXX')
+if ! tmp_dir=$(mktemp -d "${webserver_dir}"'/tmp.XXXXXXXXXX'); then
+ >&2 printf 'failed to create temporary directory - does %s have sufficient permissions on "%s"?\n' \
+ "$(whoami)" \
+ "${webserver_dir}"
+ exit 1
+fi
trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
printf '%s\n' "${hosts}" \