GithubHelp home page GithubHelp logo

drwetter / testssl.sh Goto Github PK

View Code? Open in Web Editor NEW
7.6K 178.0 1.0K 100.25 MB

Testing TLS/SSL encryption anywhere on any port

Home Page: https://testssl.sh

License: GNU General Public License v2.0

Shell 91.46% HTML 4.33% Perl 3.83% Dockerfile 0.15% Java 0.24%
tls cipher openssl logjam socket hpkp ct hsts bigip caa

testssl.sh's Introduction

Intro

Build Status Gitter License Docker

testssl.sh is a free command line tool which checks a server's service on any port for the support of TLS/SSL ciphers, protocols as well as some cryptographic flaws.

Key features

  • Clear output: you can tell easily whether anything is good or bad.
  • Machine readable output (CSV, two JSON formats)
  • No need to install or to configure something. No gems, CPAN, pip or the like.
  • Works out of the box: Linux, OSX/Darwin, FreeBSD, NetBSD, MSYS2/Cygwin, WSL (bash on Windows). Only OpenBSD needs bash.
  • A Dockerfile is provided, there's also an official container build @ dockerhub.
  • Flexibility: You can test any SSL/TLS enabled and STARTTLS service, not only web servers at port 443.
  • Toolbox: Several command line options help you to run your test and configure your output.
  • Reliability: features are tested thoroughly.
  • Privacy: It's only you who sees the result, not a third party.
  • Freedom: It's 100% open source. You can look at the code, see what's going on.
  • The development is open (GitHub) and participation is welcome.

License

This software is free. You can use it under the terms of GPLv2, see LICENSE.

Attribution is important for the future of this project -- also in the internet. Thus if you're offering a scanner based on testssl.sh as a public and/or paid service in the internet you are strongly encouraged to mention to your audience that you're using this program and where to get this program from. That helps us to get bugfixes, other feedback and more contributions.

Compatibility

Testssl.sh is working on every Linux/BSD distribution out of the box. Latest by 2.9dev most of the limitations of disabled features from the openssl client are gone due to bash-socket-based checks. As a result you can also use e.g. LibreSSL or OpenSSL >= 1.1.1 . testssl.sh also works on other unixoid systems out of the box, supposed they have /bin/bash >= version 3.2 and standard tools like sed and awk installed. An implicit (silent) check for binaries is done when you start testssl.sh . System V needs probably to have GNU grep installed. MacOS X and Windows (using MSYS2, Cygwin or WSL) work too.

Update notification here or @ mastodon (old: twitter)

Installation

You can download testssl.sh branch 3.2 just by cloning this git repository:

git clone --depth 1 https://github.com/drwetter/testssl.sh.git

3.2 is now the latest branch which evolved from 3.1dev. It's in the release candidate phase. For the former stable version help yourself by downloading the ZIP or tar.gz archive. Just cd to the directory created (=INSTALLDIR) and run it off there.

Docker

Testssl.sh has minimal requirements. As stated you don't have to install or build anything. You can just run it from the pulled/cloned directory. Still if you don't want to pull the GitHub repo to your directory of choice you can pull a container from dockerhub and run it:

docker run --rm -ti  drwetter/testssl.sh <your_cmd_line>

Or if you have cloned this repo you also can just cd to the INSTALLDIR and run

docker build . -t imagefoo && docker run --rm -t imagefoo example.com

For more please consult Dockerfile.md.

No Warranty

Usage of the program is without any warranty. Use it at yor own risk.

Testssl.sh is intended to be used as a standalone CLI tool. While we tried to apply best practise security measures, we can't guarantee that the program is without any vulnerabilities. Running as a service may pose security risks and you're recommended to apply additional security measures.

Status

We're currently in the release candidate phase for version 3.2. Bigger features will be developed in a separate branch before merged into a 3.3dev to avoid hiccups or inconsistencies.

Version 3.0.X receives bugfixes, labeled as 3.0.1, 3.0.2 and so on. This will happen until 3.2 is released.

Support for 2.9.5 has been dropped. Supported is >= 3.0.x only.

Documentation

  • .. it is there for reading. Please do so :-) -- at least before asking questions. See man page in groff, html and markdown format in ~/doc/.
  • https://testssl.sh/ will help to get you started.
  • For the (older) version 2.8, Will Hunt provides a longer description, including useful background information.

Contributing

Contributions are welcome! See CONTRIBUTING.md for details. Please also have a look at the Coding Convention.

Bug reports

Bug reports are important. It makes this project more robust.

Please file bugs in the issue tracker @ GitHub. Do not forget to provide detailed information, see template for issue, and further details @ https://github.com/drwetter/testssl.sh/wiki/Bug-reporting. Nobody can read your thoughts -- yet. And only agencies your screen ;-)

You can also debug yourself, see here.


External/related projects

Please address questions not specifically to the code of testssl.sh to the respective projects below.

Web frontend

Free to use Web frontend + commercial API

Mass scanner w parallel scans and elastic searching the results

Privacy checker using testssl.sh

Nagios / Icinga Plugins

Brew package

Daemon for batch execution of testssl.sh command files

Daemon for batch processing of testssl.sh JSON result files for sending Slack alerts, reactive copying etc

GitHub Actions

testssl.sh's People

Contributors

a1346054 avatar akabe1 avatar algreed avatar csett86 avatar dcooper16 avatar definity avatar dependabot[bot] avatar drwetter avatar dude4linux avatar emmanuelfuste avatar enxio avatar feld avatar ghen2 avatar gniltaws avatar goncalor avatar jauderho avatar k0lter avatar keisentraut avatar knweiss avatar magnuslarsen avatar mrseccubus avatar mum-viadee avatar odinmylord avatar oerdnj avatar peterdavehello avatar petermosmans avatar polarathene avatar smokris avatar teward avatar typingartist avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

testssl.sh's Issues

mx record

Automagically determine mx record of supplied domain / host and do a starttls scan on it if requested, e.g. ./testssl.sh --mx <domain|host>

SSL v2 & v3 on one line

When there is no support in openssl for SSLv2 the error message and the next protocol test get on the same line

 SSLv2      Local problem: /usr/bin/openssl doesn't support "s_client -ssl2"  SSLv3      not offered (OK)
 TLSv1      offered (OK)
 TLSv1.1    not offered
 TLSv1.2    not offered
 SPDY/NPN   not offered

SNI

shows up in STARTTLS which is wrong

CentOS 7: engine failure with system provided openssl

testssl.sh -V:

--> Displaying all local ciphers 

Hexcode  Cipher Suite Name (OpenSSL)    KeyExch.   Encryption Bits
-------------------------------------------------------------------------
Error configuring OpenSSL
139797606893472:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared   library:dso_dlfcn.c:187:filename(/usr/lib64/openssl/engines/libgost.so): /usr/lib64/openssl/engines/libgost.so: cannot open shared object file: No such file or directory
139797606893472:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:
139797606893472:error:260B6084:engine routines:DYNAMIC_LOAD:dso not found:eng_dyn.c:450:
139797606893472:error:2606A074:engine routines:ENGINE_by_id:no such engine:eng_list.c:419:id=gost
139797606893472:error:260BC066:engine routines:INT_ENGINE_CONFIGURE:engine configuration error:eng_cnf.c:204:section=gost_section, name=default_algorithms, value=ALL
139797606893472:error:0E07606D:configuration file routines:MODULE_RUN:module initialization error:conf_mod.c:237:module=engines, value=engine_section, retcode=-1      

name space handling for ciphers suites

Default is now displaying OpenSSL name spaces and if mapping file is available RFC style.

Best would be to have a switch what is going to be displayed (OPenSSL, RFC, both) and maybe one default (OpenSSL),

Add accept header

Mod_security and probably other WAFs complain and may reject a test

replace echo -e with printf for portability between Linux and BSD/Darwin

echo -e is not supported on BSD-like systems including Mac OS [1] which leads to garbled output. It would be great to replace it with printf. https://github.com/dmitris/testssl.sh/blob/crossplat/testssl.sh has the first attempt on the change (in branch cross plat).

[1] http://en.wikipedia.org/wiki/Echo_command
Some variants of Unix, such as Linux, support the options -n and -e, and do not process escape sequences unless the -e option is supplied. For example, FGRED=echo -e "\033[31m" might be used under Linux. Unfortunately, such options are non standard[3] due to historical incompatibilities between BSD and System V; the printf command can be used in situations where this is a problem. It is therefore recommended that printf be used to ensure that escape sequences are processed.

Add SHA256 fingerprint

Add SHA256 fingerprint output, along with SHA1. ie: out " Fingerprint / Serial "
outln "$($OPENSSL x509 -noout -in $HOSTCERT -fingerprint | sed 's/Fingerprint=//' ) / $($OPENSSL x509 -noout -in $HOSTCERT -fingerprint -sha256 | sed 's/Fingerprint=//' )/ $($OPENSSL x509 -noout -in $HOSTCERT -serial | sed 's/serial=//')"

Color function maker

# color = number of stars + ANSI escape code
declare -A COLORS=( [litegreen]='0\033[0;32m' [green]='2\033[1;32m' )

colorfuncmaker() {
    local COLOR_NAME
    local -i COLOR_STAR_NUM
    local COLOR_STARS=""
    local COLOR_CODE

    for COLOR_NAME in ${!COLORS[*]}; do
        COLOR_STAR_NUM="${COLORS[$COLOR_NAME]:0:1}"
        COLOR_CODE="${COLORS[$COLOR_NAME]:1}"

        if [ "$COLOR" == 0 ]; then
            # colored function
            eval "${COLOR_NAME}() { out \"${COLOR_CODE}\$1 \"; off; }"
        else
            # b/w function
            # generate stars
            if [ "$COLOR_STAR_NUM" -gt 0 ]; then
                printf -v COLOR_STARS '*%.0s' $(seq 1 ${COLORS[$COLOR_NAME]:0:1})
            fi
            eval "${COLOR_NAME}() { out \"${COLOR_STARS}\$1${COLOR_STARS} \"; }"
        fi
        # the common ...ln function
        eval "${COLOR_NAME}ln() { ${COLOR_NAME} \"\$1\"; outln; }"
    done
}

It makes testssl.sh smaller.

MacOS X test requested

Can't tell whether with that old openssl version (native but ports would be interesting too) a error free detection is possible. Without BSD ports under FreeBSD 9 I get useless results.

Can somebody please check against testssl.sh and let me know? Thx!

b1aef072-71c1-11e4-87ce-285da782d678

CI

Please consider adding tests (e.g. TravisCI) for every feature.

It is a good question how to set up badly configured webservers in Travis.
Maybe someone has an answer.

PFS key size in PFS summary

This is what I'm getting with cipherscan when using OpenSSL 1.0.2

prio  ciphersuite                  protocols  pfs_keysize
1     DHE-RSA-AES256-GCM-SHA384    TLSv1.2    DH,4096bits
2     DHE-RSA-AES256-SHA256        TLSv1.2    DH,4096bits
3     DHE-RSA-AES128-GCM-SHA256    TLSv1.2    DH,4096bits
4     DHE-RSA-AES128-SHA256        TLSv1.2    DH,4096bits
5     ECDHE-RSA-AES256-GCM-SHA384  TLSv1.2    ECDH,P-384,384bits
6     ECDHE-RSA-AES256-SHA384      TLSv1.2    ECDH,P-384,384bits
7     ECDHE-RSA-AES128-GCM-SHA256  TLSv1.2    ECDH,P-384,384bits
8     ECDHE-RSA-AES128-SHA256      TLSv1.2    ECDH,P-384,384bits

Even though that version of OpenSSL isn't out yet, I think it would be useful to get ready and offer that kind of information as soon as it's out.

IPv6

tests fail using IPv6 addresses

Binaries

Differences in 40Bit and export ciphers.

prompt % openssl64 s_client -cipher EXPORT -connect 192.168.AAA.BBB.:443 -servername broken </dev/null
CONNECTED(00000003)
depth=0 CN = borken
verify error:num=18:self signed certificate
verify return:1
depth=0 CN = broken
verify return:1
140245377365872:error:140D1044:SSL routines:tls1_change_cipher_state:internal error:t1_enc.c:652:
prompt %

@PeterMosmans: Can you reproduce that? The binaries are the ones from July from your branch:
https://github.com/drwetter/testssl.sh/tree/master/openssl-bins/openssl-1.0.2-chacha.pm

seldom hangs

  • header / renegotiation ( 'killall dd' / 'killall openssl64' needed) then.
  • to do: find guineapigs, implement also job control here

Certificate signature

Looking at the summary box, I'm missing the certificate signature

Here is one way to get it

current_sigalg=$(${OPENSSLBIN} x509 -noout -text 2>/dev/null <<<"$tmp"|grep Signature\ Algorithm | head -n 1 | awk '{print $3}') || current_sigalg="None"

outputs
sha256WithRSAEncryption

Reporting output

When running these checks, there is no good way to output to a file. I asked this question on Twitter, and it was suggested that I make this an issue...

What I'm looking for is something simple. HTML is just fine. When I attempted to send the output to a file, the output was mangled with escape codes and the like. It would be great if I could get an HTML

Service detection / WAF

Service detection fails sometimes if a WAF is in place.

Needs to be done properly so that the WAF (detected: Secusphere) senses a real client or needs to be a workaround.

openssl bins

Provide new OpenSSL bins.

Currently I have a private version which includes more ciphers however some don't work yet. Resolve that and provide binaries.

MacOS X, FreeBSD 9+10 compatilbility

  • FreeBSD 10
    • heartbleed check ails, see #34
    • with Olivier's @oparoz patch CCS is done, but false positive
  • FreeBSD 9 (openssl 0.9.8za): lots of errors!
    • null/anonyomous/40 Bit, export, DES : false negative
    • heartbleed check ails, see #34
    • with Olivier's @oparoz patch CCS is done, but false positive
    • PFS (Error in cipher list 2071:error:1410D0B9:SSL routines:SSL_CTX_set_cipher_list:no cipher match:/usr/src/secure/lib/libssl/../../../crypto/openssl/ssl/ssl_lib.c:1223:
      Note: you have the following client side ciphers only for PFS. Thus it doesn't make sense to test PFS)

Detect if server overrides client cipher order

The TLS spec demands that the server choses the first matching algorithm from the client cipher list.
However, because many client developers do not care, some servers choose the "best" cipher from the client-supplied list, instead of the first one.

Mozilla's Server-side TLS best practices have this setting enabled, and my gut feeling is that it is consensus on the web (e.g. in Apache, this is done with SSLHonorCipherOrder).

Therefore, it would be great to have a test for it.

A possible test would be to perform two connections, one of them with the cipher list reversed (don't know if OpenSSL allows that), and check if the same cipher is chosen (server priority) or not (client priority).

Speedup

.. by using internal bash functions (test, sed, etc.)

BEAST

  • define ciphers
  • call function and test for them
  • label light red

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.