Commit Graph
100 Commits
Author SHA1 Message Date
Dirk WetterandGitHub 83b09067a4 Merge pull request #1017 from dcooper16/fix1013
Fix #1013
2018-03-21 09:35:35 +01:00
Dirk WetterandGitHub 27b217b301 Merge pull request #1020 from dcooper16/ossl_ver_appendix
Fix OSSL_VER_APPENDIX
2018-03-19 16:52:20 +01:00
Dirk WetterandGitHub a7d195fb89 Merge pull request #1018 from dcooper16/fix1015
Fix #1015
2018-03-19 16:15:49 +01:00
Dirk WetterandGitHub 2c8bdcd205 Merge pull request #1019 from dcooper16/ossl_ver
Extracting OpenSSL version information
2018-03-19 16:13:47 +01:00
Dirk a178f3e183 relax host+domain names to contain underscore, see #1015 2018-03-18 23:38:23 +01:00
Dirk c91a771465 FIX #1009 and leftover fix for #988
In cases where HTTP/2 was the only ALPN protocol, the
JSON output was missing the finding as the additional
protocol was empty.

This fix tests whether there's an additional protcol
and only calls fileout() if there's one.
2018-03-17 20:37:00 +01:00
Dirk 4eb6ab5976 better naming of variables from previous commit 2018-03-17 19:44:40 +01:00
Dirk 377bde14cc Fixes ssl-native and LOGJAM: no common primes
When testssl.sh was using -ssl-native and the local openssl version
didn't support any DH ciphers the deliberately lazy approach was to
not complete the second part of the test: check for common primes.
This is a FIX for issue #1016.
2018-03-17 15:40:28 +01:00
Dirk WetterandGitHub f6dc501aed Merge pull request #1014 from dcooper16/tls13_cipher_pre_check
Check for TLSv1.3 in OpenSSL
2018-03-15 21:51:44 +01:00
Dirk WetterandGitHub 15ca770980 Merge pull request #1012 from dcooper16/tls13_draft26
TLS 1.3 drafts 25 and 26
2018-03-15 21:51:02 +01:00
Dirk WetterandGitHub 107d2dd12e Merge pull request #1007 from dcooper16/revert_read_sigalg_from_file
Revert change to read_sigalg_from_file()
2018-03-12 21:38:44 +01:00
Dirk WetterandGitHub f718592960 Merge pull request #1006 from dcooper16/X448
Add X448 support in TLS 1.3
2018-03-12 19:43:35 +01:00
Dirk 9618ed993d Better parsing of HPKP
Previously testssl.sh ran into problems when both Public-Key-Pins
and Public-Key-Pins-Report-Only were present in the header.

Now if both are present only Public-Key-Pins is evalutated and a
hint is given. If Public-Key-Pins-Report-Only is only present
a hint is given and those are evaluated.

If more than 1 from either Public-Key-Pins-Report-Only or
Public-Key-Pins is detected only the first one will be processed
and a warning will be displayed.
2018-03-03 21:40:46 +01:00
Dirk 1011ef1399 polish 2018-03-02 21:07:33 +01:00
Dirk 2e5dd0439a document variable for previous commit 080840f 2018-03-02 20:57:06 +01:00
Dirk 080840f655 fix uninitialized variables, proper exit if fail2van and friends
This commit improves assessments of server which decides after
a few connects either to drop all tcp packets or send a tcp
reset, see #1005 . It adds another global MAX_SOCKET_FAIL
(preset to 2) representing a threshold how many bash socket
connections are needed to quite the whole scan. It dramatically
reduces scan time and makes sure that the user is clear that
the scan had a problem and the results at maximum partly useful
(CSV, HTML, JSON). It also writes a valid JSON file.
See also #769.

It also fixes non-initialized variables in ``fileout_json_finding()``
and ``fileout()``
2018-03-02 20:39:07 +01:00
Dirk b1b30b3fb8 better matching of empty server banners
.. which could have led to borken JSON too
2018-03-01 16:01:05 +01:00
Dirk 8c9fdc6cc9 Fix HPKP regression where it stated that only one SPKI was used 2018-03-01 15:29:28 +01:00
Dirk b5fcc00031 reflect previous commit of changed treatment of --severity
... and some minor polishing
2018-03-01 15:13:55 +01:00
Dirk d344a1ee04 JSON(PRETTY) + CSV output when scan interrupted, WARN severity
If a severity level >= INFO was supplied,JSON* and CSV output were
not writing error conditions in fileout(). As those indicate a problem
of the assessment, this has been fixed so that if any severity is
supplied to testssl.sh it will always write WARN conditions
to file when detected.

Also if the scan was interrupted on the client side where previously
a scanTime of 0 was written to the log file now it will raise a warning
that the scan was interrupted.

See also #769. Error conditions after starting a scan on the server side
(TCP Reset, DROP after a while) still won't be treated accurately in the file output
with an error message but the resulting JSON should be still valid.
2018-03-01 13:47:34 +01:00
Dirk abc956344a Address/FIX #876 (empty addcmd2 variable) 2018-02-27 13:06:29 +01:00
Dirk WetterandGitHub 3cf591f513 Merge pull request #1002 from danielchodusov/2.9dev
Using generic HAProxy name
2018-02-22 14:49:32 +01:00
Dirk 415f98b655 Some improvements added. bash >= 3.2 is required 2018-02-19 11:55:12 +01:00
Dirk 5add07a798 make sure bash is at least 3.2, see #999 2018-02-19 11:31:03 +01:00
Dirk f812403292 Workaround for missing date conversion in OpenBSD
OpenBSD doesn't seem to be able to convert from $(date)
output to a more readable format as performed on notBefore
and notAfter from x509(1). Thus an exemption is made and
just display the format like x509(1) shows.

Also newer OpenBSD come with a newer LibreSSL version,
thus the pattern when to display a warning when the
"too unreliable to determine trust" warning is displayed.
2018-02-16 23:47:48 +01:00
Dirk WetterandGitHub 6f0a9aee11 Merge pull request #994 from dcooper16/extended_tls_sockets
TLSv1.3 draft 24
2018-02-15 21:18:45 +01:00
Dirk WetterandGitHub 022dd256e9 Merge pull request #993 from dcooper16/extra_extensions_bugfix
Bugfix for extra extensions
2018-02-15 21:16:55 +01:00
Dirk e564783fec Addding private CAs
As per @krissi's suggestion this is a smart addition to add privat CAs
to all certificate stores -- during runtime only. The switch --add-ca or
--add-CA expects an argument of one additional CA file or a comma separated
lists of them. The enviroment file ADDITIONAL_CA_FILES can be used
alternatively.

This fixes eventually #230.
2018-02-15 19:28:22 +01:00
Dirk ba8d613aa5 Add documentation about the current and corrected exit codes 2018-02-14 23:40:08 +01:00
Dirk a0dabf9acf cleaned up exit codes for error cases
For recognising error conditions during run any testssl.sh run, the program
returns 0 if all checks have been performed successfully and unambiguously. 1
is returned per error or unambiguous condition and per IP. E.g. ./testssl.sh
--ssl-native testssl.net with two IP addresses returns 2 as each client
simulation gets a "1" (ssl-native returns currently wrong results here).

This fixes #986.

A kind of vulnerability scoring for monitoring tools or CI will be done
later separately, see #985 and #327.
2018-02-14 23:15:29 +01:00
Dirk 17e6802fb4 return codes for all vulnerabilities, #986 2018-02-14 22:59:17 +01:00
Dirk 79427e3040 jsonID, code housekeeping, some CWEs added, split time
As before (see #971) and as indicated (#970) some minor
changed to the jsonID have been taking place. Some
redundant verbosity has been eliminated, some IDs
changed the name.

For HTTP2 you should now ALPN_HTTP2.

Some obvious CWEs were added in the JSON section.
ke for null cipher list, information leakage in
the http headers. There's probably space for improvements.

A few early time marks were added to debug time spend.
2018-02-14 17:21:48 +01:00
Dirk WetterandGitHub 7b5a7579d7 Merge pull request #991 from dcooper16/fix990
Fix #990
2018-02-14 11:28:51 +01:00
Dirk 3633704fa5 remove extra spaces as suggested by #989
but leave the HERE document as it is...
2018-02-13 16:55:57 +01:00
Dirk a2156904eb fix h2 reward for ALPN in JSON output (#988) 2018-02-13 16:50:35 +01:00
Dirk 59c5c95efe try to address #928 2018-02-13 16:32:28 +01:00
Dirk fb844e8510 address #986 for do_header() + some code housekeeping 2018-02-12 12:50:06 +01:00
Dirk 619dabdb38 fix borken case statement, ((ret++) doesn't seem to work 2018-02-11 14:04:45 +01:00
Dirk 5862a90319 mind certificate_info() result from previous commit 2018-02-11 13:57:26 +01:00
Dirk f4918c8fd3 further address #986
Error codes now done until run_server_defaults(). Previous
sections modified so that execution errors are added.

Modified in compare_server_name_to_cert() ret --> subret.
From the code perspective a clear distinction between
passing an error code and a functional return code
would be great. Still has to be determined whether it
maybe better to rename ret into something different.

Removed a stale code line in run_server_preference() for STARTTLS.
2018-02-11 13:43:35 +01:00
Dirk b6d4a7d4cd adress #986 for PFS, cipherlists, GREASE 2018-02-09 20:24:59 +01:00
Dirk cdced650bf try to address #769, first fix for return values (protocol section)
Following the recommendation from @dcooper16 this commit is addressing
a situation when the scan couldn't finish for external reasons and as
a consequence left a non-valid JSON file behind.

It also starts addressing #986 so that the protcol section only returns
a non-zero value if a check coundn't be performed or gave results which
weren't clear.

It also fixes a typo where in the TLS 1.3 check a status from the TLS 1.2
check was not correctly interpreted (TLS 1.2 not offered).
2018-02-09 19:42:40 +01:00
Dirk d1f0380173 add coreutils to provide full date command 2018-02-08 21:50:20 +01:00
Dirk 46fa94fa33 Merge branch '2.9dev' of github.com:drwetter/testssl.sh into 2.9dev 2018-02-08 21:15:12 +01:00
Dirk cbe38cc4bb convert Dockerfile to alpine linux 2018-02-08 21:06:19 +01:00
Dirk WetterandGitHub 38f0aa04b3 Merge pull request #984 from dcooper16/fix983
Fix #983
2018-02-08 18:24:41 +01:00
Dirk 8930fe7fb3 add a imssing blank between Access-Control-Allow-Origin Upgrade X-Served-By Referrer-Policy X-UA-Compatible and their value 2018-02-08 18:20:24 +01:00
Dirk 7bf070b016 Changes in NPN+ALPN, internal improvements for all *_done_* calls
In order to be more consistent with the other output functions having
"svrty" in their name, *_done_best and *_done_good were changed to
*_svrty_best and *_svrty_good.

run_spdy/run_http2 were renamed to run_npn and run_alpn as this is
what is actually being tested. Also the terminal and file output
is now reflecting this.

Also #980 was fixed in a sense that (only) for ALPN the protocol
h2 will get a "good". There will be an additional CSV/JSON line
for this.
2018-02-08 14:02:24 +01:00
Dirk WetterandGitHub eb6f9788f6 Merge pull request #982 from dcooper16/fix_981
Fix #981
2018-02-08 11:39:10 +01:00
Dirk 364011b6ca add missing space for RC4 screen output 2018-02-05 18:56:33 +01:00
Dirk 3cfe3ab87e polish #977 -> re-add commas in screen/html output (not JSON/CSV) 2018-02-05 13:27:25 +01:00
Dirk WetterandGitHub 8289e8ba88 Merge pull request #978 from dcooper16/hostcert_txt
Fix HOSTCERT_TXT
2018-02-03 10:22:28 +01:00
Dirk WetterandGitHub 46539d4adf Merge pull request #977 from AresS31/2.9dev
Remove CVEs commas for better consistency
2018-02-02 12:54:55 +01:00
Dirk WetterandGitHub e4d3ccc725 Merge pull request #975 from dcooper16/determine_trust_ossl111
Fix determine_trust() for OpenSSL 1.1.1
2018-02-02 12:43:22 +01:00
Dirk 7585ab60e5 fix Travis CI 2018-01-31 21:44:33 +01:00
Dirk 20d33da11b unifying output for missing must_staple xt and CT 2018-01-31 20:38:40 +01:00
Dirk d2d62a9c55 jsonID changed (server defaults), host certificate in JSON, HOSTCERT_TXT
In ``must_staple()`` and ``certificate_info()``  were the jsonIDs
changed to OpenSSLi / IETF names so that testssl.sh is more compliant
to the rest of the world. There might be still space for improvements
are far as common naming scheme is concerned.

The host certificate is now being delivered in JSON and CSV. For
further usage " " needs to be converted back to linefeeds.

Certificate Expiration was renamed to Certificate Validity.

The order of outputting the certificate serial and SHA1 fingerprint
has been swapped.

Also ``certificate_info()`` makes more use of HOSTCERT_TXT.
2018-01-31 20:01:12 +01:00
Dirk 656016eae4 Changes to outputs: certificate start+end time, CRL+OCSP
For certificate start+end time it is now displaying the
time on UTC and without mentioning the timezone twice.

Also if neither CRL nor OCSP URI is provided it'll appear
on the screen below those two checks. JSON/CSV has then an
additional finding
2018-01-31 17:23:50 +01:00
Dirk 02b5497864 remove string GMT from certificate start+end time 2018-01-29 23:54:22 +01:00
Dirk 01f7612bd0 add keys to server defaults, cert start/end time in GMT 2018-01-29 23:43:25 +01:00
Dirk 6d0123d33c changes + bug fix for certificate expiration time
This PR fixes one minor bug where the start and end time were
displayed in different time formats.

It now displays both time values in GMT.
2018-01-29 23:12:15 +01:00
Dirk d7a1236e9b Merge branch '2.9dev' of github.com:drwetter/testssl.sh into 2.9dev 2018-01-29 20:06:31 +01:00
Dirk 88cd5528e7 HOSTCERT_TXT populated, certificate end+startdate in JSON
HOSTCERT_TXT is now generated each time a HOSTCERT is
written. For now it is just being used in ``read_sigalg_from_file()``.
More to come.

Also in JSON output the start date and end date of the certificate
are now in separate objects. (the time format could need some polishing though).
2018-01-29 20:03:00 +01:00
Dirk 659a6176b6 Add TLS 1.3, better explanation for -6 2018-01-28 12:47:05 +01:00
Dirk WetterandGitHub 4cb43733d6 Merge pull request #973 from dcooper16/tls13_run_server_defaults
Add TLSv1.3 support for run_server_defaults()
2018-01-27 10:30:44 +01:00
Dirk WetterandGitHub 52feb4f578 Merge pull request #972 from dcooper16/fix_HRR
Fix HelloRetryRequest
2018-01-27 10:18:40 +01:00
Dirk WetterandGitHub 018af9972f Merge pull request #974 from dcooper16/relabel_ec_bits
Label elliptic curve public keys as "EC"
2018-01-27 10:16:58 +01:00
Dirk c1d75f65ce polish screen output for (extended) keyusage 2018-01-26 17:02:00 +01:00
Dirk 61764f332c Fix error where cipherlist checks run always 2018-01-26 15:57:42 +01:00
Dirk efbc1a4e92 Minor changes on id and findings
``run_tls_fallback_scsv()`` was upgraded to the new scheme.

It also changes a couple of more functions using a variable ``$jsonID`` instead
of a repeating fixed value for `fileout()`.

Also some it adds some ``fileout`` calls which were missing.
2018-01-25 17:35:47 +01:00
Dirk WetterandGitHub ae94b392e1 Merge pull request #951 from dcooper16/extract_certificates_function
Define extract_certificates() function
2018-01-25 16:55:00 +01:00
Dirk WetterandGitHub c8178b03d9 Merge branch '2.9dev' into extract_certificates_function 2018-01-25 16:39:30 +01:00
Dirk WetterandGitHub e446c80851 Merge pull request #971 from drwetter/new_json_for_serverdefaults
New JSON id and findings (breaks things!)
2018-01-25 16:11:24 +01:00
Dirk WetterandGitHub 513d21244f Merge branch '2.9dev' into new_json_for_serverdefaults 2018-01-25 15:49:44 +01:00
Dirk ed4262f74f Further changes to JSON ID + finding for JSON, std cipherlists
In the sense of the previous commits this one adds
further changes to the JSON output parameters ID and findings.
Findings in JSON are now more crunchy and don't repeat parts
of ID. Also ID changed so that it is more reflecting what
has been tested.

As the cipherlist checks in the beginning have been less
and less to do with the OPsnSSL standard lists
a change to remove the word "standard" was long overdue.
That has been addressed now alos in the code and in the
JSON/CSV output.

$HOSTCERT has now an .pem file extension. $HOSTCERT_TXT
will contain the text putput of the x509 openssl operation
on the certificate which enables testssl.sh to remove
some of the redundant "openssl x509 -in $HOSTCERT -text"
calls.

fileout <somestrings> has not been consistently replaced
by fileout $jsonID yet.
2018-01-25 15:05:57 +01:00
Dirk 1cec0181af More changes ID + Finding for JSON outside server defaults
This commit just adds more changes to those two parameters.
It is not completely done yet (see downgrade protection via SCSV).

Also json_prefix was changed to jsonID. The complete change of the fist
fileout field is pending.
2018-01-23 15:16:05 +01:00
Dirk WetterandGitHub cd45a2ec19 Merge pull request #969 from drwetter/keyUsage
Key usage
2018-01-23 12:10:07 +01:00
Dirk c4e4720133 slight contextual rearrangements for help() 2018-01-23 11:49:53 +01:00
Dirk 8327171935 simplify few cert checks messages + hopefullt make Travis work again 2018-01-23 11:46:24 +01:00
Dirk WetterandGitHub 2e54b9a439 Merge pull request #968 from jpstevens/patch-1
Fix typos in HSTS tests: days -> seconds
2018-01-23 09:50:09 +01:00
Dirk 0ec5586dfb Changing JSON objects in server defaults ATTENTION: breaking change!!
The server default run had several JSON objects which weren't, looking at just
    the ID, either clear or contained a redundant explanation in "finding". Purely
    certificate related JSON objects are now having the id "cert_<object>" like
    cert_CN or cert_SAN.

    This commit changes all this, also it avoids another colon in finding (see #830).

    Also the implicit strategy "output for the screen s followed by only one output with
    fileout" has been relaxed -- which results on more, better parsable JSON objects.

    Some example of the changes:

    Old:
    ----
    {
        "id"           : "Server Certificate #1 fingerprint",
        "severity"     : "INFO",
        "finding"      : "Fingerprints / Serial: SHA1 2940BC13ECF7DAF30B9084CC734C3B971D73B3BB / 01BFD1DC15006E0ABBA7C670FF5E1101, SHA256 30BA61012FFE7CEAAF9A148A0CB0C5C852A9C04F4B1C27DB6
    EFA9919C7F49CCF"
    }
    [..]
    {
        "id"           : "Server Certificate #2 ocsp_stapling",
        "severity"     : "OK",
        "finding"      : "OCSP stapling : offered"
    }

    New:
    ----
    {
        "id"           : "cert_key_size <cert#1>",
        "severity"     : "INFO",
        "finding"      : "Server keys 2048 bits"
    },{
        "id"           : "cert_fingerprint_SHA1 <cert#1>",
        "severity"     : "INFO",
        "finding"      : "2940BC13ECF7DAF30B9084CC734C3B971D73B3BB"
    },{
        "id"           : "cert_fingerprint_SHA256 <cert#1>",
        "severity"     : "INFO",
        "finding"      : "30BA61012FFE7CEAAF9A148A0CB0C5C852A9C04F4B1C27DB6EFA9919C7F49CCF"
    },{
        "id"           : "cert_serial <cert#1>",
        "severity"     : "INFO",
        "finding"      : "01BFD1DC15006E0ABBA7C670FF5E1101"
    }
    [..]
    {
            "id"           : "OCSP_stapling <cert#2>",
            "severity"     : "OK",
            "finding"      : "offered"
    }

    This PR also fixes the JSON output where for "OCSP must staple" the id was just
    'id"           : "OCSP must staple: ocsp_must_staple",' for multiple server
    certificates without the certificate number.

    As far as the code is concerned: $json_prefix should be a variable which is
    used for the id object.  If there was more then one certificates for a single
    host  detected, $json_postfix carries the certificate number.

    Unit tests need to be fixed -- if possible.
2018-01-22 23:56:03 +01:00
Dirk WetterandGitHub c5060547bd Merge pull request #950 from dcooper16/tls_fallback_scsv
run_tls_fallback_scsv() improvements
2018-01-22 22:39:09 +01:00
Dirk f5c2199369 Polishing #965
Add fileout() to #965. This commit also contains a change which needs
to be commited before: separation of ``json_prefix`` from ``json_postfix``.

Open issue: sed in openssl x509 statments look GNUish ([ \t]). Needs clarification.
2018-01-22 19:50:50 +01:00
Dirk 3b9a82b0cc Merge branch 'dcooper16-keyUsage' into keyUsage 2018-01-22 12:13:56 +01:00
Dirk 7a10e5514f add a comment for STARTTLS + TLS 1.3
related to David's comment in https://github.com/drwetter/testssl.sh/pull/958#issuecomment-358990186
2018-01-19 16:35:28 +01:00
Dirk WetterandGitHub 41635ce53f Merge pull request #963 from dcooper16/fix_962
Fix #962
2018-01-19 16:30:40 +01:00
Dirk WetterandGitHub bce69e8583 Merge pull request #961 from tissieres/2.9dev
Certificate-based auth host scanning produces invalid JSON output
2018-01-19 14:10:29 +01:00
Dirk WetterandGitHub 966ef3286e Merge pull request #958 from dcooper16/tls13_draft23
Add support for TLSv1.3 draft 23
2018-01-19 12:55:43 +01:00
Dirk WetterandGitHub f55e8888af Merge pull request #960 from dcooper16/tls13_bugfix
TLSv1.3 related bugfix
2018-01-19 12:52:39 +01:00
Dirk b0f4253ff2 add X-Permitted-Cross-Domain-Policies 2018-01-14 12:22:06 +01:00
Dirk 77071bf50d a few IBM data power headers added 2018-01-11 17:28:48 +01:00
Dirk 16de7fa1b7 Merge branch '2.9dev' of github.com:drwetter/testssl.sh into 2.9dev 2018-01-03 21:43:38 +01:00
Dirk 407358623e Fix, header restore, TLS13 ciphers
This fixes a bug which prevented the script from running properly. Also
the commit restores writing a correct comment header. In addition it
adds TLS 1.3 ciphers.
2018-01-03 21:41:09 +01:00
Dirk a3b4609d24 make 0964cbc5d3 easier in execution (session resumption) 2017-12-31 21:10:41 +01:00
Dirk 0964cbc5d3 OpenSSL 1.1.1 seems to have changed the behaviour regarding Session ID
support. If the server doesn't supply an session identifier the file
is just empty.

This commit fixes that by adding a separate case for OpenSSL 1.1.1
and an empty file. It is deliberately only changing this as this
was tested to work.

It is prelimary and a save-the-work-patch as it might be better
to catch this earlier.
2017-12-31 11:49:25 +01:00
Dirk 75e9add0f1 make ID for session_resumption_id common (allo lowercase) 2017-12-31 09:12:16 +01:00
Dirk c4c8ff4434 fix needed answer "YES" in protocol section 2017-12-29 23:14:14 +01:00
Dirk 85c470fcdc Merge branch 'jp-host+port' into 2.9dev 2017-12-27 10:14:21 +01:00
Dirk 0bc1f6f708 make MAX_PARALLEL and MAX_WAIT_TEST configurable + documentation 2017-12-27 09:50:34 +01:00
Dirk 9981d76879 Move target host + port to different JSON (pretty) object
For JSON pretty the host specific parameters target host + port
could be better placed in the scanResult object.

It is still under discussion as logically the parent object is deduced
the command line.
2017-12-25 17:42:27 +01:00