diff --git a/Readme.md b/Readme.md index 740eca1..11cfd5a 100644 --- a/Readme.md +++ b/Readme.md @@ -45,11 +45,18 @@ Done so far: * Even more compatibilty improvements for FreeBSD, RH-ish and F5 systems * OpenSSL 1.1.0 compliant -Contributions, feedback, also bug reports are welcome! For contributions please note: One patch per feature -- bug fix/improvement. Please test your changes thouroughly as reliability is important for this project. +Update notification here or @ [twitter](https://twitter.com/drwetter). + +####Contributions +Contributions, feedback, bug reports are welcome! For contributions please note: One patch per feature -- bug fix/improvement. Please test your changes thouroughly as reliability is important for this project. + +There's [coding guide line](https://github.com/drwetter/testssl.sh/wiki/Coding-Style). Please file bug reports @ https://github.com/drwetter/testssl.sh/issues . -Update notification here or @ [twitter](https://twitter.com/drwetter). +####Documentation + +For a start see the [wiki](https://github.com/drwetter/testssl.sh/wiki/Usage-Documentation). Help is needed here. ---- diff --git a/testssl.sh b/testssl.sh index 97e4366..2446715 100755 --- a/testssl.sh +++ b/testssl.sh @@ -720,7 +720,7 @@ run_http_header() { 301|302|307|308) redirect=$(grep -a '^Location' $HEADERFILE | sed 's/Location: //' | tr -d '\r\n') out ", redirecting to \"$redirect\"" - if [[ $redirect != "https://"* ]]; then + if [[ $redirect == "http://"* ]]; then pr_litered " -- Redirect to insecure URL (NOT ok)" fileout "status_code" "NOT OK" \, "Redirect to insecure URL (NOT ok). Url: \"$redirect\"" fi @@ -985,10 +985,13 @@ run_hpkp() { fileout "hpkp_preload" "INFO" "HPKP header is NOT marked for browser preloading" fi - [[ -s "$HOSTCERT" ]] || get_host_cert - # get the key fingerprints + if [[ ! -s "$HOSTCERT" ]]; then + get_host_cert || return 1 + fi + # get the key fingerprint from the host certificate hpkp_key_hostcert="$($OPENSSL x509 -in $HOSTCERT -pubkey -noout | grep -v PUBLIC | \ $OPENSSL base64 -d | $OPENSSL dgst -sha256 -binary | $OPENSSL base64)" + # compare it with the ones provided in the header while read hpkp_key; do if [[ "$hpkp_key_hostcert" == "$hpkp_key" ]] || [[ "$hpkp_key_hostcert" == "$hpkp_key=" ]]; then out "\n$spaces matching host key: " @@ -2626,14 +2629,16 @@ cipher_pref_check() { get_host_cert() { local tmpvar=$TEMPDIR/$FUNCNAME.txt # change later to $TMPFILE - $OPENSSL s_client $STARTTLS $BUGS -connect $NODEIP:$PORT $PROXY $SNI $1 2>/dev/null $tmpdir + $OPENSSL s_client $STARTTLS $BUGS -connect $NODEIP:$PORT $PROXY $SNI $1 2>/dev/null $tmpvar if sclient_connect_successful $? $tmpvar; then awk '/-----BEGIN/,/-----END/ { print $0 }' $tmpvar >$HOSTCERT + return 0 else + pr_litemagentaln "could not retrieve host certificate!" return 1 fi - tmpfile_handle $FUNCNAME.txt - # return $((${PIPESTATUS[0]} + ${PIPESTATUS[1]})) + #tmpfile_handle $FUNCNAME.txt + #return $((${PIPESTATUS[0]} + ${PIPESTATUS[1]})) } verify_retcode_helper() { @@ -3399,7 +3404,7 @@ run_server_defaults() { # http://www.heise.de/security/artikel/Forward-Secrecy-testen-und-einrichten-1932806.html run_pfs() { local -i sclient_success - local -i pfs_offered=1 + local pfs_offered=false local tmpfile local dhlen local hexcode dash pfs_cipher sslvers kx auth enc mac @@ -3431,12 +3436,12 @@ run_pfs() { pr_brownln "Not OK: No ciphers supporting Forward Secrecy offered" fileout "pfs" "NOT OK" "(Perfect) Forward Secrecy : Not OK: No ciphers supporting Forward Secrecy offered" else - pfs_offered=0 + pfs_offered=true pfs_ciphers="" pr_litegreen " PFS is offered (OK)" fileout "pfs" "OK" "(Perfect) Forward Secrecy : PFS is offered (OK)" if $WIDE; then - outln ", ciphers follow (client/browser support is here specially important) \n" + outln ", ciphers follow (client/browser support is important here) \n" neat_header else out " " @@ -3446,7 +3451,8 @@ run_pfs() { $OPENSSL s_client -cipher $pfs_cipher $STARTTLS $BUGS -connect $NODEIP:$PORT $PROXY $SNI &>$tmpfile >$ERRFILE) # -V doesn't work with openssl < 1.0 @@ -4977,7 +4990,7 @@ run_beast(){ $OPENSSL s_client -cipher "$cbc_cipher" -"$proto" $STARTTLS $BUGS -connect $NODEIP:$PORT $PROXY $SNI >$TMPFILE 2>>$ERRFILE $TMPFILE 2>$ERRFILE