Commit Graph

3876 Commits

Author SHA1 Message Date
Dirk Wetter 6071ae9883
Merge pull request #1672 from dcooper16/fix_unrecognized_option
Fix printing of unrecognized option
2020-07-07 15:53:49 +02:00
David Cooper 45eafd239f Fix printing of unrecognized option
When testssl.sh is called with an unknown option it prints something like:

     0: unrecognized option "--option"

It should be printing the name of the program rather than "0". This commit fixes that.
2020-07-07 07:30:48 -04:00
Dirk Wetter d881140cac
Merge pull request #1669 from dcooper16/separate_pr_cipher_quality
Separate pr_cipher_quality() into two functions
2020-07-07 08:36:31 +02:00
David Cooper 919064095f Separate pr_cipher_quality() into two functions
This commit separates pr_cipher_quality() into two functions, one that returns the quality of a cipher as a numeric rating (get_cipher_quality()) and one that prints a cipher based on its quality (pr_cipher_quality()). This separation allows get_cipher_quality() to be used to determine how good a cipher is without having to print anything. Having this ability would be helpful in implementing the changes suggested in #1311.
2020-07-06 15:45:36 -04:00
Dirk Wetter 9122ffec1d
Merge pull request #1668 from drwetter/1657_polish
Polish STARTTLS rating output
2020-06-26 10:02:23 +02:00
Dirk Wetter 7c75993746 remove unused spaces var 2020-06-25 20:54:43 +02:00
Dirk Wetter 288223c707 Polish STARTTLS rating output
Moved the sentence ~i "A grade better than T would lead to a false sense of security"
to the documentation. No reason for excuses in the output. ;-) Explanation fits
better in the doc.

See also #1657
2020-06-25 20:47:51 +02:00
Dirk Wetter ae72592959
Merge pull request #1666 from dcooper16/fix1665
Fix #1665
2020-06-25 20:45:19 +02:00
David Cooper 1f2b4a3f40 Fix #1665
This commit fixes #1665 by adding the certificate number to the JSON identifier for cert_eTLS.
2020-06-25 13:18:28 -04:00
Dirk Wetter b1f64a50df
Merge pull request #1663 from dcooper16/fix1662
Fix #1662
2020-06-25 13:39:58 +02:00
David Cooper 91ceaca1e9 Fix #1662
This commit fixes #1662 by changing the fileout to use the value of $cert_ext_keyusage rather than the string "cert_ext_keyusage".
2020-06-25 07:31:50 -04:00
Dirk Wetter b2d41330e0 port typo fixes to html and roff doc 2020-06-25 13:05:47 +02:00
Dirk Wetter 55f7f7d69a
Merge pull request #1657 from magnuslarsen/3.1dev
[Rating] STARTTLS output styling
2020-06-24 09:51:21 +02:00
Dirk Wetter 3c30887f39
Merge pull request #1659 from csett86/wireshark-android-7-0
Add wiresharked Android 7.0 (native)
2020-06-24 09:49:24 +02:00
Magnus Larsen f647ae8264 Change to grade cap 2020-06-23 19:24:24 +02:00
Christoph Settgast 82e939f2bd Add wiresharked Android 7.0 (native)
After being bitten by https://stackoverflow.com/questions/39133437/sslhandshakeexception-handshake-failed-on-android-n-7-0
I add a wiresharked Android 7.0 to reflect that bug in Android 7.0.
2020-06-23 15:26:31 +02:00
Magnus Larsen 069c5ae917 Spelling 2020-06-22 19:16:20 +02:00
Magnus Larsen 2bff63b7db Add a comment about STARTTLS connections in the docs 2020-06-22 19:14:25 +02:00
Magnus Larsen de14ec9f81 STARTTLS rating styling 2020-06-19 21:21:43 +02:00
Dirk Wetter e9d6462ee9
Merge pull request #1656 from magnuslarsen/3.1dev
[Rating] Clearer grade cap reasons
2020-06-19 09:50:24 +02:00
Magnus Larsen 21208f46cd Clearer grade cap reason regarding certificate errors 2020-06-18 21:15:28 +02:00
Dirk Wetter d19aed2345
Merge pull request #1652 from dcooper16/fix_wildcard
Fix and enhance CN matching
2020-06-09 10:48:59 +02:00
Dirk Wetter 4f13298938
Merge pull request #1651 from dcooper16/missing_space
Fix missing spaces
2020-06-09 09:17:37 +02:00
David Cooper a6c2168cd9 Fix and enhance CN matching
PR #1373 changed get_cn_from_cert() to handle certificate subject names that include more than one CN attribute. It did this by converting newline characters to spaces. It seems that this resulted in a space character being added to the end of the string returned by get_cn_from_cert() even in the case that the subject name only included one CN attribute. The presence of the space character in returned value caused compare_server_name_to_cert() to determine that the CN attribute did not contain a DNS name (since DNS names cannot include spaces), and so compare_server_name_to_cert() reports that the server name does not match against the CN in the subject. This may be the reason for the problem noted in #1555.

This commit fixes the above problem and also enhances the matching of the CN in the subject name against the server's name. Currently, compare_server_name_to_cert() assumes that the subject field contains at most one CN attribute. However, as noted in #1373, some certificates include subject names with more than one CN attribute, and RFC 6125 (Section 6.2.2) indicates that the certificate subject name include more than one CN, with each specifying a different DNS name.

So, in addition to fixing the problem with the space character, this commit also enhances the CN matching to work even if the certificate includes more than one CN attribute in the subject name.
2020-06-08 13:57:00 -04:00
David Cooper fe87192a80 Fix missing spaces
In some cases when the Trust finding is printed, there is no space between the results when SNI is used and the results without SNI (which appear in paraenthesis). This commit adds the missing space.
2020-06-08 13:54:36 -04:00
Dirk Wetter 6a91dadb31
Merge pull request #1637 from magnuslarsen/3.1dev
[Rating] simple DH group length
2020-06-02 16:48:45 +02:00
Magnus Larsen 55bbb98a02 small fixes 2020-06-02 16:28:24 +02:00
Magnus Larsen cce7566dc8 Moved grade_caps to run_rating() function; added KEY_EXCH_SCORE=20 back again 2020-06-02 16:26:55 +02:00
Dirk Wetter 9a22e9af1a
Merge pull request #1649 from dcooper16/SC2034
Fix Shellcheck SC2034 issues
2020-06-02 11:08:33 +02:00
David Cooper edefce5998 Fix Shellcheck SC2034 issues
This commit fixes several issues related to Shellcheck issue SC2034: unused variables.

In most cases variables are declared in a function, but are referenced later. The exceptions are:

* SESS_RESUMPTION is declared and values are assigned to it, but it us never used. (Same applies for not_new_reused in sub_seession_resumption().)

* In run_cipherlists(), there is a typo in the declaration of sslv2_tdes_ciphers.

* In get_caa_rr_record(), "hash", "len", and "line" are used but not declared.
2020-06-01 15:31:01 -04:00
Magnus Larsen 30d5710768 ephemeral is the word 2020-05-28 21:12:14 +02:00
Magnus Larsen dca50fc49a allow multiple equal key sizes 2020-05-28 21:00:45 +02:00
Magnus Larsen e6150a2348 Missed todo comment fix; cleanup output 2020-05-28 20:33:17 +02:00
Magnus Larsen 985e647cdf merge upstream 2020-05-28 20:20:32 +02:00
Dirk Wetter 4f9c5158dc
Merge pull request #1646 from drwetter/get_TXT_record
Add get_txt_record(), fix variable declaration in get_mx_record()
2020-05-25 21:31:18 +02:00
Dirk a4ae05c90c Add get_txt_record(), fix variable declaration in get_mx_record()
This commit adds a function for querying the TXT DNS record, so
that subsequently we'll can build on top of that a function for
checking MTA-STS, see #1073.

Also it modifies a local variable mxs in get_mx_record() which
was declared as mx but mxs was used. (That is pending an backport
to 3.0.)
2020-05-25 13:23:49 +02:00
Dirk Wetter e87880ee92
Merge pull request #1643 from dcooper16/EdDSA
Support EdDSA
2020-05-18 14:39:33 +02:00
David Cooper 37ffabf8d5 Remove some unnecessary quotation marks 2020-05-18 07:38:49 -04:00
David Cooper 3ae48931fb Support EdDSA
This commit adds support for EdDSA (Ed25519 and Ed448). In particular:

* It modifies prepare_tls_clienthello() to include Ed25519 and Ed448 in the signature_algorithms extension of the TLS 1.2 and earlier ClientHello (RFC 8422).

* It modifies run_server_defaults() and get_server_certificate() to check whether the server offers EdDSA certificates with TLS 1.3.

* It modifies certificate_info() to handle certificates signed with EdDSA or with EdDSA public keys, even if $OPENSSL does not support pretty printing such keys and signatures.

* It modifies read_sigalg_from_file() to recognize EdDSA signatures even if $OPENSSL does not.
2020-05-18 07:37:46 -04:00
Dirk Wetter 42386e512b
Merge pull request #1642 from dcooper16/peer_signature_type
Extract server's signature algorithm
2020-05-16 12:46:55 +02:00
David Cooper df42eeb8b4 Extract server's signature algorithm
PR #1519 requested that testssl.sh show the signature algorithm that the server uses during the TLS handshake. In TLS 1.3, this appears in the CertificateVerify message. In TLS 1.2 it appears in the ServerKeyExchange message when the chosen cipher suite uses an ephemeral (DH or ECDH) key, except in the case of cipher suites that provide no authentication. This information is not present in TLS 1.1 and earlier, as the hash algorithm to use in these earlier versions of the protocol is hard coded into the specification.

This commit takes a first step towards being able to show the signature algorithm by extending parse_tls_serverhello() to extract the signature algorithm when it is present. Matching the output produced by OpenSSL, it output two separate lines, the "Peer signature type" (RSA, RSA-PSS, DSA, ECDSA, Ed25519, or Ed448) and the "Peer signing digest" (MD5, SHA1, SHA224, SHA256, SHA384, or SHA512). This will allow the same function to extract the signature algorithm and digest, whether the handshake was performed using "$OPENSSL s_client" or tls_sockets().
2020-05-14 14:42:08 -04:00
Dirk Wetter 2022754b4a
Merge pull request #1636 from drwetter/breach_improvements
Improve compression detection for BREACH
2020-05-12 10:16:14 +02:00
Dirk Wetter 7fbb79b147
Merge pull request #1638 from dcooper16/fix_show_sigalgo
Fix $SHOW_SIGALGO
2020-05-12 10:13:22 +02:00
David Cooper d5671a0352 Fix $SHOW_SIGALGO
This commit fixes two issues related to $SHOW_SIGALGO.

First, cipher_pref_check() does not show the signature algorithm if any of the ciphers were found using tls_sockets(), since the call to tls_sockets() does not specify that the server's certificate should be extracted.

Second, in run_beast() the call to tls_sockets() indicates that the server's certificate should be extracted if "$SHOW_SIGALGO" is true, even if "$WIDE" is false. While this does not cause any problems, extracting the certificate is a waste of effort if "$WIDE" is false, since the signature algorithm is not shown in that case.
2020-05-11 10:09:02 -04:00
Magnus Larsen 8b74d41487 unintended linebreak 2020-05-11 15:22:51 +02:00
Magnus Larsen 6119d8538e proper rating of dh group length 2020-05-11 15:20:16 +02:00
Dirk Wetter 78a95d73c8 Add BREACH extension 2020-05-11 14:07:02 +02:00
Dirk Wetter 25f87455a4 Amendment for compression detection (BREACH)
This commit saves more or less time for a detection of the compression.

First it assembles the GET command with all available compressions and send them all.
If the result is negative: we can just tell the finding and return. If it's
positive: We already have identified 1x compression. Then we cycle through the
remaining compressions with single GET requests.

In order to not duplicate code we introduced a helper function sub_breach_helper()
which takes care sending the request and analysis the result.

We treat now failed requests differently: When the first fails we don't
continue anymore.
2020-05-11 13:57:50 +02:00
Dirk Wetter 825cbf7b1d Improve compression detection for BREACH
This commit tries to enummerate through all possible compressions
instead of just raising the arm because of the first one detected.

As far as the performance is concerned there's room for improvements
which subsequent commits will address.
2020-05-11 10:41:48 +02:00
Dirk Wetter 78612c86a0
Merge pull request #1635 from drwetter/dockerfile+_31dev
Better Dockerfile: doesn't require "git clone"
2020-05-09 13:18:57 +02:00