Skip to content

Commit f29c91a

Browse files
committed
Add all starttls protocols supported by openssl.
Adds -starttls for all protocols currently documented by openssl s_client (their master branch). Also allows REMOTE_EXTRA in config files to override built-in usage. Reordered extra_cmds to match openssl documentation so it's easier to see when openssl adds new protocols.
1 parent 0cf8fe3 commit f29c91a

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

getssl

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@
292292
# 2024-03-16 Use FTP_PORT when deleting ftp tokens. Delete tokens when using sftp, davfs, ftpes, ftps (#693,#839) (tlhackque)
293293
# 2024 03-16 Fix dns-01's CNAME processing. (#840) (tlhackque)
294294
# 2024-03-17 Automatically update the ACCOUNT_EMAIL (#827) (tlhackque)
295+
# 2024-03-18 Refresh the TXT record if a CNAME is found (JoergBruce #828) (2.49)
295296
# 2024-03-18 Implement --new-account-key and --DEACTIVATE-account (tlhackque)
296297
# 2024-03-18 Implement token substitution in ACLs (#267) (tlhackque)
297298
# 2024-03-19 Implement DNS_NSUPDATE_LOCALIP in dns_{add,del}_nsupdate (#801) (tlhackque)
@@ -300,6 +301,7 @@
300301
# 2024-03-21 Avoid domain processing when the action is account management. (tlhackque)
301302
# 2024-03-24 Implement multiple ACCOUNT_EMAIL addresses (tlhackque)
302303
# 2024-03-24 Use /etc/services (or similar) to translate port names. (tlhackque)
304+
# 2024-04-12 Add all starttls protocols currently documented by openssl. Ensure that REMOTE_EXTRA overides built-ins (tlhackque)
303305
# ----------------------------------------------------------------------------------------
304306

305307
case :$SHELLOPTS: in
@@ -2498,18 +2500,20 @@ requires() { # check if required function is available
24982500

24992501
function find_service_port() {
25002502
local name="$1" line
2501-
# "extra" commands from IANA port number
2502-
declare -ar extra_cmds=([21]="-starttls ftp" [143]="-starttls imap" [110]="-starttls pop3"
2503-
[25]="-starttls smtp" [587]="-starttls smtp" [5222]="-starttls xmpp"
2504-
[5432]="-starttls postgres")
2503+
# "extra" command options for openssl s_client from IANA port number
2504+
declare -ar extra_cmds=([25]="-starttls smtp" [587]="-starttls smtp" [110]="-starttls pop3"
2505+
[143]="-starttls imap" [21]="-starttls ftp" [5222]="-starttls xmpp"
2506+
[5269]="-starttls xmpp-server" [194]="-starttls irc" [5432]="-starttls postgres"
2507+
[3306]="-starttls mysql" [24]="-starttls lmtp" [119]="-starttls nntp"
2508+
[2000]="-starttls sieve" [389]="-starttls ldap")
25052509
# Standard name IANA-assigned name from previous conventions
25062510
declare -Ar aliases=(["webserver"]="https" ["ftpi"]="ftps" ["smtps_deprecated"]="smtps"
25072511
["smtps"]="submission" ["smtp_submission"]="submission" ["xmpp"]="xmpp-client"
25082512
["xmpps"]="xmpp-server")
25092513
# Fallback name => port mapping (what previous code did)
25102514
declare -Ar defaults=(["https"]=443 ["ftp"]=21 ["ftps"]=990 ["imap"]=143 ["imaps"]=993
25112515
["pop3"]=110 ["pop3s"]=995 ["smtp"]=25 ["smtps"]=465 ["submission"]=587
2512-
["xmpp-client"]=5222 ["xmpp-server"]=5369 ["ldaps"]=636 ["postgres"]=5432)
2516+
["xmpp-client"]=5222 ["xmpp-server"]=5269 ["ldaps"]=636 ["postgres"]=5432)
25132517

25142518
# Numeric name => just check for extras
25152519
if [[ "$name" =~ ^([0-9]+)$ ]]; then
@@ -2549,11 +2553,11 @@ function find_service_port() {
25492553
set_server_type() { # uses SERVER_TYPE to set REMOTE_PORT and REMOTE_EXTRA
25502554
if find_service_port "$SERVER_TYPE" ; then
25512555
REMOTE_PORT="$_PORT"
2552-
REMOTE_EXTRA="$_EXTRA"
2553-
else
2554-
info "${DOMAIN}: unknown server type \"$SERVER_TYPE\" in SERVER_TYPE"
2555-
config_errors=true
2556+
[[ -z "$REMOTE_EXTRA" ]] && REMOTE_EXTRA="$_EXTRA"
2557+
return 0
25562558
fi
2559+
info "${DOMAIN}: unknown server type \"$SERVER_TYPE\" in SERVER_TYPE"
2560+
return 1
25572561
}
25582562

25592563
send_signed_request() { # Sends a request to the ACME server, signed with your private key.
@@ -3294,7 +3298,9 @@ if [[ $_SHOW_ACCOUNT_ID -eq 0 ]] && [[ $_NEW_ACCOUNT_KEY -eq 0 ]] && [[ $_DEACTI
32943298
SANS=$(echo "$SANS" | sed 's/[, ]\+/,/g')
32953299

32963300
# from SERVER_TYPE set REMOTE_PORT and REMOTE_EXTRA
3297-
set_server_type
3301+
if ! set_server_type; then
3302+
config_errors=true
3303+
fi
32983304

32993305
# check what dns utils are installed
33003306
find_dns_utils

0 commit comments

Comments
 (0)