Skip to content

Commit c75e78b

Browse files
authored
Merge pull request #715 from srvrco/fix-preferred-chain-arg
Fix -preferred-chain argument (#712) Show help if no domain specified (#705)
2 parents 6968d45 + 3441712 commit c75e78b

File tree

6 files changed

+28
-14
lines changed

6 files changed

+28
-14
lines changed

getssl

+13-6
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,9 @@
271271
# 2021-08-26 Improve upgrade check & make upgrade do a full install when possible (tlhackque) (#694) (2.42)
272272
# 2021-09-02 Fix version compare - cURL v8 may have single digit minor numbers. (tlhackque) (2.43)
273273
# 2021-09-26 Delete key file when key algorithm has changed (makuhama)
274+
# 2021-09-30 better error if curl returns 60 (#709)
275+
# 2021-10-01 Fix -preferred-chain argument (#712)
276+
# 2021-10-01 Show help if no domain specified (#705)(2.44)
274277
# ----------------------------------------------------------------------------------------
275278

276279
case :$SHELLOPTS: in
@@ -279,7 +282,7 @@ esac
279282

280283
PROGNAME=${0##*/}
281284
PROGDIR="$(cd "$(dirname "$0")" || exit; pwd -P;)"
282-
VERSION="2.43"
285+
VERSION="2.44"
283286

284287
# defaults
285288
ACCOUNT_KEY_LENGTH=4096
@@ -290,7 +293,7 @@ CHALLENGE_CHECK_TYPE="http"
290293
CHECK_REMOTE_WAIT=0
291294
CHECK_REMOTE="true"
292295
if [[ -n "${GITHUB_REPOSITORY}" ]] ; then
293-
CODE_LOCATION="https://raw.githubusercontent.com/${GITHUB_REPOSITORY}/getssl/master/getssl"
296+
CODE_LOCATION="https://raw.githubusercontent.com/${GITHUB_REPOSITORY}/master/getssl"
294297
RELEASE_API="https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/latest"
295298
else
296299
CODE_LOCATION="https://raw.githubusercontent.com/srvrco/getssl/master/getssl"
@@ -784,7 +787,7 @@ check_getssl_upgrade() { # check if a more recent release is available
784787
# Replace error in release description with _error (which is ignored by check_output_for_errors() in the tests)
785788
debug "${release_data//error/_error}"
786789
release_data="$(sed -e's/^ *//g' <<<"${release_data}")"
787-
release_tag="$(sed -e'/^"tag_name": *"/!d;s/^"tag_name": *"\([^""]*\).*$/\1/' <<<"${release_data}")"
790+
release_tag="$(sed -e'/"tag_name": *"/!d;s/"tag_name": *"\([^""]*\).*$/\1/' <<<"${release_data}")"
788791
if [[ "${release_tag:0:1}" != 'v' ]] ; then
789792
if [[ ${_MUTE} -eq 0 ]]; then
790793
info "The current repository has no releases or is improperly tagged; can't check for upgrades: '$release_tag'"
@@ -820,7 +823,7 @@ check_getssl_upgrade() { # check if a more recent release is available
820823
if [ "$TEMP_UPGRADE_FILE" == "" ]; then
821824
error_exit "mktemp failed"
822825
fi
823-
CODE_LOCATION=$(sed -e"s/getssl\/master/${release_tag}/" <<<"$CODE_LOCATION")
826+
CODE_LOCATION=$(sed -e"s/master/${release_tag}/" <<<"$CODE_LOCATION")
824827
# shellcheck disable=SC2086
825828
debug curl ${_NOMETER:---silent} --user-agent "$CURL_USERAGENT" "$CODE_LOCATION" --output "$TEMP_UPGRADE_FILE"
826829
# shellcheck disable=SC2086
@@ -2427,7 +2430,7 @@ send_signed_request() { # Sends a request to the ACME server, signed with your p
24272430
fi
24282431
debug "response status = $response_status"
24292432
if [[ "$code" -eq 500 ]]; then
2430-
info "error on acme server - trying again ...."
2433+
info "_error on acme server - trying again ...."
24312434
debug "loop_limit = $loop_limit"
24322435
sleep 5
24332436
loop_limit=$((loop_limit - 1))
@@ -2755,7 +2758,7 @@ while [[ -n ${1+defined} ]]; do
27552758
_ONLY_CHECK_CONFIG=1 ;;
27562759
-w)
27572760
shift; WORKING_DIR="$1" ;;
2758-
-preferred-chain)
2761+
-preferred-chain | --preferred-chain)
27592762
shift; PREFERRED_CHAIN="$1" ;;
27602763
--source)
27612764
return ;;
@@ -2830,6 +2833,10 @@ if [[ $_UPGRADE_CHECK -eq 1 ]]; then
28302833
# if nothing in command line and no revocation and not only config check,
28312834
# then exit after upgrade
28322835
if [[ -z "$DOMAIN" ]] && [[ ${_CHECK_ALL} -ne 1 ]] && [[ ${_REVOKE} -ne 1 ]] && [ "${_ONLY_CHECK_CONFIG}" -ne 1 ]; then
2836+
# if nothing in command line, print help before exit.
2837+
if [[ -z "$DOMAIN" ]] && [[ ${_CHECK_ALL} -ne 1 ]]; then
2838+
help_message
2839+
fi
28332840
graceful_exit
28342841
fi
28352842
fi

test/33-ftp.bats

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ setup() {
1818
pasv_enable=NO
1919
_FTP
2020

21-
${CODE_DIR}/test/restart-ftpd
21+
${CODE_DIR}/test/restart-ftpd start
2222
fi
2323
}
2424

@@ -27,7 +27,7 @@ teardown() {
2727
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_RUN_TMPDIR/failed.skip
2828
if [ -n "${VSFTPD_CONF}" ]; then
2929
cp ${VSFTPD_CONF}.getssl $VSFTPD_CONF
30-
${CODE_DIR}/test/restart-ftpd
30+
${CODE_DIR}/test/restart-ftpd stop
3131
fi
3232
}
3333

test/34-ftp-passive.bats

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pasv_min_port=10090
2121
connect_from_port_20=NO
2222
_FTP
2323

24-
${CODE_DIR}/test/restart-ftpd
24+
${CODE_DIR}/test/restart-ftpd start
2525
fi
2626
}
2727

