generate_config.sh 1.4 KB

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