Commit f2a0b1c2 authored by Baptiste Mesta's avatar Baptiste Mesta Committed by GitHub
Browse files

fix(docker): do not print sensitive information on docker start (#356)

Only print useful configuration information by not passwords

Closes [RUNTIME-326](https://bonitasoft.atlassian.net/browse/RUNTIME-326)
parent 5aaa8a3c
#!/bin/bash #!/bin/bash
set -x
# Path to deploy the Tomcat Bundle # Path to deploy the Tomcat Bundle
BONITA_PATH=${BONITA_PATH:-/opt/bonita} BONITA_PATH=${BONITA_PATH:-/opt/bonita}
# Templates directory # Templates directory
...@@ -70,6 +71,7 @@ fi ...@@ -70,6 +71,7 @@ fi
if [ "${ENSURE_DB_CHECK_AND_CREATION}" = 'true' ] if [ "${ENSURE_DB_CHECK_AND_CREATION}" = 'true' ]
then then
echo "Creating (if missing) database and users"
# load SQL functions # load SQL functions
. ${BONITA_FILES}/functions.sh . ${BONITA_FILES}/functions.sh
case "${DB_VENDOR}" in case "${DB_VENDOR}" in
...@@ -112,10 +114,15 @@ fi ...@@ -112,10 +114,15 @@ fi
# if required, deactivate HTTP API by updating bonita.war with proper web.xml # if required, deactivate HTTP API by updating bonita.war with proper web.xml
if [ "$HTTP_API" = 'false' ] if [ "$HTTP_API" = 'false' ]
then then
echo "Unsecured HTTP API: Activated"
cd ${BONITA_FILES}/ cd ${BONITA_FILES}/
zip ${BONITA_PATH}/BonitaCommunity-${BRANDING_VERSION}/server/webapps/bonita.war WEB-INF/web.xml zip ${BONITA_PATH}/BonitaCommunity-${BRANDING_VERSION}/server/webapps/bonita.war WEB-INF/web.xml
else
echo "Unsecured HTTP API: NOT Activated"
fi fi
echo "Platform administrator username is: ${PLATFORM_LOGIN}"
echo "Tenant technical username is: ${TENANT_LOGIN}"
# replace variables # replace variables
find ${BONITA_PATH}/BonitaCommunity-${BRANDING_VERSION}/setup/platform_conf/initial -name "*.properties" | xargs -n10 sed -i \ find ${BONITA_PATH}/BonitaCommunity-${BRANDING_VERSION}/setup/platform_conf/initial -name "*.properties" | xargs -n10 sed -i \
-e 's/^#userName\s*=.*/'"userName=${TENANT_LOGIN}"'/' \ -e 's/^#userName\s*=.*/'"userName=${TENANT_LOGIN}"'/' \
...@@ -125,6 +132,7 @@ find ${BONITA_PATH}/BonitaCommunity-${BRANDING_VERSION}/setup/platform_conf/init ...@@ -125,6 +132,7 @@ find ${BONITA_PATH}/BonitaCommunity-${BRANDING_VERSION}/setup/platform_conf/init
-e 's/^#platformAdminUsername\s*=.*/'"platformAdminUsername=${PLATFORM_LOGIN}"'/' \ -e 's/^#platformAdminUsername\s*=.*/'"platformAdminUsername=${PLATFORM_LOGIN}"'/' \
-e 's/^#platformAdminPassword\s*=.*/'"platformAdminPassword=${PLATFORM_PASSWORD}"'/' -e 's/^#platformAdminPassword\s*=.*/'"platformAdminPassword=${PLATFORM_PASSWORD}"'/'
echo "Using JAVA_OPTS: ${JAVA_OPTS}"
sed -i -e 's/{{JAVA_OPTS}}/'"${JAVA_OPTS}"'/' ${BONITA_PATH}/BonitaCommunity-${BRANDING_VERSION}/setup/tomcat-templates/setenv.sh sed -i -e 's/{{JAVA_OPTS}}/'"${JAVA_OPTS}"'/' ${BONITA_PATH}/BonitaCommunity-${BRANDING_VERSION}/setup/tomcat-templates/setenv.sh
if [ -n "$JDBC_DRIVER" ] if [ -n "$JDBC_DRIVER" ]
...@@ -137,6 +145,14 @@ then ...@@ -137,6 +145,14 @@ then
fi fi
fi fi
echo "Using DB_VENDOR: ${DB_VENDOR}"
echo "Using DB_USER: ${DB_USER}"
echo "Using DB_NAME: ${DB_NAME}"
echo "Using DB_HOST: ${DB_HOST}"
echo "Using DB_PORT: ${DB_PORT}"
echo "Using BIZ_DB_USER: ${BIZ_DB_USER}"
echo "Using BIZ_DB_NAME: ${BIZ_DB_NAME}"
sed -e 's/{{DB_VENDOR}}/'"${DB_VENDOR}"'/' \ sed -e 's/{{DB_VENDOR}}/'"${DB_VENDOR}"'/' \
-e 's/{{DB_USER}}/'"${DB_USER}"'/' \ -e 's/{{DB_USER}}/'"${DB_USER}"'/' \
-e 's/{{DB_PASS}}/'"${DB_PASS}"'/' \ -e 's/{{DB_PASS}}/'"${DB_PASS}"'/' \
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment