-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Default for TLS_PEER_VERIFY socket option are set to required, may lead to confusion when running samples against self-signed certs #14632
Comments
Assigning a bug to many persons does not usually work as expected as then it is not really known who will look at it. As this looks like a socket TLS issue and @rlubos is the main expert there, I am reassigning this to him atm. |
I actually tried this too in qemu_x86 with local https server (using overlay-tls.conf and overlay-e1000.conf), the log looks like this:
|
@rlubos if you think this is not TLS related, please feel to reassing to me for example.
|
Thanks, I'll try to reproduce/debug. |
Hmm tried to reproduce, but the sample works out of the box for me :| (I've tested current master)
As you see the sample did connect and downloaded the file, next download is in progress... Perhaps some wireshark pcap or mbedTLS logs could be helpful to identify whether it's a problem with TLS handshake. |
Confirming @rlubos's results with f4c8e3f and build completely OOB (the original report contains changes at least to logging config):
("slip: [0x00400b00] cannot allocate pkt" eyecandy is from #13991). |
Okay. Turns out that the tests were failing in our environment because self-signed certs are not accepted by default. The following code snippet enabled the test (big_http_download.c:163): |
So, the best option going forward would be to enable the option to allow self-signed certificates (with appropriate disclaimers of course) for development time. But everything works now. |
I'd be +1 for enabled this option for this sample (big_http_download) with appropriate notice to README. Doubt we would enable it in Zephyr config by default, guys like @d3zd3z actually call for more stringent default setup of security-related things, not less than what we have now. But I found the "for development time" phrase resounding with what I have in mind - I wonder if we could/would/should have different Kconfig defaults for official releases vs just git master. That would be chory/cumbersome and likely confusing, so would need good discussion and consideration. |
@rlubos, so you may want to check re: error reporting in such cases (I would say that's the only thing which can be distilled from this report in the meantime, unfortunately, it's not clear if that's the issue or not, as now the ticket title, description, and console dump don't correspond to each other). |
As for the error reporting - we alredy print the error code that mbedTLS produce in case of handshake failue (at socket log level) - what more could we make? Limited errno space is not helpinig here either. @jukkar I'm trying to understand what exactly is wrong with the self-signed certificate that you use. We are actively using certificates available in The hostname check can be disabled by providing NULL for TLS_HOSTNAME option. |
Which level exactly?
Well, as this report is against big_http_download, then to make sure it prints an error (using printf). @laperie logdump shows as if it hanged. (But then it also shows https://www.7-zip.org/a/7z1805.exe, while it turns out the report is actually about accessing something different with self-signed cert, as apparently https://www.7-zip.org doesn't have self-signed cert). So, all in all, I just suggest that the behavior of big_http_download is checked when run against URL which doesn't have a proper cert, to make sure that this behavior isn't too confusing (i.e. it either works, or error is printed, extra points for clear enough error). |
Going through old issues. This is a good candidate for closing. Can be re-opened if really needed. |
Describe the bug
samples/sockets/big_http_download
To Reproduce
Steps to reproduce the behavior:
Expected behavior
HTTPS request made to https://www.7-zip.org/a/7z1805.exe and file is fetched
Impact
We have no verified cases that TLS works
Screenshots or console output
SeaBIOS (version rel-1.12.0-0-ga698c8995f-prebuilt.qemu.org)
Booting from ROM..***** Booting Zephyr OS v1.14.0-rc1-1247-gb3eb510f5c3a *****
[00:00:00.010,000] net_ctx.net_context_bind: (0x004106c0): Context 0x0040f620 binding to UDP 0.0.0.0:59111 i0
[00:00:00.070,000] net_sock_tls: No entropy device on the system, TLS communication may be insecure!
[00:00:00.080,000] net_config: Initializing network
[00:00:00.080,000] net_config: IPv4 address: 192.0.2.1
[00:00:00.080,000] net_config: Running dhcpv4 client...
Preparing HTTP GET request for https://www.7-zip.org:443/a/7z1805.exe
addrinfo @0x424008: ai_family=1, ai_socktype=1, ai_protocol=6, sa_family=1, sin_port=bb01
sock = 0
[00:00:03.130,000] net_sock_addr.dns_resolve_cb: (0x0040fc98): dns status: -100
[00:00:03.130,000] net_sock_addr.dns_resolve_cb: (0x0040fc98): dns status: -103
[00:00:03.130,000] net_sock_tls.tls_alloc: (0x004106c0): Allocated TLS context, 0x00400580
[00:00:03.130,000] net_ctx.net_context_bind: (0x004106c0): Context 0x0040f6c0 binding to TCP 0.0.0.0:52357 i0
Environment (please complete the following information):
Linux
0.10.0 SDK
Additional info
The problem is consistent independently of the URL. Regular fetching of the URL works.
The problem does not seem to be related to the server certificate as the symptoms are identical for self-signed and proper certificates.
The text was updated successfully, but these errors were encountered: