- local site=${conf%/key_send}
- rule _x509_site_key_decrypt \
- "$(cat "$tool"/etc/nginx/site.d/"$site"/key_send)" |
- rule ssh -l root ' \
- sudo install -d -m 770 -o root -g root \
- /etc/nginx \
- /etc/nginx/x509.d \
- /etc/nginx/x509.d/'"'$site'"'; \
- sudo install -m 644 -o root -g root /dev/stdin \
- /etc/nginx/x509.d/'"'$site'"'/.gitignore <<-EOF
- key.pem
- EOF
- sudo install -m 400 -o root -g root \
- /dev/stdin \
- /etc/nginx/x509.d/'"'$site'"'/key.pem
- '
+ local site="${conf%/site.conf}"
+ if test -f "$tool"/etc/nginx/site.d/"$site"/x509_host
+ then
+ rule _x509_site_key_decrypt \
+ "$(cat "$tool"/etc/nginx/site.d/"$site"/x509_host)" |
+ rule ssh -l root ' \
+ sudo install -d -m 770 -o root -g root \
+ /etc/nginx \
+ /etc/nginx/x509.d \
+ /etc/nginx/x509.d/'"'$site'"'; \
+ sudo install -m 644 -o root -g root /dev/stdin \
+ /etc/nginx/x509.d/'"'$site'"'/.gitignore <<-EOF
+ key.pem
+ EOF
+ sudo install -m 400 -o root -g root /dev/stdin \
+ /etc/nginx/x509.d/'"'$site'"'/key.pem
+ '
+ fi
+ test ! -r "$tool"/etc/nginx/site.d/"$site"/remote.sh ||
+ . "$tool"/etc/nginx/site.d/"$site"/remote.sh