generate_config.sh 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. cat << EOF > mailcow.conf
  27. # ------------------------------
  28. # mailcow web ui configuration
  29. # ------------------------------
  30. # example.org is _not_ a valid hostname, use a fqdn here.
  31. # Default admin user is "admin"
  32. # Default password is "moohoo"
  33. MAILCOW_HOSTNAME=${MAILCOW_HOSTNAME}
  34. # ------------------------------
  35. # SQL database configuration
  36. # ------------------------------
  37. DBNAME=mailcow
  38. DBUSER=mailcow
  39. # Please use long, random alphanumeric strings (A-Za-z0-9)
  40. DBPASS=$(</dev/urandom tr -dc A-Za-z0-9 | head -c 28)
  41. DBROOT=$(</dev/urandom tr -dc A-Za-z0-9 | head -c 28)
  42. # ------------------------------
  43. # HTTP/S Bindings
  44. # ------------------------------
  45. # You should use HTTPS, but in case of SSL offloaded reverse proxies:
  46. HTTP_PORT=80
  47. HTTP_BIND=0.0.0.0
  48. HTTPS_PORT=443
  49. HTTPS_BIND=0.0.0.0
  50. # ------------------------------
  51. # Other bindings
  52. # ------------------------------
  53. # You should leave that alone
  54. # Format: 11.22.33.44:25 or 0.0.0.0:465 etc.
  55. # Do _not_ use IP:PORT in HTTP(S)_BIND or HTTP(S)_PORT
  56. SMTP_PORT=25
  57. SMTPS_PORT=465
  58. SUBMISSION_PORT=587
  59. IMAP_PORT=143
  60. IMAPS_PORT=993
  61. POP_PORT=110
  62. POPS_PORT=995
  63. SIEVE_PORT=4190
  64. DOVEADM_PORT=127.0.0.1:19991
  65. SQL_PORT=127.0.0.1:13306
  66. # Your timezone
  67. TZ=${TZ}
  68. # Fixed project name
  69. COMPOSE_PROJECT_NAME=mailcow-dockerized
  70. # Additional SAN for the certificate
  71. ADDITIONAL_SAN=
  72. # Skip running ACME (acme-mailcow, Let's Encrypt certs) - y/n
  73. SKIP_LETS_ENCRYPT=n
  74. # Skip IPv4 check in ACME container - y/n
  75. SKIP_IP_CHECK=n
  76. # Skip ClamAV (clamd-mailcow) anti-virus (Rspamd will auto-detect a missing ClamAV container) - y/n
  77. SKIP_CLAMD=n
  78. # Enable watchdog (watchdog-mailcow) to restart unhealthy containers (experimental)
  79. USE_WATCHDOG=n
  80. # Send notifications by mail (no DKIM signature, sent from watchdog@MAILCOW_HOSTNAME)
  81. #WATCHDOG_NOTIFY_EMAIL=
  82. # Max log lines per service to keep in Redis logs
  83. LOG_LINES=9999
  84. # Internal IPv4 /24 subnet, format n.n.n. (expands to n.n.n.0/24)
  85. IPV4_NETWORK=172.22.1
  86. # Internal IPv6 subnet in fc00::/7
  87. IPV6_NETWORK=fd4d:6169:6c63:6f77::/64
  88. # Use this IP for outgoing connections (SNAT)' >> mailcow.conf
  89. #SNAT_TO_SOURCE=" >> mailcow.conf
  90. # Disable IPv6
  91. # mailcow-network will still be created as IPv6 enabled, all containers will be created
  92. # without IPv6 support.
  93. # Use 1 for disabled, 0 for enabled
  94. SYSCTL_IPV6_DISABLED=0
  95. EOF
  96. mkdir -p data/assets/ssl
  97. # copy but don't overwrite existing certificate
  98. cp -n data/assets/ssl-example/*.pem data/assets/ssl/