From 68b5f428fc728505d7bf138c392e7a03481f732d Mon Sep 17 00:00:00 2001 From: Timothe Litt Date: Sun, 24 Mar 2024 08:03:40 -0400 Subject: [PATCH] Make file deletion with ftp use the correct port. Score 1 for the tests. --- getssl | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/getssl b/getssl index 9785de46..22488a42 100755 --- a/getssl +++ b/getssl @@ -1608,22 +1608,21 @@ for d in "${alldomains[@]}"; do # shellcheck disable=SC2086 curl ${_NOMETER} -u "${davsuser}:${davspass}" -X "DELETE" "https://${davshost}:${davsport}${davsdirn}${davsfile}" elif [[ "${t_loc:0:6}" == "ftpes:" ]] || [[ "${t_loc:0:5}" == "ftps:" ]] ; then - if [ -n "$FTP_PORT" ]; then SFTP_PORT=":${FTP_PORT}"; fi + # FTPES (FTP over explicit TLS/SSL, port 21) and FTPS (FTP over implicit TLS/SSL, port 990). debug "using ftp to delete the file from $from" ftpuser=$(echo "${t_loc}"| awk -F: '{print $2}') ftppass=$(echo "${t_loc}"| awk -F: '{print $3}') ftphost=$(echo "${t_loc}"| awk -F: '{print $4}') ftplocn=$(echo "${t_loc}"| awk -F: '{print $5}') - SFTP_PORT="" - if [ -z "$FTP_PORT" ]; then - SFTP_PORT=":990" - fi + + if [ -n "$FTP_PORT" ]; then SFTP_PORT=":${FTP_PORT}"; else SFTP_PORT=""; fi debug "ftp user=$ftpuser - pass=$ftppass - host=$ftphost file=${ftplocn}/${token:?}" if [[ "${to:0:5}" == "ftps:" ]] ; then - # shellcheck disable=SC2086 + [ -z "$FTP_PORT" ] && SFTP_PORT=":990" + # shellcheck disable=SC2086 curl ${_NOMETER} $FTPS_OPTIONS --ftp-ssl --ftp-ssl-reqd -u "${ftpuser}:${ftppass}" --silent -Q "DELE ${token:?}}" "ftp://${ftphost}${SFTP_PORT}/${ftplocn}/" else - # shellcheck disable=SC2086 + # shellcheck disable=SC2086 curl ${_NOMETER} $FTPS_OPTIONS --ftp-ssl --ftp-ssl-reqd -u "${ftpuser}:${ftppass}" --silent -Q "DELE ${token:?}" "ftp://${ftphost}${SFTP_PORT}/${ftplocn}/" fi else