2
0

generate_config.sh 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. #!/bin/bash
  2. if [[ -f mailcow.conf ]]; then
  3. read -r -p "A config file exists and will be overwritten, are you sure you want to contine? [y/N] " response
  4. case $response in
  5. [yY][eE][sS]|[yY])
  6. mv mailcow.conf mailcow.conf_backup
  7. ;;
  8. *)
  9. exit 1
  10. ;;
  11. esac
  12. fi
  13. if [ -z "$MAILCOW_HOSTNAME" ]; then
  14. read -p "Hostname (FQDN - example.org is not a valid FQDN): " -ei "mx.example.org" MAILCOW_HOSTNAME
  15. fi
  16. if [[ -a /etc/timezone ]]; then
  17. TZ=$(cat /etc/timezone)
  18. elif [[ -a /etc/localtime ]]; then
  19. TZ=$(readlink /etc/localtime|sed -n 's|^.*zoneinfo/||p')
  20. fi
  21. if [ -z "$TZ" ]; then
  22. read -p "Timezone: " -ei "Europe/Berlin" TZ
  23. else
  24. read -p "Timezone: " -ei ${TZ} TZ
  25. fi
  26. [[ ! -f ./data/conf/rspamd/override.d/worker-controller-password.inc ]] && echo '# Placeholder' > ./data/conf/rspamd/override.d/worker-controller-password.inc
  27. cat << EOF > mailcow.conf
  28. # ------------------------------
  29. # mailcow web ui configuration
  30. # ------------------------------
  31. # example.org is _not_ a valid hostname, use a fqdn here.
  32. # Default admin user is "admin"
  33. # Default password is "moohoo"
  34. MAILCOW_HOSTNAME=${MAILCOW_HOSTNAME}
  35. # ------------------------------
  36. # SQL database configuration
  37. # ------------------------------
  38. DBNAME=mailcow
  39. DBUSER=mailcow
  40. # Please use long, random alphanumeric strings (A-Za-z0-9)
  41. DBPASS=$(</dev/urandom tr -dc A-Za-z0-9 | head -c 28)
  42. DBROOT=$(</dev/urandom tr -dc A-Za-z0-9 | head -c 28)
  43. # ------------------------------
  44. # HTTP/S Bindings
  45. # ------------------------------
  46. # You should use HTTPS, but in case of SSL offloaded reverse proxies:
  47. HTTP_PORT=80
  48. HTTP_BIND=0.0.0.0
  49. HTTPS_PORT=443
  50. HTTPS_BIND=0.0.0.0
  51. # ------------------------------
  52. # Other bindings
  53. # ------------------------------
  54. # You should leave that alone
  55. # Format: 11.22.33.44:25 or 0.0.0.0:465 etc.
  56. # Do _not_ use IP:PORT in HTTP(S)_BIND or HTTP(S)_PORT
  57. SMTP_PORT=25
  58. SMTPS_PORT=465
  59. SUBMISSION_PORT=587
  60. IMAP_PORT=143
  61. IMAPS_PORT=993
  62. POP_PORT=110
  63. POPS_PORT=995
  64. SIEVE_PORT=4190
  65. DOVEADM_PORT=127.0.0.1:19991
  66. SQL_PORT=127.0.0.1:13306
  67. # Your timezone
  68. TZ=${TZ}
  69. # Fixed project name
  70. COMPOSE_PROJECT_NAME=mailcow-dockerized
  71. # Additional SAN for the certificate
  72. ADDITIONAL_SAN=
  73. # Skip running ACME (acme-mailcow, Let's Encrypt certs) - y/n
  74. SKIP_LETS_ENCRYPT=n
  75. # Skip IPv4 check in ACME container - y/n
  76. SKIP_IP_CHECK=n
  77. # Skip ClamAV (clamd-mailcow) anti-virus (Rspamd will auto-detect a missing ClamAV container) - y/n
  78. SKIP_CLAMD=n
  79. # Enable watchdog (watchdog-mailcow) to restart unhealthy containers (experimental)
  80. USE_WATCHDOG=n
  81. # Send notifications by mail (no DKIM signature, sent from watchdog@MAILCOW_HOSTNAME)
  82. #WATCHDOG_NOTIFY_EMAIL=
  83. # Max log lines per service to keep in Redis logs
  84. LOG_LINES=9999
  85. # Internal IPv4 /24 subnet, format n.n.n. (expands to n.n.n.0/24)
  86. IPV4_NETWORK=172.22.1
  87. # Internal IPv6 subnet in fc00::/7
  88. IPV6_NETWORK=fd4d:6169:6c63:6f77::/64
  89. # Use this IP for outgoing connections (SNAT)' >> mailcow.conf
  90. #SNAT_TO_SOURCE=" >> mailcow.conf
  91. # Disable IPv6
  92. # mailcow-network will still be created as IPv6 enabled, all containers will be created
  93. # without IPv6 support.
  94. # Use 1 for disabled, 0 for enabled
  95. SYSCTL_IPV6_DISABLED=0
  96. EOF
  97. mkdir -p data/assets/ssl
  98. # copy but don't overwrite existing certificate
  99. cp -n data/assets/ssl-example/*.pem data/assets/ssl/