Commit Graph

2503 Commits

Author SHA1 Message Date
Dirk Wetter
4639e996db Remove ldap protocol early returns
Partly revert bb5450e3f5
2022-01-31 10:36:51 +01:00
Dirk Wetter
9447c8c866 Amends LDAP + STARTTLS / rename sockread_serverhello()
This commit adds parsing the success value of the STARTTLS upgrade
in LDAP. Only possible values whould be 0 or one according to RFC 2380.
All values not equal to zero will terminate the check.

Also, this PR renames sockread_serverhello() to sockread() as the word
serverhello is pretty misleading. It just reads from ANY socket. (sorry
to confuse people here, that should have gone into a separate PR).
  Also sockread() and sockread_fast() are better documented.
2022-01-27 18:35:40 +01:00
Dirk Wetter
601ff16a0a Add prototype for STARTTLS+ LDAP via sockets
See #1258

To do:
* more robustness. At least the success value from the response need to be retrieved and checked via starttls_io().
* double check the pre-handshake before the OID whether it's correct for every case
* documentation
* inline help

It seems to work though against db.debian.org
2022-01-24 16:49:03 +01:00
David Cooper
680dc9ee01 Fix potential stallling in HTTP query
In run_http_header() the GET command is first sent over TLS using a background process, and then if that does not hang, it is sent again in the foreground. Similarly, service_detection() runs the command in the background.

This commit changes determine_optimal_proto() to follow the example of run_http_header() as protection against the possibility of the HTTP query stalling.
2022-01-06 15:33:37 -05:00
David Cooper
50fe6ca96b Report if couldn't test for client authentication
This commit fixes determine_optimal_proto() and run_server_defaults() so that a "Local problem" is reported if a $URL_PATH is specified, the server is TLS 1.3-only, and $OPENSSL does not support -enable_pha (and the server does not offer client authentication as part of the initial TLS handshake).
2022-01-06 15:33:36 -05:00
David Cooper
48819c56e9 Improve check for client authentication with LibreSSL
Checking for client authentication with TLS 1.3 requires post-handshake authentication, which does not appear to be supported by LibreSSL. This commit improves the check for client authentication when testing a TLS 1.3 server using LibreSSL by having determine_optimal_proto() first test for connectivity with TLS 1.3 without checking for client authentication and then performing a separate check for client authentication using a non-TLS 1.3 protocol.

This commit only affects the flow of the program if a $URL_PATH is specified, the server supports TLS 1.3, and $OPENSSL supports TLS 1.3 but not -enable_pha.

testss.sh may still provide incorrect information about client authentication if a $URL_PATH is provided, the server is TLS 1.3-only, and LibreSSL is used.
2022-01-06 15:33:36 -05:00
David Cooper
7fb688a9d6 Improve check for client authentication
Based on initial testing, this commit improves the check for client authentication in the case that the server only requests client authentication for specific URLs. However, it does not work correctly if the server supports TLS 1.3 and $OPENSSL is a version of LibreSSL that supports TLS 1.3 in s_client. The problem is that LibreSSL does not support post-handshake authentication with TLS 1.3
2022-01-06 15:33:36 -05:00
David Cooper
e41a4c361a WIP: Improve check for client authentication
As noted in #1709, some servers will only request client authentication if a specific URL is requested. This commit modifies the check for client authentication, in the case that a $URL_PATH is provided, by having testssl.sh perform a GET request on the URL provided on the command line.
2022-01-06 15:33:36 -05:00
David Cooper
9dac4592b7 Send /dev/null to s_client
As discussed in #2079, this commit adds "</dev/null" to calls "$OPENSSL s_client" that are intended to test whether a certain option is supported. This is done to prevent hanging in the case that the option is supported, a TLS server happens to be listening on the port to which s_client tries to connect, and the connection is successful.

This PR also adds a new helper function, sclient_supported(), which is called from locally_supported() and run_prototest_openssl(). The helper function makes use of the already defined variables $HAS_SSL2, $HAS_SSL3, and $HAS_TLS13 in order to avoid calling "$OPENSSL s_client" when it has already been determined whether $OPENSSL supports the specified protocol.
2022-01-05 16:26:22 -05:00
Dirk Wetter
c573984340 Add +search to dig
... for all forward + non-mdns lookups.

This might help to avoid supplying domain names to local hosts (they would need
to have a valid certificate for the short DNS name then).

Fixes #2077
2022-01-03 16:44:09 +01:00
Emmanuel Bouthenot
bddf3a8189 Fix ports2starttls() to support (manage)sieve protocol while using STARTTLS 2021-12-20 17:16:16 +01:00
Emmanuel Bouthenot
155b380509 Add (manage)sieve protocol support when using STARTTLS 2021-12-17 12:44:39 +01:00
Dan Church
1944eb8787
Refactor strip_quote to use bash replacements instead of sed 2021-12-11 12:43:46 -06:00
Dirk Wetter
7974e57688 add extra line for Age 2021-12-10 16:06:26 +01:00
Dirk Wetter
e871bd0911 Polish PR #2032 + Additions
* address my comments
* add json fields HTTP_headerTime + HTTP_headerAge if they exists
* output HTTP_AGE if it was detected
* do stripping of line feeds closer to where variables were set
2021-12-10 14:27:30 +01:00
Dirk Wetter
d6398c3167 Merge branch 'fixhttpclockskew' of https://github.com/Wahnes/testssl.sh into Wahnes-fixhttpclockskew 2021-12-10 12:06:19 +01:00
David Cooper
ff8e9f49cc Fix #2053
This commit fixes #2053 by setting $FIRST_FINDING to false after a section footer is output.
2021-12-09 10:13:24 -05:00
David Cooper
e1600e3f62 Fix JSON section headers
This commit fixes two issues with the headers in the structured JSON output. First, if run_cipher_match() is performed the header this is used is "pretest" rather than "singleCipher". Second, the headers for "serverPreferences" and "fs" are swapped.
2021-12-08 14:13:10 -05:00
David Cooper
f2a4ee1090 Document $keyopts
Shellcheck complains on line 2234 that keyopts is referenced but not assigned and there is no explanation in the code (or in the documentation) why "$keyopts" is there. This commit adds a comment so that "$keyopts" isn't deleted as part of a code cleanup.
2021-12-08 11:50:35 -05:00
Dirk Wetter
dc782a895c
Merge pull request #2059 from dcooper16/simplify_git_rel
Simplify extracting Git information
2021-12-08 11:50:55 +01:00
David Cooper
edbc66c78d Update reset_hostdepended_vars()
This commit adds several variables to reset_hostdepended_vars() that are not currently being reset for each host being tested, but that should be reset.
2021-12-07 14:45:19 -05:00
David Cooper
019c7fa57a Simplify extracting Git information
testssl.sh currently calls "git log --format='%h %ci' -1 2>/dev/null" three times. This commits changes testssl.sh to make this call just once and then use Bash string manipulation to extract the necessary information from the result.
2021-12-07 14:38:14 -05:00
David Cooper
d701e69e20 Fix some Shellcheck issues
This commit fixes a number of issues raised by Shellcheck and removes unnecessary quotation marks in a number of places.
2021-12-07 09:22:34 -05:00
Dirk Wetter
0eb73d949a
Merge pull request #2056 from drwetter/update_ua_sneaky
Update Firefox UA used in sneaky mode
2021-12-07 08:55:54 +01:00
Dr. Matthias St. Pierre
1e3f932932 Simplify check for git working tree
Sending the entire log to /dev/null is a rather expensive way of checking whether
we are inside a git working tree. Use `git rev-parse --is-inside-work-tree` instead.
2021-12-06 17:35:54 +01:00
Dirk Wetter
914dde501a Update Firefox UA used in sneaky mode
From FF 52 to FF 94.

Also one double quote was removed
2021-12-03 13:15:13 +01:00
David Cooper
708cc672a2 Fix #2049
This commit fixes #2049 by converting newline characters to spaces in JSON and CSV findings.

fileout() calls newline_to_spaces() on the $findings that are to be written to JSON and CSV files. However, this only affects actual newline characters in the string, not escaped newline characters (i.e., "\n"). Escaped newline characters pass through this function unchanged, but then get converted to newline characters when they are written to the JSON and/or CSV files. This commit fixes the problem by also converting escaped newline characters ("\n") to spaces.
2021-11-29 14:36:29 -05:00
Dirk
aca75822c1 Fix for "Bad file descriptor" with --connect-timeout option
This fixes #1834 and #1435.

The --connect-timeout option had the problem that under certain circumstances
like parallel mass scanning it didn't work. The culprit was that a subshell command
was used to connect to the target but the file descriptor wasn't exported.

The commit changes tha logic so that this connect is still done in a subshell
as a pre-check if it's possible to connect. If this fails it proceeds with
error handling if NR_SOCKET_FAIL is above threshold. Otherwsie it just connects
again.

When testing of the alexa 500 it worked for me(tm). It would be great if others
can give it a try.
2021-11-26 17:24:02 +01:00
David Cooper
6b7836d350 Fix sub_cipherlists()
This commit fixes a bug in sub_cipherlists() when using sockets to test whether a server supports a set of ciphers with SSLv2. Code that is supposed to extract the list of SSLv2 ciphers to test for is incorrectly reading from the list of non-SSLv2 ciphers.
2021-11-22 12:25:20 -05:00
David Cooper
80934c85e8 Fix some Shellcheck issues
This commit fixes a few issues found by Shellcheck.
2021-11-12 16:20:41 -05:00
Dirk Wetter
1b11575c28
Merge pull request #2040 from dcooper16/ossl31
Support OpenSSL 3.0.1-dev and 3.1.0-dev
2021-11-10 08:12:30 +01:00
David Cooper
f1df111a32 Fix calls to debugme1() with redirects
As noted in https://github.com/drwetter/testssl.sh/pull/1963#issuecomment-954935175, there are two places in which debugme1() is called in which the command to be run prints something to stdout, which is then redirected to a file. Now that debugme1() includes a redirect from stdout to stderr, these two lines do not work as expected. The output appears in the terminal and an empty file is created.

This commit fixes the issue by not using the debugme1() function in these two places.
2021-11-09 15:36:30 -05:00
David Cooper
095433774d Support OpenSSL 3.0.1-dev and 3.1.0-dev
This commit changes a few lines of code that checks OpenSSL version numbers to recognize 3.0.1 and 3.1.0 in addtion to 3.0.0.

According to https://www.openssl.org/blog/blog/2018/11/28/version, API/ABI compatibility is guaranteed for the same MAJOR version number (starting with version 3), so it should be sufficient to just check that $OSSL_VER_MAJOR is 3.
2021-11-08 08:04:34 -05:00
Magnus Larsen
2b490bd3d3 Also calculate correct final score 2021-11-06 09:06:33 +01:00
Magnus Larsen
cc25613138 [Rating] Fix cipher strength rating, and add penalty for weak cipher suites 2021-11-06 08:45:55 +01:00
Jens Wahnes
31c2ecfcb1 Consider HTTP 'Age' header field when calculating HTTP clock skew. 2021-11-01 19:08:37 +01:00
David Cooper
43f3b507c1 Fix #1733
This commit adds PrioritzeChaCha detection, as requested in #1733. If the server (1) enforces a cipher order for a given protocol, (2) supports at least one non-ChaCha cipher for that protocol, and (3) supports at least one ChaCha cipher that would normally be less preferred than the ChaCha cipher, then a test is performed to see if the server selects the ChaCha cipher if it is listed first in the ClientHello.
2021-10-27 13:53:30 -04:00
Dirk Wetter
1dc858dc90
Merge pull request #2026 from dcooper16/speedup_cipher_pref_check
Speedup cipher_pref_check()
2021-10-27 10:04:13 +02:00
David Cooper
15e3d61ddc Speedup cipher_pref_check()
While OpenSSL 1.0.2-chacha supports more than 128 cipher suites, other versions of OpenSSL tend to support far fewer than that.

Calling check_tls12_pref() adds to the run time of cipher_pref_check(), but is only needed if OpenSSL would otherwise send a ClientHello with more than 128 cipher suites. So, this commit adds another check and only calls check_tls12_pref() if the server has the size limit bug and OpenSSL supports more than 127 ciphers.
2021-10-26 15:56:08 -04:00
David Cooper
d4606ad9f8 Remove extra colon
The code added by #2024 creates a cipher list with two consecutive colons. While this doesn't seem to be a problem, the commit removes the extra colon.
2021-10-26 15:43:01 -04:00
David Cooper
2b752feea0 Remove unnecessary quotes 2021-10-26 12:05:36 -04:00
David Cooper
4536e933f9 Improve cipher_pref_check()
Some servers are configured to prioritize ChaCha ciphers if those ciphers are preferred by the client, even if the server is generally configured to use the server's cipher preferences rather than the client's. As a result of this, if a ChaCha cipher appears in the ClientHello before a non-ChaCha cipher, the server may select the ChaCha cipher even if the server is configured to prefer the non-ChaCha cipher.

