"Certificate Verify Failed: Unable to get local issuer certificate" when callback from OAuth Provider

My domain is: api.thebuildwork.com

I ran this command: docker compose up --build
Error occurs when I navigate to a callback from Oauth provider. Ex.

It produced this output:

builder_connect-api-1      | thread 'actix-rt|system:0|arbiter:0' panicked at src/api/auth.rs:95:28:
builder_connect-api-1      | called `Result::unwrap()` on an `Err` value: Request(Reqwest(reqwest::Error { kind: Request, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("www.googleapis.com")), port: None, path: "/oauth2/v4/token", query: None, fragment: None }, source: hyper::Error(Connect, Ssl(Error { code: ErrorCode(5), cause: Some(Ssl(ErrorStack([Error { code: 2147483650, library: "system library", function: "file_open", file: "providers/implementations/storemgmt/file_store.c", line: 263, data: "calling stat(/usr/local/ssl/certs)" }, Error { code: 2147483650, library: "system library", function: "file_open", file: "providers/implementations/storemgmt/file_store.c", line: 263, data: "calling stat(/usr/local/ssl/certs)" }, Error { code: 2147483650, library: "system library", function: "file_open", file: "providers/implementations/storemgmt/file_store.c", line: 263, data: "calling stat(/usr/local/ssl/certs)" }, Error { code: 2147483650, library: "system library", function: "file_open", file: "providers/implementations/storemgmt/file_store.c", line: 263, data: "calling stat(/usr/local/ssl/certs)" }, Error { code: 167772294, library: "SSL routines", function: "tls_post_process_server_certificate", reason: "certificate verify failed", file: "ssl/statem/statem_clnt.c", line: 2091 }]))) }, X509VerifyResult { code: 20, error: "unable to get local issuer certificate" })) }))

builder_connect-nginx-1    | 2024/02/01 22:02:57 [error] 20#20: *53 upstream prematurely closed connection while reading response header from upstream, client: 76.10.12.41, server: api.thebuildwork.com, request: "GET /login/callback/discord?code=eJYTx02UXkOdYn0R9FyhcT4Bv2dgxr&state=N00T-L5rW7rIyt_A38x11A HTTP/1.1", upstream: "http://192.168.208.2:8080/login/callback/discord?code=eJYTx02UXkOdYn0R9FyhcT4Bv2dgxr&state=N00T-L5rW7rIyt_A38x11A", host: "api.thebuildwork.com", referrer: "https://discord.com/"
builder_connect-nginx-1    | 76.10.12.41 - - [01/Feb/2024:22:02:57 +0000] "GET /login/callback/discord?code=eJYTx02UXkOdYn0R9FyhcT4Bv2dgxr&state=N00T-L5rW7rIyt_A38x11A HTTP/1.1" 502 559 "https://discord.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" "-"

My web server is (include version): nginx/1.18.0

The operating system my web server runs on is (include version): Ubuntu 22.04.2 LTS

My hosting provider, if applicable, is: DigitalOcean

I can login to a root shell on my machine (yes or no, or I don't know): yes

I'm using a control panel to manage my site (no, or provide the name and version of the control panel): no

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot): certbot 2.8.0

1 Like

Hello @rgundal2, welcome to the Let's Encrypt community. :slightly_smiling_face:

Here is a list of issued certificates crt.sh | api.thebuildwork.com

The certificate being served is valid https://decoder.link/sslchecker/api.thebuildwork.com/443 and here SSL Server Test: api.thebuildwork.com (Powered by Qualys SSL Labs)

And here is the certificate chain being served

$ openssl s_client -showcerts -servername api.thebuildwork.com -connect api.thebuildwork.com:443 < /dev/null
CONNECTED(00000003)
depth=2 C = US, O = Internet Security Research Group, CN = ISRG Root X1
verify return:1
depth=1 C = US, O = Let's Encrypt, CN = R3
verify return:1
depth=0 CN = api.thebuildwork.com
verify return:1
---
Certificate chain
 0 s:CN = api.thebuildwork.com
   i:C = US, O = Let's Encrypt, CN = R3
   a:PKEY: id-ecPublicKey, 256 (bit); sigalg: RSA-SHA256
   v:NotBefore: Jan 23 22:18:28 2024 GMT; NotAfter: Apr 22 22:18:27 2024 GMT
-----BEGIN CERTIFICATE-----
MIIELDCCAxSgAwIBAgISAwo2bFbBHFggTbRswdqxUlkoMA0GCSqGSIb3DQEBCwUA
MDIxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MQswCQYDVQQD
EwJSMzAeFw0yNDAxMjMyMjE4MjhaFw0yNDA0MjIyMj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Mcku/NOl0t7HhtgQAh5S6OKp8vcN8h3OIfDJy32WYF5AnKPMTuWb275XZOPaeAn
LgliPU0Qhe/y5zxk821W33q0zzHBGXHD/WtA8ogKq9UYnOqQcasr0BZv2kP0FmGu
C5fy1P7FIExMrKLEgnOAtKAcQw6qfNvW6wPXS0N6mkFAykF/I/awzo69d7Q9VcDm
prgBA0WqpzNAAJPhSJEzJw==
-----END CERTIFICATE-----
 1 s:C = US, O = Let's Encrypt, CN = R3
   i:C = US, O = Internet Security Research Group, CN = ISRG Root X1
   a:PKEY: rsaEncryption, 2048 (bit); sigalg: RSA-SHA256
   v:NotBefore: Sep  4 00:00:00 2020 GMT; NotAfter: Sep 15 16:00:00 2025 GMT
-----BEGIN CERTIFICATE-----
MIIFFjCCAv6gAwIBAgIRAJErCErPDBinU/bWLiWnX1owDQYJKoZIhvcNAQELBQAw
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMjAwOTA0MDAwMDAw
WhcNMjUwOTE1MTYwMDAwWjAyMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNTGV0J3Mg
RW5jcnlwdDELMAkGA1UEAxMCUjMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
AoIBAQC7AhUozPaglNMPEuyNVZLD+ILxmaZ6QoinXSaqtSu5xUyxr45r+XXIo9cP
R5QUVTVXjJ6oojkZ9YI8QqlObvU7wy7bjcCwXPNZOOftz2nwWgsbvsCUJCWH+jdx
sxPnHKzhm+/b5DtFUkWWqcFTzjTIUu61ru2P3mBw4qVUq7ZtDpelQDRrK9O8Zutm
NHz6a4uPVymZ+DAXXbpyb/uBxa3Shlg9F8fnCbvxK/eG3MHacV3URuPMrSXBiLxg
Z3Vms/EY96Jc5lP/Ooi2R6X/ExjqmAl3P51T+c8B5fWmcBcUr2Ok/5mzk53cU6cG
/kiFHa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EkLNxE7GJThEUG3szgBVGP7pSWTUTsqX
nLRbwHOoq7hHwg==
-----END CERTIFICATE-----
 2 s:C = US, O = Internet Security Research Group, CN = ISRG Root X1
   i:O = Digital Signature Trust Co., CN = DST Root CA X3
   a:PKEY: rsaEncryption, 4096 (bit); sigalg: RSA-SHA256
   v:NotBefore: Jan 20 19:14:03 2021 GMT; NotAfter: Sep 30 18:14:03 2024 GMT
-----BEGIN CERTIFICATE-----
MIIFYDCCBEigAwIBAgIQQAF3ITfU6UK47naqPGQKtzANBgkqhkiG9w0BAQsFADA/
MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT
DkRTVCBSb290IENBIFgzMB4XDTIxMDEyMDE5MTQwM1oXDTI0MDkzMDE4MTQwM1ow
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwggIiMA0GCSqGSIb3DQEB
AQUAA4ICDwAwggIKAoICAQCt6CRz9BQ385ueK1coHIe+3LffOJCMbjzmV6B493XC
ov71am72AE8o295ohmxEk7axY/0UEmu/H9LqMZshftEzPLpI9d1537O4/xLxIZpL
wYqGcWlKZmZsj348cL+tKSIG8+TA5oCu4kuPt5l+lAOf00eXfJlII1PoOK5PCm+D
LtFJV4yAdLbaL9A4jXsDcCEbdfIwPPqPrt3aY6vrFk/CjhFLfs8L6P+1dy70sntK
4EwSJQxwjQMpoOFTJOwT2e4ZvxCzSow/iaNhUd6shweU9GNx7C7ib1uYgeGJXDR5
bHbvO5BieebbpJovJsXQEOEO3tkQjhb7t/eo98flAgeYjzYIlefiN5YNNnWe+w5y
sR2bvAP5SQXYgd0FtCrWQemsAXaVCg/Y39W9Eh81LygXbNKYwagJZHduRze6zqxZ
Xmidf3LWicUGQSk+WT7dJvUkyRGnWqNMQB9GoZm1pzpRboY7nn1ypxIFeFntPlF4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.thebuildwork.com
issuer=C = US, O = Let's Encrypt, CN = R3
---
No client certificate CA names sent
Peer signing digest: SHA256
Peer signature type: ECDSA
Server Temp Key: X25519, 253 bits
---
SSL handshake has read 4143 bytes and written 402 bytes
Verification: OK
---
New, TLSv1.3, Cipher is TLS_AES_256_GCM_SHA384
Server public key is 256 bit
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)
---
DONE

I see no issue regarding Let's Encrypt.

1 Like

Hi @rgundal2,

I suggest you check the Discord support forums as they probably will have better answers about Discord.

2 Likes

Yeah, I'd only say the same thing to you as I did in that other OAuth thread which is I don't see this as a Let's Encrypt issue.

If you are following specs or instructions I would contact them for suggestions. Your messages are not as clear that it is a problem connecting to discord but that is still a fair guess.

You just have some routine program debugging to isolate the exact HTTPS request that is failing and correct the cause. It is well outside the scope of this forum. Perhaps even a general programming forum is helpful (stackoverflow even)

My only tip is to look at this file and make sure it is a valid CA root store for the app stack you are using.

6 Likes

It looks like I wasn't correctly including the correct ssl certs in my Dockerfile. Thank you!

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.