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

SSL examples: updates #8643

Merged
merged 4 commits into from
Jul 27, 2022
Merged

SSL examples: updates #8643

merged 4 commits into from
Jul 27, 2022

Conversation

d-a-v
Copy link
Collaborator

@d-a-v d-a-v commented Jul 19, 2022

  • move from gitlab to ssllabs
  • simplify ethernet SSL example

The custom cipher list might need a fix for a better example.

The ethernet example works and gives the same result as WiFi example.

workaround for #8642 (comment)

@d-a-v d-a-v added this to the 3.1 milestone Jul 19, 2022
@mcspr
Copy link
Collaborator

mcspr commented Jul 20, 2022

Not seeing the crash you mentioned in matrix.

Insecure less / fewer ciphers example does not work now
(if it ever did work. need to re-check logs :)

Insecure, less secure ciphers:
Trying: www.ssllabs.com:443...[hostByName] request IP for: www.ssllabs.com
[hostByName] Host: www.ssllabs.com IP: 64.41.200.100
:ur 1
:del
:ref 1
BSSL:_connectSSL: start connection
BSSL:_wait_for_handshake: failed
BSSL:Couldn't connect. Error = 'SSL received fatal alert - Decoding error: extraneous element.'
*** Can't connect. ***
-------
Insecure, few ciphers:
Trying: www.ssllabs.com:443...[hostByName] request IP for: www.ssllabs.com
[hostByName] Host: www.ssllabs.com IP: 64.41.200.100
:ur 1
:del
:ref 1
BSSL:_connectSSL: start connection
BSSL:_wait_for_handshake: failed
BSSL:Couldn't connect. Error = 'SSL received fatal alert - Decoding error: extraneous element.'
*** Can't connect. ***

@d-a-v
Copy link
Collaborator Author

d-a-v commented Jul 20, 2022

(if it ever did work. need to re-check logs :)

It depends on what ciphers are enabled and what is used inside certificates.
Certificates may change without us updating the enabled short list, so I wonder whether adding a displayed comment and leaving it as it is.

@mcspr
Copy link
Collaborator

mcspr commented Jul 20, 2022

s/Certificate ciphers/Connection ciphers/?
isn't it related to the protocol itself, where we 'announce' what server should use to initiate secure connection?
non connecting is also a good affirmation it is not something that is always supported when using public internet services. no one stops custom setups though.

referring s_client once again, using ssllabs.com servers

    // For apps which want to use less secure but faster ciphers, only
    static const uint16_t faster_suites_P[] PROGMEM = {
      BR_TLS_RSA_WITH_AES_256_CBC_SHA256,
      BR_TLS_RSA_WITH_AES_128_CBC_SHA256,
      BR_TLS_RSA_WITH_AES_256_CBC_SHA,
      BR_TLS_RSA_WITH_AES_128_CBC_SHA };
> openssl ciphers -s -tls1_2 | tr ':' '\n' | grep '^AES'
AES256-GCM-SHA384
AES256-CCM
AES128-GCM-SHA256
AES128-CCM
AES256-SHA256
AES128-SHA256
AES256-SHA
AES128-SHA
> openssl s_client -tls1_2 -connect ssllabs.com:443 -cipher 'AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA' -trace
CONNECTED(00000003)
Sent Record
Header:
  Version = TLS 1.0 (0x301)
  Content Type = Handshake (22)
  Length = 125
    ClientHello, Length=121
      client_version=0x303 (TLS 1.2)
      Random:
        gmt_unix_time=0x9429D4C5
        random_bytes (len=28): 313388BB20F9E34F989054514A9ECB4F005ECDDD45440EDBAE9D8029
      session_id (len=0):
      cipher_suites (len=10)
        {0x00, 0x3D} TLS_RSA_WITH_AES_256_CBC_SHA256
        {0x00, 0x3C} TLS_RSA_WITH_AES_128_CBC_SHA256
        {0x00, 0x35} TLS_RSA_WITH_AES_256_CBC_SHA
        {0x00, 0x2F} TLS_RSA_WITH_AES_128_CBC_SHA
        {0x00, 0xFF} TLS_EMPTY_RENEGOTIATION_INFO_SCSV
      compression_methods (len=1)
        No Compression (0x00)
      extensions, length = 70
        extension_type=server_name(0), length=16
          0000 - 00 0e 00 00 0b 73 73 6c-6c 61 62 73 2e 63 6f   .....ssllabs.co
          000f - 6d                                             m
        extension_type=session_ticket(35), length=0
        extension_type=encrypt_then_mac(22), length=0
        extension_type=extended_master_secret(23), length=0
        extension_type=signature_algorithms(13), length=34
          ecdsa_secp256r1_sha256 (0x0403)
          ecdsa_secp384r1_sha384 (0x0503)
          ecdsa_secp521r1_sha512 (0x0603)
          ed25519 (0x0807)
          ed448 (0x0808)
          rsa_pss_pss_sha256 (0x0809)
          rsa_pss_pss_sha384 (0x080a)
          rsa_pss_pss_sha512 (0x080b)
          rsa_pss_rsae_sha256 (0x0804)
          rsa_pss_rsae_sha384 (0x0805)
          rsa_pss_rsae_sha512 (0x0806)
          rsa_pkcs1_sha256 (0x0401)
          rsa_pkcs1_sha384 (0x0501)
          rsa_pkcs1_sha512 (0x0601)
          ecdsa_sha224 (0x0303)
          rsa_pkcs1_sha224 (0x0301)

Received Record
Header:
  Version = TLS 1.2 (0x303)
  Content Type = Alert (21)
  Length = 2
    Level=fatal(2), description=handshake failure(40)

40BC41FAD77F0000:error:0A000410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:ssl/record/rec_layer_s3.c:1584:SSL alert number 40
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 7 bytes and written 130 bytes
Verification: OK
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : 0000
    Session-ID:
    Session-ID-ctx:
    Master-Key:
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    Start Time: 1658315928
    Timeout   : 7200 (sec)
    Verify return code: 0 (ok)
    Extended master secret: no
---

(-ciphersuites seems to only force certain things to the front)

@mcspr
Copy link
Collaborator

mcspr commented Jul 20, 2022

Plus, good old example.com certainly works with TLS_RSA_WITH_AES_256_CBC_SHA

@d-a-v
Copy link
Collaborator Author

d-a-v commented Jul 20, 2022

With example.com, only the last test has an issue.
I didn't try to find a compatible cipher yet.

@mcspr mcspr merged commit 646bdfc into esp8266:master Jul 27, 2022
hasenradball pushed a commit to hasenradball/Arduino that referenced this pull request Nov 18, 2024
Simplify SSL+ethernet example, reuse/include WiFi example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants