server icon indicating copy to clipboard operation
server copied to clipboard

500 Unexpected error during login - CorsPolicyService - key not found in the key ring

Open fusion4bass opened this issue 1 year ago • 2 comments

Steps To Reproduce

  1. Deploy self hosted version of Bitwarden using docker-compose
  2. Try to login on http://localhost

Expected Result

Login

Actual Result

Browser: POST | http://localhost/identity/connect/token 500 Internal Server Error

Docker compose logs:

bitwarden-identity       | warn: Duende.IdentityServer.Hosting.CorsPolicyProvider[0]
bitwarden-identity       |       => SpanId:38a461c5ddb02c71, TraceId:115cc524ce21877314e5c5f24c408398, ParentId:0000000000000000 => ConnectionId:0HN3U2VRREFDC => RequestPath:/identity/connect/token RequestId:0HN3U2VRREFDC:00000001
bitwarden-identity       |       CorsPolicyService did not allow origin: moz-extension://b8e3f0cd-d670-4e5a-9264-b0c7d6b17580
bitwarden-identity       | crit: Duende.IdentityServer.Hosting.IdentityServerMiddleware[0]
bitwarden-identity       |       => SpanId:38a461c5ddb02c71, TraceId:115cc524ce21877314e5c5f24c408398, ParentId:0000000000000000 => ConnectionId:0HN3U2VRREFDC => RequestPath:/identity/connect/token RequestId:0HN3U2VRREFDC:00000001
bitwarden-identity       |       Unhandled exception: The key {095f5985-3c62-4761-8965-120b0b276b68} was not found in the key ring. For more information go to https://aka.ms/aspnet/dataprotectionwarning
bitwarden-identity       | fail: Microsoft.AspNetCore.Server.Kestrel[13]
bitwarden-identity       |       => SpanId:38a461c5ddb02c71, TraceId:115cc524ce21877314e5c5f24c408398, ParentId:0000000000000000 => ConnectionId:0HN3U2VRREFDC => RequestPath:/identity/connect/token RequestId:0HN3U2VRREFDC:00000001
bitwarden-identity       |       Connection id "0HN3U2VRREFDC", Request id "0HN3U2VRREFDC:00000001": An unhandled exception was thrown by the application.
bitwarden-identity       |       System.Security.Cryptography.CryptographicException: The key {095f5985-3c62-4761-8965-120b0b276b68} was not found in the key ring. For more information go to https://aka.ms/aspnet/dataprotectionwarning

Screenshots or Videos

obraz

Additional Context

Used to work for few years but recently broke. Tried updates, reinstalling, updatedb, updateconf, renewcert.

Build Version

2024.4.1

Environment

Self-Hosted

Environment Details

Windows 10 WSL2 running: DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.04 DISTRIB_CODENAME=focal DISTRIB_DESCRIPTION="Ubuntu 20.04.6 LTS"

Exposed on local interfaces.

Issue Tracking Info

  • [X] I understand that work is tracked outside of Github. A PR will be linked to this issue should one be opened to address it, but Bitwarden doesn't use fields like "assigned", "milestone", or "project" to track progress.

fusion4bass avatar May 27 '24 15:05 fusion4bass

Hi there,

I am unable to reproduce this issue, it has been escalated for further investigation. If you have more information that can help us, please add it below.

Thanks!

sammbw avatar May 28 '24 01:05 sammbw

These are version of images:

1470771f1351   bitwarden/nginx:2024.5.0           "/entrypoint.sh"   17 hours ago   Up 2 hours (healthy)   80/tcp, 0.0.0.0:80->8080/tcp, 0.0.0.0:443->8443/tcp   bitwarden-nginx
a9fb9e2c48a9   bitwarden/admin:2024.5.0           "/entrypoint.sh"   17 hours ago   Up 2 hours (healthy)   5000/tcp                                              bitwarden-admin
55154f97de9b   bitwarden/sso:2024.5.0             "/entrypoint.sh"   17 hours ago   Up 2 hours (healthy)   5000/tcp                                              bitwarden-sso
c082a091a17d   bitwarden/identity:2024.5.0        "/entrypoint.sh"   17 hours ago   Up 2 hours (healthy)   5000/tcp                                              bitwarden-identity
335475b44fdb   bitwarden/attachments:2024.5.0     "/entrypoint.sh"   17 hours ago   Up 2 hours (healthy)                                                         bitwarden-attachments
62dfa26af618   bitwarden/mssql:2024.5.0           "/entrypoint.sh"   17 hours ago   Up 2 hours (healthy)                                                         bitwarden-mssql
ad314eb3ad96   bitwarden/icons:2024.5.0           "/entrypoint.sh"   17 hours ago   Up 2 hours (healthy)   5000/tcp                                              bitwarden-icons
3b52eb7ed460   bitwarden/web:2024.5.0             "/entrypoint.sh"   17 hours ago   Up 2 hours (healthy)                                                         bitwarden-web
f8715a59ed6f   bitwarden/notifications:2024.5.0   "/entrypoint.sh"   17 hours ago   Up 2 hours (healthy)   5000/tcp                                              bitwarden-notifications
7edd1373e918   bitwarden/api:2024.5.0             "/entrypoint.sh"   17 hours ago   Up 2 hours (healthy)   5000/tcp                                              bitwarden-api
cbe95e8d236a   bitwarden/events:2024.5.0          "/entrypoint.sh"   17 hours ago   Up 2 hours (healthy)   5000/tcp                                              bitwarden-events

I attach recent logs from compose but cannot attach all logs as when I use ./bitwarden.sh compresslogs the file is 1 gig :) compose-logs.txt

fusion4bass avatar May 28 '24 08:05 fusion4bass

@fusion4bass Very sorry for the long time to get back to this, are you by chance still running into this issue? If you are would you be able to make sure that you have volumes mounted? My theory is that sometime after you created the user your rebuilt the image and you did not have a persistent volume (or it was deleted after).

justindbaur avatar Jun 03 '25 20:06 justindbaur

I'm going to be closing this issue, if you are still running into the issue please make a new one!

justindbaur avatar Jun 17 '25 13:06 justindbaur