Nico Huber | d652872 | 2023-07-01 14:38:39 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | { |
| 6 | domain=${SA_PUBLIC_DOMAIN_NAME:-miau.local} |
Nico Huber | 15edd77 | 2023-07-01 18:16:50 +0000 | [diff] [blame^] | 7 | live=/etc/nginx/certs/live |
Nico Huber | d652872 | 2023-07-01 14:38:39 +0000 | [diff] [blame] | 8 | html=/var/www/html |
| 9 | |
Nico Huber | 15edd77 | 2023-07-01 18:16:50 +0000 | [diff] [blame^] | 10 | if [ ! -f ${live}/${domain}/privkey.pem ]; then |
| 11 | mkdir -p ${live}/${domain} |
| 12 | cp /etc/ssl/private/sa-selfsigned.key ${live}/${domain}/privkey.pem |
| 13 | cp /etc/ssl/certs/sa-selfsigned.crt ${live}/${domain}/fullchain.pem |
| 14 | cp /etc/ssl/certs/sa-selfsigned.crt ${live}/${domain}/chain.pem |
| 15 | cp /etc/ssl/certs/sa-selfsigned.crt ${live}/${domain}/cert.pem |
| 16 | fi |
| 17 | |
Nico Huber | d652872 | 2023-07-01 14:38:39 +0000 | [diff] [blame] | 18 | rm -rf ${html} |
| 19 | cp -a /var/www/simpleid ${html} |
| 20 | |
| 21 | for tmpl in /var/db/simpleid-templates/*.identity; do |
| 22 | ref=$(dirname ${tmpl})/$(basename ${tmpl} .identity) |
| 23 | name=$(basename ${ref}) |
| 24 | sed "s/miau.local/${domain}/" ${ref} >${html}/${name} |
| 25 | done |
| 26 | |
| 27 | for f in /etc/nginx/conf.d/sa.conf; do |
| 28 | sed "s/miau.local/${domain}/" ${f}.template >${f} |
| 29 | done |
| 30 | } |
| 31 | |
| 32 | chown -R nginx:nginx /var/www/html/ |
| 33 | |
Nico Huber | 15edd77 | 2023-07-01 18:16:50 +0000 | [diff] [blame^] | 34 | chmod -R a-w /etc/nginx/certs/ /etc/nginx/conf.d/sa.conf /var/www/html/ |
Nico Huber | d652872 | 2023-07-01 14:38:39 +0000 | [diff] [blame] | 35 | |
| 36 | exec /docker-entrypoint.sh "$@" |