From 0f67e734ed058bbc64fcc2ca972fa4fb0db37c10 Mon Sep 17 00:00:00 2001 From: agp8x Date: Sun, 29 May 2016 23:55:03 +0200 Subject: [PATCH 1/2] added sftp with password to copy files --- getssl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/getssl b/getssl index c59c6fe..b9f4be8 100755 --- a/getssl +++ b/getssl @@ -400,6 +400,23 @@ copy_file_to_location() { # copies a file, using scp if required. lcd $fromdir put $fromfile _EOF + elif [[ "${to:0:5}" == "sftp:" ]] ; then + debug "using sftp to copy the file from $from" + ftpuser=$(echo "$to"| awk -F: '{print $2}') + ftppass=$(echo "$to"| awk -F: '{print $3}') + ftphost=$(echo "$to"| awk -F: '{print $4}') + ftplocn=$(echo "$to"| awk -F: '{print $5}') + ftpdirn=$(dirname "$ftplocn") + ftpfile=$(basename "$ftplocn") + fromdir=$(dirname "$from") + fromfile=$(basename "$from") + debug "sftp user=$ftpuser - pass=$ftppass - host=$ftphost dir=$ftpdirn file=$ftpfile" + debug "from dir=$fromdir file=$fromfile" + sshpass -p $ftppass sftp $ftpuser@$ftphost <<- _EOF + cd $ftpdirn + lcd $fromdir + put $fromfile + _EOF else mkdir -p "$(dirname "$to")" if [ $? -gt 0 ]; then From d7b3a31cef48bebb5092375d3a9bd35ca6e2a70b Mon Sep 17 00:00:00 2001 From: srvrco Date: Mon, 30 May 2016 08:30:32 +0100 Subject: [PATCH 2/2] Add sftp with password to copy files (0.40) --- getssl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/getssl b/getssl index b9f4be8..fe32f8b 100755 --- a/getssl +++ b/getssl @@ -55,10 +55,11 @@ # 2016-05-21 added PUBLIC_DNS_SERVER option, for when an external, not internal DNS server is required. (0.37) # 2016-05-28 added FTP method of uploading tokens to remote server (blocked for certs as not secure) (0.38) # 2016-05-28 added FTP method into the default config notes. (0.39) +# 2016-05-30 Add sftp with password to copy files (0.40) # --------------------------------------------------------------------------- PROGNAME=${0##*/} -VERSION="0.39" +VERSION="0.40" # defaults CA="https://acme-staging.api.letsencrypt.org"