fix: 🐛 Fixed test order

master
Keith Irwin 2023-12-30 19:48:12 -07:00
parent 12b2c4c1ae
commit 59692c7142
Signed by: ki9
GPG Key ID: DF773B3F4A88DA86
1 changed files with 6 additions and 5 deletions

View File

@ -11,11 +11,7 @@ ip="${1}"; qs="$(<<<"${2}" tr '&' '\n' | sed 's/?//')"
hostname="$(<<<"${qs}" grep -oP 'host=(.*)' | sed 's/^host=//' | xargs)"
type="$(<<<"${qs}" grep -oP 'type=(.*)' | sed 's/^type=//' | xargs)"
# Make sure type is 'cert' or 'key'
if [ "${type}" != 'cert' ] && [ "${type}" != 'key' ]; then
printf 'Invalid type: %s\n' "${type}" | tee >(cat 1>&2) | /usr/lib/wagon/http_res 400; exit
fi
# Check args exist
if ! file="${hostname:?}/${type:?}.pem"; then
printf 'ERROR! Hostname "%s" or type "%s" missing!\n' "${hostname}" "${type}" >&2
printf 'Hostname or type missing!\n' | /usr/lib/wagon/http_res 400; exit
@ -23,6 +19,11 @@ else
printf 'User %s requested SSL file %s\n' "${ip}" "${file}" >&2
fi
# Make sure type is 'cert' or 'key'
if [ "${type}" != 'cert' ] && [ "${type}" != 'key' ]; then
printf 'Invalid type: %s\n' "${type}" | tee >(cat 1>&2) | /usr/lib/wagon/http_res 400; exit
fi
# Get username
if ! domain="$(/usr/lib/wagon/ns_lookup_rdns "${ip}")"; then
printf 'ERROR! Failed to lookup domain from user IP %s\n' "${ip}" | tee >(cat 1>&2) | /usr/lib/wagon/http_res 500