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

cryptomb: ssl handleshake always failed in tlsv1.2 #21198

Closed
Lynskylate opened this issue May 9, 2022 · 5 comments · Fixed by #21286
Closed

cryptomb: ssl handleshake always failed in tlsv1.2 #21198

Lynskylate opened this issue May 9, 2022 · 5 comments · Fixed by #21286
Assignees
Labels

Comments

@Lynskylate
Copy link

Lynskylate commented May 9, 2022

cryptomb: ssl handleshake always failed in tlsv1.2

@ipuustin
Openssl client can't complete ssl handleshake in tlsv1.2 protocol , but can complete tls handshake when use tlsv1.3 protocol.if connect server with tlsv1.2 protocol, envoy will reset the connection.

The difference seems to be in the order of the signature algorithms
Although client hello message offer many signature algorithm, crymtomb always use first signature method.
image
In the pr, cryptomb remove PKCS1_5 padding support and rsa_pkcs1_sha512 is the first order signature in the client hello message.

In tls1.3 rsa_pss_rsae_sha512 is the first signature algorithm, cymtomb can complete the tls handshake.
image

  • sds config *
{
    "@type":"type.googleapis.com/envoy.admin.v3.SecretsConfigDump",
    "dynamic_active_secrets":[
        {
            "name":"kubernetes://f53e12d9e545d73f29584d18e00d1cb8",
            "version_info":"2022-05-09T11:24:12+08:00/3",
            "last_updated":"2022-05-09T03:24:12.052Z",
            "secret":{
                "@type":"type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.Secret",
                "name":"kubernetes://f53e12d9e545d73f29584d18e00d1cb8",
                "tls_certificate":{
                    "certificate_chain":{
                        "inline_bytes":"LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUQrakNDQWVJQ0FRRXdEUVlKS29aSWh2Y05BUUVMQlFBd1JURU9NQXdHQTFVRUNnd0ZTWE4wYVc4eEdEQVcKQmdOVkJBTU1EMGx1ZEdWeWJXVmthV0YwWlNCRFFURVpNQmNHQTFVRUJ3d1FaR2x1WjJScGJtY3RhVzVu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K2J6dmhjaTNSMTJCUnZpenNNbGNUYU1BdXhhdmRrM2ZyZHhTckxBRVNVT3RBZDJFVTkwCkNBVXFSVHRJckdXRTdhOCsrcWIrL2QxSy91OElhd096d01yU1pwblZoR2JDeVd0QVhZV2NRYW1PVmIzcCtrK0kKWW9DTk9xUlI2UEtSNWFacmRmL2k3WW9vcnFXM1prckxOSUxrdWRCUUNtOEFOZitncGEvQ0ttY2pCKzgzNVZjSwphWVg1c2o0Mnk5dVlWeWgrNjFKUmNKdXJRMkFkZWY0S2hXTWdpcXllWlhSQitQTEgxSzVLYVN0RjA3NHd4Q01CCnd2cmtjL1gwQUM5RFBXa0hERnZTeEpVaFZSRVhHOFk1N04zWDZwQkozRmtCbmRJcXorQS9zaUo0UDRVd1F0Rm0KSHhZaGxzZ29oY3pzREJGOCtkbGtncTdGS2UvemxuWWZJL1htbVRzNEhxcWFMdlNrL0FZMWkrazUyL09vR25wSgo5K2RhbUs3dmtGSlZoZU0wcWx0cXBpbm93bXV6K1AwS2ZnR1ZVbFNKTTJJbnl0aDJHVXBsL01iM1lvSmtRK1piCmxtdEZVaEZMUFVncWtMd2RiNHc9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K"
                    },
                    "private_key_provider":{
                        "provider_name":"cryptomb",
                        "typed_config":{
                            "@type":"type.googleapis.com/envoy.extensions.private_key_providers.cryptomb.v3alpha.CryptoMbPrivateKeyMethodConfig",
                            "private_key":{
                                "inline_bytes":"W3JlZGFjdGVkXQ=="
                            },
                            "poll_delay":"0s"
                        }
                    }
                }
            }
        }
    ]
}
@Lynskylate Lynskylate added bug triage Issue requires triage labels May 9, 2022
@Lynskylate
Copy link
Author

It can also be easily reproduced using libressl

openssl s_client -connect 47.111.99.55:443 -servername a-test.mse-gw-demo.alibaba-inc.com

image

@ipuustin
Copy link
Member

ipuustin commented May 9, 2022

Thanks for the report! The PKCS1_5 support didn't work right previously, so I just removed the code. I do have a working PKCS1_5 implementation drafted -- it just needs a bunch of tests.

/assign @ipuustin

@Lynskylate
Copy link
Author

Lynskylate commented May 9, 2022

@ipuustin
I have tested the old pcks implementation, the padding type returned in the ssl message is not consistent with the padding type used by the actual hash.

We have used this function in the production environment and need to fix its compatibility with versions below tls1.3 as soon as possible. Maybe you can make your draft public and let me help with the testing part.

@ipuustin
Copy link
Member

ipuustin commented May 9, 2022

@Lynskylate I pushed the draft code here: https://github.com/ipuustin/envoy/tree/pkcs1_5

Regarding testing, the problem is that we don't really have end-to-end test code for cryptomb, so the testing code needs to be able to check that the padding is done correctly.

@mattklein123 mattklein123 removed the triage Issue requires triage label May 9, 2022
@Lynskylate
Copy link
Author

@ipuustin I used sslab to test the version. The version has been able to handle almost all ssl clients from the result.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants