Commit Graph

1370 Commits

Author SHA1 Message Date
David Cooper
86c81f2276 Use CHILD_MASS_TESTING environment variable
This PR introduces the environment variable `CHILD_MASS_TESTING`, and uses it as an indicator that testssl.sh is running as a child within mass testing rather than using the `$APPEND` flag. It also makes a number of other changes to make the handling, of HTML, CSV, JSON, and log files consistent, and it fixes a number of bugs related to the generation of these files when mass testing is being performed.

Please let me know if you disagree with any of the changes in this PR, or if you would prefer that it be broken up into multiple smaller PRs.

Some of the changes are as follows:
- When the `$APPEND` flag is true, all of these files are appended to and headers and footers are omitted. (Perhaps this should be changed. Appending to a log file isn't an issue, but appending to a JSON or HTML file without including headers or footers seems to just create an improperly formatted file).
- Following the code in `prepare_logging()`, an error is printed and the program stops if the `$APPEND` flag is false and one of the files to be written to already exists.

Some of the bugs fixed:

Creating log files did not work with mass testing:
- If `--logfile <logfile>` is used, then the parent and each child try to write to "logfile".
- If `--logging` is used, then a log file is created for each child, but an oddly-named log file is also created for the parent. The one created by the parent contains the entire output.

Plain JSON files:
- When `--jsonfile <jsonfile>` is run, there is no comma separating the final finding for one child and the first finding for the next child.

Pretty JSON files:
- When `--jsonfile-pretty <jsonfile>` is called without mass testing, the "target host" line is empty, since `$NODE` has not yet been set.
- When `--jsonfile <jsonfile>` is run with mass testing, there is no comma separating the final finding for one child and the first finding for the next child. In addition, `fileout_pretty_json_banner()` is never called, and the entries for individual tests have insufficient information to determine what is being tested (it lists "service" and "ip", but not port number).

For the final issue, when mass testing is being performed and all output is being placed in a single file, I have the parent call `fileout_pretty_json_banner()`, but tell `fileout_pretty_json_banner()` to not include a "target host" or "port", but then have each child include a "target host" or "port" (when the "service" and "ip" are being printed).
2017-03-29 11:16:09 -04:00
David Cooper
312598837f Merge branch '2.9dev' into openssl_location 2017-03-29 09:01:38 -04:00
Dirk
7953bfda5e correct DEBUGTIME 2017-03-29 11:17:24 +02:00
Dirk
05ea5675b8 one line per variable type 2017-03-29 10:44:22 +02:00
David Cooper
227a31b788 out_row_aligned_max_width()
This PR improves `out_row_aligned_max_width()` in a few ways:

* It makes better use of bash's string manipulation capabilities in order to simplify the function.

* It improves the function's performance. One of the most costly parts of `out_row_aligned_max_width()` was the while loop to print each entry in the text. Since there is only one place in the code where the the entries are not all printed the same ways (the list of supported curves printed by `run_pfs()`), the PR changes `out_row_aligned_max_width()` to just return a plain text string, which the calling function prints in the appropriate way. For the curves printed by `run_pfs()`, a new function, `out_row_aligned_max_width_by_entry()` takes care of getting the output from `out_row_aligned_max_width()` and then printing each entry appropriately.

* The PR also introduces a trick so that when the TLS extensions are printed, the text for an extension won't get split across two rows. It does this by replacing the space charters within the text for an extension with "}", formatting the result with `out_row_aligned_max_width()`, and then converting the "}" back to space characters.
2017-03-28 13:54:54 -04:00
David Cooper
572d081882 Merge branch '2.9dev' into openssl_location 2017-03-28 08:54:52 -04:00
Dirk
53de1dc7c4 clarified help() 2017-03-28 12:07:45 +02:00
David Cooper
6ca55014ed Merge branch '2.9dev' into openssl_location 2017-03-27 15:58:43 -04:00
Dirk
e2d5dc7778 part 2/2: fix for #653 2017-03-27 21:31:54 +02:00
David Cooper
eca636f284 Merge branch '2.9dev' into openssl_location 2017-03-27 15:22:18 -04:00
David Cooper
3b7264ff1f Populate OPENSSL_LOCATION in find_openssl_binary
`$OPENSSL_LOCATION` is used in `fileout_pretty_json_banner()`, `html_banner()`, `mybanner()`, and `prepare_logging()`, but the value of `$OPENSSL_LOCATION` is populated in `mybanner()`. This is usually okay, since `mybanner()` is always called before the other three functions are called. However, if `$QUIET` is `true`, then `mybanner()` returns immediately, without populating `$OPENSSL_LOCATION`, even though the value of `$OPENSSL_LOCATION` may be needed by one or more of the other functions.

This PR addresses this problem by populating `$OPENSSL_LOCATION` in `find_openssl_binary()` rather than `mybanner()`.
2017-03-27 14:54:47 -04:00
David Cooper
684c231dcd Merge branch '2.9dev' into missing_html_banner 2017-03-27 12:36:14 -04:00
Dirk
38cf16854d FIX #682 2017-03-27 17:35:45 +02:00
David Cooper
d629cbcc28 Missing HTML banner
With the commit made on March 26, "partly (1/2) fixing #653," an HTML banner isn't added to the HTML files anymore.  A banner should be added to the top of the HTML file if mass testing is being performed and a separate HTML file is being created for each test.

The `$APPEND` flag being `true` is an indicator that mass testing is being performed and that this is one of the individual tests being run. Given that `$APPEND` is `true`, `$HTMLHEADER` being `true` indicates that testssl.sh is creating the file name for the HTML output. So, it is when both flags are `true` that the HTML banner should be created.
2017-03-27 10:52:24 -04:00
Dirk
bcc597dbab clarify help #680 2017-03-27 11:37:18 +02:00
Dirk
c0af8b113f FIX #680 2017-03-27 11:29:21 +02:00
Dirk
7543aa30fb make travis mute again / introduce DEBUG_ALLINONE to use script for debug output all in one file 2017-03-27 08:59:29 +02:00
Dirk
9f1877b192 save work (still double footer, see #653) 2017-03-27 00:54:38 +02:00
Dirk
a8b2dfec40 allow '=' after --htmlfile 2017-03-27 00:34:42 +02:00
Dirk
13ba1ce966 partly (1/2) fixing #653 2017-03-27 00:30:42 +02:00
Dirk
c281956f6e ifix xtrace 2017-03-26 19:34:02 +02:00
Dirk
e268a1564a * include runtime per default in "Done" banner
* enable better performance analysis
* minor polish
2017-03-25 19:37:30 +01:00
Dirk
10bbbd9334 minor cleanups 2017-03-25 13:23:21 +01:00
Dirk Wetter
039b293790 Merge pull request #679 from dcooper16/std_cipherlists_debug
Fix std_cipherlists with debug
2017-03-25 12:36:46 +01:00
Dirk
4ae1597b2b FIX #543 2017-03-25 12:26:08 +01:00
David Cooper
8d60e87040 Fix std_cipherlists with debug
`std_cipherlists()` does not include line breaks between tests in the output to the terminal when `$DEBUG` is 1, and it does not include line break between tests in the HTML output whenever `$DEBUG` is greater than 0.
2017-03-24 16:45:39 -04:00
David Cooper
9a86825ec2 Fix client simulation
In `create_client_simulation_tls_clienthello()` the variable `sni_extension_found` should be set if the ClientHello includes an SNI extension. Instead it was being set if and only if the ClientHello included some extension other than SNI.

This bug wasn't detected before for two reasons:

* It is rare to have a ClientHello that includes an SNI extension, but no other extensions.

* The code still works correctly if `sni_extension_found` is set even if there is no SNI in the ClientHello.

So, the bug only creates a problem if the browser's ClientHello include an SNI extension and no other extensions (see "BingPreview Jun 2014" in the client_simulation branch).
2017-03-24 11:37:06 -04:00
Dirk Wetter
3514c9d98d Merge pull request #672 from dcooper16/minor_bugs
Fix two minor bugs
2017-03-24 08:00:33 +01:00
David Cooper
3a2dd3e6d1 Fixing a third minor bug
When HTML output is not being created, the print functions last step is to call `html_out()`, which responds to `return` rather than `return 0`. This causes problems for lines of code that rely on receiving a return value of 0. For example:
```
[[ $VULN_COUNT -le $VULN_THRESHLD ]] && outln && pr_headlineln " Testing for LUCKY13 vulnerability " && outln
```
2017-03-23 16:43:04 -04:00
David Cooper
7f64170402 Fix two minor bugs
This PR fixes two minor bugs:

* In `run_hpkp()`, the call to `$OPENSSL s_client` includes the option `-showcerts` twice. This PR removes one of them.

* In `get_server_certificate()`, the first call to `$OPENSSL s_client` includes `$addcmd`, but `$addcmd` has not yet been initialized. Instead, `$SNI` should be used.
2017-03-23 16:19:21 -04:00
David Cooper
13f42774ae Use printf to print browser names 2017-03-23 14:13:47 -04:00
Dirk
d5bb4edd80 * FIX #654 (no logfile when -file is specified)
* filename has now instead of just the number p+#
* minor polishing
2017-03-23 16:36:29 +01:00
David Cooper
63d02688bc Fix typo 2017-03-22 15:21:22 -04:00
David Cooper
9ad1492236 Cleanup extraction of TLS extensions
Currently there is code to extract TLS extensions in three places, in `get_server_certificate()` and two places in `determine_tls_extensions()`. This PR replaces them with one new function, `extract_new_tls_extensions()`.

In order for the new function to work correctly whether OpenSSL or `tls_sockets()` is being used, this PR also changes `parse_tls_serverhello()` so that extensions are formatted in the file it creates in the same way as they are formatted by OpenSSL.
2017-03-22 15:18:38 -04:00
Dirk
43463da4fc improvements for performance measurements (small solution)
- in gerneral better performance measurements , starts from the real beginning (almost)
- allows results to put into file (MEASURE_TIME_FILE=google.txt testssl.sh google.com)
2017-03-22 16:02:48 +01:00
Dirk
27d0570fb5 - changed performance debugging options (small solution) so that the last delta is being shown
- PS4 improved: has now a performance debugging options (big solution)
- PS4 with proper alignment
- SCAN_TIME is now global so that it can be used not only by JSON-PRETTY (small performance debugging options uses it)
- prepare_debug() has now debugging stuff only, rest went to prepare_arrays()
2017-03-21 12:44:03 +01:00
Dirk
273361fbb9 raw time assements via env var MEASURE_TIME=true 2017-03-20 22:53:18 +01:00
Dirk
60a8e0a190 monor resorting and cosmetic improvements 2017-03-19 09:47:49 +01:00
Dirk
73a094fcc7 FIX #648 (retrieve cipher and protocol from ServerHello) --> saves ~1 second and makes code better to read
other readabilty improvements
2017-03-18 22:24:35 +01:00
Dirk
8be47e484b replace some "echo $x" by HERE statement "<<<" 2017-03-18 21:01:55 +01:00
Dirk
c618b9a954 fix CR for standard cipherlists with debug=1 2017-03-18 16:09:22 +01:00
Dirk
21a51b4ff0 Merge branch '2.9dev' of github.com:drwetter/testssl.sh into 2.9dev 2017-03-18 15:58:30 +01:00
Dirk
407c4383bf - externalized client simulation data
- fixed  *_fixme()
2017-03-18 15:57:16 +01:00
Dirk Wetter
30e68311fc Merge pull request #658 from AlGreed/2.9dev
Fixed #657: Severity flag for JSON-PRETTY produces malformad JSON object
2017-03-18 13:12:40 +01:00
Dirk
84a4fafe1e fixed merge conflicts 2017-03-18 12:54:01 +01:00
AlGreed
3437f36f48 Merge branch 'drwetter/2.9dev' into 2.9dev 2017-03-18 09:41:50 +01:00
Dirk Wetter
1c9670857b Merge pull request #661 from dcooper16/normalize_ciphercode
Speedup normalize_ciphercode()
2017-03-17 21:19:23 +01:00
David Cooper
c791e5cc0e Speedup normalize_ciphercode()
This PR is the same as #661, except that it applies to the 2.9dev_html branch. It also fixes a bug in `prettyprint_local()` when a pattern to match is provided as input.
2017-03-15 10:32:29 -04:00
David Cooper
875cd43087 Speedup normalize_ciphercode()
While doing some performance testing I discovered that `normalize_ciphercode()` is very slow. This PR simplifies the function and speeds it up significantly. This PR also addresses the TODO item in `normalize_ciphercode()` by eliminating the global variable HEXC.
2017-03-15 10:22:04 -04:00
AlGreed
3122b3b7b3 Removed mistakenly commited code. 2017-03-09 19:10:51 +01:00
AlGreed
6b8de02072 Fixed broken JSON-PRETTY format. Added test to check severity levels 2017-03-09 18:55:04 +01:00
AlGreed
6201348827 Merge branch 'drwetter/2.9dev' into 2.9dev 2017-03-07 11:18:13 +01:00
David Cooper
f02948e24a Add spaces in show_finding()
When I view testssl.sh in KDE's text editor (kate), the code after "INFO" line in `show_finding()` isn't highlighted correctly, and the highlighting doesn't correct again until `pr_liteblueln()`. This PR fixes the highlighting issue by adding spaces between "]]" and ")". To be "safe," I also added spaces between "(" and "[[", and similarly added spaces in `is_json_format()`.
2017-03-06 14:37:52 -05:00
David Cooper
a3794d1f74 Merge branch '2.9dev_html' into html_headers_and_footers 2017-03-01 08:47:25 -05:00
David Cooper
3c22511806 Fix HTML headers and footers
This PR ensures that each HTML file produced by testssl.sh only includes a single header, at the top, and a single footer, at the end. It also tries to ensure that the short-version banner is only placed at the top of the HTML file if (1) mass testing is being performed and (2) the results of each test is being placed in a separate file.

It also moves some of the logic out of main and into `html_header()`.
2017-02-28 13:31:06 -05:00
David Cooper
68cf590366 Merge branch '2.9dev_html' of https://github.com/drwetter/testssl.sh into 2.9dev_html 2017-02-28 12:47:45 -05:00
Dirk
ca6cb0bf81 updated from #632 from dcooper16/negotiated_cipher 2017-02-28 18:33:17 +01:00
David Cooper
b793e5f83d Merge branch '2.9dev_html' into html_reserved 2017-02-27 13:27:16 -05:00
David Cooper
3e42b2fde9 Merge branch '2.9dev' into negotiated_cipher 2017-02-27 13:26:15 -05:00
Dirk
79a8a02328 adding spring boot header detection 2017-02-27 19:16:29 +01:00
Dirk
ac193a8ef0 adding spring boot header detection 2017-02-27 19:12:59 +01:00
David Cooper
0ada7b100c Handle HTML reserved characters in headers
So far I haven't seen any HTML reserved characters (&, <, >, ", ') in the strings processed by `emphasize_stuff_in_headers()`, so this PR may be unnecessary. However, this PR will ensure that any such characters will be properly escaped in the HTML output.
2017-02-27 11:49:51 -05:00
David Cooper
f53afdc149 Redo emphasize_stuff_in_headers()
This PR re-implements `emphasize_stuff_in_headers()` in the HTML branch to more closely match the version in 2.9dev.
2017-02-27 11:17:19 -05:00
David Cooper
915cadd20d Merge PR #646 into 2.9dev_html
This PR just brings 2.9dev_html up to date with 2.9dev.
2017-02-27 10:34:04 -05:00
David Cooper
e3c94d2a92 Merge branch '2.9dev' into negotiated_cipher
Conflicts:
	testssl.sh
2017-02-27 09:06:17 -05:00
Dirk
2232929bc5 Polish #646
"=~" doesn't need quotes if there's a text string one wants to match against (and shellcheck complains
about this)

pr_magenta shouldn't be used anymore as the logic what color we use should be done
some place else.
2017-02-27 13:43:23 +01:00
Dirk Wetter
f7c3139545 Merge pull request #646 from dcooper16/rfc-only
Add option to print only the RFC cipher names
2017-02-27 13:30:11 +01:00
Dirk
4727a69a62 fixed segfaults 2017-02-25 17:15:18 +01:00
Dirk
8d66786e42 Just saving my workJust saving my work ...
This branch is for getting the HTML patch from @dcooper16 into 2.9dev

Change to David's PR:
* removed HTMLHEADER. We always want that (in fact for flat JSON this is missing and needs to be added)
* not sure what this change does to --file
* changing of names  They were redundant sometimes (pr_*_term )
* some formatting for readbility

Open points:
* there's a loop and a segfault --> tm_done_best
* HTMLHEADER: --file
* the former sed statement aroung L1900 for the header was way more readable. The combined
  html+terminal version is just too much. Maybe a switch whether HTML is requested
  is better so that this can be separated.
  * Then e.g. "<span style=\"color:olive;font-weight:bold" can be kept in a variable
  * any reason we need the text length here?
* what went into main here is too much. Actuallly what I put already in there bothered
  me as too much logic and not obvious dependencies are in here. Now it's worse :-)
  Can't this be just similar to JSON or CSV -- a seperate function with hooks
  not in main()?
* minor thing: TERM_WIDTH is for HTML is maybe not the best. But that can be
  tackled later
2017-02-25 16:31:30 +01:00
Dirk
b10942a92e Merge branch 'generate_html' of https://github.com/dcooper16/testssl.sh into dcooper16-generate_html 2017-02-25 12:21:33 +01:00
Todd Swatling
12c3de7039 added missing herestring redirect (<<<) in find_openssl_binary function 2017-02-24 15:59:34 -05:00
Todd Swatling
783b909804 removed trailing spaces 2017-02-24 15:56:26 -05:00
David Cooper
1de12e4b01 Merge branch '2.9dev' into rfc-only 2017-02-24 11:07:28 -05:00
David Cooper
51fb93908b Merge branch '2.9dev' into generate_html
Conflicts:
	testssl.sh
2017-02-24 11:07:00 -05:00
David Cooper
bd1f02d83f Merge branch '2.9dev' into negotiated_cipher 2017-02-24 10:57:14 -05:00
Dirk Wetter
e7e9a3ed66 addressing #645 before #554 has been addressed 2017-02-24 16:26:22 +01:00
Dirk Wetter
4361bb7cce housekeeping/ cleanup 2017-02-24 16:22:59 +01:00
David Cooper
8a9d3fbd6a Merge branch '2.9dev' into rfc-only 2017-02-23 11:32:16 -05:00
David Cooper
59330a93e5 Merge branch '2.9dev' into generate_html 2017-02-23 11:31:35 -05:00
David Cooper
4c7e89f01c Merge branch '2.9dev' into negotiated_cipher 2017-02-23 11:30:52 -05:00
Dirk
b4f59e91be FIX #621 2017-02-23 17:19:52 +01:00
David Cooper
6a1c519acd Add option to print only the RFC cipher names
This PR attempts to address #631. It allows four choices for the `--mapping` option. "openssl" (default), "rfc", "no-openssl", and "no-rfc".

* "openssl" is the current default

* "no-rfc" shows only the OpenSSL names (just as it currently does)

* "rfc" shows the RFC name rather than the OpenSSL name for things that are not in wide now (just as it currently does). But now, in wide mode, it shows the RFC name first (further to the left) and the OpenSSL name second.

* "rfc-only" shows only the RFC name.

If the `--mapping` option is not provided, this is the same as "openssl". If the "cipher-mapping.txt" file cannot be found, then testssl.sh runs as if "no-rfc" had been requested.
2017-02-23 09:31:41 -05:00
David Cooper
5ffd01ed9a Merge branch '2.9dev' into generate_html
Conflicts:
	testssl.sh
2017-02-21 16:59:33 -05:00
David Cooper
7f70df32c9 Merge branch '2.9dev' into negotiated_cipher 2017-02-21 16:57:17 -05:00
Dirk Wetter
8919b419e5 Merge pull request #642 from dcooper16/wrap_long_lines
Wrap long lines in display_rdns_etc()
2017-02-21 22:51:24 +01:00
David Cooper
191d19be32 Use egrep -v to remove unwanted lines 2017-02-21 15:47:59 -05:00
David Cooper
5aaf78cff6 Fix issue #643
It seems that the head command on OS X does not accept a negative number as a value for the "-n" parameter. This PR provides an alternative method for removing the "generator:  " line without using "head."
2017-02-21 15:22:47 -05:00
David Cooper
c3d59b655f Add $CORRECT_SPACES to indentation 2017-02-21 13:46:59 -05:00
David Cooper
62db2ae6bf Wrap long lines in display_rdns_etc()
Some sites have a long list of IP addresses and some IP addresses have a long list of DNS names that map to them.

This PR changes `display_rdns_etc()` to use `out_row_aligned_max_width()` to print the other IP addresses in `$IP46ADDRs` and to print `$rDNS`.
2017-02-21 13:36:23 -05:00
David Cooper
4f73d74ee3 Merge branch '2.9dev' into generate_html
Conflicts:
	testssl.sh
2017-02-21 09:27:25 -05:00
David Cooper
a0e961e1f3 Merge branch '2.9dev' into negotiated_cipher 2017-02-21 09:24:21 -05:00
Dirk
be079acb5e - collect more TLS extensions 2017-02-21 11:16:14 +01:00
Dirk Wetter
6b90152f52 Merge pull request #639 from dcooper16/must_staple
OCSP must staple
2017-02-20 12:31:16 +01:00
Dirk Wetter
52a0d44b90 Merge pull request #637 from dcooper16/print_negotiaed_cipher
Printing Negotiated cipher
2017-02-20 11:46:24 +01:00
Dirk
bfbaba4ea7 - trying to address #640 . Better a bit pessimistic here... 2017-02-20 09:44:52 +01:00
Dirk
c284185c56 - try to address #638 2017-02-18 13:22:17 +01:00
David Cooper
4b1435f958 Make link from redirect URL
If the HTTP Status Code includes a redirect URL, then make the URL a hyper link in the HTTP output.
2017-02-17 16:40:50 -05:00
David Cooper
8c607d425e OCSP must staple
RFC 7633 introduces the TLS Features certificate extension, which contains "Features:
> The object member "Features" is a sequence of TLS extension identifiers (features, in this specification's terminology) as specified in the IANA Transport Layer Security (TLS) Extensions registry.  If these features are requested by the client in its ClientHello message, then the server MUST return a ServerHello message that satisfies this request.

The main purpose of this certificate extension is to implement "must staple." If the extension is present in a TLS server's certificate and it includes status_request, then the server MUST include a stapled OCSP response if the client requests one. (The same applies for the status_request_v2 extension.)

This PR adds a check to `certificate_info()` of whether the server supports must staple (i.e., whether its certificate includes a TLS Features extension with "status_request"). It also changes the output for "OCSP stapling" in the case that the server did not staple an OCSP response. It indicates that:
* it is a critical issue if the certificate specifies "must staple"
* it is a low severity issue if the certificate does not specify "must staple," but the certificate does include an OCSP URI.
* it is not an issue at all if the certificate does not specify "must staple" and certificate does not include an OCSP URI.
2017-02-17 15:20:37 -05:00
David Cooper
a26425af71 Printing Negotiated cipher
`run_server_preference()` prints out the server's Negotiated cipher in a different color depending on the quality of the cipher. However, there is a "FIXME" since CBC ciphers are supposed to be flagged, but it is not easy to identity all CBC ciphers from their OpenSSL names.

This PR partially addresses this. It creates a separate function for printing a cipher based on its quality. Whenever possible it determines the quality of the cipher based on the RFC name. However, if it is provided an OpenSSL name and no cipher-mapping.txt file is available, it will follow the current (imperfect) logic for determining the cipher's quality.

The function also returns a value that indicates the quality of the cipher provided, with higher numbers indicating better ciphers. This return value is used by `run_server_preference()` to determine how to populate the "severity" field when calling `fileout()`.
2017-02-17 11:20:11 -05:00
David Cooper
677a06d3aa Merge branch '2.9dev' into generate_html 2017-02-16 13:19:58 -05:00
David Cooper
c8f3dd0db0 Merge branch '2.9dev' into negotiated_cipher 2017-02-16 13:19:07 -05:00
Dirk
d2cbbaf0b1 - FIX #636
- polish
2017-02-16 19:10:59 +01:00
David Cooper
2eeeff6618 Merge branch '2.9dev' into generate_html
Conflicts:
	testssl.sh
2017-02-15 15:43:21 -05:00
David Cooper
d1ab98c5e2 Merge branch '2.9dev' into negotiated_cipher 2017-02-15 15:41:37 -05:00
Dirk Wetter
a973386c0a Merge pull request #635 from dcooper16/run_protocols_bugfix
run_protocols() bug fix
2017-02-15 19:44:53 +01:00
Dirk
c204a0b942 --proxy=auto takes now the value from https_proxy
- made DNS lookups safe (CNAME) and awk'd them almost completely ;-)
- invocation of just testssl.sh shows help again
2017-02-15 19:40:06 +01:00
David Cooper
2456c80821 Fix early newline
In the case that `tls_sockets()` is being used and the server incorrectly fails the connection rather than downgrading, testssl.sh is printing "not offered" on one line and then the error message on the next line, but all the text should appear on one line (as it does when testing TLS 1 and TLS 1.1).
2017-02-15 11:47:11 -05:00
David Cooper
efdb8c036d Merge branch '2.9dev' into run_protocols_bugfix 2017-02-15 08:45:01 -05:00
David Cooper
1cfd638345 Merge branch '2.9dev' into generate_html
Conflicts:
	testssl.sh
2017-02-15 08:44:09 -05:00
David Cooper
58f389b7cd Merge branch '2.9dev' into negotiated_cipher 2017-02-15 08:42:41 -05:00
Dirk Wetter
502601c95e Merge pull request #633 from k0ste/2.9dev_newfeature
DNS CAA: drill query support.
2017-02-15 14:01:36 +01:00
Konstantin Shalygin
cdc5e89b64
DNS CAA: drill query support. 2017-02-15 19:50:08 +07:00
David Cooper
004cbad07b run_protocols() bug fix
Since the test for TLS 1.2 in `run_protocols()` now uses `tls_sockets()` whenever `$ssl_native` is `true` (i.e., there is no longer a requirement for `$EXPERIMENTAL` to be true as well), the `$EXPERIMENTAL` flag should no longer be checked if the return value is 1.
2017-02-14 16:43:46 -05:00
David Cooper
e4aef3fdad Merge branch '2.9dev' into generate_html
Conflicts:
	testssl.sh
2017-02-14 16:27:46 -05:00
David Cooper
2e76dff0ea Merge branch '2.9dev' into negotiated_cipher 2017-02-14 16:25:27 -05:00
Dirk
4b193119b3 - made CCS I more robust, FIX #313
- removed cats ;-) FIX #352
2017-02-14 21:56:31 +01:00
Dirk
422171a0fa - fixed bug where terminal width was not inherited in file batch mode so that terminal wdith appeared to be 80 chars
- hint when URI is missing
- PFS_CIPHERs rather locally
2017-02-14 20:40:38 +01:00
David Cooper
7cbd4ade01 Merge branch '2.9dev' into generate_html
Conflicts:
	testssl.sh
2017-02-14 14:10:22 -05:00
David Cooper
8c165fd3da Merge branch '2.9dev' into negotiated_cipher 2017-02-14 14:06:18 -05:00
Dirk
a22e4e5228 - fix heartbleed detection which sometimes case false psoitives over slow connections like sattelite links, partially addressing #352
- start revamping run)ccs_injection
- fix missing space in BEAST after protocol
2017-02-14 19:45:14 +01:00
David Cooper
48088bbceb Cleanup
Rearrange code so that in the case of just a single test, `parse_hn_port()` is not called earlier than it was previously unless it needs to be called in order to create the HTML file name.

Doing this ensures that the banner is displayed even if the `$URI` cannot be parsed (except in the case that the `$URI` needs to be parsed in order to create a file name) and that any error messages created by `parse_hn_port()` will be included in the HTML, if possible.
2017-02-14 13:44:03 -05:00
David Cooper
308b24cbe9 Let testssl.sh create HTML file name
Add option for testssl.sh to create the HTML file name. If testssl.sh creates the file name, then, in the case of mass testing, a separate HTML file is created for each test (i.e., for each line in the file provided to `--file`).
2017-02-14 13:19:12 -05:00
David Cooper
e2161aef5e Rearrange code
Just a slight rearrangement of the code in order to remove some redundancy.
2017-02-14 10:04:42 -05:00
David Cooper
76c34dd148 Negotiated cipher per proto bugfix
I have a test server that I configured to support only SSLv3 and TLSv1.2. When I set `SSLHonorCipherOrder` to `off` I get the following results:
```
     ECDHE-RSA-AES256-SHA:          SSLv3     ECDHE-RSA-AES256-GCM-SHA384:   TLSv1.2
```
The current code, when printing TLSv1.2 checks whether `${cipher[4]}` is empty, and since it is assume no previous protocol (SSLv2, SSLv3, TLSv1, TLSv1.1) was supported and so doesn't output a newline before outputting the cipher and protocol for TLSv1.2.

