summaryrefslogtreecommitdiff
path: root/generate-and-upload-self-signed-keys.in
diff options
context:
space:
mode:
Diffstat (limited to 'generate-and-upload-self-signed-keys.in')
-rwxr-xr-xgenerate-and-upload-self-signed-keys.in18
1 files changed, 9 insertions, 9 deletions
diff --git a/generate-and-upload-self-signed-keys.in b/generate-and-upload-self-signed-keys.in
index 2935462..20423b3 100755
--- a/generate-and-upload-self-signed-keys.in
+++ b/generate-and-upload-self-signed-keys.in
@@ -44,10 +44,10 @@ host_key_files=$(
if [ "$(whoami)" = 'root' ]; then
updated_something=false
for host_key_file in ${host_key_files}; do
- if [ -f "${keydir}/${host_key_file}.key.pem.new" ] \
- && [ -f "${keydir}/${host_key_file}.cert.pem.new" ]; then
- mv "${keydir}/${host_key_file}.key.pem"{.new,}
- mv "${keydir}/${host_key_file}.cert.pem"{.new,}
+ if [ -f "${key_dir}/${host_key_file}.key.pem.new" ] \
+ && [ -f "${key_dir}/${host_key_file}.cert.pem.new" ]; then
+ mv "${key_dir}/${host_key_file}.key.pem"{.new,}
+ mv "${key_dir}/${host_key_file}.cert.pem"{.new,}
updated_something=true
fi
done
@@ -65,8 +65,8 @@ fi
printf '%s\n' "${hosts}" \
| while read -r host other_hosts; do
openssl req -x509 -newkey rsa:4096 \
- -keyout "${keydir}/${host}.key.pem.new" \
- -out "${keydir}/${host}.cert.pem.new" \
+ -keyout "${key_dir}/${host}.key.pem.new" \
+ -out "${key_dir}/${host}.cert.pem.new" \
-days 365 -nodes -subj '/C=DE/ST=Thuringia/L=Jena/O=Eckner/OU=Net/CN='"${host}" -sha256 \
-config <(
cat '#ETCDIR#/ssl/openssl.cnf'
@@ -82,13 +82,13 @@ done
rsync --ignore-missing-args \
$(
- printf -- "${keydir}"'/%s.cert.pem\n' ${host_key_files}
- printf -- "${keydir}"'/%s.cert.pem.new\n' ${host_key_files}
+ printf -- "${key_dir}"'/%s.cert.pem\n' ${host_key_files}
+ printf -- "${key_dir}"'/%s.cert.pem.new\n' ${host_key_files}
) \
"${remote_host}:${remote_dir}/"
(
- cd "${keydir}"
+ cd "${key_dir}"
{
printf '%s.cert.pem\n' ${host_key_files}
printf '%s.cert.pem.new\n' ${host_key_files}