generate_config.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. read -p "Hostname (FQDN): " -ei "mx.example.org" MAILCOW_HOSTNAME
  14. read -p "Timezone: " -ei "Europe/Berlin" TZ
  15. cat << EOF > mailcow.conf
  16. # ------------------------------
  17. # mailcow web ui configuration
  18. # ------------------------------
  19. # example.org is _not_ a valid hostname, use a fqdn here.
  20. # Default admin user is "admin"
  21. # Default password is "moohoo"
  22. MAILCOW_HOSTNAME=${MAILCOW_HOSTNAME}
  23. # ------------------------------
  24. # SQL database configuration
  25. # ------------------------------
  26. DBNAME=mailcow
  27. DBUSER=mailcow
  28. # Please use long, random alphanumeric strings (A-Za-z0-9)
  29. DBPASS=$(</dev/urandom tr -dc A-Za-z0-9 | head -c 28)
  30. DBROOT=$(</dev/urandom tr -dc A-Za-z0-9 | head -c 28)
  31. # ------------------------------
  32. # Misc configuration
  33. # ------------------------------
  34. # You should leave that alone
  35. # Can also be 11.22.33.44:25 or 0.0.0.0:465 etc. for specific bindings
  36. HTTPS_PORT=443
  37. SMTP_PORT=25
  38. SMTPS_PORT=465
  39. SUBMISSION_PORT=587
  40. IMAP_PORT=143
  41. IMAPS_PORT=993
  42. POP_PORT=110
  43. POPS_PORT=995
  44. SIEVE_PORT=4190
  45. # Your timezone
  46. TZ=${TZ}
  47. EOF