This PR fixes that by changing to code to look at the previous non-empty cipher (if there is one), even if that does not come from the previous protocol.
2017-02-14 09:53:38 -05:00
David Cooper
61b5539ca6 Merge branch '2.9dev' into generate_html
Conflicts:
	testssl.sh
2017-02-14 08:50:56 -05:00
David Cooper
1dc132c6a4 Option to show RFC cipher names
When a list of cipher suites is being displayed using `neat_list()`, testssl.sh shows the cipher suite's OpenSSL name and (in most cases) the RFC name as well. However, in all other cases only the OpenSSL name is shown.

This PR adds the option to have cipher suite's RFC names shown instead of the OpenSSL name, by including `--mapping rfc` in the command line. [Note: if the cipher-mapping.txt file cannot be found, then the `--mapping rfc` option is ignored and the OpenSSL names are shown.]

This PR seems to be related to issue #9, but #9 may be been referring to the output created by `neat_list()`.
2017-02-13 16:07:25 -05:00
David Cooper
e953c737d1 Merge branch '2.9dev' into generate_html
Conflicts:
	testssl.sh
2017-02-13 09:14:22 -05:00
Dirk
7d6f1eb46f polishing #628, mostly make sure we automatically align to terminal width 2017-02-13 09:06:10 +01:00
Dirk Wetter
21cd97b08a Merge pull request #628 from dcooper16/format_long_lines
Wrap long lines
2017-02-13 08:52:07 +01:00
Dirk
d2f688e925 CAA RR belongs also in JSON, see #588 2017-02-11 14:16:18 +01:00
Dirk
8dabc28280 also made sure that all old dns binaries work (SLES 11, FreeBSD 9) 2017-02-11 14:01:51 +01:00
David Cooper
376fb95d04 Follow $COLOR value in HTML output
Use the value of `$COLOR` to affect the HTML output in addition to the output to the terminal.
2017-02-10 17:08:49 -05:00
David Cooper
fea2558b20 Show gray for COLOR=1
Gray should appear for COLOR=1 or COLOR=2.

Since `pr_grey()` is basically the same as `out()` for COLOR=0, `mybanner()` should just call `pr_grey()` without checking the value of `$COLOR`.
2017-02-10 16:30:14 -05:00
David Cooper
f633ce67d6 Color change
Change `emphasize_stuff_in_headers()` to use olive and bold olive rather than brown and yellow. This matches what `aha` creates and appears similar to what is displayed in the terminal on a Mac. Also, yellow text is very difficult to read.
2017-02-10 15:05:43 -05:00
David Cooper
2652362ce0 Final fixes
Found more places where output should only go to terminal, or where it was only going to the terminal (e.g., printf) but should also be in the HTML. Also added the ability to include active URLs in the HTML output.

To Do: Handle automatic generation of HTML file name and support for parallel testing.
2017-02-10 14:47:49 -05:00
David Cooper
2b5324b8ef Fix emphasize_stuff_in_headers()
Changed `emphasize_stuff_in_headers()` so that the appropriate coloring would appear both in the terminal and in the HTML. It's slow, but it works.
2017-02-10 10:59:20 -05:00
David Cooper
a50488c44f Handle --file option
Introduced "trick" so that if the `--file` option is used, `html_header()` will only be called once before anything is printed and `html_footer()` will only be called once after all printing is complete. With this, `html_header()` now delete the output file if it exists.

