i just installed a self-hosted vaultwarden docker container on my unraid-server. everything looks fine except of my 2FA. 2FA with email also works great. but with my totp-app i’ve got the problem that i have two different times. when i have a look at my vaultwarden-admin diagnostics i see server time and browser time.
i don’t get it why browser time is 2h before. i tried already ms edge and firefox. my system (windows 11) time is the same as the server time. so i don’t understand why the browser works with a different time.
I once had a similiar problem and fixed it by mapping /etc/localtime of the host to /etc/localtime in the docker container. Looks something like that in docker-compose:
unfortunately I don’t use docker compose. However, I mapped it in unraid like this and it didn’t work. I have to admit that my knowledge of linux is not advanced enough to configure everything from the command line alone.
I was hoping that I only have to edit one entry in a file. but after everything I’ve found via google, it’s a bit more complicated to change the time zone in a container.
I will probably leave it at 2FA via mail, unless someone else has an idea of how I can solve the whole thing “simply” without advanced knowledge.
Hi,
I dont know unraid, but you can set parameters for the docker container, right?
Like the data directory with “-v /bw-data/:/data/”.
To map the timezone from the host add the start parameter “-v /etc/localtime:/etc/localtime:ro”.
Before you do that, check on the docker host, if the localtime on the server is right. You can do that with the following command: “zdump /etc/localtime”
It’s weird. On my host and in my vaultwarden container both are showing the correct time when i use zdump /etc/localtime
back to the first post. the server time is correct, but the browser time is wrong. is this really a vaultwarden/container problem? because both (host and container) showing the correct time when i type zdump /etc/localtime.
There seems to be a misconfiguration somewhere and it’s not really a vaultwarden problem (the configured TZ should be irrelevant for the displayed UTC of the container). You can check with sites like https://nist.time.gov/ or https://uhr.ptb.de/ what the time should be and if your local device’s clock is off. It should also show your device’s timezone and then you can see if you have set it correctly or if your server is 2 hours ahead (e.g. if your local time in the CEST timezone is set as the UTC of the server).
I just wanna let you guys know that my local switch (configuration) was the problem. I finally still do not know what the problem is but i put my server directly into my router. After that my time is correct and vaultwarden 2FA over TOTP is working fine.