2022-11-06 17:09:55 -07:00
|
|
|
#!/bin/bash
|
|
|
|
# FILE: wgapi:back/dashboard_ssl.cgi
|
|
|
|
# DESCRIPTION: Sends SSL certs and keys to users
|
|
|
|
# ERRORS:
|
|
|
|
# 3: Bad usage
|
|
|
|
# 4: Missing config file
|
|
|
|
CONFIG_FILE='/etc/wgapi/config'
|
|
|
|
if ! [ -f "${CONFIG_FILE}" ]; then
|
|
|
|
printf 'ERROR! %s could not find %s!\n' "${0}" "${CONFIG_FILE}" >>"${LOGFILE}"
|
|
|
|
exit 4
|
|
|
|
fi; source "${CONFIG_FILE}"
|
|
|
|
|
|
|
|
case "${REQUEST_METHOD}" in
|
|
|
|
|
2022-11-06 17:29:44 -07:00
|
|
|
# Get cert
|
2022-11-06 17:09:55 -07:00
|
|
|
'GET') "${LIB_DIR}/dashboard/ssl" "${HTTP_X_REAL_IP}" "${QUERY_STRING}";;
|
|
|
|
|
|
|
|
# Bad request
|
|
|
|
*) printf 'Invalid HTTP verb' | "${LIB_DIR}/http_res" 405;;
|
|
|
|
|
|
|
|
esac
|