Skip to content

Commit 1a1e538

Browse files
authored
v1.4.0 (#18)
Major updates * Updating base image version * Switching to esh from gomplate * Using bcg- executables Minor updates * Changing html font to Arial * Simplifying site config
1 parent f38688d commit 1a1e538

23 files changed

+150
-182
lines changed

Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM bcgdesign/nginx:alpine-3.13-1.3.2
1+
FROM bcgdesign/nginx:alpine-3.13-1.4.1
22

33
LABEL maintainer="Ben Green <[email protected]>" \
44
org.label-schema.name="Nginx Proxy" \
@@ -27,12 +27,10 @@ ENV \
2727
# set to true to skip local HTTP token check
2828
GETSSL_SKIP_HTTP_TOKEN_CHECK="false"
2929

30-
ARG GOMPLATE_VERSION=3.8.0-r0
3130
RUN apk -U upgrade \
3231
&& apk add \
3332
bash \
3433
curl \
35-
gomplate=${GOMPLATE_VERSION} \
3634
openssl \
3735
&& rm -rf /var/cache/apk/* /etc/nginx/sites /tmp/*
3836

Dockerfile-automated

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,10 @@ ENV \
2727
# set to true to skip local HTTP token check
2828
GETSSL_SKIP_HTTP_TOKEN_CHECK="false"
2929

30-
ARG GOMPLATE_VERSION=3.8.0-r0
3130
RUN apk -U upgrade \
3231
&& apk add \
3332
bash \
3433
curl \
35-
gomplate=${GOMPLATE_VERSION} \
3634
openssl \
3735
&& rm -rf /var/cache/apk/* /etc/nginx/sites /tmp/*
3836

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.3.1
1+
1.4.0

overlay/etc/cont-init.d/20-paths

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set -euo pipefail
77
# Add environment variable to S6 environment directory
88
#======================================================================================================================
99

10-
add_env () { _echo "${1}=${2}" && printf "%s" $2 > /var/run/s6/container_environment/$1; }
10+
add_env () { bcg-echo "${1}=${2}" && printf "%s" $2 > /var/run/s6/container_environment/$1; }
1111

1212

1313
#======================================================================================================================

overlay/etc/cont-init.d/21-ssl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ set -euo pipefail
99

1010
if [ "${CLEAN_INSTALL}" = "1" ] ; then
1111

12-
_echo "Clean install detected..."
13-
_rmrf "${SSL_GLOBAL_CFG}"
14-
_rmrf "${SSL_CERTS}/*"
15-
_rmrf "${SITES}/*"
16-
_done
12+
bcg-echo "Clean install detected..."
13+
bcg-rmrf "${SSL_GLOBAL_CFG}"
14+
bcg-rmrf "${SSL_CERTS}/*"
15+
bcg-rmrf "${SITES}/*"
16+
bcg-done
1717

1818
fi
1919

overlay/etc/ssl/getssl

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,8 @@
248248
# 2020-12-22 Fixes to get_auth_dns
249249
# 2020-12-22 Check that dig doesn't return an error (#611)(2.32)
250250
# 2020-12-29 Fix dig SOA lookup (#617)(2.33)
251-
# 2021-01-05 Show error if running in POSIX mode (#611)
252251
# ----------------------------------------------------------------------------------------
253252

254-
case :$SHELLOPTS: in
255-
*:posix:*) echo -e "${0##*/}: Running with POSIX mode enabled is not supported" >&2; exit 1;;
256-
esac
257-
258253
PROGNAME=${0##*/}
259254
PROGDIR="$(cd "$(dirname "$0")" || exit; pwd -P;)"
260255
VERSION="2.33"
@@ -274,7 +269,6 @@ DEACTIVATE_AUTH="false"
274269
DEFAULT_REVOKE_CA="https://acme-v02.api.letsencrypt.org"
275270
DOMAIN_KEY_LENGTH=4096
276271
DUAL_RSA_ECDSA="false"
277-
FTP_OPTIONS=""
278272
GETSSL_IGNORE_CP_PRESERVE="false"
279273
HTTP_TOKEN_CHECK_WAIT=0
280274
IGNORE_DIRECTORY_DOMAIN="false"
@@ -773,9 +767,7 @@ check_getssl_upgrade() { # check if a more recent version of code is available a
773767
getssl_versions=("${getssl_versions[@]:1}")
774768
done
775769
fi
776-
if ! eval "$ORIGCMD"; then
777-
error_exit "Running upgraded getssl failed"
778-
fi
770+
eval "$ORIGCMD"
779771
graceful_exit
780772
else
781773
info ""
@@ -843,9 +835,6 @@ copy_file_to_location() { # copies a file, using scp, sftp or ftp if required.
843835
if [[ "$cert" != "challenge token" ]] ; then
844836
error_exit "ftp is not a secure method for copying certificates or keys"
845837
fi
846-
if [[ -z "$FTP_COMMAND" ]]; then
847-
error_exit "No ftp command found"
848-
fi
849838
debug "using ftp to copy the file from $from"
850839
ftpuser=$(echo "$to"| awk -F: '{print $2}')
851840
ftppass=$(echo "$to"| awk -F: '{print $3}')
@@ -857,15 +846,9 @@ copy_file_to_location() { # copies a file, using scp, sftp or ftp if required.
857846
fromfile=$(basename "$from")
858847
debug "ftp user=$ftpuser - pass=$ftppass - host=$ftphost dir=$ftpdirn file=$ftpfile"
859848
debug "from dir=$fromdir file=$fromfile"
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
849+
ftp -n <<- _EOF
866850
open $ftphost
867-
user $ftpuser $ftppass
868-
$FTP_OPTIONS
851+
user $ftpuser $ftppass
869852
cd $ftpdirn
870853
lcd $fromdir
871854
put ./$fromfile
@@ -896,13 +879,12 @@ copy_file_to_location() { # copies a file, using scp, sftp or ftp if required.
896879
davsport=$(echo "$to"| awk -F: '{print $5}')
897880
davslocn=$(echo "$to"| awk -F: '{print $6}')
898881
davsdirn=$(dirname "$davslocn")
899-
davsdirn=$(echo "${davsdirn}/" | sed 's,//,/,g')
900882
davsfile=$(basename "$davslocn")
901883
fromdir=$(dirname "$from")
902884
fromfile=$(basename "$from")
903885
debug "davs user=$davsuser - pass=$davspass - host=$davshost port=$davsport dir=$davsdirn file=$davsfile"
904886
debug "from dir=$fromdir file=$fromfile"
905-
curl -u "${davsuser}:${davspass}" -T "${fromdir}/${fromfile}" "https://${davshost}:${davsport}${davsdirn}${davsfile}"
887+
curl -u "${davsuser}:${davspass}" -T "${fromdir}/${fromfile}" "https://${davshost}:${davsport}${davsdirn}/${davsfile}"
906888
else
907889
if ! mkdir -p "$(dirname "$to")" ; then
908890
error_exit "cannot create ACL directory $(basename "$to")"
@@ -1129,18 +1111,6 @@ find_dns_utils() {
11291111
fi
11301112
}
11311113

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-
11441114
fulfill_challenges() {
11451115
dn=0
11461116
for d in "${alldomains[@]}"; do
@@ -1290,8 +1260,8 @@ for d in "${alldomains[@]}"; do
12901260
ftppass=$(echo "${t_loc}"| awk -F: '{print $3}')
12911261
ftphost=$(echo "${t_loc}"| awk -F: '{print $4}')
12921262
ftplocn=$(echo "${t_loc}"| awk -F: '{print $5}')
1293-
debug "$FTP_COMMAND user=$ftpuser - pass=$ftppass - host=$ftphost location=$ftplocn"
1294-
$FTP_COMMAND <<- EOF
1263+
debug "ftp user=$ftpuser - pass=$ftppass - host=$ftphost location=$ftplocn"
1264+
ftp -n <<- EOF
12951265
open $ftphost
12961266
user $ftpuser $ftppass
12971267
cd $ftplocn
@@ -2676,9 +2646,6 @@ set_server_type
26762646
# check what dns utils are installed
26772647
find_dns_utils
26782648

2679-
# Find what ftp client is installed
2680-
find_ftp_command
2681-
26822649
# auto upgrade clients to v2
26832650
auto_upgrade_v2
26842651

@@ -3032,4 +2999,4 @@ fi
30322999
echo "certificate obtained for ${DOMAIN}"
30333000

30343001
# gracefully exit ( tidying up temporary files etc).
3035-
graceful_exit
3002+
graceful_exit

overlay/etc/ssl/inc/check.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#======================================================================================================================
66

77
if [ -z "${LETS_ENCRYPT_EMAIL}" ] ; then
8-
_error "LETS_ENCRYPT_EMAIL must be set before requesting SSL certificates."
8+
bcg-error "LETS_ENCRYPT_EMAIL must be set before requesting SSL certificates."
99
exit 1
1010
fi
1111

@@ -16,7 +16,7 @@ fi
1616

1717
SSL_CONF=${SSL}/conf.sh
1818
if [ ! -f ${SSL_CONF} ] ; then
19-
_error "You must create ${SSL_CONF} - see ssl-conf-sample.sh."
19+
bcg-error "You must create ${SSL_CONF} - see ssl-conf-sample.sh."
2020
exit 1
2121
fi
2222

@@ -32,7 +32,7 @@ source ${SSL_CONF}
3232
#======================================================================================================================
3333

3434
if [ "${#DOMAINS[@]}" = "0" ] ; then
35-
_error "No domains have been registered for SSL."
35+
bcg-error "No domains have been registered for SSL."
3636
exit 1
3737
fi
3838

overlay/etc/ssl/inc/setup-global.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@
77
setup_global () {
88

99
if [ ! -f ${SSL_GLOBAL_CFG} ] ; then
10-
_echo " .. creating global configuration file..."
11-
gomplate \
12-
-o ${SSL_GLOBAL_CFG} \
13-
-f ${TEMPLATES}/getssl-global.conf.tmpl
10+
bcg-echo " .. creating global configuration file..."
11+
esh -o ${SSL_GLOBAL_CFG} \
12+
${TEMPLATES}/getssl-global.conf.esh
1413
fi
1514

1615
if [ ! -f ${SSL_DHPARAM} ] ; then
17-
_echo " .. generating dhparam..."
16+
bcg-echo " .. generating dhparam..."
1817
openssl dhparam -out ${SSL_DHPARAM} ${SSL_DHPARAM_BITS}
1918
fi
2019

overlay/etc/ssl/inc/setup-nginx.sh

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ setup_nginx () {
1414
export IS_DEFAULT=${1}
1515
export DOMAIN_NAME=${2}
1616
export UPSTREAM=${3}
17-
local -n DOMAIN_ALIASES=${4}
17+
local DOMAIN_ALIASES=${4}
1818
export DOMAIN_NGXCONF=${5}
1919

2020
# paths to site configuration and custom config directory
@@ -30,25 +30,24 @@ setup_nginx () {
3030

3131
# if empty, remove config so it can be regenerated
3232
if [ -z "${DOMAIN_NGXCONF}" ] ; then
33-
_echo " removing and regnerating Nginx configuration"
33+
bcg-echo " removing and regnerating Nginx configuration"
3434
rm ${CONF}
3535

3636
# otherwise, leave file (allows custom config)
3737
else
38-
_echo " keeping existing configuration."
38+
bcg-echo " keeping existing configuration."
3939
return 0
4040
fi
4141

4242
else
4343

4444
# no need to do anything, be a good log citizen
45-
_echo " generating default Nginx configuration"
45+
bcg-echo " generating default Nginx configuration"
4646

4747
fi
4848

4949
# build domain list and remove trailing / multiple spaces between domains
50-
TMP="${DOMAIN_NAME}$(printf " %s" ${DOMAIN_ALIASES[@]})"
51-
export SERVER_NAMES=$(echo "${TMP}" | xargs)
50+
export SERVER_NAMES=$(echo "${DOMAIN_NAME} ${DOMAIN_ALIASES}" | xargs)
5251

5352
# generate site configuration
5453
if [ "${IS_DEFAULT}" = "1" ] ; then
@@ -57,8 +56,8 @@ setup_nginx () {
5756
NGINX_CONF="site"
5857
fi
5958

60-
gomplate \
59+
esh -s /bin/bash \
6160
-o ${CONF} \
62-
-f ${TEMPLATES}/nginx-${NGINX_CONF}.conf.tmpl
61+
${TEMPLATES}/nginx-${NGINX_CONF}.conf.esh
6362

6463
}

overlay/etc/ssl/inc/setup-ssl.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ generate_temp_cert () {
2929
setup_ssl () {
3030

3131
local DOMAIN_NAME=${1}
32-
local -n DOMAIN_ALIASES=${2}
32+
local DOMAIN_ALIASES=(${2})
3333
local FILE=${SSL_CERTS}/${DOMAIN_NAME}/${GETSSL_CFG}
3434

3535
# check for existing configuration
36-
[[ -f ${FILE} ]] && _echo " already set up." && return 0
36+
[[ -f ${FILE} ]] && bcg-echo " already set up." && return 0
3737

3838
# -U stop upgrade checks
3939
# -w set working directory

0 commit comments

Comments
 (0)