check the file path before copying

pull/4124/head
neilpang 3 years ago
parent 66b2d496af
commit 5440fcdf54

@ -5752,8 +5752,10 @@ _installcert() {
if [ -f "$_real_cert" ] && [ ! "$_ACME_IS_RENEW" ]; then if [ -f "$_real_cert" ] && [ ! "$_ACME_IS_RENEW" ]; then
cp "$_real_cert" "$_backup_path/cert.bak" cp "$_real_cert" "$_backup_path/cert.bak"
fi fi
if [ "$CERT_PATH" != "$_real_cert" ]; then
cat "$CERT_PATH" >"$_real_cert" || return 1 cat "$CERT_PATH" >"$_real_cert" || return 1
fi fi
fi
if [ "$_real_ca" ]; then if [ "$_real_ca" ]; then
_info "Installing CA to: $_real_ca" _info "Installing CA to: $_real_ca"
@ -5764,15 +5766,18 @@ _installcert() {
if [ -f "$_real_ca" ] && [ ! "$_ACME_IS_RENEW" ]; then if [ -f "$_real_ca" ] && [ ! "$_ACME_IS_RENEW" ]; then
cp "$_real_ca" "$_backup_path/ca.bak" cp "$_real_ca" "$_backup_path/ca.bak"
fi fi
if [ "$CA_CERT_PATH" != "$_real_ca" ]; then
cat "$CA_CERT_PATH" >"$_real_ca" || return 1 cat "$CA_CERT_PATH" >"$_real_ca" || return 1
fi fi
fi fi
fi
if [ "$_real_key" ]; then if [ "$_real_key" ]; then
_info "Installing key to: $_real_key" _info "Installing key to: $_real_key"
if [ -f "$_real_key" ] && [ ! "$_ACME_IS_RENEW" ]; then if [ -f "$_real_key" ] && [ ! "$_ACME_IS_RENEW" ]; then
cp "$_real_key" "$_backup_path/key.bak" cp "$_real_key" "$_backup_path/key.bak"
fi fi
if [ "$CERT_KEY_PATH" != "$_real_key" ]; then
if [ -f "$_real_key" ]; then if [ -f "$_real_key" ]; then
cat "$CERT_KEY_PATH" >"$_real_key" || return 1 cat "$CERT_KEY_PATH" >"$_real_key" || return 1
else else
@ -5781,14 +5786,17 @@ _installcert() {
cat "$CERT_KEY_PATH" >"$_real_key" || return 1 cat "$CERT_KEY_PATH" >"$_real_key" || return 1
fi fi
fi fi
fi
if [ "$_real_fullchain" ]; then if [ "$_real_fullchain" ]; then
_info "Installing full chain to: $_real_fullchain" _info "Installing full chain to: $_real_fullchain"
if [ -f "$_real_fullchain" ] && [ ! "$_ACME_IS_RENEW" ]; then if [ -f "$_real_fullchain" ] && [ ! "$_ACME_IS_RENEW" ]; then
cp "$_real_fullchain" "$_backup_path/fullchain.bak" cp "$_real_fullchain" "$_backup_path/fullchain.bak"
fi fi
if [ "$_real_fullchain" != "$CERT_FULLCHAIN_PATH" ]; then
cat "$CERT_FULLCHAIN_PATH" >"$_real_fullchain" || return 1 cat "$CERT_FULLCHAIN_PATH" >"$_real_fullchain" || return 1
fi fi
fi
if [ "$_reload_cmd" ]; then if [ "$_reload_cmd" ]; then
_info "Run reload cmd: $_reload_cmd" _info "Run reload cmd: $_reload_cmd"

Loading…
Cancel
Save