@@ -30,7 +30,7 @@ teardown() {
3030
[ -n "$BATS_TEST_COMPLETED" ] || touch $BATS_RUN_TMPDIR/failed.skip
3131
if [ -n "${VSFTPD_CONF}" ]; then
3232
cp ${VSFTPD_CONF}.getssl $VSFTPD_CONF
33-
${CODE_DIR}/test/restart-ftpd
33+
${CODE_DIR}/test/restart-ftpd stop
3434
fi
3535
}
3636

test/restart-ftpd

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
#!/usr/bin/env bash
22

3+
if [ -z "$1" ]; then
4+
arg="restart"
5+
else
6+
arg=$1
7+
fi
8+
39
if [ "$GETSSL_OS" = "alpine" ]; then
410
killall -HUP vsftpd >&3-
511
elif [[ "$GETSSL_OS" == "centos"[78] || "$GETSSL_OS" == "rockylinux"* ]]; then
612
pgrep vsftpd | head -1 | xargs kill -HUP
713
elif [[ "$GETSSL_OS" == "centos6" ]]; then
8-
service vsftpd restart >&3- >/dev/null
14+
service vsftpd "$arg"
915
else
1016
service vsftpd restart >/dev/null >&3-
1117
fi

test/restart-nginx

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ elif [[ "$GETSSL_OS" == "centos"[78] || "$GETSSL_OS" == "rockylinux"* ]]; then
77
pgrep nginx | head -1 | xargs kill -HUP
88
sleep 5
99
elif [[ "$GETSSL_OS" == "centos6" ]]; then
10-
service nginx restart >&3- >/dev/null
10+
service nginx restart 3>&-
11+
# service nginx restart
1112
else
1213
service nginx restart >/dev/null >&3-
1314
fi

test/test_helper.bash

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ if [[ -f /usr/bin/supervisord && -f /etc/supervisord.conf ]]; then
7474
fi
7575
elif [[ "$GETSSL_OS" == "centos"[78] || "$GETSSL_OS" == "rockylinux"* ]]; then
7676
if [ -z "$(pgrep nginx)" ]; then
77-
nginx >&3-
77+
nginx 3>&-
7878
fi
7979
if [ -z "$(pgrep vsftpd)" ] && [ "$(command -v vsftpd)" ]; then
80-
vsftpd >&3-
80+
vsftpd 3>&-
8181
fi
8282
fi
8383

0 commit comments

Comments
 (0)