Why can't I fetch this sites contents with curl?

0

I'm trying to download the contents of https://aarhustech.itslearning.com/elogin/default.aspx with curl, but I get this error:

$ curl https://aarhustech.itslearning.com/elogin/default.aspx
curl: (35) Unknown SSL protocol error in connection to aarhustech.itslearning.com:443 

It doesn't matter if I make an insecure SSL connection with the -k option or specify the user-agent with -A 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1162.0 Safari/537.1'.

It isn't even possible to get the headers, how do I fix this?

Trace output:

== Info: About to connect() to aarhustech.itslearning.com port 443 (#0)
== Info:   Trying 158.36.191.141...
== Info: connected
== Info: Connected to aarhustech.itslearning.com (158.36.191.141) port 443 (#0)
== Info: successfully set certificate verify locations:
== Info:   CAfile: /opt/local/share/curl/curl-ca-bundle.crt
  CApath: none
== Info: SSLv3, TLS handshake, Client hello (1):
=> Send SSL data, 348 bytes (0x15c)
0000: 01 00 01 58 03 03 4f cc bc 56 90 3b 93 ad 7a 6e ...X..O..V.;..zn
0010: ba 3c 8b 08 2d 12 da cf b6 1a a6 e0 e6 e6 da 0d .<..-...........
0020: f2 86 02 3c 46 46 00 00 a0 c0 30 c0 2c c0 28 c0 ...<FF....0.,.(.
0030: 24 c0 14 c0 0a c0 22 c0 21 00 a3 00 9f 00 6b 00 $.....".!.....k.
0040: 6a 00 39 00 38 00 88 00 87 c0 32 c0 2e c0 2a c0 j.9.8.....2...*.
0050: 26 c0 0f c0 05 00 9d 00 3d 00 35 00 84 c0 12 c0 &.......=.5.....
0060: 08 c0 1c c0 1b 00 16 00 13 c0 0d c0 03 00 0a c0 ................
0070: 2f c0 2b c0 27 c0 23 c0 13 c0 09 c0 1f c0 1e 00 /.+.'.#.........
0080: a2 00 9e 00 67 00 40 00 33 00 32 00 9a 00 99 00 ....g.@.3.2.....
0090: 45 00 44 c0 31 c0 2d c0 29 c0 25 c0 0e c0 04 00 E.D.1.-.).%.....
00a0: 9c 00 3c 00 2f 00 96 00 41 00 07 c0 11 c0 07 c0 ..<./...A.......
00b0: 0c c0 02 00 05 00 04 00 15 00 12 00 09 00 14 00 ................
00c0: 11 00 08 00 06 00 03 00 ff 02 01 00 00 8e 00 00 ................
00d0: 00 1f 00 1d 00 00 1a 61 61 72 68 75 73 74 65 63 .......aarhustec
00e0: 68 2e 69 74 73 6c 65 61 72 6e 69 6e 67 2e 63 6f h.itslearning.co
00f0: 6d 00 0b 00 04 03 00 01 02 00 0a 00 34 00 32 00 m...........4.2.
0100: 0e 00 0d 00 19 00 0b 00 0c 00 18 00 09 00 0a 00 ................
0110: 16 00 17 00 08 00 06 00 07 00 14 00 15 00 04 00 ................
0120: 05 00 12 00 13 00 01 00 02 00 03 00 0f 00 10 00 ................
0130: 11 00 0d 00 22 00 20 06 01 06 02 06 03 05 01 05 ....". .........
0140: 02 05 03 04 01 04 02 04 03 03 01 03 02 03 03 02 ................
0150: 01 02 02 02 03 01 01 00 0f 00 01 01             ............
== Info: Unknown SSL protocol error in connection to aarhustech.itslearning.com:443 
== Info: Closing connection #0

Tyilo

Posted 2012-06-04T11:54:24.433

Reputation: 2 345

Do you have openssl installed? – Paul – 2012-06-04T12:29:09.827

@Paul yes I have – Tyilo – 2012-06-04T12:35:05.797

Can you run it with -v and --trace so we have more output? – Paul – 2012-06-04T13:13:21.940

Can you retrieve the page with wget? Did you try the -1, -2, and -3 switches to connect with different SSL versions? Worst case scenario, try downloading the site's certificate and explicitly passing it to cURL with the -E switch. – Synetech – 2012-06-04T18:38:38.043

@Synetech It worked with either -1 or -2 options. – Tyilo – 2012-06-04T18:49:45.080

Nice. I'll undelete my answer and update it to provide the correct information. – Synetech – 2012-06-04T19:00:37.593

Answers

3

There are several SSL related settings that can be used to configure the connection including the ability to specify the certificate or disable certificate checking altogether.

In this case, it seems like the site could be using a different one from the one that the version of cURL you are using defaults to.

One option is to use a newer or older version of cURL that defaults to the same version of SSL that the site uses, but a much easier and better way is to explicitly specify the SSL version to use for the connection:

  • -1 or --tlsv1 to use TLS version 1
  • -2 or --sslv2 to use SSL version 2
  • -3 or --sslv3 to use SSL version 3

Synetech

Posted 2012-06-04T11:54:24.433

Reputation: 63 242