Also introduced the `html_reserved()`, which is called for all text to be sent to `out_html()`. `html_reserved()` converts any HTML reserved characters (", ', &, <, >) to their corresponding entity names (&quot;, &apos;, &amp;, &lt;, &gt;).
2017-02-09 17:03:21 -05:00
David Cooper
45379ce1f9 Fix subjectAltName indendation
The PR didn't account for the indentation of the subjectAltName differing depending on whether the server has one or more than one certificate.
2017-02-09 13:29:22 -05:00
David Cooper
c92131c072 Don't collect number of bits in run_pfs()
The `bits` array is no longer needed in `run_pfs()` since the information collected is not being used.
2017-02-09 11:45:29 -05:00
David Cooper
d4455081f0 Wrap long lines
This PR addresses the issue raised in #623. This PR is based on the function `out_row_aligned_max_width()` that I proposed in #623, but the `out_row_aligned_max_width()` in this PR is a little different. It takes a fourth parameter, which is the function to use to print each word in the text string to be printed. This is used in `run_pfs()` so that the "Elliptic curves offered" can be printed using this function (some servers support 25 curves), while still having the curves printed using color-coding to indicate the quality of each curve.

I somewhat arbitrarily have each line wrap at 120 characters, but that could be changed (e.g., to `$TERM_WIDTH`).
2017-02-09 11:36:24 -05:00
David Cooper
1c5ef78913 Another update to HTML colors
For the most part I used the RGB values for xterm from https://en.wikipedia.org/wiki/ANSI_escape_code#Colors for the HTML colors, but with a few exceptions. For example, I did not use "yellow" for `pr_svrty_low()`, since that color is very difficult to read. I also used a different color for `pr_svrty_medium()` so that `pr_svrty_medium()` would appear more red than `pr_svrty_low()`.

These color choices could use more adjustment.
2017-02-08 15:16:51 -05:00
David Cooper
be6bafaec4 Merge branch '2.9dev' into generate_html
Conflicts:
	testssl.sh
2017-02-08 10:04:14 -05:00
Dirk
386aa92448 keep detected status of WSL / bash on windows in a variable, see also #620 2017-02-08 09:08:05 +01:00
Dirk
0200100750 see #620 2017-02-08 08:58:28 +01:00
Dirk Wetter
0b7e9b18b8 Merge pull request #620 from teward/2.9dev
Attempt to force system binaries for WSL
2017-02-08 08:54:20 +01:00
Dirk Wetter
0810f2a719 Merge pull request #609 from dcooper16/handle_supported_groups
Handle renaming of the Supported Elliptic Curves Extension
2017-02-08 08:11:23 +01:00
Dirk
0d993427a3 - enabling TLS 1.2 via sockets
- enabling sockets in run_protocols STARTTLS per default
- minor output polishing
2017-02-07 23:08:29 +01:00
David Cooper
2af8198f27 Change HTML colors
Rather than use the colors created by `aha` use colors that more closely match the colors that appear in the terminal.
2017-02-07 17:06:27 -05:00
Thomas Ward
6140aa8b8c Attempt to force system binaries for WSL 2017-02-07 15:59:09 -05:00
David Cooper
dc9e3bfb58 Add option to create HTML
This PR adds the option to generate HTML. The code was created as follows:

* For each output function (`out()`, `outln()`, `pr_liteblue()`, etc.) I created two functions: one that just outputs to the terminal and one that outputs to the terminal and to the HTML file (if an HTML file is to be created).

* I modified the code so that any output that should appear in the HTML file in addition to being displayed on the terminal is sent through one of the display functions: out()`, `outln()`, `pr_liteblue()`, etc.

* I created a new function `retstring()` to use in place of `out()` when a function is creating a string to be "captured" by the calling function.

* I modified the code so that no string returned by a function includes color-coding escape characters.
2017-02-07 14:25:41 -05:00
David Cooper
4fab1830cb Merge branch '2.9dev' into handle_supported_groups 2017-02-06 13:49:05 -05:00
Dirk
48e264a193 fixed regression #611 2017-02-06 17:47:17 +01:00
David Cooper
321d5e0c9d Merge branch '2.9dev' into handle_supported_groups 2017-02-06 08:47:11 -05:00
Dirk
54e0395969 Reverse #600 but leave the hook in here, ANSI code for strikethru 2017-02-06 11:06:59 +01:00
Dirk Wetter
03daa1be35 Merge pull request #608 from dcooper16/neat_list_camelliagcm
Fix neat_list() for Camellia GCM
2017-02-06 10:41:01 +01:00
Dirk
a9cddd7afb see #611 2017-02-04 15:11:03 +01:00
Dirk Wetter
e95f9a8d0a Merge pull request #611 from dcooper16/print_two_CRL_or_OCSP_URI
Fix Two CRL and/or two OCSP URLs
2017-02-04 15:06:18 +01:00
Dirk
3a21097cc5 HTTP/1.1 GET handler for #254 2017-02-04 14:13:33 +01:00
Dirk Wetter
59c3286775 Merge pull request #612 from dcooper16/update_fix_587
Update fix to 587
2017-02-04 12:14:09 +01:00
AlGreed
8457c1ce9e corrected path to common_primes_file in logjam 2017-02-04 01:38:18 +01:00
Dirk
5046b80414 first draft of LUCKY13 (128 cipher limit has to be addressed) 2017-02-03 22:36:04 +01:00
David Cooper
79bfe1103c Merge branch '2.9dev' into update_fix_587 2017-02-03 08:47:29 -05:00
David Cooper
b2de5c4ac9 Merge branch '2.9dev' into print_two_CRL_or_OCSP_URI 2017-02-03 08:46:40 -05:00
David Cooper
f273b5ed8c Merge branch '2.9dev' into handle_supported_groups 2017-02-03 08:45:40 -05:00
David Cooper
da59ea11c2 Merge branch '2.9dev' into neat_list_camelliagcm 2017-02-03 08:44:36 -05:00
Dirk
925e1061b2 - renamed pr_svrty_minor --> pr_svrty_low to reflect the level literally
- minor polishing
2017-02-03 13:03:22 +01:00
Dirk
b9232fd5d0 Fix TLS_FALLBACK_SCSV detection for non RFC compliants F5 loadbalancers. They pass now the test but get additonally penalized for their non compliance, see also https://github.com/drwetter/testssl.sh/issues/121#issuecomment-113790270 2017-02-03 11:47:21 +01:00
David Cooper
e7c7e7ba19 Update fix to 587
In the revised code that was created to address #587, nothing is printed after "OCSP URI" if there is neither an OCSP URI nor a CRL URI. Instead, "--" should be printed.

I still believe that there is an inconsistency in the reporting of the output, however. At the moment, the "Certificate Revocation List" and "OCSP URI" lines indicate it is acceptable as long as the certificate contains either a CRL URI or an OCSP URI. However, the "OCSP stapling" line reports a minor finding if an OCSP response was not included in the server's reply. Shouldn't we just assume that if the certificate doesn't include an OCSP URI, then it wouldn't be possible for the server to obtain an OCSP response to staple to its reply? If so, then it seems that no OCSP stapling should only be considered a finding if an OCSP URI is present.
2017-02-02 15:52:32 -05:00
David Cooper
e9d6ac8ad1 Fix Two CRL and/or two OCSP URLs
This PR fixes issue #601.

The fix for OCSP URLs was easy. I don't entirely understand the first `awk` command in the line to extract the CRL URLs, but I tested it on several certificates and it seems to work correctly (ensuring that the only "URI" lines in the input to the second `awk` command are from the CRL Distribution Points extension).
2017-02-02 13:04:49 -05:00
David Cooper
7a378c44dc Merge branch '2.9dev' into handle_supported_groups 2017-02-02 09:13:33 -05:00
David Cooper
898438ec17 Merge branch '2.9dev' into neat_list_camelliagcm 2017-02-02 09:12:42 -05:00
Dirk
ec7aa2481a - SWEET32. Note this is still NOT COMPLETE (ciphers!) and needs more testing 2017-02-02 14:42:06 +01:00
David Cooper
f1eb3b85de Handle renaming of the Supported Elliptic Curves Extension
RFC 4492 introduced the Supported Elliptic Curves Extension, but this extension was renamed Supported Groups in RFC 7919. Following RFC 7919 (and TLSv1.3), `parse_tls_serverhello()` refers to this extension as "supported groups/#10". Since, at the moment, OpenSSL's s_client refers to this extension as "elliptic curves/#10", the extension sometimes appears twice in the "TLS extensions" line, if it is detected by both OpenSSL (in `get_server_certificate()`) and `tls_sockets()` (in `determine_tls_extensions()`):
```
 TLS extensions (standard)    "renegotiation info/#65281" "elliptic curves/#10" "EC point formats/#11" "supported groups/#10"
```
This PR fixes the problem of the extension appearing twice in the "TLS extensions" line by replacing any instances of "elliptic curves/#10" with "supported_groups/#10" in the `$tls_extensions` line extracted from `$OPENSSL s_client`. This PR also changes "supported groups/#10" to "supported_groups/#10" in `parse_tls_serverhello()`, since the current development branch of OpenSSL uses "supported_groups" to refer to this extension (see https://github.com/openssl/openssl/pull/1825).
2017-02-01 15:43:15 -05:00
David Cooper
d93f7031ac Fix neat_list() for Camellia GCM
This PR increases the width of the "Encryption" column printed by `neat_list()` in order to allow room to print "CamelliaGCM."

This is the alternative fix to the problem that was first addressed in #524. This PR obsoletes PR #530.
2017-02-01 13:31:58 -05:00
David Cooper
392dac0e39 Just print entire line in light grey 2017-01-30 09:32:47 -05:00
David Cooper
17db208756 Merge branch '2.9dev' into unsupported_ciphers_in_litegrey 2017-01-30 09:02:15 -05:00
Dirk
a7dff83160 $NODE is fine, removing $MX_HOSTNAME, #603 2017-01-29 10:46:35 +01:00
AlGreed
f07c723d59 added mx hostname for json-pretty output 2017-01-28 18:11:39 +01:00
AlGreed
fcd208b2c9 ... 2017-01-28 08:09:02 +01:00
AlGreed
04c653646e ... 2017-01-28 07:54:58 +01:00
AlGreed
29d6cbc125 Added support of multiple servers to json-pretty format; added fileout for smtp 2017-01-28 07:17:58 +01:00
David Cooper
d47601f413 Print unsupported ciphers in light grey
This PR changes testssl.sh so that when ciphers are being listed in wide mode (i.e., using `neat_list()`) and the `--show-each` option is set, ciphers that are not available are printed in light grey, whereas ciphers that are available continue to be printed in black. This makes it easier to distinguish between ciphers that are available and those that are not (the "available/"not a/v" column remains).

This PR does not change the way that ciphers that are available are printed, but it includes a hook that would allow that to change. For example, for ciphers that are available, the name of the cipher suite could be printed in a different color depending on its quality (as is done for the "Negotiated cipher" in `run_server_preference()`). The same could be done for the "Encryption" and "Bits" columns.
2017-01-25 10:41:36 -05:00
David Cooper
1ee75689e0 Fix typo in tls_sockets()
This PR just fixes a minor bug in `tls_sockets()`, changing
```
debugme "stuck on sending: $ret"
```
to
```
debugme echo "stuck on sending: $ret"
```
2017-01-25 08:57:20 -05:00
David Cooper
db4108cec5 Merge branch '2.9dev' into cipher_order_sockets 2017-01-24 08:46:40 -05:00
Dirk
2a5d56a9d6 help aviod misunderstanding, see #594 and some reordering 2017-01-24 08:37:19 +01:00
David Cooper
156787adec Merge branch '2.9dev' into cipher_order_sockets 2017-01-23 11:22:42 -05:00
Dirk
4911aaf05b Fix #593 2017-01-23 11:33:18 +01:00
Dirk Wetter
8988411fbc Merge pull request #565 from dcooper16/run_server_preference_sockets
Use sockets in run_server_preference()
2017-01-21 19:55:37 +01:00
Dirk
f80e1ecfdb - enable CAA per default (#588)
- hex2ascii() for converting strings
- swap quoted output in -S to italic (mostly)
2017-01-21 19:43:07 +01:00
Dirk
f2303a0d79 - poodle output polishing
- minor polish of #552
2017-01-21 18:08:31 +01:00
Dirk Wetter
d448ebbc77 Merge pull request #552 from dcooper16/run_beast_sockets
run_beast() speedup + sockets
2017-01-21 18:01:55 +01:00
Dirk
2b440f15ea - polishing #570
- run_logjam() terminates if no local DH export ciphers are configured
2017-01-21 16:52:02 +01:00
Dirk Wetter
20cc3bc435 Merge pull request #570 from dcooper16/run_ssl_poodle_sockets
Use sockets for run_ssl_poodle()
2017-01-21 14:37:36 +01:00
Dirk
e083fab130 - run_logjam(): run_logjam(0 fixed error where logjam couldn't parse "ServerKeyExchange" message using SSL_NATIVE -- if TLS != 1.2 was returned
- run_logjam(): determine dh bit size and based on this mark the common primes as more or less vulnerable
- run_logjam(): renamed remaining dhe variable to dh
- further house keeping in run_logjam()
2017-01-19 14:45:19 +01:00
Dirk
e3d183e909 -output correction run_logjam
- rename dhe to dh
2017-01-18 22:05:27 +01:00
David Cooper
211ce0b3fd Merge branch '2.9dev' into run_ssl_poodle_sockets 2017-01-18 15:00:32 -05:00
David Cooper
0cdbe95302 Merge branch '2.9dev' into run_beast_sockets 2017-01-18 14:59:53 -05:00
David Cooper
a016b946fd Merge branch '2.9dev' into run_server_preference_sockets 2017-01-18 14:59:07 -05:00
David Cooper
86ac32cd0d Merge branch '2.9dev' into cipher_order_sockets 2017-01-18 14:57:59 -05:00
Dirk
05d27ff1be - FIX for the last mess submitted ;-) 2017-01-18 18:09:39 +01:00