Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 1 | echo ' |
| 2 | server { |
| 3 | listen 127.0.0.1:65510; |
| 4 | include /etc/nginx/conf.d/listen_plain.active; |
| 5 | include /etc/nginx/conf.d/listen_ssl.active; |
| 6 | |
| 7 | ssl_certificate /etc/ssl/mail/cert.pem; |
| 8 | ssl_certificate_key /etc/ssl/mail/key.pem; |
| 9 | |
| 10 | include /etc/nginx/conf.d/server_name.active; |
| 11 | |
| 12 | include /etc/nginx/conf.d/includes/site-defaults.conf; |
| 13 | } |
| 14 | '; |
| 15 | for cert_dir in /etc/ssl/mail/*/ ; do |
| 16 | if [[ ! -f ${cert_dir}domains ]] || [[ ! -f ${cert_dir}cert.pem ]] || [[ ! -f ${cert_dir}key.pem ]]; then |
| 17 | continue |
| 18 | fi |
| 19 | # do not create vhost for default-certificate. the cert is already in the default server listen |
| 20 | domains="$(cat ${cert_dir}domains | sed -e 's/^[[:space:]]*//')" |
| 21 | case "${domains}" in |
| 22 | "") continue;; |
| 23 | "${MAILCOW_HOSTNAME}"*) continue;; |
| 24 | esac |
| 25 | echo -n ' |
| 26 | server { |
| 27 | include /etc/nginx/conf.d/listen_ssl.active; |
| 28 | |
| 29 | ssl_certificate '${cert_dir}'cert.pem; |
| 30 | ssl_certificate_key '${cert_dir}'key.pem; |
| 31 | '; |
| 32 | echo -n ' |
| 33 | server_name '${domains}'; |
| 34 | |
| 35 | include /etc/nginx/conf.d/includes/site-defaults.conf; |
| 36 | } |
| 37 | '; |
| 38 | done |