Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Difference between CertFromFile and CertFromMemory #1005

Open
bflyblue opened this issue Sep 22, 2024 · 1 comment
Open

Difference between CertFromFile and CertFromMemory #1005

bflyblue opened this issue Sep 22, 2024 · 1 comment

Comments

@bflyblue
Copy link

I'm not sure if this is intended behavior or not but I've noticed a difference between using CertFromFile and CertFromMemory. The latter receives the certificate chain in reverse order due to differences in how TLS.credentialLoadX509Chain and TLS.credentialLoadX509ChainFromMemory construct the results. I don't know enough to know if the order is meant to matter in a certificate chain:

    CertFromFile cert chainFiles key -> do
        cred <- either error id <$> TLS.credentialLoadX509Chain cert chainFiles key
        return $ TLS.Credentials [cred]
    ...
    CertFromMemory certMemory chainCertsMemory keyMemory -> do
        cred <-
            either error return $
                TLS.credentialLoadX509ChainFromMemory certMemory chainCertsMemory keyMemory
        return $ TLS.Credentials [cred]

When using warp-tls's tlsSettings vs tlsSettingsMemory the first works where-as the latter results in curl and wget failing with:
curl: (35) OpenSSL/3.0.14: error:0A00007B:SSL routines::bad signature

Flipping the order of the certs in my "fullchain.pem" file manually allows tlsSettingsMemory to work as expected.

@Vlix
Copy link
Contributor

Vlix commented Oct 29, 2024

Could you give a code snippet example of how you would get your fullchain.pem to be used with CertFromMemory?

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

No branches or pull requests

2 participants