Bugfix/opensearch dashboards passwd generation (#213)

This commit is contained in:
Elbakyan Shirak 2024-04-23 11:15:44 +04:00 committed by GitHub
parent 45859997b1
commit d92ac9c0ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -727,8 +727,18 @@ setup_dashboards() {
DASHBOARDS_CONF_PATH="/etc/opensearch-dashboards/opensearch_dashboards.yml"
if [[ -n ${DASHBOARDS_PASSWORD} ]]; then
echo "${DASHBOARDS_PASSWORD}" > ${APP_DIR}/.private/dashboards-password
elif [[ -f ${APP_DIR}/.private/dashboards-password ]]; then
DASHBOARDS_PASSWORD=$(cat ${APP_DIR}/.private/dashboards-password);
else
DASHBOARDS_PASSWORD=$(echo "$(cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 20)" | tee ${APP_DIR}/.private/dashboards-password)
fi
chmod o-rwx $APP_DIR/.private/dashboards-password
# configure login&pass for Dashboards, used by Nginx HTTP Basic Authentication
echo "${DASHBOARDS_USERNAME:-"onlyoffice"}:$(openssl passwd -6 -stdin <<< "${DASHBOARDS_PASSWORD:-"onlyoffice"}")" > /etc/openresty/.htpasswd_dashboards
echo "${DASHBOARDS_USERNAME:-"onlyoffice"}:$(openssl passwd -6 -stdin <<< "${DASHBOARDS_PASSWORD}")" > /etc/openresty/.htpasswd_dashboards
chown nginx:nginx /etc/openresty/.htpasswd_dashboards
# enable connection with opensearch