forked from cisagov/Malcolm
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make sure htadmin/nginx auth files get created with correct ownership (…
- Loading branch information
Showing
4 changed files
with
18 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
HTADMIN_ENABLED=${NGINX_BASIC_AUTH:-"true"} | ||
if [[ "${NGINX_BASIC_AUTH:-true}" == "true" ]]; then | ||
|
||
if [[ ! -f /var/www/htadmin/config/config.ini ]] && [[ -f /var/www/htadmin/default/config.ini ]]; then | ||
mkdir -p /var/www/htadmin/config/ | ||
cp /var/www/htadmin/default/config.ini /var/www/htadmin/config/config.ini | ||
fi | ||
if [[ ! -f /var/www/htadmin/config/config.ini ]] && [[ -f /var/www/htadmin/default/config.ini ]]; then | ||
cp /var/www/htadmin/default/config.ini /var/www/htadmin/config/config.ini | ||
[[ -n ${PUID} ]] && chown -f ${PUID} /var/www/htadmin/config/config.ini | ||
[[ -n ${PGID} ]] && chown -f :${PGID} /var/www/htadmin/config/config.ini | ||
fi | ||
|
||
if [[ ! -f /var/www/htadmin/config/metadata ]] && [[ -f /var/www/htadmin/default/metadata ]]; then | ||
mkdir -p /var/www/htadmin/config/ | ||
cp /var/www/htadmin/default/metadata /var/www/htadmin/config/metadata | ||
fi | ||
if [[ ! -f /var/www/htadmin/config/metadata ]] && [[ -f /var/www/htadmin/default/metadata ]]; then | ||
cp /var/www/htadmin/default/metadata /var/www/htadmin/config/metadata | ||
[[ -n ${PUID} ]] && chown -f ${PUID} /var/www/htadmin/config/metadata | ||
[[ -n ${PGID} ]] && chown -f :${PGID} /var/www/htadmin/config/metadata | ||
fi | ||
|
||
if [[ "$HTADMIN_ENABLED" == "true" ]]; then | ||
sleep 10 | ||
nginx -g "daemon off;" | ||
|
||
else | ||
mkdir -p /tmp/htadmin_disabled | ||
pushd /tmp/htadmin_disabled >/dev/null 2>&1 && \ | ||
cat << EOF > index.html | ||
<html> | ||
<header><title>Basic Authentication Disabled</title></header> | ||
<body> | ||
<h1>Basic HTTP authentication has been disabled.</h1> | ||
<p>Refer to the <a href="/readme#AuthLDAP" onclick="javascript:event.target.port=443">Malcolm documentation</a> for details on LDAP authentication.</p> | ||
</body> | ||
</html> | ||
EOF | ||
python3 -m http.server 80 | ||
popd >/dev/null 2>&1 | ||
/usr/local/bin/service_check_passthrough.sh -d -s htadmin -p 80 -f http | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters