diff --git a/plugins/nginx-vhosts/commands b/plugins/nginx-vhosts/commands index a1d955caa..8e221affd 100755 --- a/plugins/nginx-vhosts/commands +++ b/plugins/nginx-vhosts/commands @@ -161,12 +161,24 @@ EOF TEMP_DIR=$(mktemp -d) cd $TEMP_DIR tar xvf - <&0 - [[ ! -f "$TEMP_DIR/server.crt" ]] && echo "Tar archive missing server.crt" && exit 1 - [[ ! -f "$TEMP_DIR/server.key" ]] && echo "Tar archive missing server.key" && exit 1 + + crt_count = $(ls -1 *.crt | wc -l) + if [[ $crt_count -lt 1 ]]; then + echo "Tar archive is missing .crt file" && exit 1 + elif [[ $crt_count -gt 1 ]]; then + echo "Tar archive contains more than one .crt file" && exit 1 + fi + + key_count = $(ls -1 *.key | wc -l) + if [[ $key_count -lt 1 ]]; then + echo "Tar archive is missing .key file" && exit 1 + elif [[ $key_count -gt 1 ]]; then + echo "Tar archive contains more than one .key file" && exit 1 + fi mkdir -p "$DOKKU_ROOT/$APP/tls" - mv "$TEMP_DIR/server.crt" "$DOKKU_ROOT/$APP/tls/server.crt" - mv "$TEMP_DIR/server.key" "$DOKKU_ROOT/$APP/tls/server.key" + mv "$TEMP_DIR/*.crt" "$DOKKU_ROOT/$APP/tls/server.crt" + mv "$TEMP_DIR/*.key" "$DOKKU_ROOT/$APP/tls/server.key" cd $DOKKU_ROOT rm -rf $TEMP_DIR dokku nginx:build-config $APP