Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: No IPv4 address for "ipv6.google.com" available #191

Closed
sanderjo opened this issue Sep 17, 2015 · 14 comments
Closed

Fatal error: No IPv4 address for "ipv6.google.com" available #191

sanderjo opened this issue Sep 17, 2015 · 14 comments
Labels

Comments

@sanderjo
Copy link

With an IPv6-only site (like ipv6.google.com), I get Fatal error: No IPv4 address for "ipv6.google.com" available Full log below.

It seems open_ssl does not support IPv6, so it seems reaonable testssl.sh refuses it. But still a pity. There is an interesting work around with socat on konklone/shaaaaaaaaaaaaa#67 (comment)

listenport=$(shuf -i 10000-65000 -n 1)
socat tcp-listen:"$listenport" tcp-connect:"$host":"$port" 2>/dev/null &
echo -n | openssl s_client -connect localhost:$listenport

which I put into this script:

$ cat openssl-ipv6-via-socat.sh

#!/bin/sh
host=$1
port=$2
listenport=$(shuf -i 10000-65000 -n 1)
socat tcp-listen:"$listenport" tcp-connect:"$host":"$port" 2>/dev/null &
echo -n | openssl s_client -connect localhost:$listenport

with the result included below.

So ... can this workaround be used by/in testssl.c so that it can test ipv6-only sites?

$ ./openssl-ipv6-via-socat.sh ipv6.google.com 443
CONNECTED(00000003)
depth=2 C = US, O = GeoTrust Inc., CN = GeoTrust Global CA
verify error:num=20:unable to get local issuer certificate
verify return:0

---
Certificate chain
 0 s:/C=US/ST=California/L=Mountain View/O=Google Inc/CN=*.google.com
   i:/C=US/O=Google Inc/CN=Google Internet Authority G2
 1 s:/C=US/O=Google Inc/CN=Google Internet Authority G2
   i:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
 2 s:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
   i:/C=US/O=Equifax/OU=Equifax Secure Certificate Authority

---
Server certificate
-----BEGIN CERTIFICATE-----
MIIHjTCCBnWgAwIBAgIIUAagBcYW6/kwDQYJK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H2h0
dHA6Ly9wa2kuZ29vZ2xlLmNvbS9HSUFHMi5jcmwwDQYJKoZIhvcNAQELBQADggEB
AHdnM3j2RZ3ReNh0luWnO63RHYBRXHEKc91xZx1tk+SvZUlzH7dnzOfpsSEjATzf
a+OSZ38WoPttempwJCKpDEAf07ek9NCKUxLu2KjrkVaU+irKsZgLiPzafU+E9qci
sZaii7qPQ4o2qdJNwVxufEjIKsk3myq7xJQ42jKZY0UmXpxagrE/bvp4gFpQXU7J
pp8pvrUs/4upwx3LUtWEEX5B9Pqh1SMxTZ9mL+oh1ooEk1S/DfpiyyWyggNI5CS+
+BLzNPvHpx8jga8jSXI7XZXGvN8qYVVJMFSdZErmidAkVw1a65CVCJlOTbd/PiWn
0sLTlY6QbTXsXQOtSRLSIYg=
-----END CERTIFICATE-----
subject=/C=US/ST=California/L=Mountain View/O=Google Inc/CN=*.google.com
issuer=/C=US/O=Google Inc/CN=Google Internet Authority G2

---
No client certificate CA names sent

---
SSL handshake has read 4510 bytes and written 421 bytes

---
New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES128-GCM-SHA256
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : ECDHE-RSA-AES128-GCM-SHA256
    Session-ID: 4A3ADD518BFF23097AE6B94E77B8F93995145E89FCA8CE22286F3E97994BA6C7
    Session-ID-ctx:
    Master-Key: A8D73CBB6AD80DB06C4A6D7AB4DFAEDE2D3952A652B5F602ADC2AE9229CC9E5359021D084815BEE9963FB0E1F10B288E
    Key-Arg   : None
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    TLS session ticket lifetime hint: 100800 (seconds)
    TLS session ticket:
    0000 - ca d9 c2 56 17 db a3 c4-40 fa 69 40 b7 cb 7b 79   [email protected]@..{y
    0010 - a6 f0 28 e1 ad 90 8c 37-05 ac 00 f5 bb 50 ba 2e   ..(....7.....P..
    0020 - cb 3f b5 74 64 46 e4 14-f9 41 a1 0e 06 6b 8a b0   .?.tdF...A...k..
    0030 - 43 bf eb cc 12 63 51 f1-32 fc fc 15 f7 67 c2 2b   C....cQ.2....g.+
    0040 - ee e1 12 1c 9e 08 73 f9-b8 09 30 03 d8 48 73 d6   ......s...0..Hs.
    0050 - 9a c1 03 a7 36 82 e5 75-bb 7a bf a2 46 a2 8d 8c   ....6..u.z..F...
    0060 - 7d c1 f6 ad 68 97 36 34-8b 87 50 d6 a8 15 fd fe   }...h.64..P.....
    0070 - 3d 00 0b 25 29 a7 ea b1-0a ed 2e c2 ea 28 b7 4b   =..%)........(.K
    0080 - 3c 14 9e 4b 83 02 52 dc-21 ed 82 6f bc 1e 3a 8c   <..K..R.!..o..:.
    0090 - b8 3a 6a 58 45 15 59 ac-7e 05 b7 d6 e8 81 7c 4d   .:jXE.Y.~.....|M
    00a0 - 83 12 94 43                                       ...C

    Start Time: 1442488396
    Timeout   : 300 (sec)
    Verify return code: 20 (unable to get local issuer certificate)

---
DONE

sander@haring:~/git/testssl.sh$ ./testssl.sh ipv6.google.com

###########################################################
    testssl.sh       2.6 from https://testssl.sh/
    (4cee5c2 2015-09-16 14:58:28 -- 1.379)

      This program is free software. Distribution and
             modification under GPLv2 permitted.
      USAGE w/o ANY WARRANTY. USE IT AT YOUR OWN RISK!

       Please file bugs @ https://testssl.sh/bugs/

###########################################################

 Using "OpenSSL 1.0.2-chacha (1.0.2d-dev)" [~181 ciphers] on
 haring:./bin/openssl.Linux.i686
 (built: "Jul  6 18:16:02 2015", platform: "linux-elf")


Fatal error: No IPv4 address for "ipv6.google.com" available
@drwetter
Copy link
Owner

Hey @sanderjo,

sounds a great possibility to work around #11. Have you tried the proxy option of testssl.sh together with socat?

Cheers, Dirk

@sanderjo
Copy link
Author

sander@haring:~/git/testssl.sh$ ps -ef | grep -i socat
sander   18694 18349  0 15:40 pts/0    00:00:00 socat tcp-listen:11234 tcp-connect:ipv6.google.com:443
sander   18856 18349  0 15:41 pts/0    00:00:00 grep --color=auto -i socat
sander@haring:~/git/testssl.sh$
sander@haring:~/git/testssl.sh$
sander@haring:~/git/testssl.sh$ ./testssl.sh --proxy 127.0.0.1:11234 ipv6.google.com:https

###########################################################
    testssl.sh       2.6 from https://testssl.sh/
    (4cee5c2 2015-09-16 14:58:28 -- 1.379)

      This program is free software. Distribution and
             modification under GPLv2 permitted.
      USAGE w/o ANY WARRANTY. USE IT AT YOUR OWN RISK!

       Please file bugs @ https://testssl.sh/bugs/

###########################################################

 Using "OpenSSL 1.0.2-chacha (1.0.2d-dev)" [~181 ciphers] on
 haring:./bin/openssl.Linux.i686
 (built: "Jul  6 18:16:02 2015", platform: "linux-elf")

Fatal error: Proxy IP cannot be determined from "127.0.0.1"

Source says:

          PROXYIP=$(get_a_record $PROXYNODE 2>/dev/null | grep -v alias | sed 's/^.*address //')
          LOCAL_A=$save_LOCAL_A
          LOCAL_AAAA=$save_LOCAL_AAAA
          # no RFC 1918:
          #if ! is_ipv4addr $PROXYIP ; then
          [[ -z "$PROXYIP" ]] && fatal "Proxy IP cannot be determined from \"$PROXYNODE\"" "-3"

So no $PROXYIP determined? I'll check that.

@drwetter
Copy link
Owner

Am 09/17/2015 um 03:59 PM schrieb Sander:

So no $PROXYIP determined? I'll check that.

have you tried localhost?

Cheers, Dirk

@sanderjo
Copy link
Author

Yeah, I had tried a few things, among which 'localhost'

sander@haring:~/git/testssl.sh$ ps -ef | grep -i socat
sander   18694 18349  0 15:40 pts/0    00:00:00 socat tcp-listen:11234 tcp-connect:ipv6.google.com:443
sander   19831 18349  0 16:12 pts/0    00:00:00 grep --color=auto -i socat

sander@haring:~/git/testssl.sh$ ./testssl.sh --proxy localhost:11234 ipv6.google.com:https

###########################################################
    testssl.sh       2.6 from https://testssl.sh/
    (4cee5c2 2015-09-16 14:58:28 -- 1.379)

      This program is free software. Distribution and
             modification under GPLv2 permitted.
      USAGE w/o ANY WARRANTY. USE IT AT YOUR OWN RISK!

       Please file bugs @ https://testssl.sh/bugs/

###########################################################

 Using "OpenSSL 1.0.2-chacha (1.0.2d-dev)" [~181 ciphers] on
 haring:./bin/openssl.Linux.i686
 (built: "Jul  6 18:16:02 2015", platform: "linux-elf")

Fatal error: Proxy IP cannot be determined from "localhost"

Let's try FQDN ... ah, different error:

sander@haring:~/git/testssl.sh$ ./testssl.sh --proxy haring.myFQDNremoved:11234 ipv6.google.com:https

###########################################################
    testssl.sh       2.6 from https://testssl.sh/
    (4cee5c2 2015-09-16 14:58:28 -- 1.379)

      This program is free software. Distribution and
             modification under GPLv2 permitted.
      USAGE w/o ANY WARRANTY. USE IT AT YOUR OWN RISK!

       Please file bugs @ https://testssl.sh/bugs/

###########################################################

 Using "OpenSSL 1.0.2-chacha (1.0.2d-dev)" [~181 ciphers] on
 haring:./bin/openssl.Linux.i686
 (built: "Jul  6 18:16:02 2015", platform: "linux-elf")


Fatal error: No IPv4 address for "ipv6.google.com" available

sander@haring:~/git/testssl.sh$ 

So the same error ... testssl still does a IPv4 lookup, even when via a proxy?

@drwetter drwetter added this to the 2.7dev (2.8) milestone Sep 17, 2015
@drwetter
Copy link
Owner

Nah, need to redo the name resolution there for the proxy

@drwetter
Copy link
Owner

Enhancement for your issue follows. Reopen it if the proxy still makes problems.

@drwetter
Copy link
Owner

see 413b64c

@sanderjo
Copy link
Author

No, doesn't work for me; still Fatal error: No IPv4 address for "ipv6.google.com" available. Maybe I use the wrong command?

Full log:
After a git pull:

sander@haring:~/git/testssl.sh$ grep -i '$id:' testssl.sh
#  $Id: testssl.sh,v 1.381 2015/09/18 13:12:00 dirkw Exp $

... so, yes, new version.
Checking that socat is running:

sander@haring:~/git/testssl.sh$ !ps
ps -ef | grep socat
sander    4100  4031  0 15:36 pts/0    00:00:00 socat tcp-listen:11234 tcp-connect:ipv6.google.com:443
sander    4102  4031  0 15:36 pts/0    00:00:00 grep --color=auto socat
sander@haring:~/git/testssl.sh$ ./testssl.sh --proxy haring.MyDomain.com:11234 ipv6.google.com:https

###########################################################
    testssl.sh       2.7dev from https://testssl.sh/dev/
    (413b64c 2015-09-18 15:12:01 -- 1.381)

      This program is free software. Distribution and 
             modification under GPLv2 permitted. 
      USAGE w/o ANY WARRANTY. USE IT AT YOUR OWN RISK!

       Please file bugs @ https://testssl.sh/bugs/

###########################################################

 Using "OpenSSL 1.0.2-chacha (1.0.2d-dev)" [~181 ciphers] on
 haring:./bin/openssl.Linux.i686
 (built: "Jul  6 18:16:02 2015", platform: "linux-elf")


Fatal error: No IPv4 address for "ipv6.google.com" available

sander@haring:~/git/testssl.sh$ ps -ef | grep socat
sander    4100  4031  0 15:36 pts/0    00:00:00 socat tcp-listen:11234 tcp-connect:ipv6.google.com:443
sander    4335  4031  0 15:36 pts/0    00:00:00 grep --color=auto socat
sander@haring:~/git/testssl.sh$ 

@sanderjo
Copy link
Author

@drwetter I can't re-open as:

you can re-open your own issues *if you closed them yourself
you cannot re-open your own issues if a repo collaborator closed them

You closed my issue, so I can't re-open ... :-(

@drwetter drwetter reopened this Sep 18, 2015
@drwetter
Copy link
Owner

sorry.

Meanwhile i figured it doesn't work. To make it work would cause not only a few lines of changes.

I could make openssl commands work b byypassing the DNS lookups. The thing I don't have an idea right now is how to handle is the sockets.

@sanderjo
Copy link
Author

OK, clear. Thanks your analysis and answer.

@drwetter
Copy link
Owner

I like that cool hack and that would be great to have at least this bit of IPv6 support -- next year basically IPv6 is 20 years old and still openssl s_client doesn't support it -- but I personally have higher priorities for testssl.sh. Maybe some other dude jumps ins

@drwetter drwetter removed this from the 2.7dev (2.8) milestone Sep 18, 2015
@drwetter
Copy link
Owner

Good news: With the IPv6 patch from Fedora and a few minor changes to testssl.sh I got a complete check of ipv6.google.com working natively.

Details: #11 (comment)

@drwetter
Copy link
Owner

as native IPv6 is the way to do it, this issue won't be fixed. With the next commit you can try however whether HAS_IPv6=true ./testssl.sh <cmdline> accidentally works.

torkelsson pushed a commit to torkelsson/testssl.sh that referenced this issue Mar 1, 2016
…able IPv6 and HAS_IPv6=true in the environment

- FIX drwetter#191
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants