From 867997b5884901db751a8213cf3610a485b513ff Mon Sep 17 00:00:00 2001 From: Disassembler Date: Fri, 10 Apr 2020 17:57:42 +0200 Subject: [PATCH] Include DOMAIN directly in HOST envvar for update-conf.sh, update add-ca-cert --- apk/vmmgr | 2 +- lxc-apps/ckan/ckan-datapusher.image.d/bin/add-ca-cert | 2 +- lxc-apps/ckan/install/datapusher_conf/add-ca-cert.env | 2 +- lxc-apps/ckan/install/update-conf.sh | 11 +++++++---- lxc-apps/mifosx/install/update-conf.sh | 2 +- lxc-apps/motech/install/update-conf.sh | 6 +++--- .../opendatakit/install/odkbuild_conf/add-ca-cert.env | 2 +- lxc-apps/opendatakit/install/update-conf.sh | 8 +++++++- .../opendatakit-build.image.d/bin/add-ca-cert | 2 +- lxc-apps/pandora/install/update-conf.sh | 6 +++--- lxc-apps/sahana-demo/install/update-conf.sh | 6 +++--- lxc-apps/sahana/install/update-conf.sh | 6 +++--- lxc-apps/sambro/install/update-conf.sh | 6 +++--- lxc-apps/ushahidi/install/update-conf.sh | 8 ++++---- 14 files changed, 39 insertions(+), 30 deletions(-) diff --git a/apk/vmmgr b/apk/vmmgr index 67f7169..4989d2f 160000 --- a/apk/vmmgr +++ b/apk/vmmgr @@ -1 +1 @@ -Subproject commit 67f71697fb817348c40e0bebe1434db898dd6d0a +Subproject commit 4989d2f87f148594896a0f9dde2de8844d774efa diff --git a/lxc-apps/ckan/ckan-datapusher.image.d/bin/add-ca-cert b/lxc-apps/ckan/ckan-datapusher.image.d/bin/add-ca-cert index bbf8479..49cd105 100755 --- a/lxc-apps/ckan/ckan-datapusher.image.d/bin/add-ca-cert +++ b/lxc-apps/ckan/ckan-datapusher.image.d/bin/add-ca-cert @@ -5,7 +5,7 @@ import ssl with open('/etc/ckan-datapusher/add-ca-cert.env') as f: env = dict(tuple(line.split('=')) for line in f.read().splitlines()) -cert = ssl.get_server_certificate((env['DOMAIN'], env['PORT'])) +cert = ssl.get_server_certificate((env['HOST'], env['PORT'])) with open('/usr/lib/python2.7/site-packages/requests/cacert.pem', 'a') as f: f.write(cert) diff --git a/lxc-apps/ckan/install/datapusher_conf/add-ca-cert.env b/lxc-apps/ckan/install/datapusher_conf/add-ca-cert.env index 4ee453b..41eb4d4 100644 --- a/lxc-apps/ckan/install/datapusher_conf/add-ca-cert.env +++ b/lxc-apps/ckan/install/datapusher_conf/add-ca-cert.env @@ -1,2 +1,2 @@ -DOMAIN=ckan.spotter.vm +HOST=ckan.spotter.vm PORT=443 diff --git a/lxc-apps/ckan/install/update-conf.sh b/lxc-apps/ckan/install/update-conf.sh index 6fe97e8..25c2ed4 100755 --- a/lxc-apps/ckan/install/update-conf.sh +++ b/lxc-apps/ckan/install/update-conf.sh @@ -5,13 +5,16 @@ DATAPUSHER_CONF="${VOLUMES_DIR}/ckan/datapusher_conf" CKAN_CONF="${VOLUMES_DIR}/ckan/ckan_conf" # Variables -HOST="${HOST}.${DOMAIN}" -[ "${PORT}" != "443" ] && HOST="${HOST}:${PORT}" +HTTP_HOST="${HOST}" +[ "${PORT}" != "443" ] && HTTP_HOST="${HTTP_HOST}:${PORT}" # Replacements -sed -i "s|\(^ckan\.site_url = \).*|\1https://${HOST}|" ${CKAN_CONF}/ckan.ini - +sed -i "s|\(^ckan\.site_url = \).*|\1https://${HTTP_HOST}|" ${CKAN_CONF}/ckan.ini sed -i "s|\(^smtp\.mail_from = \).*|\1${EMAIL}|" ${CKAN_CONF}/ckan.ini sed -i "s|\(^ckanext\.geoview\.gapi_key = \).*|\1${GMAPS_API_KEY}|" ${CKAN_CONF}/ckan.ini +cat <${DATAPUSHER_CONF}/add-ca-cert.env +HOST=${HOST} +PORT=${PORT} +EOF sed -i "s|\(^FROM_EMAIL = \).*|\1'${EMAIL}'|" ${DATAPUSHER_CONF}/datapusher_settings.py diff --git a/lxc-apps/mifosx/install/update-conf.sh b/lxc-apps/mifosx/install/update-conf.sh index f8a0dd6..7ce781b 100755 --- a/lxc-apps/mifosx/install/update-conf.sh +++ b/lxc-apps/mifosx/install/update-conf.sh @@ -4,7 +4,7 @@ MIFOSX_CONF="${VOLUMES_DIR}/mifosx/mifosx_conf" # Replacements -sed -i "s|\(^\s\+proxyName=\).*|\1\"${HOST}.${DOMAIN}\"|" ${MIFOSX_CONF}/server.xml +sed -i "s|\(^\s\+proxyName=\).*|\1\"${HOST}\"|" ${MIFOSX_CONF}/server.xml sed -i "s|\(^\s\+proxyPort=\).*|\1\"${PORT}\"|" ${MIFOSX_CONF}/server.xml QUERY="UPDATE \`c_external_service_properties\` SET \`value\` = '${EMAIL}' WHERE \`external_service_id\` = 2 and \`name\` LIKE 'username'" diff --git a/lxc-apps/motech/install/update-conf.sh b/lxc-apps/motech/install/update-conf.sh index d4aabca..9c65b73 100755 --- a/lxc-apps/motech/install/update-conf.sh +++ b/lxc-apps/motech/install/update-conf.sh @@ -4,8 +4,8 @@ MOTECH_CONF="${VOLUMES_DIR}/motech/motech_conf" # Variables -HOST="${HOST}.${DOMAIN}" -[ "${PORT}" != "443" ] && HOST="${HOST}:${PORT}" +HTTP_HOST="${HOST}" +[ "${PORT}" != "443" ] && HTTP_HOST="${HTTP_HOST}:${PORT}" # Replacements -sed -i "s|\(^server\.url=\).*|\1https://${HOST}|" ${MOTECH_CONF}/config/motech-settings.properties +sed -i "s|\(^server\.url=\).*|\1https://${HTTP_HOST}|" ${MOTECH_CONF}/config/motech-settings.properties diff --git a/lxc-apps/opendatakit/install/odkbuild_conf/add-ca-cert.env b/lxc-apps/opendatakit/install/odkbuild_conf/add-ca-cert.env index 89a4ad1..3f1a860 100644 --- a/lxc-apps/opendatakit/install/odkbuild_conf/add-ca-cert.env +++ b/lxc-apps/opendatakit/install/odkbuild_conf/add-ca-cert.env @@ -1,2 +1,2 @@ -DOMAIN=odk.spotter.vm +HOST=odk.spotter.vm PORT=443 diff --git a/lxc-apps/opendatakit/install/update-conf.sh b/lxc-apps/opendatakit/install/update-conf.sh index 7e19b88..f668aa4 100755 --- a/lxc-apps/opendatakit/install/update-conf.sh +++ b/lxc-apps/opendatakit/install/update-conf.sh @@ -2,8 +2,14 @@ # Volumes ODK_CONF="${VOLUMES_DIR}/opendatakit/odk_conf" +ODKBUILD_CONF="${VOLUMES_DIR}/opendatakit/odkbuild_conf" # Replacements -sed -i "s|\(^\s\+proxyName=\).*|\1\"${HOST}.${DOMAIN}\"|" ${ODK_CONF}/server.xml +sed -i "s|\(^\s\+proxyName=\).*|\1\"${HOST}\"|" ${ODK_CONF}/server.xml sed -i "s|\(^\s\+proxyPort=\).*|\1\"${PORT}\"|" ${ODK_CONF}/server.xml sed -i "s|\(^security\.server\.securePort=\).*|\1${PORT}|" ${ODK_CONF}/security.properties + +cat <${ODKBUILD_CONF}/add-ca-cert.env +HOST=${HOST} +PORT=${PORT} +EOF diff --git a/lxc-apps/opendatakit/opendatakit-build.image.d/bin/add-ca-cert b/lxc-apps/opendatakit/opendatakit-build.image.d/bin/add-ca-cert index 33ca466..0648e5f 100755 --- a/lxc-apps/opendatakit/opendatakit-build.image.d/bin/add-ca-cert +++ b/lxc-apps/opendatakit/opendatakit-build.image.d/bin/add-ca-cert @@ -2,5 +2,5 @@ . /srv/opendatakit-build/add-ca-cert.env -true | openssl s_client -connect ${DOMAIN}:${PORT} | openssl x509 -out /usr/local/share/ca-certificates/opendatakit.crt +true | openssl s_client -connect ${HOST}:${PORT} | openssl x509 -out /usr/local/share/ca-certificates/opendatakit.crt update-ca-certificates diff --git a/lxc-apps/pandora/install/update-conf.sh b/lxc-apps/pandora/install/update-conf.sh index 3672d8d..5164b88 100755 --- a/lxc-apps/pandora/install/update-conf.sh +++ b/lxc-apps/pandora/install/update-conf.sh @@ -4,9 +4,9 @@ PANDORA_CONF="${VOLUMES_DIR}/pandora/pandora_conf" # Variables -HOST="${HOST}.${DOMAIN}" -[ "${PORT}" != "443" ] && HOST="${HOST}:${PORT}" +HTTP_HOST="${HOST}" +[ "${PORT}" != "443" ] && HTTP_HOST="${HTTP_HOST}:${PORT}" # Replacements -sed -i "s|\(^\s\+\"url\": \).*|\1\"${HOST}\"|" ${PANDORA_CONF}/config.jsonc +sed -i "s|\(^\s\+\"url\": \).*|\1\"${HTTP_HOST}\"|" ${PANDORA_CONF}/config.jsonc sed -i "s|\(^GOOGLE_API_KEY = \).*|\1'${GMAPS_API_KEY}'|" ${PANDORA_CONF}/local_settings.py diff --git a/lxc-apps/sahana-demo/install/update-conf.sh b/lxc-apps/sahana-demo/install/update-conf.sh index ea76ff1..0b53a62 100755 --- a/lxc-apps/sahana-demo/install/update-conf.sh +++ b/lxc-apps/sahana-demo/install/update-conf.sh @@ -4,11 +4,11 @@ SAHANA_CONF="${VOLUMES_DIR}/sahana-demo/sahana_conf" # Variables -HOST="${HOST}.${DOMAIN}" -[ "${PORT}" != "443" ] && HOST="${HOST}:${PORT}" +HTTP_HOST="${HOST}" +[ "${PORT}" != "443" ] && HTTP_HOST="${HTTP_HOST}:${PORT}" # Replacements -sed -i "s|\(^settings\.base\.public_url = \).*|\1\"https://${HOST}\"|" ${SAHANA_CONF}/000_config.py +sed -i "s|\(^settings\.base\.public_url = \).*|\1\"https://${HTTP_HOST}\"|" ${SAHANA_CONF}/000_config.py sed -i "s|\(^settings\.mail\.sender = \).*|\1\"${EMAIL}\"|" ${SAHANA_CONF}/000_config.py sed -i "s|\(^settings\.mail\.approver = \).*|\1\"${EMAIL}\"|" ${SAHANA_CONF}/000_config.py sed -i "s|\(^settings\.gis\.api_google = \).*|\1\"${GMAPS_API_KEY}\"|" ${SAHANA_CONF}/000_config.py diff --git a/lxc-apps/sahana/install/update-conf.sh b/lxc-apps/sahana/install/update-conf.sh index f65da9a..862618d 100755 --- a/lxc-apps/sahana/install/update-conf.sh +++ b/lxc-apps/sahana/install/update-conf.sh @@ -4,11 +4,11 @@ SAHANA_CONF="${VOLUMES_DIR}/sahana/sahana_conf" # Variables -HOST="${HOST}.${DOMAIN}" -[ "${PORT}" != "443" ] && HOST="${HOST}:${PORT}" +HTTP_HOST="${HOST}" +[ "${PORT}" != "443" ] && HTTP_HOST="${HTTP_HOST}:${PORT}" # Replacements -sed -i "s|\(^settings\.base\.public_url = \).*|\1\"https://${HOST}\"|" ${SAHANA_CONF}/000_config.py +sed -i "s|\(^settings\.base\.public_url = \).*|\1\"https://${HTTP_HOST}\"|" ${SAHANA_CONF}/000_config.py sed -i "s|\(^settings\.mail\.sender = \).*|\1\"${EMAIL}\"|" ${SAHANA_CONF}/000_config.py sed -i "s|\(^settings\.mail\.approver = \).*|\1\"${EMAIL}\"|" ${SAHANA_CONF}/000_config.py sed -i "s|\(^settings\.gis\.api_google = \).*|\1\"${GMAPS_API_KEY}\"|" ${SAHANA_CONF}/000_config.py diff --git a/lxc-apps/sambro/install/update-conf.sh b/lxc-apps/sambro/install/update-conf.sh index 7d73047..7f70f24 100755 --- a/lxc-apps/sambro/install/update-conf.sh +++ b/lxc-apps/sambro/install/update-conf.sh @@ -4,11 +4,11 @@ SAHANA_CONF="${VOLUMES_DIR}/sambro/sahana_conf" # Variables -HOST="${HOST}.${DOMAIN}" -[ "${PORT}" != "443" ] && HOST="${HOST}:${PORT}" +HTTP_HOST="${HOST}" +[ "${PORT}" != "443" ] && HTTP_HOST="${HTTP_HOST}:${PORT}" # Replacements -sed -i "s|\(^settings\.base\.public_url = \).*|\1\"https://${HOST}\"|" ${SAHANA_CONF}/000_config.py +sed -i "s|\(^settings\.base\.public_url = \).*|\1\"https://${HTTP_HOST}\"|" ${SAHANA_CONF}/000_config.py sed -i "s|\(^settings\.mail\.sender = \).*|\1\"${EMAIL}\"|" ${SAHANA_CONF}/000_config.py sed -i "s|\(^settings\.mail\.approver = \).*|\1\"${EMAIL}\"|" ${SAHANA_CONF}/000_config.py sed -i "s|\(^settings\.gis\.api_google = \).*|\1\"${GMAPS_API_KEY}\"|" ${SAHANA_CONF}/000_config.py diff --git a/lxc-apps/ushahidi/install/update-conf.sh b/lxc-apps/ushahidi/install/update-conf.sh index 02eb4e7..e01071a 100755 --- a/lxc-apps/ushahidi/install/update-conf.sh +++ b/lxc-apps/ushahidi/install/update-conf.sh @@ -4,12 +4,12 @@ USHAHIDI_CONF="${VOLUMES_DIR}/ushahidi/ushahidi_conf" # Variables -HOST="${HOST}.${DOMAIN}" -[ "${PORT}" != "443" ] && HOST="${HOST}:${PORT}" +HTTP_HOST="${HOST}" +[ "${PORT}" != "443" ] && HTTP_HOST="${HTTP_HOST}:${PORT}" # Replacements -sed -i "s|\(^\s\+\"backend_url\": \).*|\1\"https://${HOST}/platform\",|" ${USHAHIDI_CONF}/config.json -API_URL="\"https:\\\/\\\/${HOST}\\\/platform\\\/api\\\/v3\\\/config\\\/data-provider\"" +sed -i "s|\(^\s\+\"backend_url\": \).*|\1\"https://${HTTP_HOST}/platform\",|" ${USHAHIDI_CONF}/config.json +API_URL="\"https:\\\/\\\/${HTTP_HOST}\\\/platform\\\/api\\\/v3\\\/config\\\/data-provider\"" QUERY="UPDATE \`config\` SET \`config_value\` = '${API_URL}' WHERE \`group_name\` LIKE 'data-provider' AND \`config_key\` LIKE 'url'" spoc-container exec ushahidi-mariadb -- mysql -e "${QUERY}" ushahidi