Skip to content

Commit eb521c7

Browse files
authored
v1.1.0 (#5)
Major updates * Using latest Nginx image * Updating getssl to 2.3.3
1 parent 1f766be commit eb521c7

File tree

3 files changed

+34
-8
lines changed

3 files changed

+34
-8
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM bcgdesign/nginx:1.18.0-r1
1+
FROM bcgdesign/nginx:nginx-1.18.0-r1
22

33
LABEL maintainer="Ben Green <[email protected]>" \
44
org.label-schema.name="Nginx Proxy" \

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.5
1+
1.1.0

overlay/etc/ssl/getssl

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ DEACTIVATE_AUTH="false"
274274
DEFAULT_REVOKE_CA="https://acme-v02.api.letsencrypt.org"
275275
DOMAIN_KEY_LENGTH=4096
276276
DUAL_RSA_ECDSA="false"
277+
FTP_OPTIONS=""
277278
GETSSL_IGNORE_CP_PRESERVE="false"
278279
HTTP_TOKEN_CHECK_WAIT=0
279280
IGNORE_DIRECTORY_DOMAIN="false"
@@ -842,6 +843,9 @@ copy_file_to_location() { # copies a file, using scp, sftp or ftp if required.
842843
if [[ "$cert" != "challenge token" ]] ; then
843844
error_exit "ftp is not a secure method for copying certificates or keys"
844845
fi
846+
if [[ -z "$FTP_COMMAND" ]]; then
847+
error_exit "No ftp command found"
848+
fi
845849
debug "using ftp to copy the file from $from"
846850
ftpuser=$(echo "$to"| awk -F: '{print $2}')
847851
ftppass=$(echo "$to"| awk -F: '{print $3}')
@@ -853,9 +857,15 @@ copy_file_to_location() { # copies a file, using scp, sftp or ftp if required.
853857
fromfile=$(basename "$from")
854858
debug "ftp user=$ftpuser - pass=$ftppass - host=$ftphost dir=$ftpdirn file=$ftpfile"
855859
debug "from dir=$fromdir file=$fromfile"
856-
ftp -n <<- _EOF
860+
if [ -n "$FTP_OPTIONS" ]; then
861+
# Use eval to expand any variables in FTP_OPTIONS
862+
FTP_OPTIONS=$(eval echo "$FTP_OPTIONS")
863+
debug "FTP_OPTIONS=$FTP_OPTIONS"
864+
fi
865+
$FTP_COMMAND <<- _EOF
857866
open $ftphost
858-
user $ftpuser $ftppass
867+
user $ftpuser $ftppass
868+
$FTP_OPTIONS
859869
cd $ftpdirn
860870
lcd $fromdir
861871
put ./$fromfile
@@ -886,12 +896,13 @@ copy_file_to_location() { # copies a file, using scp, sftp or ftp if required.
886896
davsport=$(echo "$to"| awk -F: '{print $5}')
887897
davslocn=$(echo "$to"| awk -F: '{print $6}')
888898
davsdirn=$(dirname "$davslocn")
899+
davsdirn=$(echo "${davsdirn}/" | sed 's,//,/,g')
889900
davsfile=$(basename "$davslocn")
890901
fromdir=$(dirname "$from")
891902
fromfile=$(basename "$from")
892903
debug "davs user=$davsuser - pass=$davspass - host=$davshost port=$davsport dir=$davsdirn file=$davsfile"
893904
debug "from dir=$fromdir file=$fromfile"
894-
curl -u "${davsuser}:${davspass}" -T "${fromdir}/${fromfile}" "https://${davshost}:${davsport}${davsdirn}/${davsfile}"
905+
curl -u "${davsuser}:${davspass}" -T "${fromdir}/${fromfile}" "https://${davshost}:${davsport}${davsdirn}${davsfile}"
895906
else
896907
if ! mkdir -p "$(dirname "$to")" ; then
897908
error_exit "cannot create ACL directory $(basename "$to")"
@@ -1118,6 +1129,18 @@ find_dns_utils() {
11181129
fi
11191130
}
11201131

1132+
find_ftp_command() {
1133+
FTP_COMMAND=""
1134+
if [[ -n "$(command -v ftp 2>/dev/null)" ]]; then
1135+
debug "Has ftp"
1136+
FTP_COMMAND="ftp -n"
1137+
elif [[ -n "$(command -v lftp 2>/dev/null)" ]]; then
1138+
debug "Has lftp"
1139+
FTP_COMMAND="lftp"
1140+
fi
1141+
}
1142+
1143+
11211144
fulfill_challenges() {
11221145
dn=0
11231146
for d in "${alldomains[@]}"; do
@@ -1267,8 +1290,8 @@ for d in "${alldomains[@]}"; do
12671290
ftppass=$(echo "${t_loc}"| awk -F: '{print $3}')
12681291
ftphost=$(echo "${t_loc}"| awk -F: '{print $4}')
12691292
ftplocn=$(echo "${t_loc}"| awk -F: '{print $5}')
1270-
debug "ftp user=$ftpuser - pass=$ftppass - host=$ftphost location=$ftplocn"
1271-
ftp -n <<- EOF
1293+
debug "$FTP_COMMAND user=$ftpuser - pass=$ftppass - host=$ftphost location=$ftplocn"
1294+
$FTP_COMMAND <<- EOF
12721295
open $ftphost
12731296
user $ftpuser $ftppass
12741297
cd $ftplocn
@@ -2653,6 +2676,9 @@ set_server_type
26532676
# check what dns utils are installed
26542677
find_dns_utils
26552678

2679+
# Find what ftp client is installed
2680+
find_ftp_command
2681+
26562682
# auto upgrade clients to v2
26572683
auto_upgrade_v2
26582684

@@ -3006,4 +3032,4 @@ fi
30063032
echo "certificate obtained for ${DOMAIN}"
30073033

30083034
# gracefully exit ( tidying up temporary files etc).
3009-
graceful_exit
3035+
graceful_exit

0 commit comments

Comments
 (0)