Better logging for broken SSL

master
Keith Irwin 2022-09-10 19:10:38 -06:00
parent 4a8b5f7ea9
commit 4a96eb51be
Signed by: ki9
GPG Key ID: DF773B3F4A88DA86
1 changed files with 2 additions and 4 deletions

View File

@ -9,8 +9,6 @@
# 6: not root
# 7: openssl failed
CONFIG_FILE='/etc/wgapi/config'
if ! [ ${#} -eq 3 ]; then
printf 'ERROR! Invalid number of arguments to %s: %s\n' "${0}" "${*}" >>"${LOGFILE}"
@ -34,8 +32,8 @@ ipstring="${3}"
printf 'Signing SSL certs for %s.%s.%s...\n' "${hostname}" "${username}" "${TLD}" >>"${LOGFILE}"
# Make a directory for the new files
if ! sudo mkdir "${SSL_CONFIG_DIR:?}/${username:?}/${hostname:?}/" >>"${LOGFILE}" 2>/dev/null; then
printf 'Failed to create directory %s/%s/%s/\n' "${SSL_CONFIG_DIR}" "${username}" "${hostname}" >>"${LOGFILE}"
if ! res="$(sudo mkdir "${SSL_CONFIG_DIR:?}/${username:?}/${hostname:?}/")"; then
printf 'Failed to create directory %s/%s/%s/:\n%s\n' "${SSL_CONFIG_DIR}" "${username}" "${hostname}" "${res}" >>"${LOGFILE}"
exit 7
fi