Luigi Santivetti | ed568d4 | 2020-05-18 00:53:17 +0100 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # apache placeholders |
| 4 | # |
| 5 | # Copyright 2019 Luigi Santivetti <luigi.santivetti@gmail.com> |
| 6 | |
| 7 | # Permission is hereby granted, free of charge, to any person obtaining a |
| 8 | # copy of this software and associated documentation files (the "Software"), |
| 9 | # to deal in the Software without restriction, including without limitation |
| 10 | # the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 11 | # and/or sell copies of the Software, and to permit persons to whom the |
| 12 | # Software is furnished to do so, subject to the following conditions: |
| 13 | |
| 14 | # The above copyright notice and this permission notice (including the next |
| 15 | # paragraph) shall be included in all copies or substantial portions of the |
| 16 | # Software. |
| 17 | |
| 18 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 21 | # ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
| 22 | # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 23 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 24 | |
| 25 | _APACHE_DKRC_SERVICE_="${module}" |
| 26 | _APACHE_DKRC_IMAGE_="${host_name}-img-${_APACHE_DKRC_SERVICE_}" |
| 27 | _APACHE_DKRC_CONTEXT_="${mod_docker_d}" |
| 28 | _APACHE_DKRC_CONTAINER_="${host_name}-con-${_APACHE_DKRC_SERVICE_}" |
| 29 | _APACHE_DKRC_FRONTEND_IP_="172.28.0.2" |
| 30 | _APACHE_DKRC_BACKEND_IP_="172.27.0.3" |
| 31 | _APACHE_DKRC_PORTS_F_="${ports_f}" |
| 32 | _APACHE_DKRC_CONF_F_="${apache2_f}" |
| 33 | _APACHE_DKRC_AVAILABLE_D_="${available_d}" |
| 34 | _APACHE_DKRC_ENABLED_D_="${enabled_d}" |
| 35 | _APACHE_DKRC_CERT_L_="${certificates_l}" |
| 36 | _APACHE_DKRC_LOG_D_="${log_d}" |
| 37 | _APACHE_DKRC_WWW_D_="${www_d}" |
| 38 | if [ "$apache_has_media" -eq 1 ]; then |
| 39 | _APACHE_HAS_MEDIA_="1" |
| 40 | _APACHE_HTML_PHOTOS_D_="${photos_d}" |
| 41 | _APACHE_HTML_VIDEOS_D_="${videos_d}" |
| 42 | else |
| 43 | _APACHE_HAS_MEDIA_="0" |
| 44 | _APACHE_HTML_PHOTOS_D_="" |
| 45 | _APACHE_HTML_VIDEOS_D_="" |
| 46 | fi |
| 47 | _APACHE_DKRC_ROOTFS_="${mod_rootfs_d}" |
| 48 | _APACHE_DKRC_DOCKERFILE_="Dockerfile" |
| 49 | _APACHE_VHOST_HTTP_LOG_F_="/var/log/apache2/vhost-http-log.txt" |
| 50 | _APACHE_SSL_LOG_F_="/var/log/apache2/vhost-https-log.txt" |
| 51 | _APACHE_SSL_LOG_LEVEL_REL_="info ssl:info" |
| 52 | _APACHE_SSL_LOG_LEVEL_DBG_="trace8 ssl:trace8" |
| 53 | _APACHE_CON_SSL_D_="/etc/letsencrypt" |
| 54 | if [ "$apache_has_dummy_certs" -eq 1 ]; then |
| 55 | _APACHE_CON_SSL_CONF_F_="${_APACHE_CON_SSL_D_}/${host_name}.conf" |
| 56 | _APACHE_CON_SSL_CERT_F_="${_APACHE_CON_SSL_D_}/${host_name}.crt" |
| 57 | _APACHE_CON_SSL_KEY_F_="${_APACHE_CON_SSL_D_}/${host_name}.key" |
| 58 | else |
| 59 | _APACHE_CON_SSL_CONF_F_="${_APACHE_CON_SSL_D_}/options-ssl-apache.conf" |
| 60 | _APACHE_CON_SSL_CERT_F_="${_APACHE_CON_SSL_D_}/live/${host_name}/fullchain.pem" |
| 61 | _APACHE_CON_SSL_KEY_F_="${_APACHE_CON_SSL_D_}/live/${host_name}/privkey.pem" |
| 62 | fi |
| 63 | _APACHE_VHOST_GERRIT_LOG_F_="/var/log/apache2/vhost-gerrit-log.txt" |
| 64 | _APACHE_VHOST_GERRIT_LOG_LEVEL_REL_="info" |
| 65 | _APACHE_VHOST_GERRIT_LOG_LEVEL_DBG_="trace8" |
| 66 | _APACHE_DOCUMENT_ROOT_D_="/var/www/html" |
| 67 | _APACHE_PRIVATE_PATH_="/private" |
| 68 | _APACHE_HTTP_PORT_="80" |
| 69 | _APACHE_HTTPS_PORT_="443" |
| 70 | _APACHE_GERRIT_PROXY_PORT_="8081" |
| 71 | _APACHE_SERVER_NAME_="${host_name}" |
| 72 | _APACHE_SERVER_ALIAS_="www.${_APACHE_SERVER_NAME_}" |
| 73 | _APACHE_CON_SSL_MYSQL_D_="/etc/mysql_ssl" |
| 74 | _APACHE_CON_SSL_MYSQL_CERT_F_="${_APACHE_CON_SSL_MYSQL_D_}/" |
| 75 | _APACHE_CON_SSL_MYSQL_CERT_F_+="$(basename "${_MYSQL_SSL_CLIENT_CERT_F_}")" |
| 76 | _APACHE_CON_SSL_MYSQL_KEY_F_="${_APACHE_CON_SSL_MYSQL_D_}/" |
| 77 | _APACHE_CON_SSL_MYSQL_KEY_F_+="$(basename "${_MYSQL_SSL_CLIENT_KEY_F_}")" |
| 78 | _APACHE_CON_SSL_MYSQL_CA_F_="${_APACHE_CON_SSL_MYSQL_D_}/" |
| 79 | _APACHE_CON_SSL_MYSQL_CA_F_+="$(basename "${_MYSQL_SSL_CLIENT_CA_F_}")" |
| 80 | _APACHE_EXT_AUTH_F_="${http_authentication_bang_f}" |
| 81 | _APACHE_EXT_AUTH_KEYWORD_="bash_auth" |
| 82 | _APACHE_CON_EXT_AUTH_F_="/var/www/http_authentication" |
| 83 | if [ "${mod_mode}" = "${release}" ]; then |
| 84 | _APACHE_SSL_LOG_LEVEL_="${_APACHE_SSL_LOG_LEVEL_REL_}" |
| 85 | _APACHE_VHOST_GERRIT_LOG_LEVEL_="${_APACHE_VHOST_GERRIT_LOG_LEVEL_REL_}" |
| 86 | _APACHE_MOD_AUTHNZ_DEBUG_FLAG_="/dev/null" |
| 87 | _APACHE_CODE_IGNITER_ENV_="production" |
| 88 | else |
| 89 | _APACHE_SSL_LOG_LEVEL_="${_APACHE_SSL_LOG_LEVEL_DBG_}" |
| 90 | _APACHE_VHOST_GERRIT_LOG_LEVEL_="${_APACHE_VHOST_GERRIT_LOG_LEVEL_DBG_}" |
| 91 | _APACHE_MOD_AUTHNZ_DEBUG_FLAG_="/dev/stderr --verbose" |
| 92 | _APACHE_CODE_IGNITER_ENV_="development" |
| 93 | fi |
| 94 | _APACHE_MOD_AUTHNZ_EXTERNAL_D_="$(basename "${mod_authnz_external_d}")" |
| 95 | _APACHE_MOD_AUTHNZ_SUCCESS_CODE_="204" |
| 96 | _APACHE_MOD_AUTHNZ_H_ACCEPT_="Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" |
| 97 | _APACHE_MOD_AUTHNZ_H_CONTENT_="Content-Type: application/x-www-form-urlencoded" |
| 98 | _APACHE_MOD_AUTHNZ_LOCALHOST_="127.0.0.1" |