Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | set -o pipefail |
| 4 | |
| 5 | if [[ "$(uname -r)" =~ ^4\.15\.0-60 ]]; then |
| 6 | echo "DO NOT RUN mailcow ON THIS UBUNTU KERNEL!"; |
| 7 | echo "Please update to 5.x or use another distribution." |
| 8 | exit 1 |
| 9 | fi |
| 10 | |
| 11 | if [[ "$(uname -r)" =~ ^4\.4\. ]]; then |
| 12 | if grep -q Ubuntu <<< $(uname -a); then |
| 13 | echo "DO NOT RUN mailcow ON THIS UBUNTU KERNEL!"; |
| 14 | echo "Please update to linux-generic-hwe-16.04 by running \"apt-get install --install-recommends linux-generic-hwe-16.04\"" |
Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 15 | exit 1 |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 16 | fi |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 17 | fi |
| 18 | |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 19 | if grep --help 2>&1 | head -n 1 | grep -q -i "busybox"; then echo "BusyBox grep detected, please install gnu grep, \"apk add --no-cache --upgrade grep\""; exit 1; fi |
| 20 | # This will also cover sort |
| 21 | if cp --help 2>&1 | head -n 1 | grep -q -i "busybox"; then echo "BusyBox cp detected, please install coreutils, \"apk add --no-cache --upgrade coreutils\""; exit 1; fi |
| 22 | if sed --help 2>&1 | head -n 1 | grep -q -i "busybox"; then echo "BusyBox sed detected, please install gnu sed, \"apk add --no-cache --upgrade sed\""; exit 1; fi |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 23 | |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 24 | for bin in openssl curl docker git awk sha1sum; do |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 25 | if [[ -z $(which ${bin}) ]]; then echo "Cannot find ${bin}, exiting..."; exit 1; fi |
| 26 | done |
| 27 | |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 28 | if docker compose > /dev/null 2>&1; then |
| 29 | if docker compose version --short | grep "^2." > /dev/null 2>&1; then |
| 30 | COMPOSE_VERSION=native |
| 31 | echo -e "\e[31mFound Docker Compose Plugin (native).\e[0m" |
| 32 | echo -e "\e[31mSetting the DOCKER_COMPOSE_VERSION Variable to native\e[0m" |
| 33 | sleep 2 |
| 34 | echo -e "\e[33mNotice: You´ll have to update this Compose Version via your Package Manager manually!\e[0m" |
| 35 | else |
| 36 | echo -e "\e[31mCannot find Docker Compose with a Version Higher than 2.X.X.\e[0m" |
| 37 | echo -e "\e[31mPlease update/install it manually regarding to this doc site: https://mailcow.github.io/mailcow-dockerized-docs/i_u_m/i_u_m_install/\e[0m" |
| 38 | exit 1 |
| 39 | fi |
| 40 | elif docker-compose > /dev/null 2>&1; then |
| 41 | if ! [[ $(alias docker-compose 2> /dev/null) ]] ; then |
| 42 | if docker-compose version --short | grep "^2." > /dev/null 2>&1; then |
| 43 | COMPOSE_VERSION=standalone |
| 44 | echo -e "\e[31mFound Docker Compose Standalone.\e[0m" |
| 45 | echo -e "\e[31mSetting the DOCKER_COMPOSE_VERSION Variable to standalone\e[0m" |
| 46 | sleep 2 |
| 47 | echo -e "\e[33mNotice: For an automatic update of docker-compose please use the update_compose.sh scripts located at the helper-scripts folder.\e[0m" |
| 48 | else |
| 49 | echo -e "\e[31mCannot find Docker Compose with a Version Higher than 2.X.X.\e[0m" |
| 50 | echo -e "\e[31mPlease update/install manually regarding to this doc site: https://mailcow.github.io/mailcow-dockerized-docs/i_u_m/i_u_m_install/\e[0m" |
| 51 | exit 1 |
| 52 | fi |
| 53 | fi |
| 54 | |
| 55 | else |
| 56 | echo -e "\e[31mCannot find Docker Compose.\e[0m" |
| 57 | echo -e "\e[31mPlease install it regarding to this doc site: https://mailcow.github.io/mailcow-dockerized-docs/i_u_m/i_u_m_install/\e[0m" |
| 58 | exit 1 |
| 59 | fi |
| 60 | |
| 61 | |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 62 | if [ -f mailcow.conf ]; then |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 63 | read -r -p "A config file exists and will be overwritten, are you sure you want to continue? [y/N] " response |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 64 | case $response in |
| 65 | [yY][eE][sS]|[yY]) |
| 66 | mv mailcow.conf mailcow.conf_backup |
| 67 | chmod 600 mailcow.conf_backup |
| 68 | ;; |
| 69 | *) |
| 70 | exit 1 |
| 71 | ;; |
| 72 | esac |
| 73 | fi |
| 74 | |
| 75 | echo "Press enter to confirm the detected value '[value]' where applicable or enter a custom value." |
| 76 | while [ -z "${MAILCOW_HOSTNAME}" ]; do |
| 77 | read -p "Mail server hostname (FQDN) - this is not your mail domain, but your mail servers hostname: " -e MAILCOW_HOSTNAME |
| 78 | DOTS=${MAILCOW_HOSTNAME//[^.]}; |
| 79 | if [ ${#DOTS} -lt 2 ] && [ ! -z ${MAILCOW_HOSTNAME} ]; then |
| 80 | echo "${MAILCOW_HOSTNAME} is not a FQDN" |
| 81 | MAILCOW_HOSTNAME= |
| 82 | fi |
| 83 | done |
| 84 | |
| 85 | if [ -a /etc/timezone ]; then |
| 86 | DETECTED_TZ=$(cat /etc/timezone) |
| 87 | elif [ -a /etc/localtime ]; then |
| 88 | DETECTED_TZ=$(readlink /etc/localtime|sed -n 's|^.*zoneinfo/||p') |
| 89 | fi |
| 90 | |
| 91 | while [ -z "${MAILCOW_TZ}" ]; do |
| 92 | if [ -z "${DETECTED_TZ}" ]; then |
| 93 | read -p "Timezone: " -e MAILCOW_TZ |
| 94 | else |
| 95 | read -p "Timezone [${DETECTED_TZ}]: " -e MAILCOW_TZ |
| 96 | [ -z "${MAILCOW_TZ}" ] && MAILCOW_TZ=${DETECTED_TZ} |
| 97 | fi |
| 98 | done |
| 99 | |
| 100 | MEM_TOTAL=$(awk '/MemTotal/ {print $2}' /proc/meminfo) |
| 101 | |
| 102 | if [ ${MEM_TOTAL} -le "2621440" ]; then |
| 103 | echo "Installed memory is <= 2.5 GiB. It is recommended to disable ClamAV to prevent out-of-memory situations." |
| 104 | echo "ClamAV can be re-enabled by setting SKIP_CLAMD=n in mailcow.conf." |
| 105 | read -r -p "Do you want to disable ClamAV now? [Y/n] " response |
| 106 | case $response in |
| 107 | [nN][oO]|[nN]) |
| 108 | SKIP_CLAMD=n |
| 109 | ;; |
| 110 | *) |
| 111 | SKIP_CLAMD=y |
| 112 | ;; |
| 113 | esac |
| 114 | else |
| 115 | SKIP_CLAMD=n |
| 116 | fi |
| 117 | |
| 118 | if [ ${MEM_TOTAL} -le "2097152" ]; then |
| 119 | echo "Disabling Solr on low-memory system." |
| 120 | SKIP_SOLR=y |
| 121 | elif [ ${MEM_TOTAL} -le "3670016" ]; then |
| 122 | echo "Installed memory is <= 3.5 GiB. It is recommended to disable Solr to prevent out-of-memory situations." |
| 123 | echo "Solr is a prone to run OOM and should be monitored. The default Solr heap size is 1024 MiB and should be set in mailcow.conf according to your expected load." |
| 124 | echo "Solr can be re-enabled by setting SKIP_SOLR=n in mailcow.conf but will refuse to start with less than 2 GB total memory." |
| 125 | read -r -p "Do you want to disable Solr now? [Y/n] " response |
| 126 | case $response in |
| 127 | [nN][oO]|[nN]) |
| 128 | SKIP_SOLR=n |
| 129 | ;; |
| 130 | *) |
| 131 | SKIP_SOLR=y |
| 132 | ;; |
| 133 | esac |
| 134 | else |
| 135 | SKIP_SOLR=n |
| 136 | fi |
| 137 | |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 138 | echo "Which branch of mailcow do you want to use?" |
| 139 | echo "" |
| 140 | echo "Available Branches:" |
| 141 | echo "- master branch (stable updates) | default, recommended [1]" |
| 142 | echo "- nightly branch (unstable updates, testing) | not-production ready [2]" |
| 143 | sleep 1 |
| 144 | |
| 145 | while [ -z "${MAILCOW_BRANCH}" ]; do |
| 146 | read -r -p "Choose the Branch with it´s number [1/2] " branch |
| 147 | case $branch in |
| 148 | [2]) |
| 149 | MAILCOW_BRANCH="nightly" |
| 150 | ;; |
| 151 | *) |
| 152 | MAILCOW_BRANCH="master" |
| 153 | ;; |
| 154 | esac |
| 155 | done |
| 156 | |
| 157 | if [ ! -z "${MAILCOW_BRANCH}" ]; then |
| 158 | git_branch=${MAILCOW_BRANCH} |
| 159 | fi |
| 160 | |
| 161 | git fetch --all |
| 162 | git checkout -f $git_branch |
| 163 | |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 164 | [ ! -f ./data/conf/rspamd/override.d/worker-controller-password.inc ] && echo '# Placeholder' > ./data/conf/rspamd/override.d/worker-controller-password.inc |
| 165 | |
| 166 | cat << EOF > mailcow.conf |
| 167 | # ------------------------------ |
| 168 | # mailcow web ui configuration |
| 169 | # ------------------------------ |
| 170 | # example.org is _not_ a valid hostname, use a fqdn here. |
| 171 | # Default admin user is "admin" |
| 172 | # Default password is "moohoo" |
| 173 | |
| 174 | MAILCOW_HOSTNAME=${MAILCOW_HOSTNAME} |
| 175 | |
| 176 | # Password hash algorithm |
| 177 | # Only certain password hash algorithm are supported. For a fully list of supported schemes, |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 178 | # see https://mailcow.github.io/mailcow-dockerized-docs/models/model-passwd/ |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 179 | MAILCOW_PASS_SCHEME=BLF-CRYPT |
| 180 | |
| 181 | # ------------------------------ |
| 182 | # SQL database configuration |
| 183 | # ------------------------------ |
| 184 | |
| 185 | DBNAME=mailcow |
| 186 | DBUSER=mailcow |
| 187 | |
| 188 | # Please use long, random alphanumeric strings (A-Za-z0-9) |
| 189 | |
| 190 | DBPASS=$(LC_ALL=C </dev/urandom tr -dc A-Za-z0-9 | head -c 28) |
| 191 | DBROOT=$(LC_ALL=C </dev/urandom tr -dc A-Za-z0-9 | head -c 28) |
| 192 | |
| 193 | # ------------------------------ |
| 194 | # HTTP/S Bindings |
| 195 | # ------------------------------ |
| 196 | |
| 197 | # You should use HTTPS, but in case of SSL offloaded reverse proxies: |
| 198 | # Might be important: This will also change the binding within the container. |
| 199 | # If you use a proxy within Docker, point it to the ports you set below. |
| 200 | # Do _not_ use IP:PORT in HTTP(S)_BIND or HTTP(S)_PORT |
| 201 | # IMPORTANT: Do not use port 8081, 9081 or 65510! |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 202 | # Example: HTTP_BIND=1.2.3.4 |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 203 | # For IPv4 leave it as it is: HTTP_BIND= & HTTPS_PORT= |
| 204 | # For IPv6 see https://mailcow.github.io/mailcow-dockerized-docs/post_installation/firststeps-ip_bindings/ |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 205 | |
| 206 | HTTP_PORT=80 |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 207 | HTTP_BIND= |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 208 | |
| 209 | HTTPS_PORT=443 |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 210 | HTTPS_BIND= |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 211 | |
| 212 | # ------------------------------ |
| 213 | # Other bindings |
| 214 | # ------------------------------ |
| 215 | # You should leave that alone |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 216 | # Format: 11.22.33.44:25 or 12.34.56.78:465 etc. |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 217 | |
| 218 | SMTP_PORT=25 |
| 219 | SMTPS_PORT=465 |
| 220 | SUBMISSION_PORT=587 |
| 221 | IMAP_PORT=143 |
| 222 | IMAPS_PORT=993 |
| 223 | POP_PORT=110 |
| 224 | POPS_PORT=995 |
| 225 | SIEVE_PORT=4190 |
| 226 | DOVEADM_PORT=127.0.0.1:19991 |
| 227 | SQL_PORT=127.0.0.1:13306 |
| 228 | SOLR_PORT=127.0.0.1:18983 |
| 229 | REDIS_PORT=127.0.0.1:7654 |
| 230 | |
| 231 | # Your timezone |
| 232 | # See https://en.wikipedia.org/wiki/List_of_tz_database_time_zones for a list of timezones |
| 233 | # Use the row named 'TZ database name' + pay attention for 'Notes' row |
| 234 | |
| 235 | TZ=${MAILCOW_TZ} |
| 236 | |
| 237 | # Fixed project name |
| 238 | # Please use lowercase letters only |
| 239 | |
| 240 | COMPOSE_PROJECT_NAME=mailcowdockerized |
| 241 | |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 242 | # Used Docker Compose version |
| 243 | # Switch here between native (compose plugin) and standalone |
| 244 | # For more informations take a look at the mailcow docs regarding the configuration options. |
| 245 | # Normally this should be untouched but if you decided to use either of those you can switch it manually here. |
| 246 | # Please be aware that at least one of those variants should be installed on your maschine or mailcow will fail. |
| 247 | |
| 248 | DOCKER_COMPOSE_VERSION=${COMPOSE_VERSION} |
| 249 | |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 250 | # Set this to "allow" to enable the anyone pseudo user. Disabled by default. |
| 251 | # When enabled, ACL can be created, that apply to "All authenticated users" |
| 252 | # This should probably only be activated on mail hosts, that are used exclusivly by one organisation. |
| 253 | # Otherwise a user might share data with too many other users. |
| 254 | ACL_ANYONE=disallow |
| 255 | |
| 256 | # Garbage collector cleanup |
| 257 | # Deleted domains and mailboxes are moved to /var/vmail/_garbage/timestamp_sanitizedstring |
| 258 | # How long should objects remain in the garbage until they are being deleted? (value in minutes) |
| 259 | # Check interval is hourly |
| 260 | |
| 261 | MAILDIR_GC_TIME=7200 |
| 262 | |
| 263 | # Additional SAN for the certificate |
| 264 | # |
| 265 | # You can use wildcard records to create specific names for every domain you add to mailcow. |
| 266 | # Example: Add domains "example.com" and "example.net" to mailcow, change ADDITIONAL_SAN to a value like: |
| 267 | #ADDITIONAL_SAN=imap.*,smtp.* |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 268 | # This will expand the certificate to "imap.example.com", "smtp.example.com", "imap.example.net", "smtp.example.net" |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 269 | # plus every domain you add in the future. |
| 270 | # |
| 271 | # You can also just add static names... |
| 272 | #ADDITIONAL_SAN=srv1.example.net |
| 273 | # ...or combine wildcard and static names: |
| 274 | #ADDITIONAL_SAN=imap.*,srv1.example.com |
| 275 | # |
| 276 | |
| 277 | ADDITIONAL_SAN= |
| 278 | |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 279 | # Additional server names for mailcow UI |
| 280 | # |
| 281 | # Specify alternative addresses for the mailcow UI to respond to |
| 282 | # This is useful when you set mail.* as ADDITIONAL_SAN and want to make sure mail.maildomain.com will always point to the mailcow UI. |
| 283 | # If the server name does not match a known site, Nginx decides by best-guess and may redirect users to the wrong web root. |
| 284 | # You can understand this as server_name directive in Nginx. |
| 285 | # Comma separated list without spaces! Example: ADDITIONAL_SERVER_NAMES=a.b.c,d.e.f |
| 286 | |
| 287 | ADDITIONAL_SERVER_NAMES= |
| 288 | |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 289 | # Skip running ACME (acme-mailcow, Let's Encrypt certs) - y/n |
| 290 | |
| 291 | SKIP_LETS_ENCRYPT=n |
| 292 | |
| 293 | # Create seperate certificates for all domains - y/n |
| 294 | # this will allow adding more than 100 domains, but some email clients will not be able to connect with alternative hostnames |
| 295 | # see https://wiki.dovecot.org/SSL/SNIClientSupport |
| 296 | ENABLE_SSL_SNI=n |
| 297 | |
| 298 | # Skip IPv4 check in ACME container - y/n |
| 299 | |
| 300 | SKIP_IP_CHECK=n |
| 301 | |
| 302 | # Skip HTTP verification in ACME container - y/n |
| 303 | |
| 304 | SKIP_HTTP_VERIFICATION=n |
| 305 | |
| 306 | # Skip ClamAV (clamd-mailcow) anti-virus (Rspamd will auto-detect a missing ClamAV container) - y/n |
| 307 | |
| 308 | SKIP_CLAMD=${SKIP_CLAMD} |
| 309 | |
| 310 | # Skip SOGo: Will disable SOGo integration and therefore webmail, DAV protocols and ActiveSync support (experimental, unsupported, not fully implemented) - y/n |
| 311 | |
| 312 | SKIP_SOGO=n |
| 313 | |
| 314 | # Skip Solr on low-memory systems or if you do not want to store a readable index of your mails in solr-vol-1. |
| 315 | |
| 316 | SKIP_SOLR=${SKIP_SOLR} |
| 317 | |
| 318 | # Solr heap size in MB, there is no recommendation, please see Solr docs. |
| 319 | # Solr is a prone to run OOM and should be monitored. Unmonitored Solr setups are not recommended. |
| 320 | |
| 321 | SOLR_HEAP=1024 |
| 322 | |
| 323 | # Allow admins to log into SOGo as email user (without any password) |
| 324 | |
| 325 | ALLOW_ADMIN_EMAIL_LOGIN=n |
| 326 | |
| 327 | # Enable watchdog (watchdog-mailcow) to restart unhealthy containers |
| 328 | |
| 329 | USE_WATCHDOG=y |
| 330 | |
| 331 | # Send watchdog notifications by mail (sent from watchdog@MAILCOW_HOSTNAME) |
| 332 | # CAUTION: |
| 333 | # 1. You should use external recipients |
| 334 | # 2. Mails are sent unsigned (no DKIM) |
| 335 | # 3. If you use DMARC, create a separate DMARC policy ("v=DMARC1; p=none;" in _dmarc.MAILCOW_HOSTNAME) |
| 336 | # Multiple rcpts allowed, NO quotation marks, NO spaces |
| 337 | |
| 338 | #WATCHDOG_NOTIFY_EMAIL=a@example.com,b@example.com,c@example.com |
| 339 | #WATCHDOG_NOTIFY_EMAIL= |
| 340 | |
| 341 | # Notify about banned IP (includes whois lookup) |
| 342 | WATCHDOG_NOTIFY_BAN=n |
| 343 | |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 344 | # Subject for watchdog mails. Defaults to "Watchdog ALERT" followed by the error message. |
| 345 | #WATCHDOG_SUBJECT= |
| 346 | |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 347 | # Checks if mailcow is an open relay. Requires a SAL. More checks will follow. |
| 348 | # https://www.servercow.de/mailcow?lang=en |
| 349 | # https://www.servercow.de/mailcow?lang=de |
| 350 | # No data is collected. Opt-in and anonymous. |
| 351 | # Will only work with unmodified mailcow setups. |
| 352 | WATCHDOG_EXTERNAL_CHECKS=n |
| 353 | |
Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 354 | # Enable watchdog verbose logging |
| 355 | WATCHDOG_VERBOSE=n |
| 356 | |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 357 | # Max log lines per service to keep in Redis logs |
| 358 | |
| 359 | LOG_LINES=9999 |
| 360 | |
| 361 | # Internal IPv4 /24 subnet, format n.n.n (expands to n.n.n.0/24) |
| 362 | # Use private IPv4 addresses only, see https://en.wikipedia.org/wiki/Private_network#Private_IPv4_addresses |
| 363 | |
| 364 | IPV4_NETWORK=172.22.1 |
| 365 | |
| 366 | # Internal IPv6 subnet in fc00::/7 |
| 367 | # Use private IPv6 addresses only, see https://en.wikipedia.org/wiki/Private_network#Private_IPv6_addresses |
| 368 | |
| 369 | IPV6_NETWORK=fd4d:6169:6c63:6f77::/64 |
| 370 | |
| 371 | # Use this IPv4 for outgoing connections (SNAT) |
| 372 | |
| 373 | #SNAT_TO_SOURCE= |
| 374 | |
| 375 | # Use this IPv6 for outgoing connections (SNAT) |
| 376 | |
| 377 | #SNAT6_TO_SOURCE= |
| 378 | |
| 379 | # Create or override an API key for the web UI |
| 380 | # You _must_ define API_ALLOW_FROM, which is a comma separated list of IPs |
| 381 | # An API key defined as API_KEY has read-write access |
| 382 | # An API key defined as API_KEY_READ_ONLY has read-only access |
| 383 | # Allowed chars for API_KEY and API_KEY_READ_ONLY: a-z, A-Z, 0-9, - |
| 384 | # You can define API_KEY and/or API_KEY_READ_ONLY |
| 385 | |
| 386 | #API_KEY= |
| 387 | #API_KEY_READ_ONLY= |
| 388 | #API_ALLOW_FROM=172.22.1.1,127.0.0.1 |
| 389 | |
| 390 | # mail_home is ~/Maildir |
| 391 | MAILDIR_SUB=Maildir |
| 392 | |
| 393 | # SOGo session timeout in minutes |
| 394 | SOGO_EXPIRE_SESSION=480 |
| 395 | |
| 396 | # DOVECOT_MASTER_USER and DOVECOT_MASTER_PASS must both be provided. No special chars. |
| 397 | # Empty by default to auto-generate master user and password on start. |
| 398 | # User expands to DOVECOT_MASTER_USER@mailcow.local |
| 399 | # LEAVE EMPTY IF UNSURE |
| 400 | DOVECOT_MASTER_USER= |
| 401 | # LEAVE EMPTY IF UNSURE |
| 402 | DOVECOT_MASTER_PASS= |
| 403 | |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 404 | # Let's Encrypt registration contact information |
| 405 | # Optional: Leave empty for none |
| 406 | # This value is only used on first order! |
| 407 | # Setting it at a later point will require the following steps: |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 408 | # https://mailcow.github.io/mailcow-dockerized-docs/troubleshooting/debug-reset_tls/ |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 409 | ACME_CONTACT= |
| 410 | |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 411 | # WebAuthn device manufacturer verification |
| 412 | # After setting WEBAUTHN_ONLY_TRUSTED_VENDORS=y only devices from trusted manufacturers are allowed |
| 413 | # root certificates can be placed for validation under mailcow-dockerized/data/web/inc/lib/WebAuthn/rootCertificates |
| 414 | WEBAUTHN_ONLY_TRUSTED_VENDORS=n |
| 415 | |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 416 | EOF |
| 417 | |
| 418 | mkdir -p data/assets/ssl |
| 419 | |
| 420 | chmod 600 mailcow.conf |
| 421 | |
| 422 | # copy but don't overwrite existing certificate |
| 423 | echo "Generating snake-oil certificate..." |
| 424 | # Making Willich more popular |
| 425 | openssl req -x509 -newkey rsa:4096 -keyout data/assets/ssl-example/key.pem -out data/assets/ssl-example/cert.pem -days 365 -subj "/C=DE/ST=NRW/L=Willich/O=mailcow/OU=mailcow/CN=${MAILCOW_HOSTNAME}" -sha256 -nodes |
| 426 | echo "Copying snake-oil certificate..." |
| 427 | cp -n -d data/assets/ssl-example/*.pem data/assets/ssl/ |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 428 | |
| 429 | # Set app_info.inc.php |
| 430 | if [ ${git_branch} == "master" ]; then |
| 431 | mailcow_git_version=$(git describe --tags `git rev-list --tags --max-count=1`) |
| 432 | elif [ ${git_branch} == "nightly" ]; then |
| 433 | mailcow_git_version=$(git rev-parse --short $(git rev-parse @{upstream})) |
| 434 | mailcow_last_git_version="" |
| 435 | else |
| 436 | mailcow_git_version=$(git rev-parse --short HEAD) |
| 437 | mailcow_last_git_version="" |
| 438 | fi |
| 439 | |
| 440 | mailcow_git_commit=$(git rev-parse origin/${git_branch}) |
| 441 | mailcow_git_commit_date=$(git log -1 --format=%ci @{upstream} ) |
| 442 | |
| 443 | if [ $? -eq 0 ]; then |
| 444 | echo '<?php' > data/web/inc/app_info.inc.php |
| 445 | echo ' $MAILCOW_GIT_VERSION="'$mailcow_git_version'";' >> data/web/inc/app_info.inc.php |
| 446 | echo ' $MAILCOW_LAST_GIT_VERSION="";' >> data/web/inc/app_info.inc.php |
| 447 | echo ' $MAILCOW_GIT_OWNER="mailcow";' >> data/web/inc/app_info.inc.php |
| 448 | echo ' $MAILCOW_GIT_REPO="mailcow-dockerized";' >> data/web/inc/app_info.inc.php |
| 449 | echo ' $MAILCOW_GIT_URL="https://github.com/mailcow/mailcow-dockerized";' >> data/web/inc/app_info.inc.php |
| 450 | echo ' $MAILCOW_GIT_COMMIT="'$mailcow_git_commit'";' >> data/web/inc/app_info.inc.php |
| 451 | echo ' $MAILCOW_GIT_COMMIT_DATE="'$mailcow_git_commit_date'";' >> data/web/inc/app_info.inc.php |
| 452 | echo ' $MAILCOW_BRANCH="'$git_branch'";' >> data/web/inc/app_info.inc.php |
| 453 | echo ' $MAILCOW_UPDATEDAT='$(date +%s)';' >> data/web/inc/app_info.inc.php |
| 454 | echo '?>' >> data/web/inc/app_info.inc.php |
| 455 | else |
| 456 | echo '<?php' > data/web/inc/app_info.inc.php |
| 457 | echo ' $MAILCOW_GIT_VERSION="'$mailcow_git_version'";' >> data/web/inc/app_info.inc.php |
| 458 | echo ' $MAILCOW_LAST_GIT_VERSION="";' >> data/web/inc/app_info.inc.php |
| 459 | echo ' $MAILCOW_GIT_OWNER="mailcow";' >> data/web/inc/app_info.inc.php |
| 460 | echo ' $MAILCOW_GIT_REPO="mailcow-dockerized";' >> data/web/inc/app_info.inc.php |
| 461 | echo ' $MAILCOW_GIT_URL="https://github.com/mailcow/mailcow-dockerized";' >> data/web/inc/app_info.inc.php |
| 462 | echo ' $MAILCOW_GIT_COMMIT="";' >> data/web/inc/app_info.inc.php |
| 463 | echo ' $MAILCOW_GIT_COMMIT_DATE="";' >> data/web/inc/app_info.inc.php |
| 464 | echo ' $MAILCOW_BRANCH="'$git_branch'";' >> data/web/inc/app_info.inc.php |
| 465 | echo ' $MAILCOW_UPDATEDAT='$(date +%s)';' >> data/web/inc/app_info.inc.php |
| 466 | echo '?>' >> data/web/inc/app_info.inc.php |
| 467 | echo -e "\e[33mCannot determine current git repository version...\e[0m" |
| 468 | fi |