In a few cases, e.g., cloudflare.com for TLS 1.2, this affects the ordering of the ciphers presented by cipher_pref_check(). This commit fixes the problem by having cipher_pref_check() (and check_tls12_pref()) always place any ChaCha ciphers at the end of the cipher list in the ClientHello. This ensures that cipher_pref_check() presents the ciphers in the server's preference order.
2021-10-25 14:28:51 -04:00
David Cooper
00fb68f47c Fix s_client_options()
This commit fixes an error in s_client_options() when the function is called with an empty "-cipher" list and $OPENSSL supports "@SECLEVEL". This happens, for example, when ciphers_by_strength() is called for TLS 1.3.

The call to `openssl s_client` will fail is the cipher option is provided with an empty list or a list that just contains "@SECLEVEL=0". So, "@SECLEVEL=0" should only be added if the "$ciphers" list is non-empty. If "$ciphers" remains empty, then the "-cipher" option will not be added to the command line.
2021-10-25 12:15:13 -04:00
Dirk Wetter
31162d2320 typo / wording 2021-10-23 18:40:29 +02:00
Dirk Wetter
a11bd1585e Improvement for testing curves with several openssl / libressl versions
As noted in #2016 the detection of curves in find_openssl_binary()
copuld be improved.

This commit removes another connect call. Also it corrects the port statement
for LibreSSL-like pre-checks as port 0 generally seems to me better suited.
Inline documentation was added.

It worked so far with openssl 1.0.2, 1.1.1 and 3.0 and LibreSSL 3.4.

This needs to be backported to 3.0.
2021-10-23 18:38:04 +02:00
Dirk Wetter
6251a6c1d6
Merge pull request #2016 from drwetter/fix_double_ports
Fix double ports statement
2021-10-23 16:02:04 +02:00
Dirk Wetter
110d1aa73c Add browser requirement for the entropy of cert serial 2021-10-20 19:26:23 +02:00
Dirk Wetter
3140352b0c Fix double ports statement
In order to be in line with 3.0 this adds a statement to avoid double port
statements for WSL users in a precheck condition

   $OPENSSL s_client -groups $curve -connect 127.0.0.1:0:8443

This commit changes that to $OPENSSL s_client -groups $curve -connect 127.0.0.1:8443
which could cause a delay for WSL users and needs further investigation.

Not clear why port 8443 was chosen.
2021-10-20 09:01:09 +02:00
Dirk Wetter
2edfa57eaa Check cert serial len + fix output when too big
OpenSSL shows certificate serial numbers >35 with a LF (0A). Testssl.sh
just output that which makes JSON invalid and displays the LF in the terminal
too.

This commit fixes that (#2010) by adding filters so that the
serialnumber is not a multiline string.

Also this commit introduces a new function: a size check of the cert serial.
Below 8 bytes the CAB Forum's lower limit is hit which says the *entropy*
from a CSPRNG should be at least 64 bits. It is assumed that below 8 bytes
length this requirement isn't possible to meet (needs to be clarified with
Shannon, 8 bytes seems to low to me).
  The high threshold is according to RFC 5280, Section-4.1.2.2 .

See also #2013.

The output has changed, so that on the terminal the serial has one line,
SHA1 and SHA256 each one line. The new json key is "cert_serialNumberLen".
2021-10-19 19:42:12 +02:00
Dirk Wetter
9683af44a2
Merge pull request #1988 from drwetter/windows_dns_fix
Addressing lame DNS responses on WSL
2021-10-18 16:52:35 +02:00
Dirk Wetter
d496c0d44b
Merge pull request #2002 from smokris/1995-trusted-first
In determine_trust(), use the OpenSSL '-trusted_first' flag to ignore the now-expired DST Root CA X3 root certificate
2021-10-07 18:03:20 +02:00
Steve Mokris
5c4500ea4f Initialize/reset the TRUSTED1ST variable, in case determine_optimal_proto() changes the active openssl binary partway through execution 2021-10-06 16:01:13 -04:00
Steve Mokris
c98bbdc36d In determine_trust(), use the OpenSSL '-trusted_first' flag to ignore the now-expired DST Root CA X3 root certificate. Fixes #1995. 2021-10-05 13:45:26 -04:00
Dirk
a5aa3a4bbf Fix invalid JSON when certificate issuer contains non-ASCII chars
Changed printf %s to printf %b which cause now to output
UTF-8 correctly.

See #1992
2021-10-03 18:19:24 +02:00
Dirk Wetter
b6b5a67b92 Save # of connects / WSL uses 127.0.0.1:0 by default
In order to save time and to spare WSL users lame DNS lookups
I removed a couple of connect calls from 14 to 4:

$OPENSSL s_client -ssl2 -connect invalid.
-->
OPENSSL s_client -ssl2

NXCONNECT to localhost IP and port 0 is now the default when WSL
is detected. Not sure whether this is working under all circumstances,
so this needs some testing.
2021-10-02 15:25:42 +02:00
Dirk Wetter
e874c1013b
Revert "In determine_trust(), use the OpenSSL '-trusted_first' flag to ignore the now-expired DST Root CA X3 root certificate" 2021-10-02 08:33:39 +02:00
Steve Mokris
b0754ce0f1 In determine_trust(), use the OpenSSL '-trusted_first' flag to ignore the now-expired DST Root CA X3 root certificate. Fixes #1995. 2021-10-01 16:24:04 -04:00
Andre Klaerner
4f72f2fa8e fix html output content type header 2021-09-24 11:36:29 +02:00
Dirk Wetter
fe6c22f7fd Addressing lame DNS responses on WSL (WIP)
This commit provides a global variable to the RFC 6761 use of "invalid."
which WSL clients doen't seem to handle very well, see #1738, #1812.

With this commit it e.g. is possible to use

     NXCONNECT=localhost:0 ./testssl.sh <TARGET>

to save some time.

This commit will be amended later.
2021-09-15 09:53:20 +02:00
Dirk Wetter
2405176a26 Fix #1982: Newer openssl.cnf break openssl detection
Newer configuration files from openssl may include statements
which aren't compatible with our supplied old openssl version.
This commit adds an autodetection of such a file and uses a
openssl.cnf provided by this project then.
2021-09-15 09:31:03 +02:00
Dimitri Papadopoulos
fcb282e3c3
Typos found by codespell
Run codespell in CI
2021-09-14 13:33:39 +02:00
Dirk
15cfd849fe Replace --standard by --categories 2021-09-09 22:07:44 +02:00
Dirk
739f45015f Fix minor inconsistency in description of cipher categories
A longer while back the section ~ "Testing standard ciphers" was
renamed to "Testing cipher categories". However the internal help
didn't reflect that.

This fixes that, including an addtion to the documentation.

Note: the help still lists "-s --std, --standard" as a cmd line
switch.
2021-09-08 08:46:47 +02:00
Andreas Perhab
5ec1f83434 Fix dig -r check to only run if dig is available 2021-09-06 08:35:00 +02:00
a1346054
6782e2a3b9 Fix spelling 2021-09-04 12:39:03 +00:00
Dirk
bc742e0ea4 Amend previous commit
* add -q in grep statement to make sure the console stays clean
* redo check for noidnout by also using the help function of dig
2021-09-01 18:44:28 +02:00
Dirk
f8a87315cf Fix cases where dig -r wasn't working
* the ignore ~/.digrc option from dig is now parsed from the builtin help
* there was a potential DNS call which is now avoided
* for +noidnout check however there's a call to invalid. added
* the OPENSSL_CONF="" in check_resolver_bins() was moved a few lines
  higher to avoid other errors in the terminal

Tested on (EOL) Ubuntu 14.04 which only has dig in an older version

See also #1950
2021-09-01 18:28:12 +02:00
David Cooper
667de371cd Fix #1961
This commit fixes #1961 in the 3.1dev branch by leaving NODEIP set to the server's IP address rather than changing it to the DNS name in the case of STARTTLS XMPP.

In order to address the problem of $OPENSSL s_client not working with STARTTLS XMPP if an IP address is provided to -connect, the -xmpphost option is used to provide the DNS name.
2021-08-09 13:22:31 -04:00
Dirk
aaf6409581 Add CVEs for No-STARTTLS vulnerability
In text output only the original one from Wietse Venema.
The other known so far in JSON/CSV
2021-08-08 21:30:35 +02:00
Dirk Wetter
77e47cadff
Merge pull request #1963 from drwetter/fix_1956_3.1dev
Redirect debugme() outputs to stderr (3.1dev)
2021-08-07 16:18:43 +02:00
Dirk
3f8c62dc41 Change debugme1 calls to include redirection from stderr back to stdout
The fact that debugme1() redirects to stderr and the calls to this functions
redo that is deliberately as in the future we might want to use debugme1
without redirection.
2021-08-07 15:26:51 +02:00
Dirk
4e01f86c99 Redirect debugme() outputs to stderr (3.1dev)
... to address #1956 and other places. Similar to #1957,
only for the 3.1dev rolling release branch.

Also it changes debugme1() back? to output debug
statements only when $DEBUG >= 1. Per default here
also stderr is used.
2021-08-07 15:20:09 +02:00
David Cooper
b4d11459a8 Use all+ in calls to tls_sockets()
get_server_certificate() includes a few calls to tls_sockets() in which the response will be TLS 1.3 and in which the response will be useless if it cannot be decrypted (since the goal is to obtain the server's certificate). So, these calls to tls_sockets() should specify "all+" rather than "all".
2021-08-05 11:36:32 -04:00
David Cooper
526d25bc1d Don't test for certificate compression if --ssl-native
This commit changes run_server_defaults() so that the test for certificate compression is not run in --ssl-native mode. This fixes an issue that was caught by 21_baseline_starttls.t.
2021-08-05 10:37:37 -04:00
David Cooper
fa1ccdb565 Check for RFC 8879 certificate compression
This commit adds a check for whether the server supports certificate compression (RFC 8879). If it does, then the list of supprted compression methods is output in the server's preference order.
2021-08-04 14:39:12 -04:00
Dirk Wetter
b603d57146
Merge pull request #1952 from drwetter/fix_1717
Look-ahead trick for -U --ids-friendly
2021-08-01 17:47:11 +02:00
Dirk
6cf7521184 Look-ahead trick for -U --ids-friendly
If the order of the cmdline is '-U --ids-friendly' then we need to make sure we catch --ids-friendly. Normally we do not,
 see #1717. The following statement makes sure. In the do-while + case-esac loop  the check for --ids-friendly will be
executed again, but it does not hurt
2021-07-31 18:27:03 +02:00
Dirk
439aad1f22 Ignore $HOME/.digrc
Newer dig versions have an option to ignore $HOME/.digrc, older don't.

This commit adds a patch checking for the availability of such an option and
uses it by default. See #1894 .

If this option doesn't exist then still dig is used and can still lead to
wrong output. Unfortunately Debian-based distros are not very
good at this. Debian 10, Ubuntu 18.04 still use dig 9.11, whereas
Opensuse 15.2 has 9.16. Debian 11 and Ubuntu 20.04 use that too.
2021-07-31 15:14:22 +02:00
Dirk
525a40a653 Disable ANSI codes for italic when TERM == screen
... otherwise it is being printed in reverse, see #1928.
2021-07-31 13:17:55 +02:00
Dirk Wetter
2935ecc2e1
Merge pull request #1938 from drwetter/nmap_portdetection_1931
Improved SSL/TLS portdetection in nmap greppable files
2021-07-30 09:48:50 +02:00
David Cooper
fc310301f1 Print consecutive spaces faster
This commit adds a new function, print_n_spaces(), which prints a sequence of (up to 80) space characters.

This new function is used to replace a few places in testssl.sh in which a sequence of space characters is printed by calling 'out " "' in a loop. The new function is much faster than the current code, so it will make testssl.sh run slightly faster.
2021-07-29 15:12:27 -04:00
Dirk
defed8705b Extend TLS/SSL port detection
As mentioned in #1931 the port detection for nmap greppable files
leaves space for improvements.

Ths PR adds a pattern detection of ssl and https in the forth or fifth
parameter of an open port, so those ports will be added to a scan when
a nmap greppable output file is as input to testssl.sh .

Also it does minor code adjustments to utils/gmap2testssl.sh .
2021-07-25 17:09:30 +02:00
Dirk
5a7b7d8b8e Fix problem when nmap file has .txt extension
This addresses a bug filed in #1935 in 3.1dev when the supplied file
has a .txt extension. In this scenario the input file was nulled
as from the input file in nmap format an internal input file was
generated which has a .txt extension, in the same directory.
The idea was to persist the file for the user.

Now, this internal input file is ephemeral and only written to $TEMPDIR.
2021-07-25 13:05:40 +02:00
Dirk
28d9bc483d Fix redundant message (BREACH) when client certificate required
same as #1916.

Fixes #1915
2021-06-19 15:27:03 +02:00
Dirk Wetter
e1be4eabd2 Display time as suggested in utc (3.1dev)
See #1895
2021-06-03 19:24:50 +02:00
Dirk Wetter
893bb98a61
Merge pull request #1898 from PeterDaveHello/FixIndentation
Fix indentation in testssl.sh
2021-05-31 10:16:45 +02:00
Peter Dave Hello
8d42528ec6 Correct "GitHub" case as it should be 2021-05-30 01:19:58 +08:00
Peter Dave Hello
413f7ce9a4 Fix indentation in testssl.sh 2021-05-30 01:12:15 +08:00
Peter Dave Hello
1b4b9e3262 Fix compression detection variable syntax in run_breach() 2021-05-28 23:43:43 +08:00
Dirk Wetter
325e7380b9
Merge pull request #1888 from dcooper16/send_to_stderr
Print errors to stderr
2021-05-15 12:22:34 +02:00
David Cooper
265c85a44f Specify an error code in all calls to fatal()
This commit fix a few places in which calls to fatal() do not specify an error code.
2021-05-13 11:32:56 -04:00
David Cooper
0552fdadb8 Print errors to stderr
In parse_cmd_line() error messages are usually printed to stderr, but in three places the messages are printed to stdout. This commit modifies those three lines so that they also print to stderr.

The commit also replaces a call to a non-existant function, tmln_magenta_term, with a call to tmln_magenta.
2021-05-13 11:10:01 -04:00
Dirk Wetter
17ad3d70a4
Merge pull request #1882 from drwetter/epoch_180hsts_1879
Fix "off by one" error in HSTS
2021-05-10 12:12:39 +02:00
Chad Brigance
6b9d8bbc51 fixed minor bug with json output for TLS1.1 2021-05-08 19:24:56 +00:00
Dirk Wetter
9121c7a3c9 Fix "off by one" error in HSTS
There was by mistake a 179 days threshold and also the error message
was wrong when HSTS was exactly set to 179 days.

This commit sets it to 180 days and corrects the error messages on
both screen and JSON.
2021-05-08 14:45:38 +02:00
David Cooper
944eb1bcd9 Improve compatibility with OpenSSL 3.0
This commit addresses a few issued related to the use of testssl.sh with OpenSSL 3.0.0-alpha14.

First, when pkey is used to print a DH key that uses an unknown group, OpenSSL 3.0.0-alpha14 labels the prime and generator using "P:" and "G:" rather than "prime:" and "generator:". (In PR #1586 it was noted that OpenSSL 3.0.0-alpha1 used "prime P:" and "generator G:". The x509 command in OpenSSL 3.0.0-alpha14 still uses "prime P:" and "generator G:" when printing a DH public key in a certificate, but the pkey command just uses "P:" and "G:").

Second, when the pkey command is used to print a DH key that uses certain common primes (e.g., groups from RFC 3526 or RFC 7919), OpenSSL 3.0.0-alpha14 simply prints "GROUP: " followed by a short name for the group rather than printing the value of the prime and generator.

Finally, the "-text" option no longer works if the input is a public key. Fortunately, the "-text_pub" option provides the expected results with all versions of OpenSSL and LibreSSL.
2021-04-07 13:28:34 -04:00
Dirk
30bafe6d4f Ensure certain regex patterns work as expected and aren't localized
see #1860 .

This PR is trying to address an issue where probably newer bash versions
is treated differently as in other locales, W is just a variant of V
see also e.g.

https://collation-charts.org/opensolaris/opensolaris.2008.05.sv_SE.UTF-8.html
https://www.sqlservercentral.com/forums/topic/order-by-name-not-works#post-1644177
2021-04-04 11:55:29 +02:00
Dirk
2101425c59 Fix redundant quotes at RHS of ==
While looking at #1860 there were two instances where
the right hand side of expressions in a double square
bracket had quotes.
2021-04-02 17:01:36 +02:00
vin01
09ce15ebe9
Use locally scoped counter in hex2binary 2021-03-31 14:09:38 +02:00
David Cooper
d8bec390be Reintroduce hex2ascii()
Add hex2ascii() as a function that just calls hex2binary().
2021-03-22 11:56:46 -04:00