generate_config.sh 1.3 KB

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