server icon indicating copy to clipboard operation
server copied to clipboard

"New login" mail has wrong timezone

Open fbermel opened this issue 6 years ago • 16 comments

Hi,

Everytime I log into bitwarden (on-premise) from a new device I get an email saying that the new login happened but the timestamp in the email is UTC and not UTC+2 as my timezone.

I have setup the docker containers (adding TZ env variable and an entrypoint wrapper script for mssql container because the ubuntu 16.04 in the container is missing tzdata package) so they all are showing the correct time when I execute docker run -it containername date and I've also checked that mssql's GETDATE() is showing the correct date.

What exactly is handling the time in these emails and needs to be adjusted?

fbermel avatar May 08 '19 16:05 fbermel

This is not currently adjustable. All timestamps will remain in UTC regardless of what you set the local time of the server to. We can look into adding a setting for this, however.

kspearrin avatar May 09 '19 02:05 kspearrin

Thanks for your reply. I think such a setting would be pretty useful.

It would be also very helpful to have a global setting to set the timezone for all containers. Maybe I've just not found where this can be set globally, yet but at the moment I'm providing the TZ environment varaible in docker-compose.override.yml to all the containers.

The container bitwarden-mssql is running on Ubuntu 16.04 and is missing the package tzdata which is needed to set the timezone. So I'm also providing DEBIAN_FRONTEND: "noninteractive" to make the installation of tzdata package non-interactive. I'm then adding a shell script to the container and replace the entrypoint with this script.

mssql:
    volumes:
      - "./timezone.sh:/timezone.sh"
    environment:
      TZ: "Europe/Berlin"
      DEBIAN_FRONTEND: "noninteractive"
    entrypoint: /timezone.sh

timezone.sh

#!/bin/sh

apt-get update && apt-get install -y tzdata
rm /etc/localtime
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime
dpkg-reconfigure -f noninteractive tzdata
apt-get clean

/entrypoint.sh

Is there a way to do this more easily? Having the correct timezone on all containers would be pretty important to have correct timestamps in the log files.

fbermel avatar May 09 '19 05:05 fbermel

Has this option been added yet?

ghaisasadvait avatar Oct 25 '20 05:10 ghaisasadvait

The container bitwarden-mssql is running on Ubuntu 16.04 and is missing the package tzdata

All containers now have tzdata installed (see #606) so that you can set your own timezone thanks to the TZ environment variable.

Mart124 avatar Oct 25 '20 08:10 Mart124

Thank you for replying! I have set the correct timezone on my ubuntu server 18 as well as am running the tzdata package.It is still not working. Can you please guide me as to how to set it?

ghaisasadvait avatar Oct 25 '20 08:10 ghaisasadvait

Log into your containers and run the date command, you'll see the effect of setting TZ in bwdata/docker/docker-compose.override.yml. For example :

services:
  mssql:
    environment:
      - TZ=Europe/Berlin

However, as said above, mails will remain in UTC timezone. (you should be able to close #973)

Mart124 avatar Nov 03 '20 21:11 Mart124

Oh so regardless of setting the timezone, the email will still be in UTC?

ghaisasadvait avatar Nov 03 '20 21:11 ghaisasadvait

Yes. Proper timezone allows other things such as proper timestamps in logs, proper cron schedules etc...

Mart124 avatar Nov 03 '20 21:11 Mart124

Oh I see. Thank you for your reply!

ghaisasadvait avatar Nov 03 '20 21:11 ghaisasadvait

Closing this as tzdata was added and @Mart124 has provided information on how to configure it.

djsmith85 avatar Nov 09 '21 14:11 djsmith85

@djsmith85 Sure you can close this but the issue is not mainly about tzdata but about "New login mails" not having the correct timestamp and that it's not configurable. Since this seems to be still the case I wouldn't say that this issue is solved.

fbermel avatar Nov 09 '21 14:11 fbermel

@KnappeGEIL Thank you for your report. Based on your comment, I just checked the mail in question and indeed it is still not possible to configure/set the timezone. Re-opening..

djsmith85 avatar Nov 09 '21 14:11 djsmith85

Hi @KnappeGEIL, We're cleaning up our repositories in preparation for a major reorganization. Issues from last year will be marked as stale and closed after two weeks. If you still need help, comment to let us know and we'll look into it. Thanks!

bitwarden-bot avatar Apr 12 '22 19:04 bitwarden-bot

The email are still not coming in the local/server timezone

ghaisasadvait avatar Apr 12 '22 19:04 ghaisasadvait