Re: Connect using TLS with public Web Server

Peter Pentchev <[email protected]>
Newsgroups gmane.network.stunnel.user
Message-ID <[email protected]>
On Mon, Mar 05, 2018 at 01:28:15PM +0100, Carlos Castro wrote:
> Hello
> 
> Thanks @Peter
> 
> 
> Yes , my application not support TLS and I need the application connect
> using TLS , for this i using stunnel (i hope)
> 
> When I make curl -v http://127.0.0.1:19021  :
> 
> curl -v http://127.0.0.1:19201
> * Rebuilt URL to: http://127.0.0.1:19201/
> *   Trying 127.0.0.1...
> * Connected to 127.0.0.1 (127.0.0.1) port 19201 (#0)
> > GET / HTTP/1.1
> > Host: 127.0.0.1:19201
> > User-Agent: curl/7.47.0
> > Accept: */*
> >
> * HTTP 1.0, assume close after body
> < HTTP/1.0 400 Bad Request
> < Server: AkamaiGHost
> < Mime-Version: 1.0
> < Content-Type: text/html
> < Content-Length: 208
> < Expires: Mon, 05 Mar 2018 12:25:53 GMT
> < Date: Mon, 05 Mar 2018 12:25:53 GMT
> < Connection: close
> 
> The web ctm.omgeo.net only works in mode HTTPS , .

TL;DR: can you actually try your application with this stunnel config?

Yes, that's why you have stunnel - it will accept a pure HTTP connection
from your application (or, in this case, from cURL), and then it will
open a TLS (HTTPS) connection to ctm.omgeo.net.

Actually, the "HTTP/1.0 400 Bad Request" response that you get shows
that stunnel already works: the request to ctm.omgeo.net is sent via
HTTPS, not plain HTTP.  If you try to send a plain HTTP request to
ctm.omgeo.net port 443, cURL will report a very different error:

[roam@straylight ~]$ curl -v http://ctm.omgeo.net:443/
*   Trying 88.221.30.124...
* TCP_NODELAY set
* Connected to ctm.omgeo.net (88.221.30.124) port 443 (#0)
> GET / HTTP/1.1
> Host: ctm.omgeo.net:443
> User-Agent: curl/7.58.0
> Accept: */*
> 
* Recv failure: Connection reset by peer
* stopped the pause stream!
* Closing connection 0
curl: (56) Recv failure: Connection reset by peer
[roam@straylight ~]$

This happens because ctm.omgeo.net expects a TLS Client Hello message on
an incoming connection, and cURL sends it a plaintext HTTP request, so
ctm.omgeo.net says "this is not TLS, you must speak TLS to me, go away".

So I guess that the "400 Bad Request" response you get from
ctm.omgeo.net means that 1. you have successfully sent a request to it
and it considered it to be an HTTP request, and 2. it expected
the application to send it a specific request, not just a "GET /", so
it said "GET / is not a valid request for me, but thanks for speaking
HTTPS".  So it's time to test your actual application now; configure it
to talk to 127.0.0.1:19201 and see what happens.

If anything goes wrong, show us the stunnel log.

Hope that helps!

G'luck,
Peter

-- 
Peter Pentchev  [email protected] [email protected] [email protected]
PGP key:        http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint 2EE7 A7A5 17FC 124C F115  C354 651E EFB0 2527 DF13

_______________________________________________
stunnel-users mailing list
[email protected]
https://www.stunnel.org/cgi-bin/mailman/listinfo/stunnel-users
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEELuenpRf8EkzxFcNUZR7vsCUn3xMFAlqeXU8ACgkQZR7vsCUn
3xPLpA//Y3WTz2Ze+JebwMCtwz7qXUfjy2UcijMw9NQydwMgOwbDPm/9XQaZTtoG
xRCk678FIwf8hMzXH3cEHmeniVDNTxwgZ3XooIUkLGDthgX81zWn/wI+ZGMK+4TQ
OjxO8TU1Th9Ly9H99SMl6bm3VKRz7Gc7mkaOB6Zb5UDGTvjiD7eN4R2Hc7Z5zLAG
Hou+/DShYvX/Nxd/anJo5UfAs+1KnyxWDzz6k0s9ryjv5SJe3UDJLghsYedLr9L1
4m/HpjvzUiS8vo8D0epXKEfTNS69K4Vji2lVvp2Tl9/BB06346dPH/qLzCOhxEYw
FnL7dP1ecnRpkek8RdaR48VmH4chiF0W0lLMefOFfUMX0bsgOqrErLz/A5xE1pHE
ucKDBqGFuji5WHFOADDZP6TeH87t+hWxZwnWtyjwKD1yYamh5zUssAYbAzyHwdJw
KsqWLVTICUX2qCp+15HDYYiph2/8f/SoiWTAnywGv7CpX/PLjTJ4FWw/F7U9hTwH
0n7EmhI6ZltsHRPJiAQ4qeSSB0YhxCKYIadXLdqPos7EOEzgnhSvznLIEegrQjqj
K05hf0qNmHKstkzsGXr88R/oJfREQhbKzonsOTASUHcgGXaIjp1ZZfB3WLXZFekk
5z8WPcUTqZ9sfSnjpUlMY9NHbXssTxNg948gBvreO0AsbqEO7ao=
=E+uj
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.