Skip to content

Instantly share code, notes, and snippets.

@psd
Created April 26, 2020 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save psd/4ba6f0c927bafbc49e0175ce9d2ca445 to your computer and use it in GitHub Desktop.
Save psd/4ba6f0c927bafbc49e0175ce9d2ca445 to your computer and use it in GitHub Desktop.
Add self-signed certificates by hand to curl
$ HOSTNAME=www.chelmsford.gov.uk
$ openssl s_client -showcerts -servername $HOSTNAME -connect $HOSTNAME:443 > cacert.pem </dev/null
$ curl -Lv --cacert cacert.pem 'https://www.chelmsford.gov.uk/EasySiteWeb/GatewayLink.aspx?alId=1095043' > resource.csv
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying 20.39.208.115:443...
* TCP_NODELAY set
* Connected to www.chelmsford.gov.uk (20.39.208.115) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: cacert.pem
CApath: /etc/ssl/certs
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.3 (IN), TLS handshake, Server hello (2):
{ [108 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [1773 bytes data]
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
{ [333 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [70 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
* TLSv1.2 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use http/1.1
* Server certificate:
* subject: OU=Domain Control Validated; CN=*.chelmsford.gov.uk
* start date: Jun 20 10:02:15 2019 GMT
* expire date: Aug 4 12:49:17 2021 GMT
* subjectAltName: host "www.chelmsford.gov.uk" matched cert's "*.chelmsford.gov.uk"
* issuer: C=BE; O=GlobalSign nv-sa; CN=GlobalSign RSA DV SSL CA 2018
* SSL certificate verify ok.
} [5 bytes data]
> GET /EasySiteWeb/GatewayLink.aspx?alId=1095043 HTTP/1.1
> Host: www.chelmsford.gov.uk
> User-Agent: curl/7.68.0
> Accept: */*
>
{ [5 bytes data]
* Mark bundle as not supporting multiuse
< HTTP/1.1 302 Found
< Date: Sun, 26 Apr 2020 11:04:13 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 165
< Connection: keep-alive
< Cache-Control: private
< Location: /_resources/assets/attachment/full/0/1095043.csv
< Set-Cookie: ASP.NET_SessionId=gfi23wgvv54grqtnhwjg5b02; path=/; HttpOnly; SameSite=Lax
< Set-Cookie: ASP.NET_SessionId=gfi23wgvv54grqtnhwjg5b02; path=/; HttpOnly; SameSite=Lax
< Set-Cookie: __AntiXsrfToken=2f06f69020b7477faedfca1bf0c58a31; path=/; HttpOnly
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
<
* Ignoring the response-body
{ [165 bytes data]
100 165 100 165 0 0 1289 0 --:--:-- --:--:-- --:--:-- 1289
* Connection #0 to host www.chelmsford.gov.uk left intact
* Issue another request to this URL: 'https://www.chelmsford.gov.uk/_resources/assets/attachment/full/0/1095043.csv'
* Found bundle for host www.chelmsford.gov.uk: 0x5646dcbc4af0 [serially]
* Can not multiplex, even if we wanted to!
* Re-using existing connection! (#0) with host www.chelmsford.gov.uk
* Connected to www.chelmsford.gov.uk (20.39.208.115) port 443 (#0)
} [5 bytes data]
> GET /_resources/assets/attachment/full/0/1095043.csv HTTP/1.1
> Host: www.chelmsford.gov.uk
> User-Agent: curl/7.68.0
> Accept: */*
>
{ [5 bytes data]
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Date: Sun, 26 Apr 2020 11:04:13 GMT
< Content-Type: text/csv
< Content-Length: 37743
< Connection: keep-alive
< Cache-Control: public
< Expires: Sun, 26 Apr 2020 11:04:13 GMT
< Last-Modified: Tue, 18 Feb 2020 13:00:37 GMT
< ETag: "B4CBA8BC35643278EC5A40A64C014980"
< Set-Cookie: ASP.NET_SessionId=0clh0wcaolftnobbzey1yo4q; path=/; HttpOnly; SameSite=Lax
< Content-Disposition: attachment; filename="Brownfield Register December 2019.csv"
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
<
{ [15869 bytes data]
100 37743 100 37743 0 0 207k 0 --:--:-- --:--:-- --:--:-- 207k
* Connection #0 to host www.chelmsford.gov.uk left intact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment