Skip to content

Commit 351f36c

Browse files
author
tosticated
committed
Changed parameter to --reqheader for custom HTTP headers.
1 parent 1473cdf commit 351f36c

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* Added --overwrite argument to support overwriting output files without warning
2929
* Headerflag X-XSS-Protection is now labeled as INFO
3030
* Client simulation runs in wide mode which is even better readable
31-
* Added --customhttpheader to support custom headers in HTTP requests
31+
* Added --reqheader to support custom headers in HTTP requests
3232

3333
### Features implemented / improvements in 3.0
3434

doc/testssl.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ Please note that \fBfname\fR has to be in Unix format\. DOS carriage returns won
137137
\fB\-\-basicauth <user:pass>\fR This can be set to provide HTTP basic auth credentials which are used during checks for security headers\. BASICAUTH is the ENV variable you can use instead\.
138138
.
139139
.P
140-
\fB\-\-customhttpheader <header>\fR This can be used to add additional HTTP request headers in the correct format \fBHeadername: headercontent\fR\. This parameter can be called multiple times if required\. For example: \fB\-\-customhttpheader \'Proxy\-Authorization: Basic dGVzdHNzbDpydWxlcw==\' \-\-customhttpheader \'ClientID: 0xDEADBEAF\'\fR\. CUSTOMHTTPHEADER is the corresponding environment variable\.
140+
\fB\-\-reqheader <header>\fR This can be used to add additional HTTP request headers in the correct format \fBHeadername: headercontent\fR\. This parameter can be called multiple times if required\. For example: \fB\-\-reqheader \'Proxy\-Authorization: Basic dGVzdHNzbDpydWxlcw==\' \-\-reqheader \'ClientID: 0xDEADBEAF\'\fR\. REQHEADER is the corresponding environment variable\.
141141
.
142142
.SS "SPECIAL INVOCATIONS"
143143
\fB\-t <protocol>, \-\-starttls <protocol>\fR does a default run against a STARTTLS enabled \fBprotocol\fR\. \fBprotocol\fR must be one of \fBftp\fR, \fBsmtp\fR, \fBpop3\fR, \fBimap\fR, \fBxmpp\fR, \fBxmpp-server\fR, \fBtelnet\fR, \fBldap\fR, \fBirc\fR, \fBlmtp\fR, \fBnntp\fR, \fBpostgres\fR, \fBmysql\fR\. For the latter four you need e\.g\. the supplied OpenSSL or OpenSSL version 1\.1\.1\. Please note: MongoDB doesn\'t offer a STARTTLS connection, LDAP currently only works with \fB\-\-ssl\-native\fR\. \fBtelnet\fR and \fBirc\fR is WIP\.

doc/testssl.1.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/testssl.1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ The same can be achieved by setting the environment variable `WARNINGS`.
110110

111111
`--basicauth <user:pass>` This can be set to provide HTTP basic auth credentials which are used during checks for security headers. BASICAUTH is the ENV variable you can use instead.
112112

113-
`--customhttpheader <header>` This can be used to add additional HTTP request headers in the correct format `Headername: headercontent`. This parameter can be called multiple times if required. For example: `--customhttpheader 'Proxy-Authorization: Basic dGVzdHNzbDpydWxlcw==' --customhttpheader 'ClientID: 0xDEADBEAF'`. CUSTOMHTTPHEADER is the corresponding environment variable.
113+
`--reqheader <header>` This can be used to add additional HTTP request headers in the correct format `Headername: headercontent`. This parameter can be called multiple times if required. For example: `--reqheader 'Proxy-Authorization: Basic dGVzdHNzbDpydWxlcw==' --reqheader 'ClientID: 0xDEADBEAF'`. REQHEADER is the corresponding environment variable.
114114

115115

116116
### SPECIAL INVOCATIONS

testssl.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ QUIET=${QUIET:-false} # don't output the banner. By doing this
162162
SSL_NATIVE=${SSL_NATIVE:-false} # we do per default bash sockets where possible "true": switch back to "openssl native"
163163
ASSUME_HTTP=${ASSUME_HTTP:-false} # in seldom cases (WAF, old servers, grumpy SSL) service detection fails. "True" enforces HTTP checks
164164
BASICAUTH=${BASICAUTH:-""} # HTTP basic auth credentials can be set here like user:pass
165-
CUSTOMHTTPHEADER=${CUSTOMHTTPHEADER:-""} # HTTP custom request header can be set here like Header: content. Can be used multiple times.
165+
REQHEADER=${REQHEADER:-""} # HTTP custom request header can be set here like Header: content. Can be used multiple times.
166166
BUGS=${BUGS:-""} # -bugs option from openssl, needed for some BIG IP F5
167167
WARNINGS=${WARNINGS:-""} # can be either off or batch
168168
DEBUG=${DEBUG:-0} # 1: normal output the files in /tmp/ are kept for further debugging purposes
@@ -374,7 +374,7 @@ TLS_NOW="" # Similar
374374
TLS_DIFFTIME_SET=false # Tells TLS functions to measure the TLS difftime or not
375375
NOW_TIME=""
376376
HTTP_TIME=""
377-
CUSTOMHTTPHEADERS=()
377+
REQHEADERS=()
378378
GET_REQ11=""
379379
START_TIME=0 # time in epoch when the action started
380380
END_TIME=0 # .. ended
@@ -19250,7 +19250,7 @@ tuning / connect options (most also can be preset via environment variables):
1925019250
--phone-out allow to contact external servers for CRL download and querying OCSP responder
1925119251
--add-ca <CA files|CA dir> path to <CAdir> with *.pem or a comma separated list of CA files to include in trust check
1925219252
--basicauth <user:pass> provide HTTP basic auth information.
19253-
--customhttpheader <header> add custom http request headers
19253+
--reqheader <header> add custom http request headers
1925419254

1925519255
output options (can also be preset via environment variables):
1925619256
--quiet don't output the banner. By doing this you acknowledge usage terms normally appearing in the banner
@@ -19403,7 +19403,7 @@ SHOW_EACH_C: $SHOW_EACH_C
1940319403
SSL_NATIVE: $SSL_NATIVE
1940419404
ASSUME_HTTP $ASSUME_HTTP
1940519405
BASICAUTH: $BASICAUTH
19406-
CUSTOMHTTPHEADER: $CUSTOMHTTPHEADER
19406+
REQHEADER: $REQHEADER
1940719407
SNEAKY: $SNEAKY
1940819408
OFFENSIVE: $OFFENSIVE
1940919409
PHONE_OUT: $PHONE_OUT
@@ -20527,7 +20527,7 @@ determine_service() {
2052720527
local ua
2052820528
local protocol
2052920529
local basicauth_header=""
20530-
local customhttpheader=""
20530+
local reqheader=""
2053120531

2053220532
# Check if we can connect to $NODEIP:$PORT. Attention: This ALWAYS uses sockets. Thus timeouts for --ssl-=native do not apply
2053320533
if ! fd_socket 5; then
@@ -20555,10 +20555,10 @@ determine_service() {
2055520555
if [[ -n "$BASICAUTH" ]]; then
2055620556
basicauth_header="Authorization: Basic $(safe_echo "$BASICAUTH" | $OPENSSL base64 2>/dev/null)\r\n"
2055720557
fi
20558-
if [[ -n "$CUSTOMHTTPHEADERS" ]]; then
20559-
customhttpheader="$(join_by "\r\n" "${CUSTOMHTTPHEADERS[@]}")\r\n" #Add all required custom http headers to one string with newlines
20558+
if [[ -n "$REQHEADERS" ]]; then
20559+
reqheader="$(join_by "\r\n" "${REQHEADERS[@]}")\r\n" #Add all required custom http headers to one string with newlines
2056020560
fi
20561-
GET_REQ11="GET $URL_PATH HTTP/1.1\r\nHost: $NODE\r\nUser-Agent: $ua\r\n${basicauth_header}${customhttpheader}Accept-Encoding: identity\r\nAccept: text/*\r\nConnection: Close\r\n\r\n"
20561+
GET_REQ11="GET $URL_PATH HTTP/1.1\r\nHost: $NODE\r\nUser-Agent: $ua\r\n${basicauth_header}${reqheader}Accept-Encoding: identity\r\nAccept: text/*\r\nConnection: Close\r\n\r\n"
2056220562
# returns always 0:
2056320563
service_detection $OPTIMAL_PROTO
2056420564
else # STARTTLS
@@ -22210,10 +22210,10 @@ parse_cmd_line() {
2221022210
BASICAUTH="$(parse_opt_equal_sign "$1" "$2")"
2221122211
[[ $? -eq 0 ]] && shift
2221222212
;;
22213-
--customhttpheader|--customhttpheader=*)
22214-
CUSTOMHTTPHEADER="$(parse_opt_equal_sign "$1" "$2")"
22213+
--reqheader|--reqheader=*)
22214+
REQHEADER="$(parse_opt_equal_sign "$1" "$2")"
2221522215
[[ $? -eq 0 ]] && shift
22216-
CUSTOMHTTPHEADERS+=("$CUSTOMHTTPHEADER")
22216+
REQHEADERS+=("$REQHEADER")
2221722217
;;
2221822218
(--) shift
2221922219
break

0 commit comments

Comments
 (0)