Commit Graph

2440 Commits

Author SHA1 Message Date
Dirk
a90eb8c9be FIX #744 2017-06-01 16:24:45 +02:00
Dirk Wetter
f3f29cd85c Merge pull request #760 from dcooper16/fix_757
Fix #757
2017-06-01 15:51:21 +02:00
Dirk
e4f64463a4 FIX #758 2017-06-01 15:47:38 +02:00
David Cooper
5807b5e993 Fix #757
I believe I discovered the reason for issue #757: f2303a0d79.

This commit removed attempted to replace `$cbc_cipher_list_hex` (which was computed on the fly) with `$cbc_ciphers_hex` (which is static). However, the function was still using `$cbc_cipher_list_hex`, and since it wasn't being initialized to "" at the beginning of the function, the second call to `run_beast()` (to handle the second IP address) just appended to the value created by the first. Then, when the first two bytes were removed from the resulting string the result was a malformed cipher suite list, which caused `tls_sockets()` to fail.
2017-06-01 09:36:03 -04:00
Dirk
e035dabb13 Trying to address #733, not complete yet (see also #735).
Open issues: 1) The SNI logic 2) The fileout logic. 3) another section with ``trust_nosni -eq 4/8``

For 2): fileout is a general finding MEDIUM [1] which isn't in line now with the pr_*finding
in the section above anymore. It would make sense to punish HTTP services more than others.
Unfortunately he fileout statement cannot be moved below pr_svrty_medium/pr_svrty_high as
trustfinding_nosni hasn't been determined yet.

Fast solution would be probably to move the trustfinding_nosni section above the trustfinding
section.

Still 3) and a different trust over non-SNI makes it difficult -- e.g. Server has CN match only over
SNI but without SNI SAN matches. That's an edge case though which probably doesn't exist (like Bielefeld)

[1] That was WARN before. WARN should indicate a status of testssl that it cannot perform a check
2017-06-01 15:19:21 +02:00
David Cooper
28dadbfb19 Merge branch '2.9dev' into mass_testing_command_line_error 2017-05-30 16:52:55 -04:00
David Cooper
0f09af8566 Stop parent if child encounters parsing error
This PR implements the suggestion from #753 for a child process in mass testing to send a signal to the parent to exit if the child encounters an error parsing its command line. At the moment, the child only sends the signal if it encounters an error that results in the `help()` function being called, but that could easily be changed (e.g., to also send a signal if `fatal()` is called in the child process).

In the case of parallel mass testing, the cleanup function needs to call `get_next_message_testing_parallel_result()` for the child that sent the signal, since otherwise the child's error message would not be displayed. Since I cannot tell which child sent the signal, I just call `cleanup()`, which displays the output of all completed child processes. Since the child process will send the signal almost immediately after starting, it can be assumed the that process that send the signal will be the last one that completed, and so its output will be displayed last (so it isn't hidden from the user).

Note that PR #753 is still needed, since there are still scenarios in which a child would not produce any JSON output, but the parent testssl.sh would not exit (e.g., the child process cannot open a socket to the server it is supposed to test). In additional, PR #754 would still be useful, since it would be more user friendly to catch the error in the mass testing file immediately (when possible) rather that partway through a potentially time-consuming testing process.
2017-05-24 17:12:18 -04:00
David Cooper
c831dd0fd3 Handle all empty JSON file cases 2017-05-23 14:52:25 -04:00
David Cooper
01fb0ba9a2 Merge branch '2.9dev' into mass_testing_command_line_error 2017-05-23 08:57:49 -04:00
Dirk
de177a774c fix formatting problem in run_client_simulation() wide mode when CHACHA20/POLY1305-OLD ciphers
are encountered and remove 4 columns before protocols.

mimor readability improvements in prepare_array() and run_client_simulation()
2017-05-22 23:04:58 +02:00
David Cooper
1311fe595b Massing testing with command line error
There is a bug in testssl.sh that occurs if mass testing is being performed, there is an error in the command line for one of the child tests, and either a single HTML file or a single JSON file is being created.

If mass testing is being performed and `parse_cmd_line()` detects an error in the command line for one of the child tests, then it will call `help()`, which will exit the program, resulting in `cleanup ()` being called. `cleanup ()` will call `html_footer()` and `fileout_footer()`. Since `html_header()` and `json_header()` have not yet been called, `$HTMLHEADER` and `$JSONHEADER` will both be `true, and so `html_footer()` and `fileout_footer()` will output HTML and JSON footers, even though no headers have been output.

This PR fixes the problem by having `help()` set `$HTMLHEADER` and `$JSONHEADER` to `false` so that no HTML or JSON footers are created.

A related problem is that if a single JSON file is being created, the parent process will insert a separator (a comma) into the JSON file between the outputs of each child process. However, if there is an error in one of the child process's command lines, then this child process will not produce any JSON output and so the JSON file will have two consecutive separators (commas), which is invalid according to http://jsonlint.com.

This PR provides a partial fix for the problem for parallel mass testing by checking whether a child process has created a non-empty JSON output before adding a separator to the JSON file. It leaves two unresolved problems:

* It does not fix the problem at all for `run_mass_testing()`, where the separator is added before the test with the command line error is run.

* It does not fix the problem for parallel mass testing for the case in which the first child test has a command line error.
2017-05-22 16:57:15 -04:00
Dirk
d64fabafd5 completed the commit 601c810240
started to use the ip parameter to decide where the dns resoultion
takes place (see #739 and #748). --ip=proxy or DNS_VIA_PROXY=true
will mean DNS resolutioni is done by proxy,

furthermore: swapped a few pr_magenta by pr_warning. Generally
testssl.sh should use for warnings a warning function and not
directly a color (we want to be flexible). There are still a few
remainders for fatal() which use bold magenta and thus I haven't
changed yet.

Also html_reserved() is being called also if no html output
is being requested. This could be fixed better probably.
2017-05-19 20:28:18 +02:00
Dirk
601c810240 add stderr to line showing "Waiting for test" FIX #750 2017-05-19 17:09:47 +02:00
Dirk
041abd57ce FIX #749 and #751
Additionally fix a probable cmd line parsing problem where an argument '--file' was supplied with '='
2017-05-19 17:00:30 +02:00
David Cooper
9d9a658dca More improvements to mass testing in parallel
This PR introduces the following changes/improvements to running mass testing in parallel:

* Continuous feedback is provided on the progress of testing, so that testssl.sh doesn't appeared to be frozen, even if it is waiting a long time for a child test to complete. [The feedback text is sent to `stderr` so that it doesn't appear in the log file if the `--logging` option is used.]

* Text sent to `stderr` by a child test is captured and then displayed in context with the appropriate test rather than being displayed at the time the error occurs. [Note that this means that if the `--logfile <logfile>` option is used (with `logfile` being the name of a file), then `logfile` will include both `stdout` and `stderr`.]

* If a test is started but it does not complete (because testssl.sh was stopped or because the test timed out), then a message is displayed indicating that the test didn't finish.

I believe that `run_mass_testing_parallel()` is either ready for use or nearly ready for use. So, I changed the program to use `run_mass_testing_parallel()` rather than `run_mass_testing()` if the `$EXPERIMENTAL` flag is set.
2017-05-16 14:16:35 -04:00
Dirk
3b1638f603 small performance improvement for prepare_arrays() by replacing grep + awk by awk only 2017-05-16 09:45:16 +02:00
Dirk
e8b5a82c7e Considerable reliability improvements for ticketbleed: if a handshake server hello
was received, testssl.sh tries 3 times to get memory from the server, If
the server returns different memory it's highly likely vulnerable.
(some more vulnerable devices to test against would be appreciated).

This is the default now -- all other hosts are mostly labled as OK.

Parsing SERVICE should be a little faster and more reliable

Increased needed debug level for output @ parse_tls_serverhello
2017-05-15 19:47:13 +02:00
Dirk
b694930fc2 RFC 5077 states that the server MAY give a hint of the lifetime of the ticket.
Sometimes it just does not. In those case also sometimes session resumption
via tickets is supported.

This fixes the output for Session Ticket RFC 5077 and doesn't draw the wrong
conclusion from a missing lifetime hint.

It also tests for ticketbleed first whether there's a session ticket TLS
extension.
2017-05-15 13:18:20 +02:00
Dirk
49b1be9f34 fix json/csv output for ticketbleed 2017-05-15 10:08:34 +02:00
Dirk
b4889a731b Upgraded proxy sockets to use CONNECT 1.0 to avoid proxy problems -- for the time being (see also #741/ #739) 2017-05-12 18:31:59 +02:00
David Cooper
9897debd4d Prevent broken pipe error
When the `--log`, `--logging`, or `--logfile <logfile>` option is being used and testssl.sh is stopped, a "printf: write error: Broken pipe" message tends to appear. From what I can tell, this is a result of the `tee` process being killed before the `cleanup ()` function completes. At the moment, `cleanup ()` doesn't write very much to `stdout`, but if parallel mass testing is performed, then `cleanup ()` may try to write the results of several previously completed tests.

This PR fixes the problem by adding the `-i` option ("ignore interrupt signals") to `tee`.

Note that I have tested this on a Linux desktop and an OS X laptop, but don't have a MS Windows computer on which to test this change.
2017-05-12 09:51:19 -04:00
David Cooper
55df788937 Improvements to mass testing in parallel
This PR provides improvements to `run_mass_testing_parallel()`. Currently, `run_mass_testing_parallel()` treats `$MAX_PARALLEL` as the maximum difference between the number of the test whose results were last processed and the number of the most recently started test. This means that test #40 will not be started until the results of test #20 have been processed. I've encountered situations in which tests 21 though 39 have completed, but test #20 is still running, and so no new tests are started.

This PR fixes the problem by checking the status of all running child tests to see if any are complete, rather than just looking at `$NEXT_PARALLEL_TEST_TO_FINISH`. This prevents one slow child test (or a few slow child tests) from slowing up the entire mass testing process.

This PR also changes the basis for determining whether a slow child process should be killed. Rather than waiting `$MAX_WAIT_TEST` seconds from the time that the parent started waiting (which is rather arbitrary), it kills the process if `$MAX_WAIT_TEST` seconds have passed since the child test was started. Given this, and that the above change makes it less likely that a slow child test will slow up the overall testing, I increased `$MAX_WAIT_TEST` from 600 seconds to 1200 seconds.

I added some `debugme` statements that provide feedback on the status of testing, but in non-debug mode there may be a perception issue. If one test (e.g., test #20) is very slow, testssl.sh will not display any results from later tests until the slow test finishes, even though testssl.sh will continue running new tests in the background. The user, seeing no output from testssl.sh for an extended period of time, may think that testssl.sh has frozen, even though it is really just holding back on displaying the later results so that the results will be displayed in the order in which the tests were started.
2017-05-10 12:18:59 -04:00
Dirk
2936a42bc7 address #626 2017-05-09 21:58:03 +02:00
Dirk
9ed47eaa19 FIX #718 (added TLS padding to ticketbleed handshake). Also added TLS extension Signature Algorithms 2017-05-09 17:29:57 +02:00
Dirk
23e6209beb Merge branch '2.9dev' of github.com:drwetter/testssl.sh into 2.9dev 2017-05-08 23:55:19 +02:00
Dirk
ebd9e6ae65 manually merged #728 (see #423), credits also to @seccubus. Unfortunately the unit tests don't make so much sense atm 2017-05-08 23:51:37 +02:00
Dirk Wetter
53da6da77b Merge pull request #730 from typingArtist/729_catch_read_timeout
correctly capture return code in starttls_full_read
2017-05-04 22:32:23 +02:00
Dirk
699b48c8b8 lowering severity and taking other clients as browsers into account #735 2017-05-04 12:34:20 +02:00
Thomas Kähn
5293c51bc4 Alert on missing SANs 2017-05-04 11:09:27 +02:00
typingArtist
55bbeef36c correctly capture return code in starttls_full_read 2017-04-30 19:57:40 +02:00
Dirk
ba9c056dfc renamed browser --> client simulation 2017-04-28 20:35:07 +02:00
Ondřej Surý
c3fd0249f5 Revert "Downgrade BREACH attack to MEDIUM severity (as it depends on many things)"
This reverts commit 3d2666ab79.
2017-04-25 16:32:06 +02:00
Ondřej Surý
3d2666ab79 Downgrade BREACH attack to MEDIUM severity (as it depends on many things) 2017-04-25 16:17:43 +02:00
Ondřej Surý
3fe0975f27 Merge branch '2.9dev-return-code' into 2.9dev 2017-04-25 15:19:46 +02:00
Ondřej Surý
9c7076b579 $? has an exitcode of the previous if then fi statement, use exit $ret 2017-04-25 15:12:01 +02:00
Ondřej Surý
4579ed2398 Fix prln usage to outln 2017-04-25 15:06:41 +02:00
Dirk
8ea8513529 fixed in Testing server preferences --> Negotiated cipher the empty TMPfile which led to an ugly error
fixed in Session Resumption  for tickets if no extension=no resumption: there was 1x LF too much
2017-04-24 19:18:39 +02:00
David Cooper
eea91a5a61 Merge branch '2.9dev' into client_simulation_wide_option 2017-04-24 08:50:53 -04:00
Dirk
01489b9ca1 special treatment for empty serverhello for ticketbleed 2017-04-24 09:25:23 +02:00
Dirk
2db8e8e8b1 use HAS_NO_SSL2 2017-04-22 22:14:06 +02:00
Dirk
c8cd1318e9 FIX #719, still work to do for ticketbleed (#655) 2017-04-22 15:39:18 +02:00
David Cooper
deab58fe26 Add wide option for client simulations
There is a comment in the `run_client_simulation()` function that says "FIXME: printf formatting would look better, especially if we want a wide option here."

This PR is an attempt at addressing that FIXME and adding a wide option. The proposed wide option prints the same information as the non-wide option, just with the columns aligned. I didn't add any of the additional information that is displayed by other functions in wide mode, since I thought that made the output too wide.
2017-04-21 16:27:02 -04:00
Dirk
584c933493 updated user agent for sneaky 2017-04-21 11:31:42 +02:00
Dirk
28660f7a77 corrected pr_warningln 2017-04-20 17:29:07 +02:00
Dirk
1d992f3620 preview from clientsim branch, important to add now 2017-04-20 17:24:07 +02:00
Dirk
7c676dfc63 FIX #717 -- doubel meaning fo '-h' 2017-04-19 19:46:54 +02:00
Dirk Wetter
869ec9b9c3 Merge pull request #685 from dcooper16/openssl_location
Populate OPENSSL_LOCATION in find_openssl_binary
2017-04-19 18:23:14 +02:00
Todd Swatling
ee4975ac8a modified find_openssl_binary() to use TESTSSL_INSTALL_DIR since get_install_dir() works very hard to determine the where testssl actually is 2017-04-19 09:40:56 -04:00
David Cooper
f7540cae57 Merge branch '2.9dev' into openssl_location 2017-04-19 09:13:33 -04:00
Dirk
c4a2ba8b49 vuln count adjusted 2017-04-19 01:21:13 +02:00
Dirk
2469603a7f save also 1x connect for heartbleed() by reusing a previoulsy identified protocol 2017-04-19 00:30:09 +02:00
Dirk
de79bd6b0e implemented ticketbleed (experimental). Renamed other vulnerabilty checks to easier memorize each check:
-H is now --heartbleed instead of --headers,
-B is now --breach instead of --heartbleed,
-T is now --ticketbleed (was previously --breach)

bugs fix for run_ccs_injection() where the tls protocols wa not properly passed to the ClientHello

Made use of already determined protocol ( this time only from determine_optimal_proto() ) ==> we shpould use this in run_protocols() too!)
for run_ccs_injection + run_ticketbleed(). For achieving this determine_optimal_proto() needed to be modified so that it adds a protocol
to PROTOS_OFFERED (all_failed is now boolean there)

added two easy functions for converting dec to hex

sockread_fast() is for testing which should make socket erads faster -- albeit it could potentially block the whole thing
2017-04-18 23:15:32 +02:00
David Cooper
7747d965d4 Merge branch '2.9dev' into openssl_location 2017-04-14 09:12:20 -04:00
Dirk
4b833b7b6e code readability improvements 2017-04-14 11:26:01 +02:00
Dirk Wetter
3d8c8769a9 Merge pull request #709 from dcooper16/fix_616
Fix #616
2017-04-14 11:04:54 +02:00
David Cooper
27124a404b Merge branch '2.9dev' into debug_output_in_html 2017-04-13 16:34:44 -04:00
David Cooper
2bfc0dc1d7 Merge branch '2.9dev' into fix_616 2017-04-13 16:33:57 -04:00
David Cooper
756e28d2dc Merge branch '2.9dev' into openssl_location 2017-04-13 16:31:30 -04:00
David Cooper
dcfee43b0d Use of color in emphasize_stuff_in_headers()
`emphasize_stuff_in_headers()` only adds color to the text being printed to the terminal if `$COLOR` is 2. So, the same should be the case for the HTML output.
2017-04-13 16:06:06 -04:00
David Cooper
5afee01797 No debugging text in HTML output
This PR fixes two places in which output is being included in the HTML output, but shouldn't be.
2017-04-13 14:28:39 -04:00
David Cooper
712c4ad30b Fix #616
This PR addresses issue #616, changing `run_cipher_match()` so that only those ciphers that are available are shown, unless the `--show-each` flag has been provided.

It also fixes a problem where the signature algorithm isn't being shown, even if `$SHOW_SIGALGO` is true.
2017-04-13 14:03:51 -04:00
David Cooper
c77cbc3043 Merge branch '2.9dev' into openssl_location 2017-04-13 11:05:28 -04:00
David Cooper
e3e25ce1c3 Use get_cipher helper function
The new `get_cipher()` helper function was not being used in every place where it could be used.
2017-04-13 10:32:19 -04:00
David Cooper
ae1bd5c6bd Merge branch '2.9dev' into openssl_location
Conflicts:
	testssl.sh
2017-04-12 16:07:42 -04:00
Dirk
5168fab693 minor polishing 2017-04-12 21:50:55 +02:00
David Cooper
59683927f8 Prevent word splitting 2017-04-12 15:39:37 -04:00
David Cooper
4d0bd4acb5 Merge branch '2.9dev' into openssl_location 2017-04-12 15:36:58 -04:00
Dirk Wetter
d2b70f7289 Merge pull request #706 from dcooper16/fix_702
Fix #702
2017-04-12 21:33:36 +02:00
Dirk Wetter
9f7ab1cef6 Merge pull request #707 from dcooper16/more_702_fixes
More fixes for #702
2017-04-12 21:19:17 +02:00
Dirk
036bf2e53c revamped run_std_cipherlists(). There are now less catagories, less overlap and it's more modern:
NULL ciphers (no encryption)
 Anonymous NULL Ciphers (no authentication)
 Export ciphers (w/o ADH+NULL)
 LOW: 64 Bit + DES encryption (w/o export)
 Weak 128 Bit ciphers
 Triple DES Ciphers (Medium)
 High grade encryption
 Strong grade encryption (AEAD ciphers)
2017-04-12 21:00:08 +02:00
David Cooper
2ac14e879d More fixes for #702
This PR just addresses some places where quotes need to be used to avoid word splitting in case the referenced file, or path to the file, contains space characters.
2017-04-12 14:34:26 -04:00
David Cooper
fa736cf6d9 Fix typo in run_mass_testing_parallel() 2017-04-12 12:24:33 -04:00
David Cooper
513ba8ff2d Another fix to calling child process
The previous fix did not work if testssl.sh was found via `$PATH`. This seems to work in all cases. If testssl.sh is found via `$PATH` or if the command line includes a path, then `which` returns a non-empty response; otherwise, `$0` does not include any path, but one needs to be provided, so `$RUN_DIR/$PROG_NAME` is used.
2017-04-12 12:15:27 -04:00
David Cooper
f094013aeb Fix creation of child process
Using "$0" as the name of the executable seems to work as long as "$0" contains a directory name (e.g, "workingfiles/testssl.sh"), but not if it is just the name of the executable (e.g., "testssl.sh"). Specifying "$RUN_DIR/$PROG_NAME" seems to work in both cases, since if "$0" doesn't contain any path information, `$RUN_DIR` is `.`
2017-04-12 11:39:24 -04:00
David Cooper
6633d0e549 Improve pretty-printing of command line string
Use the suggestion "If you want to print the argument list as close as possible to what the user probably entered" from http://stackoverflow.com/questions/10835933/preserve-quotes-in-bash-arguments to create `$CMDLINE` and to print the command lines in `run_mass_testing()` and `run_mass_testing_parallel()`.
2017-04-12 10:00:40 -04:00
David Cooper
7cbce9cb55 Fix #702
This PR addresses issue #702. Rather than create the command line for each child process in `run_mass_testing()` as a string, it creates it as an array, with each argument being a separate element in the array. This was done based on http://mywiki.wooledge.org/BashFAQ/050.

The printing of each child's command line done based on http://stackoverflow.com/questions/10835933/preserve-quotes-in-bash-arguments.

The `$CMDLINE` string remains unchanged, even though it isn't entirely "correct," since http://jsonlint.com/ complains if the "Invocation:" string contains backslashes.
2017-04-11 17:05:27 -04:00
David Cooper
91695fe07e Merge branch '2.9dev' into openssl_location 2017-04-11 13:17:22 -04:00
Dirk
ed2aa6698d comments added for #705 2017-04-11 18:48:23 +02:00
David Cooper
a1d4eac64d Don't read tls_data.txt inside function
I was doing some testing on my extended_tls_sockets branch and discovered that it was not fully working since the `TLS13_KEY_SHARES` array was empty. According to https://lists.gnu.org/archive/html/bug-bash/2012-06/msg00068.html, there is an issue when trying to initialize a global array inside a function. (The current code initializes `TLS12_CIPHER`, `TLS_CIPHER`, and `TLS13_KEY_SHARES` within `get_install_dir()`, since tls_data.txt is read in that function.) In fact, according to http://stackoverflow.com/questions/10806357/associative-arrays-are-local-by-default, in order to initialize a global variable in a function, one needs to provide the `-g` option, which was only added in Bash 4.2.

This PR seems to fix the problem by moving the reading of tls_data.txt to the main body of the code rather than reading it within the `get_install_dir()` function.
2017-04-10 17:07:46 -04:00
David Cooper
43a4358442 Merge branch '2.9dev' into openssl_location 2017-04-10 09:00:06 -04:00
Dirk
5054cc33f3 rename *test_just_one as @AlGreed suggestted in #703 2017-04-10 14:45:39 +02:00
Dirk
0bbbd5217a swapped -f and -s
-f is now forward secrecy
    -s is standard cipher lists
2017-04-08 09:14:56 +02:00
David Cooper
25977d5537 Merge branch '2.9dev' into openssl_location 2017-04-07 09:41:40 -04:00
Dirk
55713e4929 use per default a lf before the first fatal message 2017-04-07 10:26:41 +02:00
Dirk
c75a2cd838 In addition to #701 add quotes for correcting cmdline parsing -- especially for supplied filenames/arguments
(HTML,CSV,JOSN,PROXY).

Also strip off leading http:// | https://  for --proxy
2017-04-07 09:49:44 +02:00
Dirk Wetter
dc629202bb Merge pull request #701 from dcooper16/wordsplitting_filenames
Handle word splitting of log file names.
2017-04-07 08:54:07 +02:00
Dirk Wetter
9c13d2a3a2 Merge pull request #700 from dcooper16/fix_696
Fix #696
2017-04-07 08:52:38 +02:00
David Cooper
381ad3de32 Handle word splitting of log file names.
This PR fixes a problem that occurs if log file names include spaces.
2017-04-06 11:26:03 -04:00
David Cooper
3a9c49c989 Fix #696
If I understand correctly how `run_hpkp()` should be displaying the list of Backups, the problem shown in the photo attached to #696 occurred because the dangling SPKIs should have been printed on the next line. This PR fixes this by changing the code that prints out the "good" backups to include a newline after printing the CA's name.

Another problem this PR fixes is that `tm_italic()` is being called instead of `pr_italic()`, meaning that the italicized text is being printed to the terminal, but is not being included in the HTML output.

Finally, this PR fixes errors in the definitions of `tmln_italic()` and `prln_italic()`. `tmln_italic()` calls `outln()` and `prln_italic()` calls `tmln_out()` instead of the reverse.
2017-04-06 10:54:20 -04:00
David Cooper
ce620ac7d0 Fix #695
This PR fixes issue #695 by changing the call to `out_row_aligned_max_width()` so that the length of the flag is considered in determining the length of the first line of the output.
2017-04-06 10:37:45 -04:00
David Cooper
69530d77cf Merge branch '2.9dev' into openssl_location 2017-04-06 09:12:43 -04:00
Dirk
e2f5d5c3cf updated comments 2017-04-06 11:33:54 +02:00
Dirk
3351f8832c mute the error message using bash3, see #697 (2.9dev) 2017-04-06 11:23:57 +02:00
Dirk Wetter
c188408f8e Merge pull request #698 from dcooper16/mass_testing_parallel
Mass testing in parallel
2017-04-06 10:25:38 +02:00
Dirk
8a2967c62e make use of swapped out tls data file
(main() sill needs a bit of work)
2017-04-06 09:47:09 +02:00
David Cooper
c04d254a43 Mass testing in parallel
This PR modifies `run_mass_testing_parallel()` so that it may be used in place of  `run_mass_testing()`.
2017-04-05 16:58:57 -04:00
David Cooper
b98ef7cd8e Merge branch '2.9dev' into openssl_location 2017-04-05 15:01:06 -04:00
Dirk
61d42b022c fix missing space in banner and suppress empty version string 2017-04-05 20:39:35 +02:00
Dirk
ec55cdea14 "post-fix" for #697 (2.9dev) 2017-04-05 20:20:00 +02:00
David Cooper
dabe72542f Merge branch '2.9dev' into openssl_location 2017-04-05 12:41:50 -04:00
Dirk
bfb0f4bc7d FIX #697 in 2.9dev (bash hiccup @ tolower) 2017-04-05 17:28:06 +02:00
Dirk
b1ce11d76e in addition to #694: using the predefined variable 2017-04-05 14:48:35 +02:00
Dirk
6b0f389225 fix #694 (CSP and HTTP header friends were cut off @ last colon)
introduced strip_leading_space() / strip_trailing_space()
2017-04-05 14:42:55 +02:00
David Cooper
2d73d06474 Merge branch '2.9dev' into openssl_location 2017-04-04 15:49:40 -04:00
Dirk
7549f10c79 added explanation for #692 2017-04-04 20:23:28 +02:00
David Cooper
1b4c1cc40c Update testssl.sh
This PR fixes two issues with HTML generation that were introduced by a commit on March 31, 2016, "[count_ciphers is now un-sed'ed, minor improvements](a480e5f699)."

The first is that in `std_cipherlists()`, `[[ $DEBUG -ge 1 ]] && outln " -- $1" || outln` was changed to `[[ $DEBUG -ge 1 ]] && outln " -- $1" || outln`. The result being that in the HTML output, all of the tests from `run_std_cipherlists()` appear on the same line. This PR changes the line to:
```
          [[ $DEBUG -ge 1 ]] && tm_out " -- $1"
          outln
``
so that the line break is added to the HTML output, but the debugging information is not.

The second problem is that the commit on March 31 moved the call in main to `html_header()` until after the calls to `get_install_dir()`, `find_openssl_binary()`, `mybanner()`, `check4openssl_oldfarts()`, and `check_bsd_mount()`. The problem is that each of these functions may call an output function that will call `html_out()`.

If `html_out()` is called before `html_header()` and the command line contains `--htmlfile <htmlfile>`, then "htmlfile" will be written to before `html_header()` is called and then `html_header()` will warn that "htmlfile" already exists and then exit the program.

If `html_out()` is called before `html_header()` and the command line contains `--html`, then anything send to `html_out()` before `html_header()` is called (such as the banner) will not appear in the HTML file.
2017-04-04 13:25:31 -04:00
David Cooper
1ca898190d Merge branch '2.9dev' into openssl_location 2017-04-04 08:54:18 -04:00
Dirk
8213e2436c addressed #691 for 2.9dev 2017-04-04 09:54:47 +02:00
David Cooper
a26a53ccef Merge branch '2.9dev' into openssl_location 2017-04-03 09:00:47 -04:00
Dirk
498dda94ce using get_san_dns_from_cert() 2017-04-01 10:38:04 +02:00
David Cooper
32418e39db Merge branch '2.9dev' into openssl_location 2017-03-31 12:02:22 -04:00
Dirk
6b601e22c7 adding Referrer-Policy header (FIX #604)
introduced get_san_dns_from_cert()

added two stub function get_session_ticket_lifetime_from_serverhello
2017-03-31 17:04:04 +02:00
David Cooper
e03d89107b Merge branch '2.9dev' into openssl_location 2017-03-31 09:36:26 -04:00
Dirk Wetter
75c794546d Merge pull request #689 from dcooper16/run_server_defaults_cleanup
Cleanup variable definitions in run_server_defaults()
2017-03-31 12:53:46 +02:00
Dirk
a480e5f699 count_ciphers is now un-sed'ed, minor improvements 2017-03-31 12:24:25 +02:00
David Cooper
9f93d9d578 Move insertion of commas to a separate file
Create a separate function to insert the comma separators between findings for different tests within mass testing.
2017-03-30 12:48:25 -04:00
David Cooper
d8a7037000 Add missing comma
I did some testing with http://jsonlint.com/ and discovered a missing comma when massing testing is being performed and a single JSON file is being created.
2017-03-30 12:37:41 -04:00
David Cooper
73a24cba27 Correct indentation in run_server_defaults()
This second commit doesn't make any changes to the code, it just corrects the indentation.
2017-03-30 10:27:08 -04:00
David Cooper
ba2a75b093 Cleanup variable definitions in run_server_defaults()
In `run_server_defaults()` the variable `success` is defined twice, once an an ordinary variable and once as an array. The PR removes the incorrect definition. It also removes the definitions of some variables that are no longer used and reorganizes the definitions so that each line has only one variable type.

I also noticed a typo later in `run_server_defaults()` and corrected it.
2017-03-30 10:08:26 -04:00
David Cooper
04f86f9469 Fix indentation of JSON pretty banner 2017-03-29 11:22:29 -04:00
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
Dirk
61b16a078a - file etc/common-primes was not edited correctly! 2017-01-18 16:38:09 +01:00
Dirk
8bf7b6b31b forgot to save work, followup to 4433345b16 , #120, #589 2017-01-18 16:23:18 +01:00
Dirk
4433345b16 - first implementation (draft) of LOGJAM common primes, see #589, #120
- output polishing of run_drown()
- polishing of run_logjam()
- decrease severity to high for LOGJAM, see CVE rating
2017-01-18 15:53:01 +01:00
David Cooper
643b80c541 Merge branch '2.9dev' into run_ssl_poodle_sockets 2017-01-17 09:07:21 -05:00
David Cooper
149c822f38 Merge branch '2.9dev' into run_beast_sockets 2017-01-17 09:05:52 -05:00
David Cooper
b8953fa31f Merge branch '2.9dev' into run_server_preference_sockets 2017-01-17 09:04:40 -05:00
David Cooper
76f1cb18d0 Merge branch '2.9dev' into cipher_order_sockets 2017-01-17 09:03:13 -05:00
Dirk
e9916dd1f4 - FIX #566
- reorder get_<DNS>_record() for better overview
- move CMDLINE__IP away from main into determine_ip_addresses() where it belongs to
2017-01-17 13:57:14 +01:00
Dirk
e7a35934ae add lf before -E 2017-01-17 12:00:18 +01:00
Dirk Wetter
5ea5ae5a53 Merge pull request #571 from dcooper16/run_freak_sockets
Use sockets for run_freak()
2017-01-17 11:41:50 +01:00
Dirk
a3a30c7fa5 - CAA RR (expertimental)
- replace some sed+grep by awk in get_mx_record()
2017-01-17 11:19:57 +01:00
Dirk
cdbdc51f5d fix #587 2017-01-16 14:06:32 +01:00
Dirk Wetter
350c2e09bb Merge pull request #576 from dcooper16/extend_logjam_phase_1
Extend logjam phase 1
2017-01-14 21:40:29 +01:00
Dirk Wetter
ad7eeddb96 Merge pull request #579 from dcooper16/run_crime_sockets
Use sockets for run_crime()
2017-01-14 13:18:22 +01:00
Dirk Wetter
354e0ed31a Merge pull request #585 from dcooper16/show_selected_curve
Show selected curve
2017-01-14 12:12:33 +01:00
David Cooper
c5dcaf476f Remove redundant setting to success to 0 2017-01-13 12:18:32 -05:00
David Cooper
91e0da3485 Detect support for encrypt-then-mac extension
In some cases, the "TLS extensions" line output for the "--server-defaults" option will not show `"encrypt-then-mac/#22"` even if the server supports this extension. The reason is that a server will only include this extension in the ServerHello message if it supports the extension and the selected cipher is a CBC cipher. So, if `determine_tls_extensions()` connects to the server with a non-CBC cipher, then it will not detect if the server supports the encrypt-then-mac extension.

It is possible that support for the extension will be detected by `get_server_certificate()`, but only if one of the calls to that function results in a CBC cipher being selected and OpenSSL 1.1.0 is being used (as prior versions did not support the encrypt-then-mac extension).

In this PR, if `determine_tls_extensions()` is called and `$TLS_EXTENSIONS` does not already contain `"encrypt-then-mac/#22"`, then an attempt will be made to connect to the server with only CBC ciphers specified in the ClientHello. If the connection is not successful (presumably because the server does not support any CBC ciphers), then a second connection attempt will be made with the "default" ciphers being specified in the ClientHello.

en.wikipedia.org is an example of a server that supports the encrypt-then-mac extension, but for which the support is not currently detected (unless OpenSSL 1.1.0 is used) since in the call to `determine_tls_extension()` a non-CBC cipher is selected.
2017-01-13 12:13:20 -05:00
David Cooper
42da64d601 Show selected curve
This PR changes `read_dhbits_from_file()` so that, when the "quiet" parameter is absent, the selected curve is shown in addition to the number of bits. This PR only affects the output of `run_client_simulation()` and the `Negotiated cipher` in `run_server_preference()`.
2017-01-13 10:28:48 -05:00
David Cooper
77dbe7ed1b Merge branch '2.9dev' into run_crime_sockets 2017-01-13 09:09:04 -05:00
David Cooper
859ea0c7d3 Merge branch '2.9dev' into run_freak_sockets 2017-01-13 09:08:02 -05:00
David Cooper
eabaa95163 Merge branch '2.9dev' into extend_logjam_phase_1 2017-01-13 09:07:12 -05:00
David Cooper
545a4543bc Merge branch '2.9dev' into run_ssl_poodle_sockets 2017-01-13 09:06:04 -05:00
David Cooper
e2dca3e845 Merge branch '2.9dev' into run_beast_sockets 2017-01-13 09:05:02 -05:00
David Cooper
1169e3daef Merge branch '2.9dev' into run_server_preference_sockets 2017-01-13 09:04:10 -05:00
David Cooper
43d495aa65 Merge branch '2.9dev' into cipher_order_sockets 2017-01-13 09:03:00 -05:00
Dirk Wetter
436326a547 Merge pull request #573 from dcooper16/run_std_cipherlists_sockets
Use sockets for run_std_cipherlists()
2017-01-13 14:44:43 +01:00
David Cooper
1a705f900f run_client_simulation() bugfix
There are two places in `run_client_simulation()` in which `$OPENSSL s_client` is called, after which there is a `debugme echo` line to display the `$OPENSSL s_client` command line when testssl.sh is being run in debug mode, and then `sclient_connect_successful $? $TMPFILE` is called to determine whether `$OPENSSL s_client` successfully established a connection.

So, `sclient_connect_successful()` is being passed the result of the `debugme()` call, which always returns 0, rather than the result of the `$OPENSSL s_client` call.

This PR fixes the problem by moving the `debugme()` line to before the call to `$OPENSSL s_client`, so that  `sclient_connect_successful()` is passed the results of the `$OPENSSL s_client` call.
2017-01-12 14:59:29 -05:00
David Cooper
c9119dd8ee Use static lists for sockets 2017-01-12 13:09:11 -05:00
David Cooper
92d1daa976 Merge branch '2.9dev' into run_crime_sockets 2017-01-09 09:06:10 -05:00
David Cooper
d011803ae8 Merge branch '2.9dev' into run_std_cipherlists_sockets 2017-01-09 09:03:18 -05:00
David Cooper
be7bb01815 Merge branch '2.9dev' into run_freak_sockets 2017-01-09 09:02:23 -05:00
David Cooper
c8d04d7bab Merge branch '2.9dev' into extend_logjam_phase_1
Conflicts:
	testssl.sh
2017-01-09 09:01:31 -05:00
David Cooper
cb362f6082 Merge branch '2.9dev' into run_ssl_poodle_sockets 2017-01-09 08:54:20 -05:00
David Cooper
d1238f201e Merge branch '2.9dev' into run_beast_sockets 2017-01-09 08:53:24 -05:00
David Cooper
cc4ab5cdec Merge branch '2.9dev' into run_server_preference_sockets 2017-01-09 08:52:26 -05:00
David Cooper
85afbbd6ed Merge branch '2.9dev' into cipher_order_sockets 2017-01-09 08:51:10 -05:00
Dirk Wetter
33ca94f6e8 Merge pull request #577 from dcooper16/run_server_defaults_bugfix
run_server_defaults() bugfix
2017-01-08 15:59:45 +01:00
Dirk Wetter
b99371c069 Merge pull request #578 from dcooper16/fix_sslv2_sockets
sslv2_sockets() bug fixes
2017-01-08 15:58:01 +01:00
David Cooper
95c75f1792 Add support for OpenSSL 1.1.0
Starting with OpenSSL 1.1.0, s_client will not offer TLS compression methods, even if OpenSSL is compiled with zlib support, unless the `-comp` flag is included in the command line.
2017-01-05 15:45:18 -05:00
David Cooper
ab9eb6044e Use sockets for run_crime()
This PR changes `run_crime()` to use `tls_sockets()` rather than failing if `$OPENSSL` lacks zlib support, unless `$SSL_NATIVE` is `true`.

At the moment, the ClientHello created by `socksend_tls_clienthello()` only specifies the NULL compression method. So, this PR adds a new parameter to `socksend_tls_clienthello()` and `tls_sockets()` to allow to caller to request that additional compression methods (DEFLATE and LZS) be specified in the ClientHello.

This PR makes another change to `run_crime()`. At the moment, if `$OPENSSL s_client` fails to connect to the server, `run_crime()` will report that the server is not vulnerable, since the output from `$OPENSSL s_client` includes the line "Compression: NONE" (see below). This PR changes that by checking whether the connection was successful, and reporting a "test failed (couldn't connect)" warning if it wasn't successful, rather than reporting "not vulnerable (OK)".

```
CONNECTED(00000003)
140338777061024:error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version:s23_clnt.c:769:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 7 bytes and written 389 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1
    Cipher    : 0000
    Session-ID: 
    Session-ID-ctx: 
    Master-Key: 
    Key-Arg   : None
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    Start Time: 1483645971
    Timeout   : 300 (sec)
    Verify return code: 0 (ok)
---
```
2017-01-05 14:55:08 -05:00
Todd Swatling
557c15607a detects install dir when symlinked and realpath not present
$ ls -l /usr/local/bin/testssl
lrwxrwxrwx /usr/local/bin/testssl -> /home/user/testssl.sh/testssl.sh
2017-01-05 14:45:39 -05:00
Todd Swatling
70e6e289e1 removed trailing spaces 2017-01-05 14:20:19 -05:00
David Cooper
d66e5ec0d7 sslv2_sockets() bug fixes
This PR fixes a few bugs in `sslv2_sockets()`. The main issue is that a server may not send the entire ServerHello in a single packet. If it doesn't and the full response is being parsed (i.e., certificate and list of ciphers), then `parse_sslv2_serverhello()` will encounter errors, since it assumes that it has the entire ServerHello. This PR compares the length of the response to the length of the ServerHello as specified in the first two bytes of the response and requests more data from the server if the response appears incomplete.

This PR also modifies `parse_sslv2_serverhello()` to check for more errors. It compares the length of the response it has been provided to the specified length (`$v2_hello_length`) and returns an error if the response is shorter than `$v2_hello_length` and the full response is supposed to be parsed. It will also check whether there was an error in converting the certificate from DER to PEM format and will return an error if there was (and it will suppress the error message).
2017-01-04 10:47:36 -05:00
David Cooper
c1d072b7a8 Check for matching SSLv2 cipher
Some servers respond to an SSLv2 ClientHello with a list of all SSLv2 ciphers that the server supports rather than just a list of ciphers that it supports in common with the client (i.e., that appear in the ClientHello). This PR changes the sockets version of `std_cipherlists()` so that, if `sslv2_sockets()` is successful, it checks whether there are any ciphers in common between the ClientHello and the ServerHello before declaring that the server supports the specified cipher list.
2017-01-04 10:34:13 -05:00
David Cooper
5270747eb0 Check for matching SSLv2 cipher
Some servers respond to an SSLv2 ClientHello with a list of all SSLv2 ciphers that the server supports rather than just a list of ciphers that it supports in common with the client (i.e., that appear in the ClientHello). This PR changes the sockets version of `run_freak()` so that, if `sslv2_sockets()` is successful, it checks whether there are any ciphers in common between the ClientHello and the ServerHello before declaring that the server supports an export RSA cipher.
2017-01-04 10:31:13 -05:00
David Cooper
ad5590a444 run_server_defaults() bugfix
If `determine_tls_extensions()` does not create a temporary file (`$TEMPDIR/$NODEIP.determine_tls_extensions.txt`) then `run_server_defaults()` will display error messages when an attempt is made to copy this file or to search (grep) it. This may happen if `$OPTIMAL_PROTO` is `-ssl2` or if `determine_tls_extensions()` uses sockets and `parse_tls_serverhello()` encountered an error and did not create a temporary file (`$TEMPDIR/$NODEIP.parse_tls_serverhello.txt`). This PR fixes this by only trying to copy and search `$TEMPDIR/$NODEIP.determine_tls_extensions.txt` is `$OPTIMAL_PROTO` is not `-ssl2` and `determine_tls_extensions()` was successful (return value 0).
2017-01-04 10:19:11 -05:00
David Cooper
83472301bc Don't "echo" the prime to the terminal 2016-12-30 11:33:27 -05:00
David Cooper
62aee8f846 Remove leading "00" byte from prime, if present
The primes in https://svn.nmap.org/nmap/scripts/ssl-dh-params.nse do not include a leading "00" byte, so don't include it in `$dh_p`.
2016-12-30 11:32:41 -05:00
David Cooper
c0c041b1c2 Merge branch '2.9dev' into run_std_cipherlists_sockets 2016-12-29 16:59:58 -05:00
David Cooper
5e5199ddb5 Merge branch '2.9dev' into run_freak_sockets 2016-12-29 16:58:22 -05:00
David Cooper
3b54ac398e Merge branch '2.9dev' into run_ssl_poodle_sockets 2016-12-29 16:57:31 -05:00
David Cooper
99290ea1a5 Merge branch '2.9dev' into run_beast_sockets 2016-12-29 16:56:08 -05:00
David Cooper
a094acc155 Merge branch '2.9dev' into run_server_preference_sockets 2016-12-29 16:54:05 -05:00
David Cooper
7116d1bbdf Merge branch '2.9dev' into cipher_order_sockets 2016-12-29 16:52:50 -05:00
David Cooper
b7ff8a1ee3 Add extra check 2016-12-29 16:45:46 -05:00
David Cooper
e931ebf6b4 Merge branch '2.9dev' into extend_logjam_phase_1 2016-12-29 16:43:44 -05:00
Dirk Wetter
e8e60e368f Merge pull request #568 from dcooper16/test_just_one_sockets
test_just_one() sockets
2016-12-29 22:38:35 +01:00
David Cooper
ec3a644c4d Common primes test phase 1
In response to your request in #572, this PR provides a starting point for addressing #120. It adds code to `run_logjam()` to try connecting to the server using any cipher that uses an ephemeral DH key. If successful, it gets the server's ephemeral key (in OpenSSL's PEM format) and then extracts the prime from the key and places it in `$dh_p`. So, all that needs to be done at this point is to compare `$dh_p` against a set of "bad" primes. I'm not sure if I'll be able to work on that part soon, so if someone else has the time, that would be great.

I actually found the `-msg` option easy to use. I moved the code in `parse_tls_serverhello()` that extracts the DH ephemeral public key from the ServerKeyExchange message into a separate function. Then, if using OpenSSL with the `-msg` option, I extract the ServerKeyExchange message from `$TMPFILE` and call this new function to extract the key and convert it to PEM format. That way the new code in `run_logjam()` can use either `$OPENSSL` or `tls_sockets()`.
2016-12-29 16:31:42 -05:00
Dirk Wetter
5627211add Merge pull request #556 from dcooper16/run_pfs_sockets
run_pfs() speedup + sockets
2016-12-29 22:18:28 +01:00
Dirk
c3b300c5fb - cleanup ignore_no_or_lame()
- reorder get_install_dir in main() so that warnings are not displayed before --help
- tweak missing ~/etc msg
2016-12-29 22:02:07 +01:00
David Cooper
3884f30821 Merge branch '2.9dev' into run_std_cipherlists_sockets 2016-12-29 11:58:38 -05:00
David Cooper
912db2fc95 Merge branch '2.9dev' into run_freak_sockets 2016-12-29 11:57:43 -05:00
David Cooper
f0f3918b0f Merge branch '2.9dev' into run_ssl_poodle_sockets 2016-12-29 11:56:43 -05:00
David Cooper
9513ed4d99 Merge branch '2.9dev' into test_just_one_sockets 2016-12-29 11:55:52 -05:00
David Cooper
de61f0cbf3 Merge branch '2.9dev' into run_beast_sockets 2016-12-29 11:55:01 -05:00
David Cooper
2350eaa9f5 Merge branch '2.9dev' into run_server_preference_sockets 2016-12-29 11:54:00 -05:00
David Cooper
e18b5a4709 Merge branch '2.9dev' into run_pfs_sockets 2016-12-29 11:52:29 -05:00
David Cooper
802af274d9 Merge branch '2.9dev' into cipher_order_sockets 2016-12-29 11:51:15 -05:00
Dirk Wetter
b8e1ede08c Merge pull request #572 from dcooper16/run_logjam_sockets
Use sockets for run_logjam()
2016-12-29 15:38:54 +01:00
Dirk
c3671928ae fix for 83d2a63 2016-12-29 00:09:44 +01:00
Dirk
83d2a63e0f - Stronger warning if ~/etc is missing, also requires more explicit consent to continue
- fix lfs for -e -E if openssl has not DH/ECDH
- further minor output corrections
2016-12-28 23:47:35 +01:00
David Cooper
88f4c77078 Merge branch '2.9dev' into run_std_cipherlists_sockets 2016-12-28 11:27:22 -05:00
David Cooper
324a78a47d Merge branch '2.9dev' into run_logjam_sockets 2016-12-28 11:26:20 -05:00
David Cooper
6ed620d740 Merge branch '2.9dev' into run_freak_sockets 2016-12-28 11:25:26 -05:00
David Cooper
322703d39f Merge branch '2.9dev' into run_ssl_poodle_sockets 2016-12-28 11:24:44 -05:00
David Cooper
44c766b993 Merge branch '2.9dev' into test_just_one_sockets 2016-12-28 11:23:54 -05:00
David Cooper
88658f8b89 Merge branch '2.9dev' into run_beast_sockets 2016-12-28 11:23:05 -05:00
David Cooper
1b70bc5994 Merge branch '2.9dev' into run_server_preference_sockets 2016-12-28 11:22:18 -05:00
David Cooper
da217f2136 Merge branch '2.9dev' into run_pfs_sockets 2016-12-28 11:21:30 -05:00
David Cooper
ccebf47f56 Merge branch '2.9dev' into cipher_order_sockets 2016-12-28 11:19:32 -05:00
David Cooper
fd2e52c396 Minor bug fixes in run_protocols()
In a few places `run_protocols()` specifies the wrong TLS version as the "ID" when calling `fileout()`.
2016-12-27 14:14:20 -05:00
David Cooper
fddc8a012e Merge branch '2.9dev' into run_std_cipherlists_sockets 2016-12-23 14:32:08 -05:00
David Cooper
b88cc4af71 Merge branch '2.9dev' into run_logjam_sockets 2016-12-23 14:31:13 -05:00
David Cooper
2bdc63e47d Merge branch '2.9dev' into run_freak_sockets 2016-12-23 14:28:18 -05:00
David Cooper
6084968b7a Merge branch '2.9dev' into run_ssl_poodle_sockets 2016-12-23 14:27:18 -05:00
David Cooper
3050a4c1fc Merge branch '2.9dev' into test_just_one_sockets 2016-12-23 14:25:23 -05:00
David Cooper
ba2f07bc0b Merge branch '2.9dev' into run_beast_sockets 2016-12-23 14:24:14 -05:00
David Cooper
64bd786daf Merge branch '2.9dev' into run_server_preference_sockets 2016-12-23 14:22:47 -05:00
David Cooper
48f33fff5a Merge branch '2.9dev' into run_pfs_sockets 2016-12-23 14:21:23 -05:00
David Cooper
fba1793c5a Merge branch '2.9dev' into cipher_order_sockets 2016-12-23 14:20:16 -05:00
David Cooper
dc98371ed0 Use sockets for run_http2()
This PR changes `run_http2()` so that it uses `tls_sockets()` rather than failing, if `$OPENSSL` does not support the `-alpn` option. If `$OPENSSL` supports the `-alpn` option (or if `$SSL_NATIVE` is true), then this PR has no effect.
2016-12-23 11:02:31 -05:00
David Cooper
90812a2732 Use sockets for run_std_cipherlists()
This PR change `run_std_cipherlists()` to use sockets. As noted in isse #554, I have some questions about the definitions of the cipher lists, but I wrote the code so that the ciphers that are tested when using sockets are the same as those that are tested when using OpenSSL. For a few of the cipherlists, the sockets version tests a few additional ciphers; but these are ciphers that are not supported by OpenSSL, and whose definitions are consistent with the ciphers that OpenSSL includes.

As written, `std_cipherlists` will use sockets for testing by default, except in two cases:
* If the `$SSL_NATIVE` is true, then only OpenSSL is used, and if OpenSSL doesn't support any ciphers in the cipherlist, then the test is skipped.
* If `$FAST` is true (but `$SSL_NATIVE` is false), then OpenSSL is used whenever it supports at least one cipher from the cipherlist, and `tls_sockets()` (or `sslv2_sockets()`) is only used when OpenSSL doesn't support any ciphers from the cipherlist.
2016-12-22 15:46:01 -05:00
David Cooper
0d75bae195 Use sockets for run_logjam()
This PR changes `run_logjam()` to use sockets.
2016-12-21 14:55:01 -05:00
David Cooper
815e21e9b5 Use sockets for run_freak()
This PR changes `run_freak()` to use sockets.

I added two ciphers to `$exportrsa_cipher_list`: EXP1024-RC4-MD5 (0x00,0x60) and EXP1024-RC2-CBC-MD5 (0x00,0x61). So, the list is now as follows:
```
      0x00,0x62 - EXP1024-DES-CBC-SHA            TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA                SSLv3      Kx=RSA(1024)   Au=RSA     Enc=DES(56)                    Mac=SHA1     export    
      0x00,0x61 - EXP1024-RC2-CBC-MD5            TLS_RSA_EXPORT1024_WITH_RC2_56_MD5                 SSLv3      Kx=RSA(1024)   Au=RSA     Enc=RC2(56)                    Mac=MD5      export    
      0x00,0x64 - EXP1024-RC4-SHA                TLS_RSA_EXPORT1024_WITH_RC4_56_SHA                 SSLv3      Kx=RSA(1024)   Au=RSA     Enc=RC4(56)                    Mac=SHA1     export    
      0x00,0x60 - EXP1024-RC4-MD5                TLS_RSA_EXPORT1024_WITH_RC4_56_MD5                 SSLv3      Kx=RSA(1024)   Au=RSA     Enc=RC4(56)                    Mac=MD5      export    
      0x00,0x14 - EXP-EDH-RSA-DES-CBC-SHA        TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA              SSLv3      Kx=DH(512)     Au=RSA     Enc=DES(40)                    Mac=SHA1     export    
      0x00,0x08 - EXP-DES-CBC-SHA                TLS_RSA_EXPORT_WITH_DES40_CBC_SHA                  SSLv3      Kx=RSA(512)    Au=RSA     Enc=DES(40)                    Mac=SHA1     export    
      0x00,0x06 - EXP-RC2-CBC-MD5                TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5                 SSLv3      Kx=RSA(512)    Au=RSA     Enc=RC2(40)                    Mac=MD5      export    
 0x04,0x00,0x80 - EXP-RC2-CBC-MD5                SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5               SSLv2      Kx=RSA(512)    Au=RSA     Enc=RC2(40)                    Mac=MD5      export    
      0x00,0x0E - EXP-DH-RSA-DES-CBC-SHA         TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA               SSLv3      Kx=DH/RSA      Au=DH      Enc=DES(40)                    Mac=SHA1     export    
      0x00,0x03 - EXP-RC4-MD5                    TLS_RSA_EXPORT_WITH_RC4_40_MD5                     SSLv3      Kx=RSA(512)    Au=RSA     Enc=RC4(40)                    Mac=MD5      export    
 0x02,0x00,0x80 - EXP-RC4-MD5                    SSL_CK_RC4_128_EXPORT40_WITH_MD5                   SSLv2      Kx=RSA(512)    Au=RSA     Enc=RC4(40)                    Mac=MD5      export
```
2016-12-21 13:16:10 -05:00
David Cooper
f450bc66cd Use sockets for run_ssl_poodle()
This PR changes `run_ssl_poodle()` to use sockets. This PR is particularly useful when $OPENSSL is OpenSSL 1.1.0, since OpenSS 1.1.0 does not support SSLv3 by default. But, it is also useful if $OPENSSL supports some, but not all, of the CBC ciphers.

As with `run_beast()`, there is a small change to `$cbc_cipher_list`. The following two ciphers were added:
```
          0x00,0x0B - EXP-DH-DSS-DES-CBC-SHA  SSLv3 Kx=DH/DSS   Au=DH   Enc=DES(40)   Mac=SHA1 export
          0x00,0x0E - EXP-DH-RSA-DES-CBC-SHA  SSLv3 Kx=DH/RSA   Au=DH   Enc=DES(40)   Mac=SHA1 export
```
The ciphers that were removed are all SSLv2 ciphers:
```
     0x07,0x00,0xC0 - DES-CBC3-MD5            SSLv2 Kx=RSA      Au=RSA  Enc=3DES(168) Mac=MD5 
     0x06,0x00,0x40 - DES-CBC-MD5             SSLv2 Kx=RSA      Au=RSA  Enc=DES(56)   Mac=MD5 
     0x04,0x00,0x80 - EXP-RC2-CBC-MD5         SSLv2 Kx=RSA(512) Au=RSA  Enc=RC2(40)   Mac=MD5  export
     0x05,0x00,0x80 - IDEA-CBC-MD5            SSLv2 Kx=RSA      Au=RSA  Enc=IDEA(128) Mac=MD5 
     0x03,0x00,0x80 - RC2-CBC-MD5             SSLv2 Kx=RSA      Au=RSA  Enc=RC2(128)  Mac=MD5
```
(EXP-RC2-CBC-MD5 is both an SSLv2 and an SSLv3 cipher. Previously it was listed twice in `$cbc_cipher_list`, now it appears once.)
2016-12-21 10:36:09 -05:00
David Cooper
b04bb8d82a Merge branch '2.9dev' into test_just_one_sockets 2016-12-21 09:07:13 -05:00
David Cooper
09aad7489d Merge branch '2.9dev' into run_beast_sockets 2016-12-21 09:06:21 -05:00
David Cooper
a387566fb7 Merge branch '2.9dev' into run_server_preference_sockets 2016-12-21 09:05:17 -05:00
David Cooper
eaf5671b17 Merge branch '2.9dev' into run_pfs_sockets
Conflicts:
	testssl.sh
2016-12-21 09:04:11 -05:00
David Cooper
9d44bb6abd Merge branch '2.9dev' into cipher_order_sockets 2016-12-21 09:01:47 -05:00
Dirk Wetter
7a4c6294ac Merge pull request #567 from dcooper16/run_rc4_e
Mark export ciphers in run_rc4()
2016-12-21 12:56:26 +01:00
David Cooper
378f4439a3 testssl.sh hangs on local testing
In a few places testssl.sh tries to determine $OPENSSL s_client's capabilities by calling `$OPENSSL s_client` without specifying a host to which to connect. For example:
```
$OPENSSL s_client -no_ssl2 2>&1
```
This idea is that `$OPENSSL s_client` should reveal something about its capabilities without actually trying to connect to a host.

This works in most cases. However, the manual pages for s_client states:
```
-connect host:port
    This specifies the host and optional port to connect to. If not specified then an attempt is made to connect to the local host on port 4433.
```
So, the above call is actually trying to connect to the local host on port 4433. If the local host is running `$OPENSSL s_server`, then `$OPENSSL s_server` will by default be listening on port 4433, and the connection attempt will most likely succeed. Since the `OPENSSL s_client` command does not include a `< /dev/null`, the `OPENSSL s_client` will just hang waiting for additional input.

Adding `-connect x` to the `$OPENSSL s_client` prevents $OPENSSL from trying to connect to a host, but seems to still provide the necessary information about OpenSSL's capabilities.
2016-12-20 14:02:29 -05:00
David Cooper
4af01a6c1b test_just_one() sockets
This PR implements `test_just_one()` in a similar manner to `run_allciphers()`
2016-12-20 13:14:40 -05:00
David Cooper
1a7d1f73d2 Mark export ciphers in run_rc4()
This PR adds ",exp" to the bits column when `run_rc4()` is run in the "--wide" mode and the cipher is an export cipher. This makes the wide mode of `run_rc4()` align with other functions, such as `run_allciphers()`.
2016-12-20 13:11:03 -05:00
David Cooper
cfaeb51395 Show "exp" bits column for export ciphers 2016-12-20 12:59:26 -05:00
David Cooper
8a26186862 Merge branch '2.9dev' into run_server_preference_sockets 2016-12-20 08:52:10 -05:00
David Cooper
9f8aff5758 Merge branch '2.9dev' into run_pfs_sockets 2016-12-20 08:50:59 -05:00
David Cooper
5b52e81c20 Merge branch '2.9dev' into run_beast_sockets 2016-12-20 08:50:09 -05:00
David Cooper
8c33562ba7 Merge branch '2.9dev' into cipher_order_sockets 2016-12-20 08:49:10 -05:00
Dirk
ea7edaf59f - unify timeout msgs on the console 2016-12-20 14:17:14 +01:00
David Cooper
dd5487b213 Ensure cipher[i]="" in SSLv3 test 2016-12-19 17:06:45 -05:00
David Cooper
6492954735 Fix alignment 2016-12-19 16:59:27 -05:00
David Cooper
b1d231ff85 Use sockets in run_server_preference()
This PR adds the use of sockets to `run_server_preference()` to determine the "Negotiated cipher per proto." It only uses sockets in two cases:
* For SSLv2, if $OPENSSL does not support SSLv2.
* For SSLv2, if $OPENSSL does not support SSLv3.

This PR will have no effect if the provided OpenSSL binaries are used.
2016-12-19 16:56:12 -05:00
David Cooper
2db0894ae6 Merge branch '2.9dev' into run_pfs_sockets 2016-12-19 09:09:45 -05:00
David Cooper
fbf40474a9 Merge branch '2.9dev' into run_beast_sockets 2016-12-19 09:08:26 -05:00
David Cooper
f553e72dd4 Merge branch '2.9dev' into cipher_order_sockets 2016-12-19 09:07:03 -05:00
Dirk Wetter
8e9a8faca4 Merge pull request #541 from dcooper16/run_cipher_per_proto_sockets
run_cipher_per_proto() speedup + sockets
2016-12-17 12:17:45 +01:00
David Cooper
7fa6455b83 Fix typo 2016-12-16 11:30:34 -05:00
David Cooper
412fea2c38 Fix alignment problem in test_just_one()
When `test_just_one()` uses `neat_list()` with a cipher that is not available and that uses DH for key exchange, the columns do not line up correctly. `test_just_one()` adds "TBD" in gray to "DH", and while `neat_list()` tries to adjust for the presence of color codes, it doesn't seem to correctly handle the gray color code here.

Rather than try to fix this in `neat_list()`, I propose to just remove the "TBD". Adding it is inconsistent with other functions (like `run_allciphers()`), and it seems inappropriate, since there is nothing "to be determined," as the cipher suite isn't supported by the server.

If adding "TBD" were appropriate anywhere, it would seem to be in cases in which the server does support the cipher, but the number of bits in the ephemeral key couldn't be determined because the version of OpenSSL being used can't show DH/ECDH bits. (Not that I'm proposing this. I think the one-line warning, "(Your $OPENSSL cannot show DH/ECDH bits)", is enough.

Here is an example of `test_just_one()` with some ciphers not supported by the server that use DH key exchange:

```
 Testing single cipher with word pattern "CAMELLIA" (ignore case) 

Hexcode  Cipher Suite Name (OpenSSL)       KeyExch.  Encryption Bits     Cipher Suite Name (RFC)
---------------------------------------------------------------------------------------------------------------------------
 xc077   ECDHE-RSA-CAMELLIA256-SHA384      ECDH TBD   Camellia  256      TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384           not a/v
 xc073   ECDHE-ECDSA-CAMELLIA256-SHA384    ECDH TBD   Camellia  256      TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384         not a/v
 xc4     DHE-RSA-CAMELLIA256-SHA256        DH TBD   Camellia  256      TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256             not a/v
 xc3     DHE-DSS-CAMELLIA256-SHA256        DH TBD   Camellia  256      TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256             not a/v
 xc2     DH-RSA-CAMELLIA256-SHA256         DH/RSA     Camellia  256      TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256              not a/v
 xc1     DH-DSS-CAMELLIA256-SHA256         DH/DSS     Camellia  256      TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256              not a/v
 x88     DHE-RSA-CAMELLIA256-SHA           DH 2048    Camellia  256      TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA                available
 x87     DHE-DSS-CAMELLIA256-SHA           DH TBD   Camellia  256      TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA                not a/v
 x86     DH-RSA-CAMELLIA256-SHA            DH/RSA     Camellia  256      TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA                 not a/v
 x85     DH-DSS-CAMELLIA256-SHA            DH/DSS     Camellia  256      TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA                 not a/v
 xc5     ADH-CAMELLIA256-SHA256            DH TBD   Camellia  256      TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA256             not a/v
 x89     ADH-CAMELLIA256-SHA               DH TBD   Camellia  256      TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA                not a/v
 xc079   ECDH-RSA-CAMELLIA256-SHA384       ECDH/RSA   Camellia  256      TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384            not a/v
 xc075   ECDH-ECDSA-CAMELLIA256-SHA384     ECDH/ECDSA Camellia  256      TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384          not a/v
 xc0     CAMELLIA256-SHA256                RSA        Camellia  256      TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256                 not a/v
 x84     CAMELLIA256-SHA                   RSA        Camellia  256      TLS_RSA_WITH_CAMELLIA_256_CBC_SHA                    not a/v
 xc076   ECDHE-RSA-CAMELLIA128-SHA256      ECDH TBD   Camellia  128      TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256           not a/v
 xc072   ECDHE-ECDSA-CAMELLIA128-SHA256    ECDH TBD   Camellia  128      TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256         not a/v
 xbe     DHE-RSA-CAMELLIA128-SHA256        DH TBD   Camellia  128      TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256             not a/v
 xbd     DHE-DSS-CAMELLIA128-SHA256        DH TBD   Camellia  128      TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256             not a/v
 xbc     DH-RSA-CAMELLIA128-SHA256         DH/RSA     Camellia  128      TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256              not a/v
 xbb     DH-DSS-CAMELLIA128-SHA256         DH/DSS     Camellia  128      TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256              not a/v
 x45     DHE-RSA-CAMELLIA128-SHA           DH 2048    Camellia  128      TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA                available
 x44     DHE-DSS-CAMELLIA128-SHA           DH TBD   Camellia  128      TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA                not a/v
 x43     DH-RSA-CAMELLIA128-SHA            DH/RSA     Camellia  128      TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA                 not a/v
 x42     DH-DSS-CAMELLIA128-SHA            DH/DSS     Camellia  128      TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA                 not a/v
 xbf     ADH-CAMELLIA128-SHA256            DH TBD   Camellia  128      TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA256             not a/v
 x46     ADH-CAMELLIA128-SHA               DH TBD   Camellia  128      TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA                not a/v
 xc078   ECDH-RSA-CAMELLIA128-SHA256       ECDH/RSA   Camellia  128      TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256            not a/v
 xc074   ECDH-ECDSA-CAMELLIA128-SHA256     ECDH/ECDSA Camellia  128      TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256          not a/v
 xba     CAMELLIA128-SHA256                RSA        Camellia  128      TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256                 not a/v
 x41     CAMELLIA128-SHA                   RSA        Camellia  128      TLS_RSA_WITH_CAMELLIA_128_CBC_SHA                    not a/v
```
2016-12-16 10:15:05 -05:00
David Cooper
8b6b308b30 Merge branch '2.9dev' into run_pfs_sockets 2016-12-14 16:10:27 -05:00
David Cooper
b4632962e9 Merge branch '2.9dev' into run_beast_sockets 2016-12-14 16:09:35 -05:00
David Cooper
90c946a931 Merge branch '2.9dev' into cipher_order_sockets 2016-12-14 16:08:41 -05:00
David Cooper
87d4063abf Merge branch '2.9dev' into run_cipher_per_proto_sockets 2016-12-14 16:07:42 -05:00
AlGreed
ee74fe0b25 Merge branch 'drwetter/2.9dev' into 2.9dev 2016-12-14 20:59:13 +01:00
AlGreed
8d285a8696 reverted color=0 for json and csv formats; rewrote strip_quote to cross platform variant. 2016-12-14 20:55:17 +01:00
AlGreed
520966f776 color=0 for json and csv formats to avoid escape characters in a report 2016-12-14 12:09:23 +01:00
David Cooper
276731082f Merge branch '2.9dev' into run_pfs_sockets 2016-12-13 08:44:59 -05:00
David Cooper
a3158be963 Merge branch '2.9dev' into ec_curve_strengths 2016-12-13 08:44:07 -05:00
David Cooper
0d51901385 Merge branch '2.9dev' into run_beast_sockets 2016-12-13 08:43:11 -05:00
David Cooper
b7c566fb24 Merge branch '2.9dev' into cipher_order_sockets 2016-12-13 08:42:06 -05:00
David Cooper
6b1b25a4b1 Merge branch '2.9dev' into run_cipher_per_proto_sockets 2016-12-13 08:40:47 -05:00
Dirk
f30dab9e2f cosmetic improvement to #551 2016-12-13 12:38:20 +01:00
Dirk Wetter
7f3b1de737 Merge pull request #551 from dcooper16/parse_sslv2_fix
Don't parse SSLv2 ServerHello unless successful response
2016-12-13 12:28:26 +01:00
Dirk Wetter
156af69dc2 Merge pull request #560 from sdann/2.9dev
Add support for testing postgres protocol over TLS/SSL
2016-12-13 08:53:30 +01:00
Steven Danneman
461f956603 Add support for testing postgres protocol over TLS/SSL
The Postgres protocol uses STARTTLS with a custom start packet. This
functionality is supported by openssl s_client in the current openssl
master branch but not yet in any released version.

This patch detects whether the given openssl binary supports postgres
and runs the default tests against a postgres server.

Example of no openssl support:

    ~/bin/testssl$ ./testssl.sh --quiet
    --openssl=/opt/openssl/openssl-1.1.0c/bin/openssl --starttls=postgres
    test.postgres.server.com:5432

     Start 2016-12-07 18:03:24    -->> ip.add.re.ss:5432
    (test.postgres.server.com:5432) <<--

    Fatal error: Your /opt/openssl/openssl-1.1.0c/bin/openssl does not
    support the "-starttls postgres" option

Example of openssl support:

    ~/bin/testssl$ ./testssl.sh --quiet
    --openssl=/opt/openssl/openssl-2016-12-07/bin/openssl --startt ls=postgres
    test.postgres.server.com:5432

     Start 2016-12-07 18:06:03    -->> ip.add.re.ss:5432
    (test.postgres.server.com:5432) <<--

     Service set:            STARTTLS via POSTGRES

     Testing protocols (via openssl, SSLv2 via sockets)

     SSLv2               not offered (OK)
     SSLv3               offered (NOT ok)
     TLS 1               offered
     TLS 1.1             offered
     TLS 1.2             offered (OK)
     SPDY/NPN            (SPDY is an HTTP protocol and thus not tested here)
     HTTP2/ALPN          (HTTP/2 is a HTTP protocol and thus not tested
    here)
    ...
2016-12-12 12:05:11 -08:00
David Cooper
953d02b61c Merge branch '2.9dev' into run_pfs_sockets 2016-12-12 09:49:05 -05:00
David Cooper
78813ee707 Merge branch '2.9dev' into ec_curve_strengths 2016-12-12 09:47:58 -05:00
David Cooper
e0d4b3a7da Merge branch '2.9dev' into run_beast_sockets 2016-12-12 09:46:30 -05:00
David Cooper
2a9668c000 Updated based on @typingArtist's suggesting 2016-12-12 09:38:20 -05:00
David Cooper
55436eec68 Merge branch '2.9dev' into parse_sslv2_fix 2016-12-12 09:25:45 -05:00
David Cooper
f243803d77 Merge branch '2.9dev' into cipher_order_sockets 2016-12-12 09:24:29 -05:00
David Cooper
3deaa0b167 Merge branch '2.9dev' into run_cipher_per_proto_sockets 2016-12-12 09:22:48 -05:00
Dirk
d14b24e832 regression fix #290, see #549 2016-12-11 18:15:36 +01:00
Dirk Wetter
6380121acc Merge pull request #542 from dcooper16/run_rc4_sockets
run_rc4() sockets implementation
2016-12-10 23:49:08 +01:00
David Cooper
97652e64e0 run_pfs() speedup + sockets
This PR implements `run_pfs()` in a manner similar to `run_allciphers()`. It uses OpenSSL followed by `tls_sockets()` to test for both supported PFS cipher suites as well as elliptic curves offered.

I made an attempt at addressing #548 by using different colors to print the different curve names, depending on strength. The colors chosen are exactly the same as those that would be chosen by `read_dhbits_from_file()`:
```
     # bits <= 163:       pr_svrty_medium
     163 < # bits <= 193: pr_svrty_minor
     193 < # bits <= 224: out
     # bits > 224:        pr_done_good
```

I also added code for #464 to create a list of the DH groups from RFC 7919 that a server supports. However, since no servers seem to support this at the moment (except with TLS 1.3), I marked this code to only run if the $EXPERIMENTAL flag is set.
2016-12-08 12:36:45 -05:00
David Cooper
6d93bff835 Align elliptic curve lengths with OpenSSL
For several elliptic curves the number of bits, as indicated by OpenSSL, is slightly different than the name implies. For example, for sect239k1 OpenSSL outputs: `Server Temp Key: ECDH, sect239k1, 238 bits`.

This PR aligns the output created by `parse_tls_serverhello()` with OpenSSL.
2016-12-08 10:19:57 -05:00
David Cooper
bceca2a89e Fix bug in reading of cipher mapping file
When the cipher-mapping.txt file is read, the contents of the "Mac=..." column is placed in `TLS_CIPHER_EXPORT` rather than the contents of the "export" column. This PR fixes that.
2016-12-06 17:18:18 -05:00
David Cooper
dd04a10b2f run_beast() speedup + sockets
This PR implements `run_beast()` in a manner similar to `run_allciphers()`.
2016-12-06 11:37:41 -05:00
David Cooper
8b9bc3ca2c Don't parse SSLv2 ServerHello unless successful response
This PR is a proposed alternative to #537. It only attempts to extract the certificate and list of ciphers from the SSLv2 ServerHello is `ret=3`.
2016-12-06 11:23:01 -05:00
David Cooper
48e1e5e1a5 Merge branch '2.9dev' into run_rc4_sockets
Conflicts:
	testssl.sh
2016-12-05 09:10:51 -05:00
David Cooper
2c140bb7e8 Merge branch '2.9dev' into cipher_order_sockets 2016-12-05 09:02:50 -05:00
David Cooper
d27d48491f Merge branch '2.9dev' into run_cipher_per_proto_sockets 2016-12-05 08:57:16 -05:00
Dirk
62a40f747e Merge branch '2.9dev' of https://github.com/AlGreed/testssl.sh into AlGreed-2.9dev
Conflicts:
	testssl.sh
2016-12-03 13:39:50 +01:00
David Cooper
e2613303ea Merge branch '2.9dev' into run_cipher_per_proto_sockets 2016-12-02 13:35:21 -05:00
David Cooper
e82c5288cd Merge branch '2.9dev' into cipher_order_sockets 2016-12-02 13:33:53 -05:00
David Cooper
93b5a5c595 Merge branch '2.9dev' into run_rc4_sockets 2016-12-02 13:32:43 -05:00
David Cooper
e7eac77be4 run_drown() when server has non-RSA certificates
This PR address a problem in `run_drown()` when the server does not support SSLv2, but does support multiple certificates or doesn't have an RSA certificate.

One example of the problem can be seen with www.facebook.com. If `run_server_preferences()` is run before `run_drown()`, then the results of `run_drown()` are:
```
 DROWN (2016-0800, CVE-2016-0703)          not vulnerable on this port (OK)
                                           make sure you don't use this certificate elsewhere with SSLv2 enabled services
                                           https://censys.io/ipv4?q=A626B154CC65634181250B810B1BD4C89EC277CEA08D785EEBE7E768BDA7BB00 SHA256 A3F474FB17509AE6C5B6BA5E46B79E0DE6AF1BF1EEAA040A6114676E714C9965 could help you to find out
```
If only `run_drown()` is performed, then the result is:
```
 DROWN (2016-0800, CVE-2016-0703)          not vulnerable on this port (OK)
                                           make sure you don't use this certificate elsewhere with SSLv2 enabled services
                                           https://censys.io/ipv4?q=A626B154CC65634181250B810B1BD4C89EC277CEA08D785EEBE7E768BDA7BB00 could help you to find out
```
However, A626B154CC65634181250B810B1BD4C89EC277CEA08D785EEBE7E768BDA7BB00 is the fingerprint of Facebook's ECDSA certificate, not its RSA certificate.

In addition, as noted in the "FIXME," `run_drown()` will display the warning "make sure you don't use this certificate elsewhere with SSLv2 enabled services" even if the server doesn't have an RSA certificate, even though SSLv2 can only use RSA certificates.

This PR fixes this issue by only showing the warning if the server has an RSA certificate and by ensuring that the `$cert_fingerprint_sha2` used to construct the "https://censys.io/ipv4?q=..." URL only contains a single SHA256 fingerprint and that it is the fingerprint of the server's RSA certificate.
2016-12-02 10:16:04 -05:00
AlGreed
9eba15834e Merge remote-tracking branch 'drwetter/2.9dev' into 2.9dev 2016-12-01 23:52:51 +01:00
David Cooper
c522cad687 Use sockets to determine cipher order
This PR modifies `cipher_pref_check()` to use `tls_sockets()`. As with similar PRs for `run_allciphers()`, `run_cipher_per_proto()`, and `run_rc4()`, it also makes use of `$OPENSSL s_client`, since `$OPENSSL s_client` is faster than `tls_sockets()`.

With this PR, `cipher_pref_check()` first uses `$OPENSSL s_client` to obtain an ordered list of ciphers. It then makes one call to `tls_sockets()` (or a few calls if proto is TLSv1.2 and `$SERVER_SIZE_LIMIT_BUG` is `true`) to find if the server supports any ciphers that are not detected by `$OPENSSL s_client`. If not, then it is done. If it finds one, then it throws out the previous results and starts over with `tls_sockets()`. [If proto is TLSv1.2 and `$SERVER_SIZE_LIMIT_BUG` is `true`, then it doesn't throw out the `$OPENSSL s_client` results. Instead, it continues with `tls_sockets()` to get the full list of supported ciphers, and then uses `tls_sockets()` to order that list.]

The result is that this PR works almost as fast as the current `cipher_pref_check()` if `$OPENSSL s_client` finds all of the supported ciphers, at the cost of a performance penalty when testing servers that support ciphers that would have otherwise been missed using just OpenSSL.

Note that in this PR I removed SSLv2 from the list of protocols tested. This is because https://community.qualys.com/thread/16255 states that "in SSLv2 the client selects the suite to use." It seems that in SSLv2, the client sends a list of ciphers that it supports, the server responds with a list of ciphers that the client and server have in common, and then "the client selects the suite to use." So, showing a cipher order for SSLv2 is a bit misleading.

As noted in #543, this PR does not modify the second part of `cipher_pref_check()`, which deals with NPN protocols.
2016-12-01 16:51:38 -05:00
David Cooper
33baf66703 Merge branch '2.9dev' into run_rc4_sockets 2016-12-01 13:29:13 -05:00
David Cooper
b79abd969a Merge branch 'run_cipher_per_proto_sockets' of https://github.com/dcooper16/testssl.sh into run_cipher_per_proto_sockets 2016-12-01 13:26:27 -05:00
David Cooper
f2dae8efaf Merge branch '2.9dev' into run_cipher_per_proto_sockets 2016-12-01 13:24:36 -05:00
Dirk Wetter
b58c48fa3e Merge pull request #544 from dcooper16/fixmeln_typo
Typo in definition of fixmeln()
2016-12-01 18:18:41 +01:00
David Cooper
07edcd9a6a Typo in definition of fixmeln()
The `fixmeln()` function was misnamed `fixme()`.
2016-12-01 12:04:06 -05:00
Dirk Wetter
7aee9b9f0b Merge pull request #536 from typingArtist/fix_starttls
Implement proper STARTTLS handshake for ftp, smtp, pop, imap and nntp
2016-12-01 16:29:12 +01:00
David Cooper
db1f4c37a2 Limit calls to tolower()
It turns out that calling `tolower()` once for each cipher to test is very expensive. So, this commit tries to call `tolower()` only when necessary.
2016-11-30 13:40:28 -05:00
David Cooper
3838b0f613 Merge branch '2.9dev' into run_rc4_sockets 2016-11-30 09:14:23 -05:00
David Cooper
2ff480a6df Merge branch '2.9dev' into run_cipher_per_proto_sockets 2016-11-30 09:11:26 -05:00
David Cooper
01997b8b81 run_rc4() sockets implementation
This PR implements `run_rc4()` in a similar manner to `run_allciphers()` and `run_cipher_per_proto()` (in PR #541). The change doesn't seem to have much of an impact on speed, but when sockets are used it can detect ciphers that aren't locally supported by OpenSSL.
2016-11-29 11:58:49 -05:00
David Cooper
af84d9b220 run_cipher_per_proto() speedup + sockets
This PR implements `run_cipher_per_proto()` in a manner similar to `run_allciphers()`.
2016-11-29 11:16:01 -05:00
David Cooper
49c023f27f run_allciphers() bug fixes
This PR fixes two minor bugs in run_allciphers():

* If `$SSL_NATIVE` or `$FAST` is `true`, then the cipher mapping file will not be used (unless `$OPENSSL ciphers` does not support the `-V` option), so there is no "fallback" to openssl, even if `[[ $TLS_NR_CIPHERS == 0 ]]`.

* If `$using_sockets` is `false` and `$SHOW_EACH_C` is `true`, then `ossl_supported` should be checked to see if the cipher was tested, not `TLS_CIPHER_OSSL_SUPPORTED`.
2016-11-28 10:45:44 -05:00
AlGreed
490818e931 Merge remote-tracking branch 'drwetter/2.9dev' into 2.9dev 2016-11-23 09:51:27 +01:00
AlGreed
4847fbc49a removed filling for hints 2016-11-23 09:46:11 +01:00
typingArtist
4d8c258b0b #536: fixed STARTTLS depending on 0 returned from debugme 2016-11-23 09:17:39 +01:00
typingArtist
b7294c60c4 Implemented proper STARTTLS handshake for ftp, smtp, pop, imap and nntp 2016-11-22 18:57:21 +01:00
David Cooper
c7b3e32701 Merge branch '2.9dev' into reorganize_run_server_defaults 2016-11-21 16:49:04 -05:00
David Cooper
ed3ecdd524 Reorganize run_server_defaults()
This function reorganizes `run_server_defaults()` based on the suggestion in #515.

The current `determine_tls_extensions()` is renamed to `get_server_certificate()`, and two changes are made to it:
*it no longer includes an extra call to `$OPENSSL s_client` to check for the ALPN extension; and
* rather than setting `$TLS_EXTENSIONS` to be the extensions found during this call to the function, it adds any newly found extensions to those already in `$TLS_EXTENSIONS`.

The PR then adds a new function, `determine_tls_extensions()`, which borrows some logic from the old `determine_tls_extensions()`, but this new `determine_tls_extensions()` only looks for additional TLS extensions, including ALPN.

`run_server_defaults()` makes multiple calls to `get_server_certificate()` (as it previously did to `determine_tls_extensions()`) in order to collect all of the server's certificates, and then it makes one call to `determine_tls_extensions()`, which checks for support for extensions that were not checked for by `get_server_certificate()` (e.g., ALPN, extended master secret, signed certificate timestamps).

The new `determine_tls_extensions()` will check for most of the extensions that are checked for by 
`run_server_defaults()`, including the heartbeat extension, so the call to `determine_tls_extensions()` from `run_heartbleed()` will still work.
2016-11-21 14:26:19 -05:00
David Cooper
f4529df263 More fixes for missing cipher mapping file
> The dh_bits are still not shown, maybe because of #531.

This PR fixes the issue of dh_bits not being shown if the cipher-mapping.txt file is missing. The problem is that the code in `parse_tls_serverhello()` that parses the ServerKeyExchange message assumes that `$rfc_cipher_suite` has the RFC version of the name the cipher suite. However, if the cipher-mapping.txt file is missing, `$rfc_cipher_suite` will have the OpenSSL name of the cipher suite. This PR changes the code to recognize either the RFC or OpenSSL names for ciphers with ephemeral DH or ECDH keys.
2016-11-21 11:30:01 -05:00
Dirk Wetter
e60180d0ea Merge pull request #522 from dcooper16/faster_run_allciphers
Faster version of run_allciphers()
2016-11-20 10:41:26 +01:00
Dirk Wetter
b22bde8ce0 Merge pull request #521 from dcooper16/no_pkey
OpenSSL 0.9.8 does not support the pkey command
2016-11-20 09:45:32 +01:00
Dirk Wetter
a9f8411160 Merge pull request #523 from dcooper16/missing_mapping_file
Additional fixes for no cipher mapping file
2016-11-19 22:39:10 +01:00
Dirk Wetter
e0f7bc4062 Merge pull request #529 from dcooper16/parse_tls_serverhello6
Extend TLS ServerHello parsing (part 6)
2016-11-19 22:26:56 +01:00
Dirk Wetter
0d74b798fb Merge pull request #528 from dcooper16/parse_tls_serverhello5
Extend TLS ServerHello parsing (part 5)
2016-11-19 22:25:26 +01:00
David Cooper
d02a0af8af Extend TLS ServerHello parsing (part 6)
This PR extends `tls_sockets()` by parsing the contents of the ALPN and NPN extensions, if the "full" response is being processed.
2016-11-18 12:09:07 -05:00
David Cooper
403a5c5b1e Extend TLS ServerHello parsing (part 5)
When `tls_sockets()` is used with the "full" option and the chosen cipher suite involves an ephemeral finite-field DH key (DH), this PR extracts the public key from the ServerKeyExchange message and adds it to `$TMPFILE`. In addition (and the primary reason for this PR), it compares the ephemeral public key's parameters to those specified in RFC 7919, and indicates whether one the groups from that RFC was used. This will allow `run_pfs()` to be extended to indicate which, if any, RFC 7919 DH groups a server supports.
2016-11-18 10:19:44 -05:00
AlGreed
d1ff5449b9 spelling fixed 2016-11-18 00:44:24 +01:00
AlGreed
eb86467b50 Merge branch 'drwetter/2.9dev' into 2.9dev 2016-11-17 23:27:50 +01:00
AlGreed
f7cf3552f0 Fixed some bugs; added CVE, CWE and hint fields. 2016-11-17 23:27:27 +01:00
David Cooper
64f56e899b Merge branch '2.9dev' into no_pkey 2016-11-17 13:52:44 -05:00
David Cooper
05b8010526 Merge branch '2.9dev' into faster_run_allciphers 2016-11-17 13:51:16 -05:00
David Cooper
ae3d5cfad9 Merge branch '2.9dev' into missing_mapping_file 2016-11-17 13:49:56 -05:00
David Cooper
cdd127fe44 Merge branch '2.9dev' into neat_list_Camellia_GCM 2016-11-17 13:48:41 -05:00
David Cooper
a18dd45f1f Extend TLS ServerHello parsing (part 4)
This PR adds parsing of the CertificateStatus message to `parse_tls_serverhello()`. If the caller requests that the "full" response be parsed, then the CertificateStatus message is parsed, and the OCSP response is added to $TMPFILE, in a manner similar to the output of `$OPENSSL s_client` when the `-status` option is used.
2016-11-17 12:04:24 -05:00
David Cooper
496957720e Fix neat_list() for Camellia GCM
The string "CamelliaGCM" is too long for the "Encryption" column printed by `neat_list()`. So, either "CamelliaGCM" needs to be shortened to "Camellia" (as this PR does), or the "Encryption" column needs to be made wider.
2016-11-16 09:07:52 -05:00
David Cooper
3c107b543e Additional fixes for no cipher mapping file
Client simulations can still use sockets even if the cipher mapping file is missing. If the cipher file is present, then `parse_tls_serverhello()` write the RFC name for the cipher and then `run_client_simulation()` converts that to the OpenSSL name (so that the output is the same as if OpenSSL were used).  This PR changes `parse_tls_serverhello()` so that it writes the OpenSSL name for the cipher if the mapping file is missing, which `run_client_simulation()` can then just display.

This PR also unsets `ADD_RFC_STR` if the mapping file is missing, so that `neat_list()` won't try to display the RFC names for the ciphers.
2016-11-15 15:55:54 -05:00
David Cooper
46e9e99437 Merge branch '2.9dev' into faster_run_allciphers
Conflicts:
	testssl.sh
2016-11-15 15:06:24 -05:00
David Cooper
96caa6c302 Merge branch 'no_pkey' of https://github.com/dcooper16/testssl.sh into no_pkey 2016-11-15 14:53:33 -05:00
David Cooper
ea10f1ee93 Faster version of run_allciphers()
This PR speeds up the implementation of `run_allciphers()` by introducing a number of changes:

* Rather than check for implemented ciphers in a hierarchical manner (as introduced in #326), this PR follows the approach of `cipher_pref_check()`. Testing a block of ciphers, marking the selected cipher as implemented, and then testing same block of ciphers, minus those that have previously been selected, until a test fails. Thus the number of calls to `$OPENSSL s_client` is just one more than the number of ciphers implemented. (Since some servers cannot handle ClientHellos with more than 128 messages, the tests are performed on blocks of 128 or few ciphers. So, if OpenSSL supports 197 ciphers, the number of calls to `$OPENSSL s_client` is 2 plus the number of ciphers supported by the server.

* If $using_sockets is true, then OpenSSL is used first to find all supported ciphers that OpenSSL supports (since OpenSSL is faster than `tls_sockets()`), and then `tls_sockets()` is only used to test those cipher suites that were not found to be supported by OpenSSL.

* The `prepare_debug()` function, which reads in `$CIPHERS_BY_STRENGTH_FILE` determines which ciphers are supported by the version of OpenSSL being used. If a version of OpenSSL older than 1.0 is being used, then this is used to determine which ciphers to test using OpenSSL rather than using `$OPENSSL ciphers -V`.

Following the approach of `cipher_pref_check()` reduces the number of queries to the server. Using OpenSSL before `tls_sockets()` reduces the number of calls to `tls_sockets()` to 3 plus the number of ciphers supported by the server that are not supported by OpenSSL, so the cost penalty over just using OpenSSL is fairly small.
2016-11-15 14:45:50 -05:00
David Cooper
8ad9e45acf OpenSSL 0.9.8 does not support the pkey command
The `tls_sockets()` and `sslv2_sockets()` use `get_pub_key_size()` to extract the size of the server's public key if the full response is being processed, and `get_pub_key_size()` uses `$OPENSSL pkey` to extract the server's public key from the certificate. However, OpenSSL 0.9.8 does not support the "pkey" command. This PR changes `get_pub_key_size()` to suppress the error message displayed by OpenSSL when the "pkey" command is not supported.
2016-11-15 11:32:30 -05:00
Dirk
08384920a9 Cipher mapping externalized by using David's extended mapping. Also implemented warnings
and fallback to openssl if this file cannot be found and thus sockets can't be used
2016-11-15 15:20:48 +01:00
Dirk
e8ce1fcb74 emphasize that we're using sockets in run_allciphers -- unless otherwise requested 2016-11-15 13:09:41 +01:00
Dirk
d4ed7466ce introducing --fast for the impatient 2016-11-15 12:59:07 +01:00
Dirk Wetter
37933d6fa1 Merge pull request #512 from dcooper16/run_allciphers_sockets
Use tls_sockets() in run_allciphers()
2016-11-15 12:54:15 +01:00
Dirk Wetter
cb53723dff Merge pull request #515 from dcooper16/find_more_extensions
Find more extensions in run_server_defaults()
2016-11-15 10:24:00 +01:00
David Cooper
1a042d5dba Merge branch '2.9dev' into parse_tls_serverhello3 2016-11-09 17:29:20 -05:00
David Cooper
28e4984f8a Merge branch '2.9dev' into find_more_extensions 2016-11-09 17:28:32 -05:00
David Cooper
7ff9f13b12 Merge branch '2.9dev' into run_allciphers_sockets 2016-11-09 17:27:00 -05:00
Dirk Wetter
83d2bb0241 Merge pull request #514 from dcooper16/fix_x25519_2.9dev
Curve X25519 fixes for 2.9dev
2016-11-09 21:29:29 +01:00
Dirk
fc3db43948 Merge branch 'fix_x25519' of https://github.com/dcooper16/testssl.sh into dcooper16-fix_x25519 2016-11-09 21:18:09 +01:00
David Cooper
a97ca32568 Extend TLS ServerHello parsing (part 3)
This PR adds parsing of the Certificate message to `parse_tls_serverhello()`. If the caller requests that the "full" response be parsed, then the Certificate message is parsed, the server's certificate is placed in $HOSTCERT and the intermediate certificates are placed in  $TEMPDIR/intermediatecerts.pem. The certificates are also added to $TMPFILE, in a manner similar to the output of `$OPENSSL s_client` when the `-showcerts` option is used.
2016-11-09 13:41:36 -05:00
David Cooper
3a68e5b937 Find more extensions in run_server_defaults()
This PR uses `tls_sockets()` to determine whether a server supports certain extensions that may not be supported by `$OPENSSL`. At the moment it checks for max_fragment_length, client_certificate_url, truncated_hmac, ALPN, signed_certificate_timestamp, encrypt_then_mac, and extended_master_secret.

In https://github.com/dcooper16/testssl.sh/blob/extended_tls_sockets/testssl.sh, `run_server_defaults()` is re-written to use `tls_sockets()` instead of `$OPENSSL`, with just one call to `$OPENSSL s_client` to get the session ticket, which reduces the dependence on `$OPENSSL`, but this PR limits the number of calls to `tls_sockets()`, which is still slow.

Note: I included ALPN in the `tls_sockets()` ClientHello since a single call to `tls_sockets()` cannot test for both NPN and ALPN, and since support for NPN was added to OpenSSL before support for ALPN was added, I figured it was more likely that `determine_tls_extensions()` had already determined whether the server supported NPN.
2016-11-08 12:36:25 -05:00
David Cooper
64a96c8388 Curve X25519 fixes for 2.9dev
This PR fixes the same issues as were fixed in PR #513, but also makes two changes to `parse_tls_serverhello()`:

* It changes the number of bits for curve X25519 from 256 to 253 to match OpenSSL.

* It removes the "ECDH, " from the "Server Temp Key: " line in order to match OpenSSL's output.
2016-11-08 10:20:48 -05:00
David Cooper
43b35b8cc2 Curve X25519 fixes
This PR fixes two issues related to curve X25519.

First, while OpenSSL 1.1.0 supports curve X25519, it is not included in the output of `$OPENSSL ecparam -list_curves`. I tried several versions of OpenSSL (and one version of LibreSSL), and every version output either "Error with command" or "unknown option" in response to `$OPENSSL s_client -curves $curve` if it either did not support the `-curves` option or did not support `$curve`. (When the `-curve` option was supported with `$curve`, a "connect" error was output.)

The second issue is that the "Server Temp Key" line in the output of `s_client` is different for curve X25519. For other elliptic curves, the output is
```
Server Temp Key: ECDH, P-256, 256 bits
```
For X25519 it is:
```
Server Temp Key: X25519, 253 bits
```
So, `read_dhbits_from_file()` needs to allow for `$what_dh` being "X25519" rather than "ECDH" and `run_pfs()` needs to allow for the possibility that the curve name will be the first field rather than the second.
2016-11-08 10:10:14 -05:00
David Cooper
facf34391f Merge branch '2.9dev' into run_allciphers_sockets 2016-11-08 08:43:24 -05:00
Dirk
9ea5cf8698 minor 2016-11-07 23:52:58 +01:00
David Cooper
66c855f54b Merge branch '2.9dev' into run_allciphers_sockets 2016-11-07 13:50:58 -05:00
Dirk
a153b71598 fixing same openssl cipher names, see #379 2016-11-06 23:00:55 +01:00
Dirk
db64ea6d61 add more test info to #503 2016-11-06 22:43:42 +01:00
Dirk
f5f3218e69 update 2016-11-06 21:12:57 +01:00
Dirk Wetter
21a676c2f5 Merge pull request #511 from dcooper16/client_sim_dh_bits
Use ephemeral public key in client simulations
2016-11-06 20:56:39 +01:00
Dirk
711e460cae minor polish 2016-11-06 20:39:56 +01:00
Dirk Wetter
18c4164902 Merge pull request #507 from dcooper16/tls_sockets_extra_extensions
Allow caller to provide extra extensions to tls_sockets()
2016-11-06 20:25:04 +01:00
Dirk
72ac0734d1 tolower 2016-11-05 14:55:30 +01:00
Dirk
dc871030b2 reordered help 2016-11-05 13:43:55 +01:00
Dirk
4fc387ed12 Merge branch '2.9dev' of github.com:drwetter/testssl.sh into 2.9dev 2016-11-05 12:27:09 +01:00
Dirk
d698005313 tolower 2016-11-05 12:26:18 +01:00
David Cooper
342a4c9e70 Use tls_sockets() in run_allciphers()
The PR changes `run_allciphers()` to use `tls_sockets()` (and `sslv2_sockets()`)rather than `$OPENSSL` unless `$SSL_NATIVE` is set or `$STARTTLS` is non-empty. Using sockets allows `run_allciphers()` to test all ciphers, rather than just those supported by `$OPENSSL`.

Using sockets results in `run_allciphers()` running more slowly, partially since it is testing more ciphers, but mostly since `tls_sockets()` is currently slower than `$OPENSSL` (as noted in #413).
2016-11-04 15:45:07 -04:00
David Cooper
db1709b389 Fix alignment in run_allciphers()
This commit makes no changes to the code, it just corrects the indentation.
2016-11-04 14:27:50 -04:00
David Cooper
765b1bdf5d Use ephemeral public key in client simulations
This PR makes similar changes to `run_client_simulation()` as were made to `tls_sockets()`, so that  `run_client_simulation()` retrieves the entire server response, even if it is split across multiple packets, and it has `parse_tls_serverhello()` extract information about the server's ephemeral public key, if present.

The PR also changes `run_client_simulation()` to use information about the ephemeral public key. It includes the length of the public key in the output and, if it is a DH public key, checks that the size is within the acceptable range (`${minDhBits[i]} <= dh_bits <= ${maxDhBits[i]}`).
2016-11-04 11:51:34 -04:00
David Cooper
875eefd4fc Merge branch '2.9dev' into tls_sockets_extra_extensions
Conflicts:
	testssl.sh
2016-11-04 09:15:28 -04:00
Dirk
f18a398ce3 handle better missing ca_hashes.txt 2016-11-04 08:39:14 +01:00
Dirk
e8d7e16a9d handle better missing ca_hashes.txt 2016-11-04 08:35:27 +01:00
Dirk Wetter
cc6da260f8 Merge pull request #508 from dcooper16/parse_tls_serverhello2
Extend TLS ServerHello parsing (part 2)
2016-11-04 07:25:38 +01:00
AlGreed
175ead6d2a Merge remote-tracking branch 'drwetter/2.9dev' into 2.9dev 2016-11-04 02:54:56 +01:00
David Cooper
a6addba038 Extend TLS ServerHello parsing (part 2)
This PR adds initial parsing of the ServerKeyExchange message to `parse_tls_serverhello()`. For ephemeral DH keys, it extracts the length of the key. For ephemeral ECDH keys that are encoded using the named_curve option, it extracts the length of the key and the name of the curve.
2016-11-03 16:14:14 -04:00
David Cooper
31eba73b36 Merge branch '2.9dev' into tls_sockets_extra_extensions 2016-11-03 14:20:20 -04:00
Dirk Wetter
04544e8423 Merge pull request #506 from dcooper16/parse_tls_serverhello1
Extend TLS ServerHello parsing (part 1)
2016-11-03 17:57:15 +01:00
David Cooper
ed4d29e0c5 Allow caller to provide extra extensions to tls_sockets()
This PR allows the caller to provide additional extensions to `tls_sockets()` to be included in the ClientHello. If the caller provides an extension that would have already been included in the ClientHello, then the caller's value for the extension is used rather than the default value.
2016-11-03 10:49:27 -04:00
David Cooper
98aaab5e12 Extend TLS ServerHello parsing (part 1)
This PR extended `parse_tls_serverhello()` in a few ways:

* If the "full" response is to be parsed, then additional checks are performed to verify that `$tls_hello_ascii` contains the entire response

* The extensions field is parsed and the list of extensions found is placed in `$TLS_EXTENSIONS` (if the "full" response is being parsed).

* Initial support for TLS 1.3 is added:

  - Accounts for differences between TLS 1.2 ServerHello and TLS 1.3 ServerHello (as outlined in PR #499).

  - Recognizes new alerts and handshake message types.

  - Allows for server response to include message fragments of type "application data"
2016-11-03 10:18:27 -04:00
David Cooper
24cc3ae73f Fix #499
I forgot that `parse_tls_serverhello()` is also called by `client_simulation_sockets()`. Since PR #499 changed the input to `parse_tls_serverhello()`, the change needs to be made in `client_simulation_sockets()` as well.
2016-11-03 10:02:45 -04:00
David Cooper
80d9f418d0 Merge branch '2.9dev' into get_full_server_response 2016-10-31 08:57:34 -04:00
Dirk
f1d609e008 putput polish 2016-10-29 15:38:07 +02:00
Dirk Wetter
63ec369f34 output polish 2016-10-29 15:37:30 +02:00
David Cooper
3fa8449351 Merge branch '2.9dev' into get_full_server_response 2016-10-28 16:59:01 -04:00
Dirk
cc474190af Merge branch 'no_version_tolerance_test' of https://github.com/dcooper16/testssl.sh into dcooper16-no_version_tolerance_test
Conflicts:
	testssl.sh
2016-10-28 22:17:34 +02:00
Dirk
b540d362b9 add option for -n / --nodns which avoids DNS lookups. Usefuk where ne DNS is needed.available as is speeds up the start consinderably 2016-10-28 21:37:10 +02:00
Dirk Wetter
df2704dc20 Merge pull request #498 from Sousaphone/master
Apple ATS9 client simulation
2016-10-28 21:31:39 +02:00
Dirk Wetter
cd9f45ce25 Merge pull request #493 from dcooper16/asciihex_to_binary
Use printf in asciihex_to_binary_file
2016-10-28 21:31:01 +02:00
AlGreed
694e4c7b6e pretty json format + severity levels filter 2016-10-28 15:30:07 +02:00
David Cooper
95f583322a Merge branch 'master' into no_version_tolerance_test 2016-10-27 16:51:50 -04:00
Dirk
99300a0059 bump version 2016-10-27 22:02:35 +02:00
Dirk
1613bb214e Merge branch 'master' into CA_pinning
Conflicts:
	testssl.sh
2016-10-27 21:59:10 +02:00
David Cooper
4614e56022 Fix for when no mapping file is present
Now that the mapping file is no longer used, `$ADD_RFC_STR` should not be unset just because the mapping file cannot be found.

In addition, since `show_rfc_style()` is now used in `parse_tls_serverhello()`, it cannot return an empty string just because the user set "--mapping no-rfc" on the command line. Instead, `neat_list()` should check the value of `$ADD_RFC_STR` and not call `show_rfc_style()` if it has been unset.

Finally, since `show_rfc_style()` no longer returns strings with extra spaces, there is no need to call `strip_spaces()`
2016-10-27 14:28:16 -04:00
David Cooper
c8ff119316 Add option to retrieve entire server response
In some cases the server's response to a ClientHello spans more than one packet. If the goal is just to determine whether the connection was successful and to extract a few pieces of information from the ServerHello message, then this is unlikely to be a problem. However, if there is a desire to extract the server's certificate chain (Certificate message) or to determine the type and size of the server's ephemeral public key (ServerKeyExchange message), then the entire response needs to be obtained, even if it spans multiple packets.

This PR adds a new function, `check_tls_serverhellodone()`, that checks whether the entire response has been received (e.g., whether the ServerHelloDone message has been received). If the response indicates that the response is incomplete, then `tls_sockets()` requests more data from the server until the response is complete or until the server doesn't provide any more data in response.

The PR only changes the behavior of `tls_sockets()` if the caller indicates that it wants to extract the ephemeral key or that it wants the entire response to be parsed. Otherwise, only the first packet returned by the server is sent to `parse_tls_serverhello()`. [The value of `$process_full` is not used at the moment, but will be in a subsequent PR that modifies `parse_tls_serverhello()`.]

This PR also changes `tls_sockets()` to send a close_notify to the server if the connection was successfully established.
2016-10-25 11:04:23 -04:00
Thomas Alexander Frederiksen
217f2fb91a Apple ATS9 client test 2016-10-19 10:54:37 +02:00
Dirk
ef78aec50b FIX #490 2016-10-15 22:56:53 +02:00
Dirk
5e5edd5c89 FIX #490 2016-10-15 22:55:24 +02:00
mailsvb
4ce4d922ac remove additional pr_off at the end of sslv2 check 2016-10-12 22:32:35 +02:00
Dirk
6723622024 - do not do HTTP2+SPDY checks if non-STARTTLS but also non-HTTP
- ASSUMING_HTTP --> ASSUME_HTTP
- minor cleanups
2016-10-11 22:30:30 +02:00
David Cooper
3c55eec654 Remove test of version tolerance
PR #346 added a test for version tolerance to `run_protocols()`, but I think it may now be more appropriate to remove that test. Draft -16 of TLS 1.3, which was posted on September 22, changed the way that version negotiation is handled for TLS 1.3 and above. The current version tolerance test sends a ClientHello with the version field set to "03, 05", to represent a TLS 1.4 ClientHello. While this was consistent with RFC 5246 and with drafts of TLS 1.3 up to -15, draft -16 changed the version field to `legacy_version` and declared that its value should be "03, 03" for TLS 1.2 and above. (For TLS 1.3 and above a Supported Versions extension is included to inform the server which versions of TLS the client supports.) The change in draft -16 was made as a result of the problems with servers not handling version negotiation correctly.

Since the current draft suggests that a server should never be presented with a ClientHello with a version higher than "03, 03" (even for clients that support TLS versions higher than 1.2), it seems there is no reason to include the version tolerance test anymore.

For servers that do not support TLS 1.2, the additional checks that were added by PR #346 will already detect if the server cannot perform version negotiation correctly.
2016-10-11 11:01:04 -04:00
David Cooper
140ff91c60 Use printf in asciihex_to_binary_file
Use `printf` in `asciihex_to_binary_file()` rather than `echo -e -n`
2016-10-11 10:08:59 -04:00
Dirk
77f98e73e2 medium only for "Secure Client-Initiated Renegotiation" != HTTP 2016-10-10 23:27:34 +02:00
mailsvb
5a967302dc fix usage of CA_BUNDLES_PATH env for local ca_bundles 2016-10-08 22:50:44 +02:00
Dirk
1c5eb17729 (saving work): major cleanups for output readability and code 2016-10-06 18:53:25 +02:00
Dirk
bd64fb4214 minor putput cleanup for headers 2016-10-03 21:17:29 +02:00
Dirk Wetter
19b63aa8a9 duplicate headers fixed, #FIX 488, outstanding: proper treatment of simulatenous Public-Key-Pins|Public-Key-Pins-Report-Only 2016-10-03 18:52:48 +02:00
Dirk
e2023f51ac evaluate env TESTSSL_INSTALL_DIR and CA_BUNDLES_PATH for CA bundles and/or RFC/IANA mapping, FIX #475, #435 2016-10-02 18:15:13 +02:00
Dirk
fd6e2c0682 cleanup of #489 2016-10-01 22:25:14 +02:00
Dirk
09c19b4654 FIX #489, clear warning if >=1 HSTS headers are present 2016-10-01 10:04:33 +02:00
David Cooper
76a79a1f42 Merge branch '2.9dev' into full_parse_sslv2 2016-09-30 11:30:14 -04:00
Dirk
a5adb2f3ec fixing last T CI run 2016-09-29 21:20:13 +02:00
Dirk
c785087d15 - save 1x sed in count_lines/words 2016-09-29 21:03:48 +02:00
Dirk
05a0e555a7 - save 1x sed in count_lines/words 2016-09-29 20:59:13 +02:00
David Cooper
0676866e91 Add option for extract data from SSLv2 ServerHello
This PR adds the option for `parse_sslv2_serverhello()` to extract information from the ServerHello (server key size and cipher suites supported) and write the information to `$TMPFILE` as well as to write the server's certificate to `$HOSTCERT`.
2016-09-28 17:15:37 -04:00
David Cooper
1dddad20c9 Don't use mapping-rfc.txt
The mapping file is now only used in `show_rfc_style()`. This PR changes `show_rfc_style()` to use the `$TLS_CIPHER_HEXCODE` and `$TLS_CIPHER_RFC_NAME` arrays.

Note that `get_install_dir()` still searches for the mapping-rfc.txt in order to determine `$INSTALL_DIR`. `$INSTALL_DIR` is only used to determine the location of the CA bundles in `determine_trust()`:
```
     local ca_bundles="$INSTALL_DIR/etc/*.pem"
```
2016-09-28 15:36:49 -04:00
Dirk
d786a94a8c output + code polishing, phrasing. lf still has space for improvements 2016-09-28 20:32:01 +02:00
David Cooper
4751a58d56 Allow cipher list to be passed to sslv2_sockets()
This PR changes `sslv2_sockets()` so that a list of ciphers may optionally be passed as an argument. This will support the use of `sslv2_sockets()` in some places where `$OPENSSL s_client` is currently used.
2016-09-28 13:46:43 -04:00
Dirk
a54df8a55b fix if statement 2016-09-28 08:00:56 +02:00
Dirk
9f313f15ea added --openssl-timeout in help 2016-09-27 23:38:47 +02:00
Dirk
4d1303f5b9 TLS 1.2 sockets not anymore experimental 2016-09-27 23:33:38 +02:00
Dirk
e1f9209c23 corrected version 2016-09-27 23:32:24 +02:00
Dirk
aab0487a96 Merge branch 'dcooper16-openss2rfc_rfc2openssl' into 2.9dev 2016-09-27 22:55:54 +02:00
Dirk
c028ec4ed6 Merge branch 'dcooper16-remove_sockread' into 2.9dev 2016-09-27 22:33:53 +02:00
Dirk
2036e1e9e0 #414 polish: filename fix for windows, handling of existence and type of timeout 2016-09-27 22:15:57 +02:00
Dirk
bf4dd76995 Merge branch 'master' of https://github.com/TKCERT/testssl.sh into TKCERT-master 2016-09-27 21:48:43 +02:00
David Cooper
6ded937b14 Merge branch 'master' into remove_sockread 2016-09-26 17:02:53 -04:00
David Cooper
ee0279edd7 Merge branch 'master' into openss2rfc_rfc2openssl 2016-09-26 17:01:46 -04:00
Dirk Wetter
2201c59ba3 FIX #477: check also for ALPN as TLS extension 2016-09-26 21:47:57 +02:00
David Cooper
98663b4c72 Merge branch 'master' into remove_sockread 2016-09-26 09:46:27 -04:00
David Cooper
1c3bf3e592 Merge branch 'master' into openss2rfc_rfc2openssl 2016-09-26 09:45:28 -04:00
Dirk Wetter
fcdc15b24b no STARTTLS for NPN, preparing #477 2016-09-24 16:59:28 +02:00
Dirk Wetter
0cadeefb05 cleanup #473 2016-09-24 16:07:23 +02:00
Dirk Wetter
679d1b9c1f Merge pull request #473 from nachtgeist/issue-467
Fix handling of empty argument to "-nextprotoneg" parameter
2016-09-24 16:01:47 +02:00
Weida Hong
566623c4a9 Remove duplicated do_rc4 in debug_globals() 2016-09-24 15:10:10 +08:00
Daniel Reichelt
4f04820c76 Fix handling of empty argument to "-nextprotoneg" parameter
s_client's manpage states for -nextprotoneg:

"Empty list of protocols is treated specially and will cause the client
to advertise support for the TLS extension but disconnect just after
reciving ServerHello with a list of server supported protocols."

Consequently, the previous workaround of just quoting an empty variable
is insufficient and the "-nextprotoneg" parameter has to be removed
entirely from the command-line in case of an empty argument.

In other locations where "-nextprotoneg" is used
- its argument cannot be empty ($NPN_PROTOs is initialized to a non-
  empty value and set read-only) or
- its argument is intended to be empty (line 3724) or
- the command will not be invoked at all (for-loop parameter, line 3725)

This fixes #467 - again.

Additionally this patch prefers usage of -alpn over -nextprotoneg if the
openssl binary used supports it.
2016-09-22 16:53:54 +02:00
David Cooper
b01f9c8132 Merge branch 'master' into remove_sockread 2016-09-21 16:12:39 -04:00
David Cooper
73d535ebb4 Merge branch 'master' into openss2rfc_rfc2openssl
Conflicts:
	testssl.sh
2016-09-21 16:11:55 -04:00
Dirk Wetter
ddbf4caa46 FIX #476 2016-09-21 21:59:50 +02:00
Dirk Wetter
802a6da92c - centralized some HAS_* vars from s_client 2016-09-21 21:42:45 +02:00
Dirk Wetter
9afbba1e04 - 3DES removed from \'MEDIUM\'
- preparation to show cipher string in std_cipherlists
- global var for HTTP_STATUS_CODE, allowing a hint for web application wrt to e.g. cookies
2016-09-21 20:32:04 +02:00
David Cooper
b7fbd13f1a Merge branch 'master' into remove_sockread 2016-09-14 14:37:14 -04:00
David Cooper
63fec45f3f Merge branch 'master' into openss2rfc_rfc2openssl 2016-09-14 14:36:15 -04:00
Karsten Weiss
42e9406ee1 run_rp_banner(): Fix indentation. 2016-09-14 12:24:54 +02:00
Karsten Weiss
6a6d4880d6 run_application_banner(): Fix modified in subshell bug.
Refactor the while loop so it doesn't use a subshell anymore. Also use
"read -r" to prevent backslash escaping.

```
In testssl.sh line 1193:
               app_banners="$app_bannersline"
               ^-- SC2030: Modification of app_banners is local (to subshell caused by pipeline).

In testssl.sh line 1195:
          fileout "app_banner" "WARN" "Application Banners found: $app_banners"
                                                                  ^-- SC2031: app_banners was modified in a subshell. That change might be lost.
```

Found by ShellCheck.
2016-09-14 12:24:44 +02:00
Karsten Weiss
beae0ce195 run_{rp,application}_banner(): Fix unassigned variables.
This commit fixes the following two instances of referenced but not assigned
variables:

```
In testssl.sh line 1159:
               rp_banners="$rp_bannersline"
                           ^-- SC2154: rp_bannersline is referenced but not assigned.

In testssl.sh line 1193:
               app_banners="$app_bannersline"
                            ^-- SC2154: app_bannersline is referenced but not assigned.
```

Found by ShellCheck.
2016-09-14 12:24:28 +02:00
Daniel Reichelt
2a926609ca quote argument for s_client's -nextprotoneg parameter
The argument to -nextprotoneg is provided in sometimes empty an unquoted
variables. Because of the missing quotes, the next word on the line "-status"
gets parsed as "-nextprotoneg"'s argument instead of enabling the OCSP status
check.

This fixes #467.
2016-09-13 21:22:35 +02:00
Dirk
cca1b49890 - fixing wrong cipher order for URL=ipaddress 2016-09-12 21:54:51 +02:00
Dirk Wetter
4158372ab7 Merge pull request #468 from knweiss/referenced_but_not_assigned
compare_server_name_to_cert(): Fix unassigned vars.
2016-09-12 16:51:34 +02:00
Karsten Weiss
b9d9a909b1 certificate_info(): Fix unassigned variable.
Fix referenced but not assigned variable 'sign_algo'.

In testssl.sh line 4309:
               fileout "${json_prefix}algorithm" "DEBUG" "Signature Algorithm: $sign_algo"
                                                                               ^-- SC2154: sign_algo is referenced but not assigned.

Found by ShellCheck.
2016-09-12 16:20:05 +02:00
Karsten Weiss
7dbbe42ea0 compare_server_name_to_cert(): Fix unassigned vars.
Two instances of referenced but not assigned variables ('req' instead of
'ret').

In testssl.sh line 4130:
     if [[ $req -eq 0 ]]; then
           ^-- SC2154: req is referenced but not assigned.

Found by ShellCheck.
2016-09-12 16:12:18 +02:00
Dirk
f0132dcb7f stringer usabiliy warning for SHA1 + HTTP 2016-09-07 21:34:27 +02:00
David Cooper
7932d34fda Updates to cipher suite table
Changed `Enc=CHACHA20/POLY1305(256)` to `Enc=ChaCha20(256)` and `Enc=GOST-28178-89-CNT(256)` to `Enc=GOST(256)` in order to shorten the names that are printed, so that they fit in the allocated column.

Added the four experimental post-quantum cipher suites mentioned in #462.
2016-09-06 14:47:20 -04:00
David Cooper
3b3d16849d Merge branch 'master' into remove_sockread
Conflicts:
	testssl.sh
2016-09-06 11:38:54 -04:00
David Cooper
950b39122e Merge branch 'master' into openss2rfc_rfc2openssl 2016-09-06 10:34:53 -04:00
Dirk
d1cc7b3755 FIX #426 2016-09-06 08:32:05 +02:00
Dirk
c00c98caa2 warning for SHA1 sig algo and web servers 2016-09-05 10:01:46 +02:00
David Cooper
44c37e3177 Merge branch 'master' into remove_sockread 2016-09-02 10:50:28 -04:00
David Cooper
f17a09e1d9 Merge branch 'master' into openss2rfc_rfc2openssl 2016-09-02 10:47:36 -04:00
Dirk Wetter
228296e175 Merge pull request #290 from andreild/issue-289-domain-resolution-etc-hosts
Fix #289 - the grep that decides whether a domain is a local address …
2016-09-02 15:38:28 +02:00
Dirk Wetter
fdcdad3faa Merge pull request #345 from dcooper16/more_sslv2_sslv3_fixes
More SSLv2 (and SSLv3) related fixes
2016-09-02 09:06:52 +02:00
David Cooper
a9002ba6e6 Fix tls_sockets() when SNI empty
`socksend_tls_clienthello()` always includes a server name extension in the ClientHello (for TLS 1.0 and above), even if `$SNI` is empty. If `$NODE` is an IP address, then the IP address is placed in the extension, even though RFC 6066 says that only DNS names are supported in the extension.

This PR changes `socksend_tls_clienthello()` so that the server name extension is only included in the ClientHello is `$SNI` is not empty.
2016-09-01 13:22:39 -04:00
Dirk
2313aee22d fix for previously borken HPKP_MIN value 2016-09-01 19:09:12 +02:00
Dirk
1c53160348 ups ;-) 2016-09-01 19:04:47 +02:00
David Cooper
305c8c0063 Merge branch 'master' into remove_sockread 2016-09-01 10:57:43 -04:00
David Cooper
59d4acec11 Merge branch 'master' into more_sslv2_sslv3_fixes 2016-09-01 10:56:57 -04:00
David Cooper
e10d256ae6 Merge branch 'master' into openss2rfc_rfc2openssl 2016-09-01 10:55:29 -04:00
Dirk
d665f69c72 fix #436 2016-09-01 12:42:56 +02:00
David Cooper
9ef0d1f4ea 20 lines is 320 bytes, not 160 2016-08-31 17:07:53 -04:00
David Cooper
a2f968d4ad Undo changed behavior for CCS 2016-08-31 17:03:50 -04:00
David Cooper
d9578bb975 Merge branch 'master' into remove_sockread 2016-08-31 17:02:18 -04:00
David Cooper
e79e980336 Display SNI information in "Server Certificate" line
This PR is an attempt to address issue #447. If more than one certificate is being displayed, then a parenthetical saying "(in response to request w/o SNI)" is added for any certificate that was obtained using `$SNI=""`.

In addition, if the certificate was obtained without SNI, then `certificate_info()` doesn't call `$OPENSSL s_client` in order to obtain the non-SNI host certificate and it does not display a separate "Trust (hostname)" finding for the non-SNI certificate.
2016-08-30 15:22:46 -04:00
David Cooper
1b548cee10 Follow https://github.com/Tripwire/OpenSSL-CCS-Inject-Test
Attempt to rewrite `run_ccs_injection()` to follow the logic from https://github.com/Tripwire/OpenSSL-CCS-Inject-Test.
2016-08-30 11:38:43 -04:00
David Cooper
f88ad58e72 Merge branch 'master' into openss2rfc_rfc2openssl 2016-08-29 15:03:35 -04:00
David Cooper
6e6fdf6410 Merge branch 'master' into more_sslv2_sslv3_fixes 2016-08-29 15:02:40 -04:00
David Cooper
9bcf232f0f Check for empty byte6 2016-08-29 14:10:16 -04:00
David Cooper
3dc8754a0e Merge branch 'master' into remove_sockread 2016-08-29 14:07:43 -04:00
David Cooper
957225595f Merge branch 'master' into unsupported_purpose 2016-08-29 10:17:27 -04:00
David Cooper
2abf6fc7c7 Fix merge 2016-08-29 10:14:21 -04:00
David Cooper
dea2b1a761 Merge branch 'master' into remove_sockread
Conflicts:
	testssl.sh
2016-08-29 10:05:01 -04:00
David Cooper
01391e318a Merge branch 'master' into openss2rfc_rfc2openssl 2016-08-29 10:00:18 -04:00
David Cooper
97b8dd1959 Merge branch 'master' into more_sslv2_sslv3_fixes
Conflicts:
	testssl.sh
2016-08-29 09:57:36 -04:00
Dirk
54a66b9d88 - minor output fixes
- removed "experimental" from TLS_FALLBACK_SCSV + DROWN
- bumped up version to rc2
2016-08-28 21:41:30 +02:00
Dirk Wetter
1e5b619a19 Merge pull request #427 from dcooper16/server_preference_sslv2_fixes
SSLv2 fixes for server preference
2016-08-28 19:15:22 +02:00
Dirk Wetter
dbb7d6f4be Merge pull request #444 from dcooper16/sslv2_sockets
Move printing of results out of sslv2_sockets()
2016-08-28 18:27:29 +02:00
Dirk Wetter
f4d9a638ba Merge pull request #449 from dcooper16/poodle_no_ssl3
Warning on Poodle test when no local SSLv3 support
2016-08-28 18:10:50 +02:00
Dirk Wetter
a76e67cbbe Merge pull request #450 from dcooper16/determine_optimal_proto_fix
Fix SSLv2-only test in determine_optimal_proto()
2016-08-28 18:08:01 +02:00
Dirk Wetter
1d83e220bf Merge pull request #456 from dcooper16/dh_keys
Support DH server keys
2016-08-28 18:04:22 +02:00
Dirk Wetter
8da00a8025 Merge pull request #445 from dcooper16/devel_option
Fix "--devel" with SSLv2
2016-08-28 18:03:17 +02:00
Dirk Wetter
dfa0cfd0b4 Merge pull request #453 from dcooper16/no_ssl2
OpenSSL 1.1.0 doesn't have "-no_ssl2" option
2016-08-28 17:58:56 +02:00
David Cooper
98dc3bfadb Support DH server keys
When `certificate_info()` is given a certificate with a DH public key it displays something like:
```
   Server key size              fixme:  dhKeyAgreement 3072 bits (FIXME: can't tell whether this is good or not)
```

This PR fixes that so that the output is:
```
   Server key size              DH 3072 bits
```
2016-08-25 15:23:53 -04:00
David Cooper
aeba340dcb Output correct error for unsupported certificate purpose
This PR is in response to issue #454. I tried repeating the reported problem by creating a certificate in which the extendedKeyUsage extension was present and only included the anyExtendedKeyUsage OID. In running the test, I discovered two problems.

First, when `determine_trust()` is calling `verify_retcode_helper()` to display the reason that path validation failed, it assumes that there are at least two certificate bundles provided. (I was running the test using just one certificate bundle, containing my local root.) So, I changed `determine_trust()` to use `${verify_retcode[1]}` rather than `${verify_retcode[2]}` in the case that all bundles failed (it seems that 2 vs. 1 was an arbitrary choice).

Once that was fixed, testssl.sh output "NOT ok  (unknown, pls report) 26". So, the second thing this PR fixes is to output "NOT ok (unsupported certificate purpose)" if OpenSSL responds with an unsupported certificate purpose error.
2016-08-25 11:41:16 -04:00
David Cooper
12e3a3314a OpenSSL 1.1.0 doesn't have "-no_ssl2" option
With OpenSSL 1.1.0, `s_client -no_ssl2` fails with an "unknown option" error. At the moment the `-no_ssl2` option is only used in two functions, `run_client_simulation()` and `run_crime()`. In `run_crime()`, the `-no_ssl2` option is only included if the OpenSSL version is 0.9.8.

This PR checks whether the OpenSSL version in use supports the `-no_ssl2` option, and if it doesn't, it removes it from the calls to `s_client` in `run_client_simulation()`.
2016-08-24 10:14:12 -04:00
David Cooper
7cfe97f23a Warning on BEAST when no local SSLv3 support
If the version of OpenSSL being used doesn't support `s_client -ssl3` (e.g., OpenSSL 1.1.0), `run_beast()` doesn't display a warning that testing for CBC in SSLv3 isn't locally supported.

This PR adds a "Local problem" warning if the OpenSSL being used doesn't support `s_client -ssl3`.
2016-08-23 12:37:22 -04:00
David Cooper
0fcb2bcb44 Fix SSLv2-only test in determine_optimal_proto()
The test for whether a server only supports SSLv2 was broken, since `$OPTIMAL_PROTO` will be `-ssl2` whether SSLv2 is the only protocol that succeeds or no protocol succeeds.

This PR sets $OPTIMAL_PROTO (or $STARTTLS_OPTIMAL_PROTO) to "" if no protocol succeeds.
2016-08-23 12:29:31 -04:00
David Cooper
38abfeb1e5 Return 0 even if test couldn't be performed 2016-08-23 11:35:03 -04:00
David Cooper
7dd1d15e9a run_ssl_poodle() when OpenSSL doesn't support SSLv3
If the version of OpenSSL being used doesn't support `s_client -ssl3` (e.g., OpenSSL 1.1.0), `run_ssl_poodle()` displays `not vulnerable (OK)` even though it can't test whether the server is vulnerable.

This PR fixes it so that a "Local problem" warning is displayed is `s_client -ssl3` isn't supported.

The PR also removes the `$SNI` from the call to `$OPENSSL s_client` since OpenSSL ignores the `-servername` directive for `-ssl3` anyways.
2016-08-23 11:31:04 -04:00
David Cooper
2b7a77979c Fix "--devel" with SSLv2
If testssl.sh is called with `--devel 22` and the response from `sslv2_sockets()` is not 0, then `tls_sockets()` will be called, and the result of the `tls_sockets()` command will be output rather than the result of the `sslv2_sockets()` command.
2016-08-11 14:40:20 -04:00
David Cooper
358a4082e8 Move printing of results out of sslv2_sockets()
This PR addresses the "FIXME" in `run_protocols()`:
```
      sslv2_sockets                                                    #FIXME: messages/output need to be moved to this (higher) level
```
It also changes `run_drown()` to call `sslv2_sockets()` in order to avoid duplicate code.
2016-08-11 14:16:33 -04:00
David Cooper
50d2ef18ca Replace sockread() with sockread_serverhello()
This PR is in response to issue #352, where it was noted that Bash does not support binary data in strings.

I replaced all calls to `sockread()` with calls to `sockread_serverhello()`, and then, since is now used everywhere and not just to read ServerHello messages, I renamed `sockread_serverhello()` to `sockread()`.

I tested the revised code against several servers, including one that is vulnerable to CCS and Heartbleed, and got the same results as with the current code (although the hexdumps displayed in debug mode differ).

One concern I have is the code in `run_ccs_injection()`. The current code is:
```
     byte6=$(echo "$SOCKREPLY" | "${HEXDUMPPLAIN[@]}" | sed 's/^..........//')
     lines=$(echo "$SOCKREPLY" | "${HEXDUMP[@]}" | count_lines )
     debugme echo "lines: $lines, byte6: $byte6"

     if [[ "$byte6" == "0a" ]] || [[ "$lines" -gt 1 ]]; then
          pr_done_best "not vulnerable (OK)"
...
```
I revised this to:
```
     if [[ -s "$SOCK_REPLY_FILE" ]]; then
          byte6=$(hexdump -ve '1/1 "%.2x"' "$SOCK_REPLY_FILE" | sed 's/^..........//')
          lines=$(hexdump -ve '16/1 "%02x " " \n"' "$SOCK_REPLY_FILE" | count_lines )
          debugme echo "lines: $lines, byte6: $byte6"
     fi
     rm "$SOCK_REPLY_FILE"
     if [[ "$byte6" == "0a" ]] || [[ "$lines" -gt 1 ]]; then
...
```
In the revised code `byte6` is initialized to `0a` so that the response is `not vulnerable (OK)` if `$SOCK_REPLY_FILE` is empty. This has worked okay since for all of the servers that I tested that weren't vulnerable `$SOCK_REPLY_FILE` was empty. Since I haven't seen any other examples, I don't understand why check for vulnerability was written the way it was. So, I'm a bit concerned that the test in the revised code may produce incorrect results now that `hexdump -ve '1/1 "%.2x"' "$SOCK_REPLY_FILE"` is an accurate hexdump of the reply.
2016-08-10 16:14:32 -04:00
David Cooper
f9a4ab51b2 Merge branch 'master' into server_preference_sslv2_fixes 2016-07-26 13:36:15 -04:00
David Cooper
1a091c1a9a Merge branch 'master' into openss2rfc_rfc2openssl 2016-07-26 13:35:11 -04:00
David Cooper
1add0f86f9 Merge branch 'master' into more_sslv2_sslv3_fixes
Conflicts:
	testssl.sh
2016-07-26 13:33:49 -04:00
Dirk Wetter
48f2dc20a6 Merge pull request #428 from dcooper16/determine_optimal_proto_ssl2_fix
SSLv2 fixes for determine_optimal_proto()
2016-07-26 18:29:49 +02:00
Dirk Wetter
3f550d14cf Merge pull request #429 from dcooper16/old_openssl_warning
Don't ignore response to old OpenSSL warning
2016-07-26 18:27:33 +02:00
David Cooper
746eab7f6b Fix two minor typos
Fixes for two minor typos that were previously included in PR #345.
2016-07-26 12:07:08 -04:00
David Cooper
72bbdbf49b Remove fixes for minor typos 2016-07-26 12:00:46 -04:00
David Cooper
4ed1f2fc11 Don't ignore response to old OpenSSL warning
In the check for old versions of OpenSSL, the results of the call to `ignore_no_or_lame()` are ignored, and so the program continues even if the user enters `no`.
2016-07-26 11:29:25 -04:00
David Cooper
bc6367d3ad Update testssl.sh 2016-07-26 11:21:23 -04:00
David Cooper
b43562aabf Update testssl.sh 2016-07-26 11:13:45 -04:00
David Cooper
23d311b1fc SSLv2 fixes for determine_optimal_proto()
This PR makes three changes to `determine_optimal_proto()`:
* It no longer tries an empty string for `$OPTIMAL_PROTO` twice.
* It does not include `-servername` for `-ssl2` or `-ssl3`, since some versions of OpenSSL that support SSLv2 will fail if `s_client` is provided both the `-ssl2` and `-servername` options.
* It displays a warning if `$OPTIMAL_PROTO` is `-ssl2`, since some tests in testssl.sh will not work correctly for SSLv2-only servers.
2016-07-26 11:10:20 -04:00
David Cooper
e9a2d27af3 Remove determine_optimal_proto() fix 2016-07-26 11:04:43 -04:00
David Cooper
d67fff3223 SSLv2 fixes for server preference
This PR addresses two issues related to SSLv2 for "--server-preference" checks.

First, some versions of OpenSSL that support SSLv2 will fail if `s_client` is provided both the `-ssl2` and `-servername` options.

Second, the line for extracting the chosen cipher,`cipher=$(awk '/Cipher.*:/ { print $3 }' $TMPFILE)`, fails for SSLv2. For SSLv2, the output from `$OPENSSL s_client` is as shown below, and the `cipher=` line extracts the word `between` from `Ciphers common between both SSL endpoints:` rather than `IDEA-CBC-MD5` from `   Cipher    : IDEA-CBC-MD5`.

```
...
Ciphers common between both SSL endpoints:                                                                                                                                                                   
RC4-MD5         RC2-CBC-MD5     IDEA-CBC-MD5                                                                                                                                                                 
DES-CBC-MD5     DES-CBC3-MD5                                                                                                                                                                                 
---                                                                                                                                                                                                          
SSL handshake has read 1191 bytes and written 373 bytes                                                                                                                                                      
---                                                                                                                                                                                                          
New, SSLv2, Cipher is IDEA-CBC-MD5                                                                                                                                                                           
Server public key is 2048 bit                                                                                                                                                                                
Secure Renegotiation IS NOT supported                                                                                                                                                                        
Compression: NONE                                                                                                                                                                                            
Expansion: NONE                                                                                                                                                                                              
No ALPN negotiated                                                                                                                                                                                           
SSL-Session:                                                                                                                                                                                                 
    Protocol  : SSLv2                                                                                                                                                                                        
    Cipher    : IDEA-CBC-MD5
...
```
2016-07-26 10:22:36 -04:00
David Cooper
93ba2e5d65 Remove some server preference fixes 2016-07-26 10:11:22 -04:00
David Cooper
46323602b1 Merge branch 'master' into openss2rfc_rfc2openssl 2016-07-26 08:51:10 -04:00
David Cooper
6bd6b8959c Merge branch 'master' into more_sslv2_sslv3_fixes 2016-07-26 08:48:01 -04:00
Dirk Wetter
5a763ff8e1 Merge pull request #424 from dcooper16/run_rc4_ssl2_ciphers
SSLv2 fixes for run_rc4()
2016-07-26 12:08:17 +02:00
David Cooper
add75caf82 SSLv2 fixes for test_just_one()
This PR changes test_just_one() to correctly handle SSLv2 ciphers.

As with PR #424, this PR addresses the problem in which servers that do not implement SSLv2, but that implement RC4-MD5, EXP-RC2-CBC-MD5, EXP-RC4-MD5, or NULL-MD5 are shown as implementing both the SSLv2 and SSLv3 versions of the ciphers, and that any SSLv2 ciphers that a server does implement are not shown as being implemented.
2016-07-25 17:00:49 -04:00
David Cooper
db0a6db620 Remove fixes for test_just_one() 2016-07-25 16:54:19 -04:00
David Cooper
43d5ad5071 SSLv2 fixes for run_rc4()
This PR changes run_rc4() to correctly handle SSLv2 ciphers.

It addresses the problem in which servers that do not implement SSLv2, but that implement SSLv3 ciphers that share an OpenSSL name with an SSLv2 cipher (RC4-MD5 and EXP-RC4-MD5), are not incorrectly shown as having implemented the SSLv2 cipher.

It also addresses the problem that if a server does implement SSLv2 with an RC4 SSLv2-cipher suite, then that cipher suite it not shown as being implemented.
2016-07-25 16:42:04 -04:00
David Cooper
d2f1e15243 Remove fixes for run_rc4() 2016-07-25 16:30:30 -04:00
David Cooper
b142962063 Merge branch 'master' into more_sslv2_sslv3_fixes 2016-07-25 16:24:35 -04:00
David Cooper
bb29e3c917 Merge branch 'master' into run_allciphers(),run_cipher_per_proto(),-and-SSLv2 2016-07-25 09:39:28 -04:00
David Cooper
6d164d8a2e Merge branch 'master' into openss2rfc_rfc2openssl 2016-07-25 09:38:05 -04:00
David Cooper
36a3230b84 Merge branch 'master' into more_sslv2_sslv3_fixes 2016-07-25 09:36:50 -04:00
Frank Breedijk
dd10194977 Addressed comments by @drwetter
It is OK for a site to pin a CA that is not part of the chain (like github.com does)
This is a provision against a CA compromise (like diginotar) which could lead to a
briked site in case of CA compromise.

GitHub has built in multiple levels of security they have both backup pins for host
certs and back pins for CAs (and I wouldn;t be surprised if they have a backup
intermediate pin too).
2016-07-25 11:02:05 +02:00
Frank Breedijk
9133eddb9a Working unit tests again 2016-07-25 10:57:10 +02:00
Frank Breedijk
fccc5fe4fb Merge branch 'CA_pinning' of https://github.com/drwetter/testssl.sh into CA_pinning 2016-07-25 09:38:30 +02:00
Dirk
541690b46e - enabled+renamed tolerance test per default
- quoted some bool vars for faster execution
2016-07-23 15:12:13 +02:00
Dirk Wetter
38b61ed36f Merge pull request #346 from dcooper16/version_negotiation
Additional checks in run_protocols()
2016-07-23 14:54:50 +02:00
Dirk
3d588ddb20 change sequence of out output (trust checks together 2016-07-23 14:52:26 +02:00
Dirk Wetter
0c2acdd8fe Merge pull request #420 from dcooper16/signed-signed-check
Fix check for self-signed certificate
2016-07-23 14:47:14 +02:00
Dirk
1a099d35b7 - minor polishing #419 2016-07-23 11:17:49 +02:00
David Cooper
ae38670067 Fix check for self-signed certificate
The check for whether a certificate is self-signed was using the undefined variable $CN rather than $cn.
2016-07-22 12:06:52 -04:00
David Cooper
df64e47fb9 CN <--> hostname match
PR to address issue #94 (CN <--> hostname match)
2016-07-22 11:31:52 -04:00
David Cooper
603ed33f57 Merge branch 'master' into version_negotiation 2016-07-20 13:39:11 -04:00
David Cooper
6730ed8340 Merge branch 'master' into run_allciphers(),run_cipher_per_proto(),-and-SSLv2 2016-07-20 13:37:54 -04:00
David Cooper
89df7c5ec2 Merge branch 'master' into openss2rfc_rfc2openssl 2016-07-20 13:36:12 -04:00
David Cooper
e8d10a5e05 Merge branch 'master' into more_sslv2_sslv3_fixes 2016-07-20 13:34:39 -04:00
Dirk Wetter
82c8663b4f speed improvement due to using a precomputed hash table for known CAs 2016-07-20 19:12:02 +02:00
Dirk Wetter
fad41b059f - first set of patches 2016-07-20 19:01:02 +02:00
Dirk Wetter
535c37fbb3 Merge branch 'feature/ca-pinning' of https://github.com/seccubus/testssl.sh into seccubus-feature/ca-pinning 2016-07-20 18:47:05 +02:00
David Cooper
bdea1a0971 Merge branch 'master' into issuer2
Conflicts:
	testssl.sh
2016-07-20 11:45:08 -04:00
Dirk Wetter
6e5c2a824e merged #416 2016-07-20 17:38:55 +02:00
David Cooper
346c52dc7c CA names with domain component attributes
`certificate_info()` does not correctly display the Issuer name for CAs that use domain component attributes.

There is a server on the NIST intra-net that I test against that has a certificate issued by a NIST CA, and the issuer name in the certificate is of the form: `/DC=net/DC=example/DC=internal/CN=CAname`

Since there is no organizational name, testssl.sh displays the name as:
```
 Issuer                       "CAname" ("")
```
In this PR, if the Issuer name has 'DC=' attributes, but does not have an 'O=' attribute, the "DC=" attributes are combined into a DNS name that is used as if it were the organizational name:
```
 Issuer                       "CAname" ("internal.example.net")
```
I should note, however, that I have not been able to find any other examples of TLS server certificates that have been issued by CAs that have domain components ("DC=") in their names. So, it may not be worthwhile to change the code to try to accommodate such CAs.
2016-07-20 11:37:51 -04:00
David Cooper
d9f8024d9a Fix JSON output of Issuer name
`certificate_info()` currently outputs `$issuer` to the JSON file, where is should be outputting `$issuer_CN` in order for the information in the JSON file to match the information that is displayed.

This PR also fixes the problem that if an Issuer name contains a domain component attribute (DC=) then it will be mistakenly treated as a country attribute (C=).
2016-07-20 10:50:38 -04:00
Dirk
5de3ef3e22 Merge branch 'run_pfs_curves' of https://github.com/dcooper16/testssl.sh into dcooper16-run_pfs_curves
Conflicts:
	testssl.sh
2016-07-16 21:21:18 +02:00
Dirk
0c22ea9a0e - output polising in curves
- fix for jail #258
2016-07-16 20:48:56 +02:00
David Cooper
a06ac81df3 Speed up finding supported curves
Rather than try each curve one at a time, follow model in `cipher_pref_check()`.  First include all curves in ClientHello, then successively remove from the ClientHello those curves that have been offered by the server until the connection fails. This makes the number of calls to `$OPENSSL s_client` one more than the number of supported curves rather than the number of curves in NamedCurve supported by $OPENSSL.

Note, however, that OpenSSL defines MAX_CURVELIST as 28 and fails if the `-curves` option includes more than 28 curves. Since OpenSSL 1.1.0 offers 29 curves from NamedCurve, this PR breaks the list of supported curves in 2. At the cost of one additional calls to `$OPENSSL s_client` it ensures that the number of curves provides to the `-curves` option is below the limit.
2016-07-14 13:23:50 -04:00
Thomas Patzke
be5004741c Added port numbers to log and result output files 2016-07-12 16:34:20 +02:00
Thomas Patzke
a288954d36 Added --openssl-timeout parameter
In some cases OpenSSL processes hanged indefinitely while scans. This
new parameter allows to wrap the "timeout" tool around the openssl
invocation.
2016-07-12 16:30:01 +02:00
Dirk
bda62ec715 no glasses needed, just need to look at the right spot ;- 2016-07-11 19:41:32 +02:00
Dirk
5f47359291 polishing output for #413 2016-07-11 18:44:28 +02:00
Dirk Wetter
400e969585 Merge pull request #413 from dcooper16/test_curves
Determine support elliptic curves for ECDHE- ciphers
2016-07-11 18:11:09 +02:00
David Cooper
891c56f8bf Determine support elliptic curves for ECDHE- ciphers
This PR extends run_pfs() to display the set of elliptic curves supported by the server, if the server supports any ECDHE- ciphers.
2016-07-11 11:00:56 -04:00
David Cooper
fb94221ce0 Reorder supported curves
Reorder the supported curves sent by socksend_tls_clienthello() from strongest to weakest.
2016-07-11 10:52:48 -04:00
David Cooper
f968bd8346 Merge branch 'master' into version_negotiation 2016-07-11 10:45:59 -04:00
David Cooper
197bee8658 Merge branch 'master' into run_allciphers(),run_cipher_per_proto(),-and-SSLv2 2016-07-11 10:44:37 -04:00
David Cooper
c6373a181f Merge branch 'master' into openss2rfc_rfc2openssl 2016-07-11 10:43:35 -04:00
David Cooper
08953416e8 Merge branch 'master' into more_sslv2_sslv3_fixes 2016-07-11 10:42:28 -04:00
Dirk Wetter
16087f8252 Merge pull request #411 from welwood08/patch-2
Server cipher order NPN tests should use SNI
2016-07-11 16:24:45 +02:00
Dirk
3e8d5208dc further fix, see #410 2016-07-11 16:20:36 +02:00
Will Elwood
2573a9b8b8 More SNI for NPN tests
Found another NPN test (for the case where server doesn't specify cipher order?) that wasn't using SNI.
Also found a comment saying proxies don't support NPN => removed `$PROXY` from all modified lines.
2016-07-11 14:37:20 +01:00
Will Elwood
382d22648a Server cipher order NPN tests should use SNI
I noticed the NPN parts of this test were not returning any ECDSA ciphers where I expected them to match the results of the immediately preceding TLS 1.2 test. Found it wasn't using SNI so my test server was using the default domain (snakeoil RSA certificate) instead of the tested domain (dual ECDSA/RSA certificates).
2016-07-11 14:15:50 +01:00
Will Elwood
3c39396391 Unreadable SAN list on FreeBSD
On FreeBSD, sed does not support "\n" in the replacement string of a substitution. The SANs are currently output all together inside a single pair of quotes and each separated with an "n" character, needless to say this is very difficult to read.

After a little digging, it seems this is a somewhat recent regression of the fix in #173. I believe `tr` would be a more cross-platform way to do this, and several sources (including the author of that PR) would seem to agree - assuming the newline is now necessary.

It doesn't appear to matter what order the newline replacement happens amongst all the other replacements, so I have placed it first simply to avoid extending any already-long lines. Please correct me if this deduction is false.
2016-07-11 13:35:55 +01:00
David Cooper
f216cbe61f Merge branch 'master' into version_negotiation 2016-07-08 09:39:12 -04:00
David Cooper
02a39e4859 Merge branch 'master' into run_allciphers(),run_cipher_per_proto(),-and-SSLv2 2016-07-08 09:38:06 -04:00
David Cooper
dfa92445ee Merge branch 'master' into openss2rfc_rfc2openssl 2016-07-08 09:37:09 -04:00
David Cooper
788042ba37 Merge branch 'master' into more_sslv2_sslv3_fixes 2016-07-08 09:35:52 -04:00
Dirk
af4117aa7a FIX #404 2016-07-08 11:25:41 +02:00
Dirk
8c11334030 FIX #405 2016-07-08 11:15:41 +02:00
Dirk Wetter
57bf01a360 Merge pull request #402 from dcooper16/poodle
Check for all CBC ciphers in Poodle test
2016-07-08 10:04:49 +02:00
Thomas Ward
de05711e5a Fix grammar issue in help output for --openssl
Missing a closing parentheses `)`.
2016-07-06 14:23:32 -04:00
David Cooper
ec6c0ce605 Check for all CBC ciphers in Poodle test
This PR should address issue #399.

I created the list of ciphers using the CIPHERS_BY_STRENGTH file from PR #373, making a list of all ciphers that had "CBC" in the RFC name and for which I had been able to find a corresponding OpenSSL name. Then, since that list contained more than 128 ciphers, I removed any ciphers from the list where the name ended in "-SHA256" or "-SHA384", as it is my understanding that those ciphers can only be used with TLS 1.2.
2016-07-06 10:52:54 -04:00
Frank Breedijk
02fb4ef9ca Debug begone 2016-07-06 00:12:48 +02:00
Frank Breedijk
845e6c13a3 And we have unit tests too (and found some bugs in the process) 2016-07-05 23:55:19 +02:00
Frank Breedijk
95e42b2fdf Better displaying of findings 2016-07-05 23:33:20 +02:00
Frank Breedijk
5ea49c1433 Merge branch 'master' of https://github.com/drwetter/testssl.sh into feature/ca-pinning 2016-07-05 18:15:46 +02:00
Frank Breedijk
07f91a54bf Fixed the encoding for root/intermediate CAs now. 2016-07-05 18:10:36 +02:00
David Cooper
b6accbe737 Merge branch 'master' into version_negotiation 2016-07-05 10:24:53 -04:00
David Cooper
1102ef324c Merge branch 'master' into run_allciphers(),run_cipher_per_proto(),-and-SSLv2 2016-07-05 10:23:13 -04:00
David Cooper
ad92ca8519 Merge branch 'master' into openss2rfc_rfc2openssl 2016-07-05 10:21:30 -04:00
David Cooper
6ec00c33db Merge branch 'master' into more_sslv2_sslv3_fixes
Conflicts:
	testssl.sh
2016-07-05 10:19:53 -04:00
Dirk
0217992553 fixed error where an URI in X509v3 Issuer Alternative Name was displayed and an URI in SAN 2016-07-05 00:08:51 +02:00
Dirk
d2f2dab7fb fix regression lf in CN 2016-07-05 00:02:34 +02:00
Dirk
2bba19360f see #401, part 2 2016-07-04 23:52:52 +02:00
Dirk Wetter
251e3f9a3b Merge pull request #371 from dcooper16/fix_issue_276
Fix issue #276
2016-07-04 23:25:13 +02:00
Dirk
0b5705fff4 FIX #258, FIX #398
partly addressed: #246
2016-07-04 23:05:12 +02:00
Frank Breedijk
e280cac2af Without bash-bsd check 2016-07-04 17:30:32 +02:00
Frank Breedijk
4efb6531c2 Merge branch 'master' of https://github.com/drwetter/testssl.sh into issues/258 2016-07-04 17:28:06 +02:00
Frank Breedijk
3049425740 Checks for CA and intermediate pins too. Need to clean up output and write unit tests 2016-07-04 17:25:48 +02:00
Frank Breedijk
a648470988 Not done yet, but the basic code is working 2016-07-04 17:21:24 +02:00
Dirk
f01bff973a renamed function, better banner for logging 2016-07-04 13:59:39 +02:00
Dirk
491a03233b updating neat_list() to be faster and more compatible to openssl 1.1.0 with new chacha/poly ciphers 2016-07-03 22:35:21 +02:00
Dirk
d5242c255e FIX #384 2016-07-03 21:45:49 +02:00
Frank Breedijk
946506f3ac This Fixes #258 - Checks if /dev/fd is mounted on FreeBSD 2016-07-03 19:52:48 +02:00
Dirk
32f249b0c2 enabling sockets for client testing per default #375 2016-07-01 18:26:05 +02:00
Dirk
2362cd8745 wording for GOST sig algos and keys 2016-07-01 12:03:46 +02:00
David Cooper
a8f3223100 Fix typo
Fix typo in parsing $CIPHERS_BY_STRENGTH_FILE.
2016-06-30 13:50:47 -04:00
David Cooper
0af62efb4f Merge branch 'master' into version_negotiation 2016-06-29 11:03:45 -04:00
David Cooper
a534b8de5f Merge branch 'master' into run_allciphers(),run_cipher_per_proto(),-and-SSLv2 2016-06-29 11:02:14 -04:00
David Cooper
c4d6f3fb58 Merge branch 'master' into openss2rfc_rfc2openssl
Conflicts:
	testssl.sh
2016-06-29 09:59:52 -04:00
David Cooper
df55d4af51 Merge branch 'master' into more_sslv2_sslv3_fixes 2016-06-29 09:57:38 -04:00
David Cooper
53dec241f1 Merge branch 'master' into fix_issue_276 2016-06-29 09:56:08 -04:00
Dirk
36d300b74e add line when using sockets for client simulation 2016-06-28 12:21:50 +02:00
David Cooper
be85fbf2b7 Update IE client simulation data
Change client data for IE 8-10 and IE 11 to match ssllabs.
2016-06-24 16:14:41 -04:00
David Cooper
799c6a5fd0 Handle missing $MAPPING_FILE_RFC
Changed code for run_client_simulation() so that cipher is output when sockets are used even if $MAPPING_FILE_RFC is missing. Also, updated the client data.
2016-06-24 15:48:40 -04:00
David Cooper
b6ccdec614 Merge branch 'master' into version_negotiation 2016-06-24 13:27:35 -04:00
David Cooper
31c3a87a72 Merge branch 'master' into run_allciphers(),run_cipher_per_proto(),-and-SSLv2 2016-06-24 13:26:28 -04:00
David Cooper
d30dbe3c41 Merge branch 'master' into openss2rfc_rfc2openssl 2016-06-24 13:25:11 -04:00
David Cooper
0adac7a9a4 Merge branch 'master' into more_sslv2_sslv3_fixes 2016-06-24 13:24:17 -04:00
David Cooper
f2077b7726 Merge branch 'master' into fix_issue_276 2016-06-24 13:23:07 -04:00
David Cooper
0e58e272f8 Merge branch 'master' into client_sim_sockets
Conflicts:
	testssl.sh
2016-06-24 13:18:25 -04:00
Dirk
5cb4b722b4 in client simulation it should be TLSv1.0 instead of TLSv1.0 2016-06-24 19:01:00 +02:00
Dirk
93204937c5 FIX #376 2016-06-23 19:42:26 +02:00
David Cooper
dd8788d670 Merge branch 'master' into fix_issue_276 2016-06-23 09:42:18 -04:00
David Cooper
8c14ba37d6 Merge branch 'master' into more_sslv2_sslv3_fixes 2016-06-23 09:40:34 -04:00
David Cooper
549d432dc7 Merge branch 'master' into openss2rfc_rfc2openssl 2016-06-23 09:38:04 -04:00
David Cooper
df2904edbf Merge branch 'master' into run_allciphers(),run_cipher_per_proto(),-and-SSLv2 2016-06-23 09:36:58 -04:00
David Cooper
df4edd4152 Merge branch 'master' into version_negotiation 2016-06-23 09:36:06 -04:00
David Cooper
bebdc3c70e Merge branch 'master' into client_sim_sockets 2016-06-23 09:24:54 -04:00
Dirk
68353db42b polishing #382 2016-06-23 14:33:26 +02:00
Dirk Wetter
31c8979d41 Merge pull request #382 from seccubus/mass_and_file_out
Allow the file output feature and mass_test feature to work together
2016-06-23 13:40:09 +02:00
Dirk Wetter
b5b9dd8712 Merge pull request #387 from bad/master
porting to NetBSD
2016-06-23 12:15:02 +02:00
Dirk
ef23703903 fix for #389 2016-06-23 12:04:45 +02:00
Florian Schuetz
18c5f273c3 HSTS: check if max-age is present and nonzero 2016-06-21 21:24:24 +02:00
Florian Schuetz
f8579ee2f7 Fix HSTS/HPKP includeSubDomains and preload being broken in file output. 2016-06-21 08:57:39 +02:00
Christoph Badura
0fd261eb6c Refactor date parsing. Makes testssl.sh work on NetBSD too.
Introduce a parse_date() function to handle all date parsing.
Check for the following date(1) variants:
GNU: accepts "-d date-to-parse".
FreeBSD/OS X: accepts "-j -f input-format"
everything else: accepts "-j date-to-parse"

usage: parse-date date output-format input-format

Tested on NetBSD, OS X 10.11 and Debian jessie.
2016-06-20 22:01:13 +02:00
Christoph Badura
48d5e5a7a1 Drop remaining '\c's in printf(1) arguments. 2016-06-20 22:01:13 +02:00
David Cooper
b8b779b419 Use sockets for client simulations
Modify run_client_simulation() to send the ClientHello from https://api.dev.ssllabs.com/api/v3/getClients (modified to use the correct value in the server name extension) if $EXPERIMENTAL is true, $STARTTLS is empty, and $SSL_NATIVE is false.
2016-06-17 16:33:00 -04:00
David Cooper
1275ce5ed2 Merge branch 'master' into version_negotiation 2016-06-17 16:18:09 -04:00
David Cooper
0a51239cda Merge branch 'master' into run_allciphers(),run_cipher_per_proto(),-and-SSLv2 2016-06-17 16:17:31 -04:00
David Cooper
5a5424653b Merge branch 'master' into openss2rfc_rfc2openssl
Conflicts:
	testssl.sh
2016-06-17 16:16:38 -04:00
David Cooper
aeef882476 Merge branch 'master' into more_sslv2_sslv3_fixes 2016-06-17 16:14:59 -04:00
David Cooper
2b4d10137a Merge branch 'master' into fix_issue_276 2016-06-17 16:14:24 -04:00
Dirk Wetter
02e9f5cd23 fix colum spacing again for all alg chacha poly ciphers 2016-06-15 21:31:10 +02:00
Dirk Wetter
d10dd6d34c align old chacha/poly ciphers output in OPENSSL name, see #379 2016-06-15 20:12:48 +02:00
Frank Breedijk
3b1d8b6253 Need to deal with the comma correctly if we are appending to a file 2016-06-14 10:36:57 +02:00
David Cooper
4114db6663 Another update to ChaCha20 cipher names 2016-06-13 16:11:23 -04:00
David Cooper
8053e42e0f Update ChaCha20 cipher names
In accordance with PR #381, updated the ChaCha20 cipher names, then realigned the columns since the new cipher names are longer than any previously encountered cipher name.
2016-06-13 15:23:23 -04:00
David Cooper
b590ecedcf Merge branch 'master' into version_negotiation 2016-06-13 15:03:11 -04:00
David Cooper
321a8bfe57 Merge branch 'master' into run_allciphers(),run_cipher_per_proto(),-and-SSLv2 2016-06-13 15:02:20 -04:00
David Cooper
35deb6a40d Merge branch 'master' into more_sslv2_sslv3_fixes 2016-06-13 15:00:52 -04:00
David Cooper
42674ef2b8 Merge branch 'master' into openss2rfc_rfc2openssl 2016-06-13 15:00:09 -04:00
David Cooper
5f120f8021 Merge branch 'fix_issue_276' of https://github.com/dcooper16/testssl.sh into fix_issue_276 2016-06-13 14:57:51 -04:00
David Cooper
3420c86e7f Merge branch 'master' into fix_issue_276 2016-06-13 14:55:55 -04:00
David Cooper
1d0c8cb3f8 Printing of subjectAltName extension
Modify the extraction of the subjectAltName extension from certificates in order to address SANs with name forms other than DNS and otherName.
2016-06-13 12:52:19 -04:00
David Cooper
b264714fd9 Add check of IP address
compare_server_name_to_cert() now checks the DNS names and IP addresses in the subjectAltName extension for a match.
2016-06-13 11:09:15 -04:00
Frank Breedijk
701545dbb6 Allow the file output feature and mass_test feature to work together 2016-06-13 15:35:56 +02:00
David Cooper
b7fe461a6c Merge branch 'master' into openss2rfc_rfc2openssl 2016-06-10 15:34:00 -04:00
David Cooper
706db7553f Merge branch 'master' into more_sslv2_sslv3_fixes 2016-06-10 15:30:56 -04:00
David Cooper
76ea57863a Merge branch 'master' into run_allciphers(),run_cipher_per_proto(),-and-SSLv2 2016-06-10 15:29:00 -04:00
David Cooper
f84ebd99b5 Merge branch 'master' into fix_issue_276 2016-06-10 15:27:46 -04:00
David Cooper
52d6eabdf7 Merge branch 'master' into version_negotiation
Conflicts:
	testssl.sh
2016-06-10 15:26:29 -04:00
David Cooper
8c86049848 run_cipher_per_proto() 128-cipher limit
Ensure that neither run_allciphers() nor run_cipher_per_proto() sends a ClientHello with 128 or more cipher suites.
2016-06-10 13:45:25 -04:00
David Cooper
b566da94f5 Revised to use arrays
Here is a revision that creates a mapping file (similar to mapping.txt, but that mirrors the formatting of "$OPENSSL ciphers -V" and that includes all cipher suites, even ones for which there is no OpenSSL name), loads the contents of the file into arrays, and then uses the arrays to implement openssl2rfc() and rfc2openssl().
2016-06-10 11:11:39 -04:00
David Cooper
b8348c6454 Merge branch 'master' into version_negotiation 2016-06-09 10:21:49 -04:00
David Cooper
bf4134844c Merge branch 'master' into run_allciphers(),run_cipher_per_proto(),-and-SSLv2 2016-06-09 10:21:09 -04:00
David Cooper
c20d2dfc6f Merge branch 'master' into more_sslv2_sslv3_fixes 2016-06-09 10:20:20 -04:00
David Cooper
c1624782d5 Merge branch 'master' into openss2rfc_rfc2openssl 2016-06-09 10:18:29 -04:00
David Cooper
189fe662f5 Merge branch 'master' into fix_issue_276 2016-06-09 10:17:49 -04:00
Dirk
adbb1932eb simplified cipher and protocol retrieval in 'Testing server preferences' 2016-06-09 15:56:53 +02:00
David Cooper
c656015312 Merge branch 'master' into version_negotiation
Conflicts:
	testssl.sh
2016-06-09 09:34:37 -04:00
David Cooper
d2bded1114 Merge branch 'master' into run_allciphers(),run_cipher_per_proto(),-and-SSLv2 2016-06-09 09:33:05 -04:00
David Cooper
aa9eeaf6af Merge branch 'master' into more_sslv2_sslv3_fixes
Conflicts:
	testssl.sh
2016-06-09 09:31:46 -04:00
David Cooper
a46b6791db Merge branch 'master' into fix_issue_276 2016-06-09 09:29:40 -04:00
Dirk
5ceace33e0 - FIX #189 with a smart check, introduced global var SERVER_SIZE_LIMIT_BUG
- introduced "has_server_protocol()" which can be used to check b4 connecting if protocol is a/v
2016-06-09 11:04:40 +02:00
David Cooper
eb9e2d85a0 Merge branch 'master' into version_negotiation 2016-06-08 13:47:35 -04:00
David Cooper
ce9b277b2c Merge branch 'master' into run_allciphers(),run_cipher_per_proto(),-and-SSLv2 2016-06-08 13:47:01 -04:00
David Cooper
b5765bfda0 Merge branch 'master' into openss2rfc_rfc2openssl 2016-06-08 13:46:18 -04:00
David Cooper
90fcb3500c Merge branch 'master' into more_sslv2_sslv3_fixes 2016-06-08 13:45:22 -04:00
David Cooper
a224bb5068 Merge branch 'master' into fix_issue_276 2016-06-08 13:44:16 -04:00
David Cooper
5e3d4d127c Mask error when no $MAPPING_FILE_RFC
Redirect error output to $ERRFILE if $MAPPING_FILE_RFC is missing.
2016-06-08 12:07:23 -04:00
David Cooper
4750c3f0d5 Adding x25519 and x448 to ClientHello
This added x25519 and x448 to the list of supported elliptic curves in the ClientHello created by socksend_tls_clienthello().
2016-06-08 11:25:47 -04:00
David Cooper
5edd005df0 Merge branch 'master' into version_negotiation
Conflicts:
	testssl.sh
2016-06-08 09:52:45 -04:00
David Cooper
130aa350d2 Merge branch 'master' into run_allciphers(),run_cipher_per_proto(),-and-SSLv2 2016-06-08 09:48:18 -04:00
David Cooper
0c146ef7a1 Merge branch 'master' into openss2rfc_rfc2openssl 2016-06-08 09:47:37 -04:00
David Cooper
cbb20bf661 Merge branch 'master' into more_sslv2_sslv3_fixes 2016-06-08 09:46:58 -04:00
David Cooper
eaad4c7dd8 Merge branch 'master' into fix_issue_276 2016-06-08 09:46:25 -04:00
Dirk Wetter
c929fba206 Merge pull request #342 from dcooper16/socksend_tls_clienthello_extensions
More extensions in socksend_tls_clienthello()
2016-06-08 10:39:17 +02:00
Dirk
d858edca1b - filled PROTOS_OFFERED w sense
- minor fixes for fileout
- introduced "fixme()"
2016-06-07 23:06:58 +02:00
David Cooper
253ba29cde openssl2rfc and rfc2openssl
This PR provides implementations of openssl2rfc and rfc2openssl. It also uses openssl2rfc() in run_server_preference() to help determine how to display the "negotiated cipher." I believe that using the RFC names addresses the current FIXME:

FIXME BEAST: We miss some CBC ciphers here, need to work w/ a list"
2016-06-07 14:02:48 -04:00
David Cooper
ec8420144d Merge branch 'master' into version_negotiation 2016-06-07 10:36:52 -04:00
David Cooper
c13ae4a001 Merge branch 'master' into socksend_tls_clienthello_extensions 2016-06-07 10:35:32 -04:00
David Cooper
c50f2cc796 Merge branch 'master' into run_allciphers(),run_cipher_per_proto(),-and-SSLv2 2016-06-07 10:33:21 -04:00
David Cooper
366025256b Merge branch 'master' into more_sslv2_sslv3_fixes
Conflicts:
	testssl.sh
2016-06-07 10:30:46 -04:00
David Cooper
a6d59b5380 Merge branch 'master' into fix_issue_276 2016-06-07 10:24:56 -04:00
Dirk
8ed6214b6f preliminary fix for #189 (SIZELMT_W_ARND=true needed) 2016-06-07 13:02:58 +02:00
Dirk
29072315e5 output correction for IPv6 and --ip=<addr 2016-06-07 09:08:48 +02:00
Dirk
6f4ba5bda7 - corrected handling of shortened warning periods for LE certs (dual certs were wrong)
- (kind of) readded cert_key_algo in output
- smaller output fixes e.g. for GOST certificates
2016-06-06 13:42:17 +02:00
Dirk Wetter
561cfa16fc - FIX #367 2016-06-02 21:31:24 +02:00
David Cooper
b1e2fc7448 Merge branch 'master' into version_negotiation 2016-06-02 09:19:37 -04:00
David Cooper
e8cc32af54 Merge branch 'master' into socksend_tls_clienthello_extensions 2016-06-02 09:16:45 -04:00
David Cooper
f5fcff22d6 Merge branch 'master' into run_allciphers(),run_cipher_per_proto(),-and-SSLv2 2016-06-02 09:14:20 -04:00
David Cooper
c593675b8e Merge branch 'master' into more_sslv2_sslv3_fixes 2016-06-02 09:09:57 -04:00
David Cooper
fc6b5070af Merge branch 'master' into fix_issue_276 2016-06-02 09:08:24 -04:00
Dirk Wetter
6a9b0e01fc - polishing #366 and IPv6-related 2016-06-02 09:59:52 +02:00
David Cooper
6825c0b363 Allow for certificates with no subjectAltName extension
While it seems that almost all certificates include a subjectAltName extension, need to allow for the possibility that the two certificates being compared don't have subjectAltName extensions.
2016-06-01 16:20:10 -04:00
David Cooper
3bc0d6b45c Fix issue #276
Here is my proposed change to fix issue #276.
2016-06-01 15:57:40 -04:00
David Cooper
a9cd3ec6ca Merge branch 'master' into version_negotiation
Conflicts:
	testssl.sh
2016-05-31 09:51:13 -04:00
typingArtist
2c69e83f5b https://github.com/drwetter/testssl.sh/issues/365 add UNBRACKETED_IPV6 quirks option
Since some OpenSSL binaries, namely Gentoo’s, don’t support bracketed
IPv6 addresses but unbracketed ones, specified as the -connect option,
the UNBRACKETED_IPV6 environment variable can be set to true for
disabling the automatic addition of brackets around IPv6 addresses on
such platforms.
2016-05-27 20:11:47 +02:00
typingArtist
cf62353fc6 https://github.com/drwetter/testssl.sh/issues/365 ensure DNS PTR lookups use un-bracketed IPv6 address
While standard OpenSSL requires the literal IPv6 address enclosed
in [brackets], standard DNS lookup tools don’t support the additional
characters. Before making reverse PTR lookups, these brackets have to
be removed from the IPv6 addresses.
2016-05-27 19:54:23 +02:00
Dirk Wetter
e1a8306286 - try to address #352
- WARNING in fileout is MEDIUM now
- NOT ok for medium on screen squashed
2016-05-27 17:43:45 +02:00
Dirk Wetter
6fb15e83fa global $OPENSSL_NR_CIPHERS 2016-05-26 12:56:55 +02:00
David Cooper
4d059f7106 Merge branch 'master' into version_negotiation 2016-05-25 16:57:37 -04:00
David Cooper
acc72a1daf Merge branch 'master' into socksend_tls_clienthello_extensions 2016-05-25 16:50:56 -04:00
David Cooper
a503d883c7 Merge branch 'master' into run_allciphers(),run_cipher_per_proto(),-and-SSLv2 2016-05-25 16:38:23 -04:00
David Cooper
f9757c4e4d Merge branch 'master' into more_sslv2_sslv3_fixes 2016-05-25 16:32:04 -04:00
David Cooper
2a4d987f31 Merged master fixed conflict. 2016-05-24 14:19:19 -04:00
David Cooper
e0c147ec86 run_pfs() and run_rc4() show each fixes
When run_rc4() is run with the "--show-each" option, but without the "--wide" option, a list of all RC4 ciphers is printed, without any distinction between those that are supported by the server and those that are not. This is the same issue I noted in #332 for run_pfs().

In run_pfs(), the displayed output was corrected, but all ciphers were still being added to $pfs_ciphers, so the list of supported PFS ciphers sent to fileout() was incorrect.

This PR fixes both issues.
2016-05-24 13:57:47 -04:00
Dirk
5a03e96304 - consequently removed "NOT ok" for not-av of TLS 1.2 2016-05-23 22:42:40 +02:00
Dirk Wetter
bf17a17b70 - 3DES in standard cipher list is medium, thus "NOT ok" is too much (need for elegant general way for "medium")
(see also https://www.keylength.com/en/8/)
2016-05-23 18:56:05 +02:00
Dirk Wetter
aa99c5eb88 - FIX #347
- LF removed in JSON
2016-05-20 13:45:53 +02:00
Dirk Wetter
803e363310 Merge pull request #356 from dcooper16/server_key_size
Fix typo in Server key size check
2016-05-20 08:16:48 +02:00
David Cooper
2ffed62d53 Recognize more signature algorithms
This PR adds to the list of signature algorithms recognized in certificate_info().
2016-05-19 16:45:56 -04:00
David Cooper
dccf9bef63 Fix typo in Server key size check
When certificate_info() is trying to determine what type of public key the server has so that it can determine whether the key size is acceptable, it sometimes looks at $cert_sig_algo rather than $cert_key_algo. This PR fixes that and also adds support for DSA public keys.
2016-05-19 16:39:06 -04:00
Dirk Wetter
9a1425da14 - FIX #354
- polish #353
2016-05-18 19:06:26 +02:00
David Cooper
2a0a382321 Don't use dec2hex
The dec2hex() was actually converting from hex to decimal. Since it was only being used in one place, and wasn't really needed there, I just deleted it.
2016-05-17 12:02:12 -04:00
David Cooper
cba7fddbdd Revised parse_tls_serverhello()
Revised parse_tls_serverhello() to more carefully check the response for errors, and to provide for more flexibility (e.g., if handshake messages are split across multiple fragments).
2016-05-16 16:52:51 -04:00
David Cooper
07a8bd3143 Support version negotiation test
The new test in PR #346 sends a TLSv1.4 ClientHello, so socksend_tls_clienthello() needs to include the signature algorithms extension if $tls_low_byte >= 3 rather than only if it is equal to 3.
2016-05-11 09:24:07 -04:00
Dirk Wetter
4eefe0df8b Merge pull request #314 from thomaspatzke/master
logfile, jsonfile and csvfile parameters work without =
2016-05-11 00:14:24 +02:00
David Cooper
1d4622ebab Additional checks in run_protocols()
One server I am testing responds to an SSLv3 ClientHello with TLSv1.2. If tls_sockets is being used, then testssl.sh responds with "#FIXME: downgraded. still missing a test case here." This PR fixes that, and in general checks the responses in run_protocols() more closely.

If tls_sockets is being used and the connection fails even though the server supports an earlier version of SSL/TLS, then it flags an error. If tls_sockets returns 2, then it verifies that $DETECTED_TLS_VERSION is equal to the highest version number supported by the server (that is also less than the version number in the ClientHello).

In addition, in order to test servers' support for version negotiation, it adds a new test that sends a TLSv1.4 ClientHello and verifies that the server responds with the highest version number that it supports. (This test only runs if both $using_sockets and $EXPERIMENTAL are true and server actually supports some version of SSL/TLS other than SSLv2.)
2016-05-06 15:12:53 -04:00
David Cooper
92c2b60d9b Signature Algorithms extension for TLSv1.2 only
Changed to only include the signature algorithms extension for TLSv1.2, since RFC 5246 says:

   Note: this extension is not meaningful for TLS versions prior to 1.2.
   Clients MUST NOT offer it if they are offering prior versions.
   However, even if clients do offer it, the rules specified in [TLSEXT]
   require servers to ignore extensions they do not understand.

Inclusion of the extension for TLS 1.1 didn't seem to cause any harm, but it seems better to follow the RFC and not include it for TLSv1.0 or TLSv1.1.
2016-05-05 17:08:40 -04:00
David Cooper
120a5c86ef Add padding extension
RFC 7685 notes that there is at least one TLS implementation that hangs if the client sends a ClientHello with a TLSCiphertext.length between 256 and 511 bytes, and so the padding extension was defined in order to get around this bug. (OpenSSL s_client includes this extension when the -bugs option is used.) So, I changed socksend_tls_clienthello() to include the padding extension if the CLientHello would have a length between 256 and 511 bytes, making the padding extension just large enough to make the ClientHello 512 bytes.

I also fixed a typo (a missing "0x") in the check for whether any ECC ciphers are included in the Client Hello.
2016-05-03 16:48:42 -04:00
David Cooper
9d1803d6eb More SSLv2 (and SSLv3) related fixes
In doing some work on cipher_pref_check() I noticed that it was failing on SSLv2 since the call to "$OPENSSL s_client" includes SNI. I've also noticed in my testing that "$OPENSSL s_client" will not connect to an SSLv2-only server unless the "-ssl2" flag is included. So, I carefully checked each call to "$OPENSSL s_client" in the program (other than in run_allciphers and run_cipher_per_proto, since those functions are already addresses in PR #341) to see whether they would inappropriate fail with an SSLv2-only (or SSLv3-only) server.

As a general rule, if the call doesn't currently include the protocol, then I added "-ssl2" if $OPTIMAL_PROTO is "-ssl2", indicating that the server only supports SSLv2, and I removed any $SNI if a protocol is specified if a protocol is specified and it is either SSLv2 or SSLv3.

I tested it on an SSLv2-only server, and the results are much better. I also tested it on a collection of other servers, none of which support SSLv2, and the results are the same as with the current code.

The only thing I haven't been able to test is how the revised code works when the "--starttls" option is used. I don't believe the changes I made would cause anything to break in that case, but I also don't think code will work any better in that case, if the server only supports SSLv2. Of course, since no server should support SSLv2 (let alone only SSLv2), it shouldn't really be an issue.

One thing that I did not change, but that I do not understand; why does determine_optimal_proto() try the protocols in the order "-tls1_2 -tls1 -ssl3 -tls1_1 -ssl2" rather than "-tls1_2 -tls1_1 -tls1 -ssl3 -ssl2"? Doesn't the current ordering imply that TLS v1.0 and SSLv3 are better than TLS v1.1?
2016-04-29 17:04:01 -04:00
David Cooper
91bab81e26 "$OPENSSL ciphers" ignores "-tls1_1" and "-tls1_2"
Versions of OpenSSL prior to 1.1.0 ignore the options "-tls1_1" and "-tls1_2". So, a call of the form "$OPENSSL ciphers -tls1_2 -V 'ALL:COMPLEMENTOFALL:@STRENGTH' would list all supported ciphers (including SSLv2 ciphers), not just ciphers appropriate for TLS1.2.

This changes the code to use "-tls1" instead of "-tls1_1" or "-tls1_2" if a version of OpenSSL other than 1.1.0 is being used.
2016-04-21 14:05:19 -04:00
Dirk Wetter
269a9e8c60 - fix LF in JSON/CSV output
- fix EV detection
2016-04-21 18:44:57 +02:00
David Cooper
cf84d69171 Fix some typos
Note: I deleted line 207, "HAS_SSL2=false", since it was a repeat of line 203.
2016-04-21 12:04:33 -04:00
Dirk
c62177044b - FIX #336 2016-04-20 18:53:04 +02:00
David Cooper
fe098d4b39 Use $HAS_SSL2
I changed the code to use the global $HAS_SSL2 rather than $sslv2_locally_supported.

I don't think there's a need to use $HAS_SSL3 in run_allciphers(), since the call to "$OPENSSL s_client" for non-SSLv2 ciphers does not specify a protocol. It's also not needed in run_cipher_per_proto(), since there is already a call to locally_supported() before anything further is done with a protocol.
2016-04-19 09:47:52 -04:00
David Cooper
7e506e5c5a More extensions in socksend_tls_clienthello()
This PR adds the signature algorithms, heartbeat, session ticket, and next protocol extensions to the client hello message created by socksend_tls_clienthello() for TLS 1.0 and above. It also adds the supported elliptic curves and ec points format extensions if the client hello message includes any ECC cipher suites.

I tested this version against several servers with $EXPERIMENTAL set to true and get the same results as with the current code with $EXPERIMENTAL set to false.
2016-04-13 15:39:12 -04:00
David Cooper
c6db49066f run_allciphers(),run_cipher_per_proto(), and SSLv2
This PR addresses two problems related to SSLv2 in run_allciphers() and run_cipher_per_proto().

In run_cipher_per_proto(), the call to "$OPENSSL s_client" is changed to that $SNI is not included if $proto is -sslv2 or -sslv3. As noted in a comment within run_prototest_openssl(), "newer openssl throw an error if SNI is supplied with SSLv2" and "SSLv3 doesn't have SNI (openssl doesn't complain though -- yet)."

run_allciphers() will sometimes incorrectly report that a server supports an SSLv2 cipher, even if the server does not support SSLv2 at all. The problem occurs if there is a supported SSLv3 cipher suite that has the same OpenSSL name as an SSLv2 cipher suite (e.g., RC4-MD5). Since the call to "$OPENSSL s_client" only uses the OpenSSL name, but the results report both the name, hexcode, and RFC cipher suite name, both the SSLv2 and SSLv3 cipher suites are reported as being supported (e.g., 0x04=RC4-MD5=TLS_RSA_WITH_RC4_128_MD5 and x010080=RC4-MD5=SSL_CK_RC4_128_WITH_MD5). This PR fixes the problem by testing SSLv2 cipher suites separately from non-SSLv2 cipher suites.
2016-04-11 15:51:53 -04:00
Dirk Wetter
199708f94c Merge pull request #335 from dcooper16/run_cipher_per_proto_speedup
run_cipher_per_proto speedup
2016-04-08 22:11:59 +02:00
David Cooper
bbb8af804e Fix typo in neat_list()
The last line of neat_list currently uses $HEXC as the parameter to show_rfc_style(), but it should use $hexcode. At the moment using $HEXC instead of $hexcode makes no difference, since hexcode="$1" and in all calls to neat_list() the first parameter is $HEXC. However, this bug could create problems in the future since neat_list() will misbehave if the value of the first parameter (hexcode) isn't the same as $HEXC.
2016-04-08 14:49:44 -04:00
David Cooper
bbcc869dec run_cipher_per_proto speedup
This PR makes basically the same changes to run_cipher_per_proto() as I previously made to run_allciphers(). The main difference is that in this function, round 0 consists of a single call to "$OPENSSL s_client" with "-cipher" including all of the locally supported ciphers. The reason for the difference is that in run_allciphers() its saves time to assume the server supports at least one cipher suite. In the case of run_cipher_per_proto(), however, it is likely that the server will not support some protocols at all, so its usually faster to start with a single call to "$OPENSSL s_client" that tests whether the server supports the protocol at all.
2016-03-31 09:38:20 -04:00
Dirk
16927f523f - NOT OK ==> NOT ok
- FIX #332 (--show-each w/o --wide)
- polishing PR #329
2016-03-30 23:28:31 +02:00
Dirk
bed1a602f1 - small hint for new chacha/poly ciphers 2016-03-29 21:56:31 +02:00
David Cooper
eac2df6d81 run_allciphers() speedup
The run_allciphers() function currently works by calling "$OPENSSL s_client" once for each cipher suite supported by $OPENSSL. In the case of "OpenSSL 1.0.2-chacha (1.0.2e-dev)" that means 195 calls to  "$OPENSSL s_client" even though servers tend to only support a small fraction of these cipher suites.

This PR produces the same output as the current run_allciphers() with fewer calls to "$OPENSSL s_client", which results in the function running faster (usually much faster). The basic idea behind the revised function is to test cipher suites in blocks. If $OPENSSL supports 195 cipher suites, then it group these cipher suites into 4 blocks of 64 (with the final block being smaller). It makes one call to "$OPENSSL s_client" with cipher suites 1-64, and if it fails, then it knows that none of these 64 cipher suites are supported by the server and it doesn't need to perform any more tests on these 64 cipher suites. If it succeeds, then it breaks the 64 cipher suites into 4 blocks of 16 and calls "$OPENSSL s_client" with each of those blocks. The blocks of 16 that are successful are broken into blocks of 4, and for each of the successful blocks of 4 the individual cipher suites are tested.

For testssl.sh and www.google.com the number of calls to "$OPENSSL s_client" is reduced from 195 to 88. For github.com the number of calls is reduced to 56!

I haven't made any changes to run_cipher_per_proto yet, but if this PR is accepted I can make the same changes in that function.

Thanks,

David
2016-03-25 10:00:50 -04:00
Dirk
dd30b8225e - FIX #324 (thx, @dawsonpaul 2016-03-21 23:03:42 +01:00
Dirk Wetter
b5b158d5b2 - BREACH missed a LF 2016-03-19 18:15:38 +01:00
Dirk
ab7f66533c - FIX #323
- add  MicrosoftSharePointTeamServices in header detection
2016-03-19 17:20:36 +01:00
Dirk Wetter
942359c8c1 - FIX #318
- minor code housekeeping
- increased amount of buffer read for sockets, real fix follows. #313
2016-03-12 17:08:43 +01:00
Thomas Patzke
7cc41a1a92 logfile, jsonfile and csvfile parameters work without = (as documented in help) 2016-03-08 22:25:00 +01:00
Dirk
483139f0a4 - show censy link by default 2016-03-05 21:35:30 +01:00
Dirk Wetter
28a6199109 - several code housekeepings
* SHOW_EACH_C has now the correct logic
  * pr_litemagenta ==> pr_warning
  * fileout WARN according to pr_warning then changed appropiately
  * some global vars in "" to avoid unneccessary shell expansion
  * HAS_SSL2/HAS_SSL3 now works more reliably
  * warning added in cipher order if ssl2/ssl3 is not supported by openssl
2016-03-05 21:07:49 +01:00
Dave Cottlehuber
9e77f38318 fix certificate_info() test 2016-03-03 21:47:36 +01:00
Dirk Wetter
1ead2e65bc - experimental label for DROWN 2016-03-03 20:04:20 +01:00
Dirk Wetter
6367693ccf - first check for DROWN #305 2016-03-03 19:50:44 +01:00
Dirk Wetter
752e6cdf56 - one outstanding openssl CVE issue wrt SSLv2
- first skeleton for DROWN #305
2016-03-03 11:56:25 +01:00
Thomas Martens
38477b4383 renamed pr_brown to pr_svrty_medium 2016-03-01 20:42:34 +01:00
Thomas Martens
dbfa66e6c7 renamed pr_yellow to pr_svrty_minor 2016-03-01 20:41:03 +01:00
Thomas Martens
ff9f1632e4 renamed pr_green to pr_done_best 2016-03-01 20:39:30 +01:00
Thomas Martens
2686f8cdb4 renamed pr_litegreen to pr_done_good 2016-03-01 20:36:41 +01:00
Thomas Martens
207e4e5ce4 renamed pr_red to pr_svrty_critical 2016-03-01 20:31:26 +01:00
Thomas Martens
cad924e707 renamed pr_litered to pr_svrty_high 2016-03-01 20:25:41 +01:00
John Carver
87218b6b1a Merge branch 'master' into uppercase-severity-codes 2016-02-23 10:34:32 -06:00
Dirk
20cee1e788 - fix: relative redirect led to fp (https) 2016-02-22 10:44:43 +01:00
Dirk
c70a13d014 - fix #296 (no recent regression as assumed) 2016-02-20 21:46:17 +01:00
Dirk
583584e095 - FIX #297
- FIX #243
- reformmated BEAST a bit (was screwed up in ! WIDE mode if too many ciphers
2016-02-20 14:10:04 +01:00
Dirk
71b4c03202 - fix key problem hpkp 2016-02-20 11:07:47 +01:00
John Carver
4be1539a4d lowercase ok when used with NOT in (NOT ok) 2016-02-18 11:49:47 -06:00
John Carver
291edce0c3 uppercase server sets a cipher order (OK) 2016-02-18 11:41:17 -06:00
John Carver
6858026412 uppercase INFO when outputting status_code 2016-02-18 11:15:31 -06:00
b1gb1t
2ee021d337 Correction of line 3607: new line (\n) corrupted the json format 2016-02-16 09:54:01 +01:00
Dirk Wetter
61c1669687 Merge pull request #292 from dcooper16/multiple_certificates
Detect multiple certificates cleanup
2016-02-14 00:08:52 +01:00
Sietse van der Molen
394f186000 also remove carriage returns, fix for csv 2016-02-12 12:40:31 +01:00
Sietse van der Molen
b2e4df60ca fix json output
use double quotes instead of single quotes
delete newlines from strings
2016-02-12 11:05:36 +01:00
David Cooper
02239be295 Detect multiple certificates cleanup
This corrects the indentation within determine_trust() when there are multiple certificates and the output for "Chain of trust (experim.)" takes up more than one lines.

In addition, it fixes the ID field of the JSON output for entries related to the certificate. At the moment, each ID string begins with a blank space. This changes it to remove the space if there is one certificate and to add "Server Certificate #X" at the beginning of each ID if there is more than one certificate.

Perhaps there's a better way than just using, for example, "Server Certificate #1 key_size" as a way to distinguish multiple "key_size" entries in the JSON file. This is just one idea, and it can certainly be changed if those who intend to use the JSON output prefer something else.
2016-02-09 13:35:46 -05:00
AndreiD
8842aeb2b9 Fix #289 - the grep that decides whether a domain is a local address doesn't consider the case when the full domain name is in the hosts file, but followed by .some.other.stuff. This PR addresses this case. 2016-02-08 12:51:54 +01:00
Dirk Wetter
70cd658447 - FIX #283 (regression from 1a8ed3d70a)
- minor output fixes for BEAST
- >4096 bit RSA keys labled in litemangenta now as it could have compatibility probs
- -V 0x.. or -V 0X.. gives at least a warning
2016-02-07 19:13:59 +01:00
Thomas Jensen
c48b27a9a9 fix typo in b93fc824 2016-02-07 03:07:30 +01:00
Dirk
b93fc82489 slightly better output for OCSP stapling 2016-02-06 22:31:32 +01:00
Dirk
a676742256 Remaining issues solved for OpenSSL 1.1.0 compliance, output corrections, CN/SNI improvements 2016-02-03 17:55:53 +01:00
Dirk
9cf3e21c3d - swapped sig_algo and server key size
- output improvements for unknown sig algos like GOST
2016-02-03 09:55:47 +01:00
Dirk
ea18d2f02c - fix: discovering the CN for the default host (without SNI)
- CN parsing of certificate improved
- CN / subject can be also cyrillic now -- supposed the terminal supports the charset
2016-02-03 00:05:57 +01:00
Dirk
dd65050ee1 - "secret" env switch shows during -e/-E the signature algorithm (see also #276)
- exp. date check corrected esp. for openssl 1.1.0
- warning relaxed for chain of trust
2016-02-01 22:06:27 +01:00
dcooper16
9f998d8c53 Number of trusted certificate files in $INSTALL_DIR/etc/*.pem
The number of .pem files in $INSTALL_DIR/etc is currently hard-coded into determine_trust. This modifies the code so that the number of files can be changed without having to change the code.
2016-02-01 14:11:50 -05:00
Dirk Wetter
f7853f36a0 - added SSL_CERT_FILE=/dev/null
- output cleanups in determine_trust()
2016-02-01 17:33:59 +01:00
dcooper16
abffd1b81e Fix chain of trust problem
This should fix issue #278. I'm not sure whether openssl verify will ever print out more than one error, so to be safe, I wrote the code to handle the possibility that it might; if there is more than one error, it just takes the first and ignores the rest.
2016-02-01 11:17:13 -05:00
Dirk Wetter
8f9b38f7d4 - LF and other corrections for HPKP
- output corrections for 2 x HPKP (e.g. scotthelme)
2016-02-01 13:23:28 +01:00
Dirk
0bfe12742e correct signature keysizes, FIX #249 2016-02-01 10:19:23 +01:00
Dirk
c62abaf215 fix colored output in wide mode (FIX #277) 2016-01-31 23:53:13 +01:00
Dirk
5ae9bb8c13 - typo in IPv4 header
- fixed recognition of XML,HTML to separate header
- fixed -V <pattern
2016-01-31 21:02:18 +01:00
Dirk
1726d3b41c minor change of color 2016-01-31 11:04:59 +01:00
Dirk
f7baa560c2 - typos, etc 2016-01-31 10:54:45 +01:00
Dirk
c564e305a7 - FIX #273 2016-01-31 01:55:23 +01:00
Dirk
fc346a35fe - indentation reverted to old value if in only one certificate
- minor cleanups in the output
2016-01-30 23:59:29 +01:00
dcooper16
2bf9c5d81e Detect multiple certificates
Modifies --server-defaults to handle cases in which the server has more than one certificate (e.g., one with an RSA key and one with an ECC key).
2016-01-28 17:06:34 -05:00
Dirk
495b9cda9b - several fixes/improvements for new JSON/CSV file feature #268
* no color code in files
  * rc4 ciphers were missing
  * NODE was missing
  * calling of NODEIP/PORT was not neccessary
  * default naming of files similar to $LOGFILE
2016-01-23 23:33:17 +01:00
Dirk
8a2fe5915a - /usr/bin/printf --> printf 2016-01-23 20:33:46 +01:00
Dirk
1a8ed3d70a - JSON/CSV from #268, labeled it experimental
- fixes partly #31
- several fixes to it (backticks, single sq brackets, renaming funcs, removed lf in JSON, ...)
2016-01-23 19:18:33 +01:00
Thomas Martens
b16ab6a021 added colorblind option
if colorblind option is set swap green and blue in the output
2016-01-22 20:40:08 +01:00
Thomas Martens
8bae1bc1ed added --mapping=no-rfc
don't display the RFC ciphername in the cipher checks.
2016-01-19 21:55:06 +01:00
Dirk
b97788ba73 typo fixed 2016-01-15 17:30:47 +01:00
Dirk
5257c2f38a - inline license clarifications
(separate file needed later)
2016-01-15 17:04:16 +01:00
Dirk
a9643b6d1e - hooks for rfc/non-rfc
- FIX for beast: no CBC cipher at all is  now displayed
- minor cosmetic stuff
2016-01-15 16:37:47 +01:00
Dirk
2871aaaee3 - optical cleanups for #265
- don't do browser tests for non-HTTP services
2016-01-15 15:53:03 +01:00
Frank Breedijk
55c0b24278 Don't forget to add help message 2016-01-13 10:26:12 +01:00
Frank Breedijk
ab47f8ada9 Added client simulations based on @ivanr s list on ssllabs 2016-01-13 10:21:01 +01:00
Dirk
dc4f90ac48 missing linefeed 2015-12-29 17:07:03 +01:00
Dirk
b962ccde53 FIX #262 2015-12-29 10:05:20 +01:00
Dirk
3b17c9e321 cosmetic corrections to help 2015-12-27 14:51:18 +01:00
Dirk
914e364d1e - fix headline for non-socket support 2015-12-27 13:33:53 +01:00
Dirk
e10da3a78a - minor adjustmentents to program style 2015-12-24 23:00:23 +01:00
Dirk
5c19bf5892 - fix for web sites having leading spaces b4 html/xml content starts 2015-12-22 21:08:52 +01:00
Dirk
c3269f1927 - Fixes for #260 2015-12-22 20:31:52 +01:00
Dirk Wetter
f65fa69c3c Merge pull request #248 from lainegholson/master
Add HTTP2/ALPN support
2015-12-22 12:05:53 +01:00
Frank Breedijk
826ac43504 Redirect test that doesn't depend om JSON/CSV output 2015-12-21 20:59:40 +01:00
Laine Gholson
d2df8b8590 Fix unrelated typos 2015-12-21 10:37:23 -06:00
Laine Gholson
d0122698ed Fix ALPN when testing multiple IPs 2015-12-13 13:16:37 -06:00
Laine Gholson
d43351e2cb Undo commit f56fdd4 2015-12-13 13:13:51 -06:00
Laine Gholson
f56fdd43da Don't output reason not testing spdy when testing server prefs 2015-12-12 23:09:42 -06:00
Laine Gholson
1bd08f34bd Remove redundant newlines 2015-12-12 22:58:52 -06:00
Laine Gholson
e8b04c77d3 Consider h2 a valid NPN protocol 2015-12-12 20:07:24 -06:00
Laine Gholson
3d28f44e56 Change flag order 2015-12-12 18:41:13 -06:00
Laine Gholson
33bda6408a Add HTTP2/ALPN support 2015-12-12 18:20:57 -06:00
Dirk
bac7cde3bd - re-adjusted preference for rfc/iana mapping file 2015-12-11 13:13:22 +01:00
Dirk
867d698a16 - days left until expiration 2015-12-08 17:51:46 +01:00
Dirk
1f39ab8241 - fix timestamp in log file 2015-12-08 16:37:35 +01:00
Dirk
041b77c5ed - sanity check whether URL/URI is last arg
- typo fix while logging (fall back CVS tags weren't written
2015-12-08 13:31:52 +01:00
Dirk
2e0e7b83d5 reverse non-typo
drill comes later
2015-11-28 17:33:10 +01:00
Dirk Wetter
ad8f82f190 Merge pull request #240 from k0ste/master
Add drill support (ldns lib), fix mistype
2015-11-28 17:14:18 +01:00
Laine Gholson
7fee2fe29b Show SHA384 certificates as secure 2015-11-26 13:53:35 -06:00
Konstantin Shalygin
30d046a6a5 fix PWD mistype 2015-11-23 20:02:06 +06:00
Konstantin Shalygin
43cb1d8763 add drill support 2015-11-23 19:54:41 +06:00
Dirk
f76d07d43e - logging now the cmd line, FIX #238
- internal improvements of stdout banner
2015-11-21 13:39:37 +01:00
Laine Gholson
c5a4eafed7 Fix filename typo
CREDITS.md was called CREDIT.md
2015-11-14 17:19:13 -06:00
Armin F. Gnosa
7e08d3d4da fixed typo in parameter descriptions 2015-11-12 23:47:43 +01:00
Dirk
5749051839 - fix vertical distances after PFS && wide
- fix misleading "--ip=v4only" in help
2015-11-11 17:49:36 +01:00
Dirk
756a6ab41d - NEW: logging of stdout!
- rearragments in global var declaration for better readability
2015-11-11 11:56:32 +01:00
Dirk
87592aafd9 - line space for some single vuln. adjusted 2015-11-08 22:14:28 +01:00
Laine Gholson
e122d65f52 Only use local rDNS with .local domain 2015-11-06 19:16:21 -06:00
Laine Gholson
457fcacf3f Fix error 2015-11-05 19:39:26 -06:00
Laine Gholson
d9dfe438e5 Prefer 'avahi-resolve' over 'dig' for mDNS 2015-11-05 19:04:04 -06:00
Laine Gholson
a9a4326038 Support rDNS with mDNS and Bonjour mDNS (mac) 2015-11-05 15:54:29 -06:00
Dirk Wetter
50c5f0b93d add '-bugs' so that buggy F5s can be better tested 2015-11-03 23:29:53 +01:00
Dirk
e390345629 typo 2015-11-03 19:51:45 +01:00
Dirk
c272878c73 - warning session tickets -> PFS 2015-11-03 19:51:05 +01:00
Dirk
8ff39c5028 - client based authentication, FIX #215
- SSL Session ID support test
2015-11-03 13:13:10 +01:00
Dirk
0463471c40 - fixing side effect from #225
- other minor output corrections
2015-11-03 10:30:59 +01:00
Dirk
84e6be3547 - revert part of #225
- clarify name of bool var for type of tput
2015-11-02 10:49:40 +01:00
Dirk Wetter
8b54609c3d Merge pull request #225 from Harinus/master
Fix: tput: No value for $TERM and no -T specified
2015-11-02 10:40:59 +01:00
Laine Gholson
8c173764bd Use 'awk' instead of 'sed -E' 2015-11-01 10:40:44 -06:00
Laine Gholson
686dd511a6 Add support for .local domains with avahi 2015-10-31 20:01:52 -05:00
Martin Hoffmann
6a8d4870ab Missing space ;)
Whoops... edited this from the github webpage..
2015-10-30 09:56:48 +01:00
Martin Hoffmann
9bfeac19bc Fix: tput: No value for $TERM and no -T specified
Avoid "tput: No value for $TERM and no -T specified" when running from CGI or similar by checking for interactive shell
2015-10-30 09:46:35 +01:00
Peter Mosmans
62af7be5a1 Added check for availability oftput (Fixes #222)
Slight change due to drwetter's comment
2015-10-25 22:31:44 +10:00
William Lovins
4095dc53be Changed wording for easier readability. 2015-10-16 14:40:06 +01:00
Dirk
7bf1319c93 - FIX #218 for exim and friends 2015-10-15 15:14:37 +02:00
Dirk
eb49132682 - changed headline for each sub test from blue to underline+bold
- save determine_service log
2015-10-15 14:15:07 +02:00
Dirk
78fab8addb - FIX #213, wording 2015-10-13 22:25:01 +02:00
Dirk
d4dbf1138c - FIX #214 2015-10-13 08:31:54 +02:00
Dirk
1a1f007ef9 - banner f'up reversed 2015-10-11 23:34:53 +02:00
Dirk
8c0786d147 - switched on clientauth functionality (missed b4) 2015-10-11 23:23:35 +02:00
Dirk
b9bfd48871 - client based auth (see sclient_connect_successful() works now, see #206)
- careful regression tests for this, point open: speed
- test for more TLS extensions
- heartbleed() does now before a check whether heartbeat is available to save time
- breach simplyfied (and doesn't have to be killed in seldom cases)
- tmpfiles are only being erased after exit not after each function
- user agent is testssl -- unless --sneaky is chosen
- global host vars are now being resetted to prevent side effects
- tls version in record layer is now always 1
- used ERRFILE wherever possible
- smaller code cleanups
2015-10-11 23:07:16 +02:00
Dirk Wetter
0600e39b45 - fix screw up of rDNS display for those few folks having only IPv4 ;-) 2015-10-06 12:30:29 +02:00
Dirk
f8d6a2fb6d - IPv6 formatting fixed, see #11 (points 3,4,5)
5 cannot be done automagically, see issue
2015-10-05 09:56:21 +02:00
Dirk
a0d634f94a - ouput corrections for BEAST 2015-10-04 12:32:29 +02:00
Dirk
41bc2fb70c - regression wrt what_dh 2015-10-03 00:14:52 +02:00
Dirk Wetter
f3cef41053 - some speed improvements (sed, tr --> bash internal s'n'r)
- revamped BEAST a bit: availablity of higher protocols lead now to yellow color, see #208
- Fixed error in BEAST (no higher protos led to no message)
- made BEAST it faster: one check for protocol ssl3+tls1 upfront, see #208
2015-10-01 13:27:14 +02:00
typingArtist
2ca6c2b0dc improved variable naming, scope and worked around length limitation of cipher list, as suggested by @drwetter 2015-09-30 14:54:39 +02:00
typingArtist
449aada392 fix CBC cipher selection
CBC cipher selection is not so easy using the openssl tool alone. Selecting the cipher based on the string CBC occuring in it would be right if it’s
about the RFC name of the cipher but not so with the openssl naming. Since CBC ciphers are not going to be continued anyway, I think it’s safe to take
a static list. However, it’s easy to extract it from the cipher list in openssl-rfc.mapping.html, but we certainly don’t want to require that file to
be shipped all the time.
2015-09-30 12:44:27 +02:00
Dirk
1c1eaa53d8 - fix for renamed http_header function 2015-09-29 18:47:49 +02:00
Dirk
cac49cb1f1 - "--file" implicitly does "--warnings=batch"
- "--file" works now fine with equal sign
- fixed load balancer issue where header request stalled and testssl.sh consequently too
- http_date needed to be changed too because of that
- needed to estimate then the http_date when request was killed (HAD_SLEPT)
  will Mr. Spock like this??
- fixed load balancer issue where header request for breach test stalled and thus an error was displayed
- code improvements
2015-09-28 22:54:00 +02:00
Dirk
feaef680aa - IPv6 #11 is 80% working (whohoo!). Needed is an openssl capable IPv6 and HAS_IPv6=true in the environment
- FIX #191
2015-09-26 22:44:33 +02:00
Dirk Wetter
cc81642ee3 - #FIX 202 (EV detection from TERENA/Digicert) 2015-09-25 14:35:42 +02:00
Dirk
a2efc201b7 - added a failure condition for trust check 2015-09-24 09:10:43 +02:00
Dirk
06466cca92 - proxy in determine_trust was missing 2015-09-23 09:03:47 +02:00
Dirk
0b1e573fc9 - FIX #190: Server temp key backport for RH-ish systems works now automagically
- just to be sure there's a cmd line flag --has-dhbit / env HAS_DH_BITS
- some reordering
2015-09-22 20:09:26 +02:00
Dirk
4b57a22f6e - FIX #198 (date env problem under BSD and maybe others) 2015-09-22 17:14:36 +02:00
Dirk
1668daa04e - NEW: chain of trust -- for openssl 1.0.2 only
- FIX #97
2015-09-22 15:05:59 +02:00
Dirk
3eeb1f9d9d - check whether dig, host or nslookup is there. The error message is now describing the cause 2015-09-21 16:43:47 +02:00
Dirk
23802e219d - #FIX 197
- renamed a variable
2015-09-21 14:03:48 +02:00
Dirk
6406e1828d - minor polish of output 2015-09-19 15:03:40 +02:00
Dirk
413b64c44a - fixed proxy name resolution and make it more robust
- additional line if a proxy is used above rDNS
2015-09-18 15:12:01 +02:00
Dirk
945d26d222 - changed version number
- retabed to five spaces
2015-09-17 15:30:15 +02:00
Dirk
58096d6633 2.6 release 2015-09-15 08:49:00 +02:00
Dirk
467988fb0a - improved resilience in cipher order check
- improved also there compatibility with intolerant IIS6 servers
2015-09-14 12:54:54 +02:00
Dirk
a2ba43ec78 - litemagenta should be used for not fatal conditions / magenta for fatal conditions (prg terminates then) 2015-09-14 11:12:37 +02:00
Dirk
9b08cb7584 - FIX /workaround for #188 (https://github.com/drwetter/testssl.sh/issues/188)
- bumped up version to rc4
2015-09-14 11:03:10 +02:00
Dirk
a9f231b3ff - fix where an $PID"ERRFILE" was written 2015-09-09 16:41:32 +02:00
Dirk
d28317f2d0 - exit code always 0 unless an error occured
- enable devel feaure of SSLv2 via socket
2015-09-08 19:30:03 +02:00
Dirk
566a059250 - fix for issue when a non-HTTP service indicates a misleading non-match of certificate
- wildcard check
2015-09-06 18:21:08 +02:00
Dirk Wetter
b9bfa2355a fix for scott helme's multiple keys (https://scotthelme.co.uk/hpkp-toolset) 2015-09-04 14:19:06 +02:00
Dirk Wetter
422b4d511a minor cleanups for finding openssl binaries 2015-09-04 10:04:56 +02:00
Dirk Wetter
6a036cd7d4 removed hardcoded obsolete paths for binaries 2015-09-03 13:26:02 +02:00
Dirk
1c5870e3e3 typo, fix from Stefan Stidl (thx!) 2015-09-03 12:17:32 +02:00
Dirk
489baa1299 unitize programming styles: ${var} --> $var, double square brackets instead of single 2015-09-03 12:14:47 +02:00
anoma
6b22851104 Typo. Inconsistent CVE string format
Trivial typo. All other CVE outputs are in the form CVE-XXXX-YYYY
2015-09-03 09:10:06 +01:00
Dirk Wetter
90930a2f78 - changed return code if someone dares to use dash as it hiccups
- catch users try to use sh instead of real bash (#184),  see http://www.gnu.org/software/bash/manual/bashref.html#Bash-POSIX-Mode)
2015-09-02 12:56:03 +02:00
Dirk Wetter
45eb3ed662 better phrasing for LOGJAM, see #181 2015-08-28 17:43:38 +02:00
Dirk Wetter
90ead7a301 FIX #183 2015-08-28 17:06:07 +02:00
Dirk Wetter
412fb6fb05 FIX #182 2015-08-28 16:46:28 +02:00
Dirk Wetter
9b718d39d0 - removed VERBERR (is now DEBUG=2)
- hex2dec uses now internal echo instead of printf (which has problems with some chars if unexpected content if not properly used)
2015-08-28 14:59:04 +02:00
Dirk
b5818f6034 - FIX $177
- some by-catches whle shellchecking
- minor cleanups
2015-08-28 00:15:51 +02:00
Dirk
c102bb6712 micro fix for the ESC code orgination fron tput test 2015-08-27 20:39:20 +02:00
Dirk
0d9370237c - FIX #172
- labeled TLS_FALLBACK_SCSV as experimental, to be improved in next release (remarks in code)
- removed experimental from FREAK check
- separated headerfile from errorfile, TLS handshake oids were sometimes misinterpreted as IPv4 addreses in header
- bumped up rc version
- linefeeds
2015-08-27 11:25:12 +02:00
Dirk Wetter
c93dc01b41 better service detection, dedicated line for NNTP and certificate stuff redirected to ERRFILE 2015-08-26 20:06:53 +02:00
Dirk Wetter
838112e6d2 - LibreSSL compatibility: recent pull spits out an error if cnf file isn't found (oh well) ==> introduction of #ERRFILE, good idea anyway
- commented what I wanted to achieve with the colors
- code cleanups
2015-08-24 23:50:03 +02:00
Dirk
aa91990fb3 - fix bug where a host name like AAA.BBB.CCC.DDD.in-addr.arpa.DOMAIN.TLS was taken as an ipv4 address
- freebsd 9 supports now also colors with setaf, Darwin?
- correct indentation of help
- improved parsing in command line so that where a distinct option is required it is also tested in the 1st place
- removed -q in help (deprecated as we might want to use it for other things in the future)
- fix: if $PWD/openssl was a dir it bailed out
- cleanup of fatal errors ==> provide ONE function
2015-08-24 22:17:35 +02:00
Dirk
83bf9067aa FIX #167 (# of certificates provided) 2015-08-23 21:16:34 +02:00
Dirk Wetter
6baf5e377c - sanitize '%' in general output function, avoids hiccups in url encoded strings
- FIX #178 (Security headers only key in green, not value)
- CSP rule for facebook hast 127.0.0.1 which is labeled as IP address
2015-08-21 18:10:45 +02:00
Dirk Wetter
87cef93b6c - more solid parsing for HPKP header (FIX #163)
- X-UA-Compatible is now an "other" flag and key won't be swallowed
2015-08-21 12:43:10 +02:00
Dirk Wetter
394bde8ff5 output FIX for multiple CRLs (#165) 2015-08-21 10:47:29 +02:00
Peter Mosmans
cd4ba60f16 Fixes #174
Thanks to Ligushka
2015-08-18 16:07:24 +02:00
Jonathon Rossi
e8cbf1a699 Fix subject alternative name on darwin 2015-08-18 17:15:17 +10:00
Dirk
9afab04012 FIX #162 (leading space for rp banner and missing lf) 2015-08-17 20:13:52 +02:00
Dirk
405b0f10bf FIX #161 + small improvemnet on rengotiation 2015-08-15 21:33:17 +02:00
Dirk
e3fcd786f7 - FIX #160 -- removed code from #27
- bumped up version to 2.6rc2
2015-08-15 18:48:49 +02:00
Dirk Wetter
58a1c1c1da - expiration variables tunable via ENV
- cleanups expire section
2015-08-13 16:56:12 +02:00
Thomas Kähn
8963916b3b Fix certificate expiration check 2015-08-12 18:28:50 +02:00
Dirk Wetter
719536a44e FIX: Dilyans bug where a STARTTLS servive runs on a different port 2015-08-12 13:58:45 +02:00
Dirk
5bc6e5fda9 - if a record is local host it is shown now
- also look in etc hosts for MSYS2
- cosmetic improvements
2015-08-12 00:17:28 +02:00
Dirk Wetter
81b158431f NEW: showing # of detected pinned keys (HPKP) 2015-08-10 15:58:56 +02:00
Dirk Wetter
72aa8add5c FIX for missing CN (e.g. cloudflare) 2015-08-10 15:17:42 +02:00
Dirk Wetter
e6f0f79157 - FIX: rDNS ignores CNAME now
- some code beautified
2015-08-10 14:47:11 +02:00
Dirk
aa2b33fdb4 rp header fine tuning 2015-08-08 13:42:31 +02:00
Dirk
dc60d9360a reverse proxy banner alignment 2015-08-08 13:37:05 +02:00
Dirk
56e6f90308 FIX #158 (pagesspeed header was identified as IPv4 addr) 2015-08-08 10:20:13 +02:00
Dirk Wetter
70ff293fb7 - fix for #156
- reverting #27. Catch is the functions are being initiated at a fixed time instead of while calling. This conflicts with the --color option which is done late. Other solution?
2015-08-05 11:31:55 +02:00
Dirk
f1fe2c3286 just renaming as rc1 for 2.6 2015-08-02 01:25:39 +02:00
Dirk
fcb8c5d0bc - FIX for multiple ip addresses for one mx host (didn't expect a matroshka ;-))
- make dotted lines smaller
2015-08-02 01:16:27 +02:00
Dirk
ea1ab3b911 help for mass testing option in #153 2015-08-02 00:26:34 +02:00
Dirk
325abcfc06 - first shot for szepeviktor's color function maker #27 2015-08-02 00:03:30 +02:00
Dirk
9006234c34 - NEW: mass testing via --file
- FIX: ipv6 address in rDNS was ..umm err ....missing some chars
- rough ipv6 address detection (fixes single colon in "further ip addresses")
- FIX: facebook has EC certificate but signing algo is not EC
- FIX for wrong openssl location in banner
2015-08-01 23:11:27 +02:00
Peter Mosmans
c04497f2f6 Another fix for #140
Suppress awk warnings
Don't try to retrieve header information from openssl stderr output
2015-07-27 12:16:03 +02:00
Dirk
f45f91a07e - quiet mode for mass testing (see #148) w/o banner
- -q is now --devel
2015-07-25 14:33:08 +02:00
Dirk
d4f7dd0f91 * squash dirname err msg on FreeBSD
* numerous DNS related internal improvements
* FIX #137
* FIX #147
2015-07-23 17:11:33 +02:00
Dirk
013a24caea * - improved DNS parser again, see #141 #140
* at least exit with -250 or worse if a problem occurs (rest still undefined, needs to be fixed, see #145/#100)
* renamed all top level tests in "run_" for better code
2015-07-22 13:11:20 +02:00
Dirk
c66a2c8f2e FIX #144: reverse screw up of hpkp function for BSD/Darwin 2015-07-21 20:35:49 +02:00
Dirk
784294b52d awk fixes for MSYS2 FIX #141, #FIX 140 2015-07-21 14:20:15 +02:00
Jonathon Rossi
298a91d743 Fix bash 3 support
Mac OS X ships with bash 3, not 4. The case statement fallthrough and
continue operators were added in bash 4.
2015-07-21 15:11:20 +10:00
Dirk Wetter
f81b3a5c25 * GOST ciphers sometimes missing during scan
* help was not precise wrt some arg w no params
2015-07-20 14:05:35 +02:00
Dirk Wetter
66f0b22adb word match for -V / -x now only for non-numbers: testssh.sh -x cc google.com tests for chaha ciphers
(before only word matching was done e.g.: testssl.sh -x ECDH chase.com
2015-07-17 15:58:07 +02:00
Dirk Wetter
d9b9d2c2fb * path display error in banner fixed 2015-07-17 14:58:12 +02:00
Dirk Wetter
cda5eff12e * STARTTLS_SLEEP
* resolved misleading output STARTTLS + socket
* fixed poodle ciphers in code (but not used yet)
2015-07-17 14:33:23 +02:00
Dirk Wetter
f04ee57e79 * display shortend path to $OPENSSL in banner 2015-07-17 13:25:39 +02:00
Harald Wagener
4df61eed14 Update testssl.sh
Fix typo.
2015-07-17 11:05:07 +02:00
Dirk Wetter
54290b220a - Provide Darwin binaries and paths thereto
- provide also other static bins in $PWD/bin
2015-07-16 23:01:10 +02:00
Dirk Wetter
b157a26632 * EV certificate detection
* SSLv2 + STARTTLS protocol check always uses sockets now
* STARTTLS protocol now returns over sockets the TLS time (if available)
* few LibreSSL output oddities fixes
* output corrections for STARTTLS
* additional path for binaries (we change the path soon but leave both in the code for now)
2015-07-16 17:58:03 +02:00
Dirk
4c033bc0cc * header flags added 2015-07-14 20:44:04 +02:00
Dirk
2e40c2bde6 * misleading warning for DH bits for Negotiated cipher omitted if no DH or EC and OPENSSL <= 1.0.1 2015-07-14 19:58:04 +02:00
Dirk
32325d0643 * fix for scanning an IP address only
* server_preference: cipher adjusted
* some [[ and ]] in loops, hoping to speed up processing a bit
* cosmetic stuff
2015-07-14 17:13:58 +02:00
Dirk
2ae8f2d6e3 fix regression: port 25 is the one for --mx 2015-07-14 12:35:26 +02:00
Dirk
0b1c0dca46 FIX #132 (see also discussions in #133 2015-07-13 23:41:49 +02:00
Dirk
dfc37bc892 workaround / FIX #134 (OPENSSL_CONF destroyed lookup via host/dig/nslookup 2015-07-13 23:24:23 +02:00
Dirk
f95326cf21 * Liferay in header will be marked in yellow
* more tries to find openssl binaries (also those in git)
2015-07-12 18:46:27 +02:00
Dirk
3cf891bd5e * FIX #131 (EC certificate key size was critized)
* FIX: if request w/o SNI didn't succeed it resulted in an ugly openssl error message
* FIX #51 (we try to initialize GOST engine before showing the banner)
2015-07-10 10:23:10 +02:00
Dirk Wetter
f1d8471a3d * heartbleed and ccs check enabled per default for STARTTLS
* performance improvements for sockets+STARTTLS (still only enabled via EXPERIMENTAL=yes)
2015-07-08 21:30:31 +02:00
Dirk Wetter
d3b8f8e0a2 cosmetic corrections (output) 2015-07-08 11:34:45 +02:00
Dirk Wetter
5944c35075 * EXPERIMETAL=yes is used, testssl.sh uses for protocols, heartbleed, ccs sockets also for STARTTLS!
* it's slow though (to be improved)
* renamed vars for proxy
* cleanups
2015-07-07 22:59:31 +02:00
Dirk Wetter
179d8700d1 * NEW: xmpphost support
* FIX for regression (80e26a75ef), config file GOST
2015-07-06 20:42:43 +02:00
Dirk Wetter
c08baa94b3 * CHANGE: some tuning variable are now booleans (see help)
* help() to reflect this
* cleanups
2015-07-06 10:10:46 +02:00
Dirk
80e26a75ef * Warning if LibreSSL is used #126
* FIX for screwed up output for fixed ciphers (FREAK, LOGJAM), see also #126
* GOST support now doesn't complain if MY confif file aleady exists (minor fix)
2015-07-02 16:39:41 +02:00
Dirk
5acfc93d79 * couple of checks for new proxy option from John Newbigin #124
* minor cleanups for #124
2015-06-29 23:28:37 +02:00
Dirk
ddd680ac93 * merge #124 from jnewbigin
* fix my run time error
2015-06-29 22:29:15 +02:00
Dirk
15a672b521 * assertion vs. condition fixed 2015-06-29 10:41:56 +02:00
Dirk
93f5b8216d * FIX #125
* beautified some code / function names
2015-06-28 13:52:42 +02:00
Dirk
5d78c9421f * first tls_low_byte is now always 01 in TLS 1.0 --> TLS 1.2 (see openssl)
* removing TLS 1.2 check from sockets as IIS has a problem with it
2015-06-24 11:08:09 +02:00
Dirk
e121f944e9 * FIX: added missed downgrade (ret=2) in socket protcol check
* resorted helper functions to top
* cleanups (ok, renamed some functions)
2015-06-23 21:54:47 +02:00
Dirk
b575710634 * FIX in --ip=one
* straighthen help()
* FIX ret value for no response in parse_tls_serverhello
2015-06-23 12:58:40 +02:00
Dirk
ae8f998f8f * help corrected, -e is standard 2015-06-23 07:56:56 +02:00
Dirk
a6c5a2af0d * handshake works now with SNI 2015-06-22 23:19:08 +02:00
Dirk
d3c793e6bc * help without <> now and |
* socket SNI issue: As it turns out Apache 2.2/2.4 is not behaving according to https://tools.ietf.org/html/rfc6066#section-3
   .
2015-06-22 18:32:40 +02:00
Dirk
58a6f501b5 - better addressed no clear fallback repsonses, see #121 2015-06-20 19:36:11 +02:00
Dirk
633cdc209b - NEW: IP address detection now in HTTP header
- NEW: Varnish and Squid header detected
- NEW: option --ip=one is a shortcut and means just test the first ip
- CSP Report-Only in security headers
- New: Varnish and Squid header detected, OWA header
- all single tests in bold now
- no support for TLS 1.2 spits out "NOT ok" as it is not ok
- Medium ciphers and DES ciphers are not having aNULL and aDH ciphers anymore and have different colors --> ratings
- http-date is now in http header(), tls_time in server_defaults()
- http header reply is indented to same row as server defaults
- http status code is displayed clearly now
- BUGFIX: IPv6 address wasn't displayed
- cleanup
- application banner now in two lines if needed
- try a second time to get a http header if first one fails
- fix: case where % sign in ip address made prinf hiccup (sanitized)
- fix: $url was in some functions empty
- fixed bug where some headers were displayed twice
2015-06-19 20:36:32 +02:00
Dirk
59299ce9e1 - FIX #119 (sed -E fails for old sed versions)
- std_cipherlists tuned
- fix for selfsigned certs (missed sometimes because of trailing space)
2015-06-17 11:33:29 +02:00
Dirk
06899f3cbf - introduced Reverse Proxy header
- FIX for OWA header
- beautfied some header funcs
- fixed GET_REQ1?/HEAD_REQ1?
2015-06-16 23:00:47 +02:00
Dirk
478b8afac7 FIX: bail out better if $NODE doesn't resolve
cipher lists now wth plural ending
added Liferay-Portal + X-OWA-Version for application banner
new http_header (still leaving old one in)
readability improvements
2015-06-16 19:53:40 +02:00
Dirk
e16ccd06b6 - testing all IP addresses of a node works now (refactoring of parse_hn_port into three functions) FIX #96
- SNI is unset if STARTTLS is set
- some BSD fixes (sed)
2015-06-16 14:04:44 +02:00
Dirk
4432faf497 "--ip" works now (see help)
little cleanups
2015-06-15 12:13:16 +02:00