docker-entrypoint.sh 1012 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/bash
  2. # Run hooks
  3. for file in /hooks/*; do
  4. if [ -x "${file}" ]; then
  5. echo "Running hook ${file}"
  6. "${file}"
  7. fi
  8. done
  9. python3 -u /bootstrap/main.py
  10. BOOTSTRAP_EXIT_CODE=$?
  11. # Fix OpenSSL 3.X TLS1.0, 1.1 support (https://community.mailcow.email/d/4062-hi-all/20)
  12. if grep -qE 'ssl_min_protocol\s*=\s*(TLSv1|TLSv1\.1)\s*$' /etc/dovecot/dovecot.conf /etc/dovecot/extra.conf; then
  13. sed -i '/\[openssl_init\]/a ssl_conf = ssl_configuration' /etc/ssl/openssl.cnf
  14. echo "[ssl_configuration]" >> /etc/ssl/openssl.cnf
  15. echo "system_default = tls_system_default" >> /etc/ssl/openssl.cnf
  16. echo "[tls_system_default]" >> /etc/ssl/openssl.cnf
  17. echo "MinProtocol = TLSv1" >> /etc/ssl/openssl.cnf
  18. echo "CipherString = DEFAULT@SECLEVEL=0" >> /etc/ssl/openssl.cnf
  19. fi
  20. if [ $BOOTSTRAP_EXIT_CODE -ne 0 ]; then
  21. echo "Bootstrap failed with exit code $BOOTSTRAP_EXIT_CODE. Not starting Dovecot."
  22. exit $BOOTSTRAP_EXIT_CODE
  23. fi
  24. echo "Bootstrap succeeded. Starting Dovecot..."
  25. /usr/sbin/dovecot -F