On the host running docker, I ran a similar test -- I set up a postfix server to relay mail through the LAN postfix server which then relays through gmail. Setup looks like:
Arch Linux (postfix)-------------->| Arch Linx VM (Reverse Proxy)
docker image --------------------| -->Postfix server ----------------->Gmail ------> user
So I can send mail from the bw host, relayed through postfix running on Arch Linux VM, relayed through Gmail and then sent to user
I configured BW to relay mail through the Reverse Proxy Postfix server (however clearly it didn't work).
I'm not sure what email address it having a problem building
To trigger Bitwarden to send the email -- I'm clicking on box on main page enabled (Verify Email).
I'll provide more information as needed -- thanks for any help.
Originally created by @kevdogg on GitHub (Feb 5, 2020).
I've seen previous thread addressing this issue however no solution was presented except upgrade to latest version.
I'm using bitwarden_rs from container. BW 2.12.1
```
[2020-02-05 01:41:50][bitwarden_rs::api::core::accounts][ERROR] Error sending delete account email: Error building email. invalid email address
[2020-02-05 01:41:50][response][INFO] POST /api/accounts/verify-email (post_verify_email) => 200 OK
[2020-02-05 01:41:57][ws::handler][DEBUG] Handler received
```
Here is my docker-compose.yml file (with selected parts redacted)
```
# docker-compose.yml
version: '3.7'
networks:
docker_net:
ipam:
driver: default
config:
- subnet: 172.28.1.0/24
services:
bitwarden:
container_name: 'bitwardenrs'
# image: bitwardenrs/server:latest
build:
context: .
dockerfile: Dockerfile
restart: always
networks:
docker_net:
ipv4_address: 172.28.1.2
volumes:
- /var/data/bw-data:/data
ports:
- 80:80
- 3012:3012
environment:
LOG_FILE: 'data/bitwarden.log'
LOG_LEVEL: 'debug'
EXTENDED_LOGGING: 'true'
SIGNUPS_ALLOWED: 'true'
ADMIN_TOKEN: '<password>'
WEBSOCKET_ENABLED: 'true'
DOMAIN: 'https://bw.<base_domain>'
SMTP_HOST: 'postfix.<base_domain>'
SMTP_FROM: 'admin@bw.<base_domain>'
SMTP_PORT: '587'
SMTP_SSL: 'true'
SMTP_USERNAME: '<username>'
SMTP_PASSWORD: '<password in plain text>'
SMTP_EXPLICIT_TLS: 'true'
```
On the host running docker, I ran a similar test -- I set up a postfix server to relay mail through the LAN postfix server which then relays through gmail. Setup looks like:
Arch Linux (postfix)-------------->| Arch Linx VM (Reverse Proxy)
docker image --------------------| -->Postfix server ----------------->Gmail ------> user
So I can send mail from the bw host, relayed through postfix running on Arch Linux VM, relayed through Gmail and then sent to user
I configured BW to relay mail through the Reverse Proxy Postfix server (however clearly it didn't work).
I'm not sure what email address it having a problem building
To trigger Bitwarden to send the email -- I'm clicking on box on main page enabled (Verify Email).
I'll provide more information as needed -- thanks for any help.
@kevdogg commented on GitHub (Feb 5, 2020):
I further tried this experiment going through Bitwarden Admin panel and then trying to send an email through the Invite User dialog
I popped open F12 and under network tab this is what I found:
```
{ErrorModel: {Message: "Error building email", Object: "error"}, Message: "", Object: "error",…}
ErrorModel: {Message: "Error building email", Object: "error"}
Message: ""
Object: "error"
ValidationErrors: {"": ["Error building email"]}
error: ""
error_description: ""
```
is this a valid email address - admin@bw.<base_domain>? (note: "bw." inlcuded)
can "username" send email as admin@bw.<base_domain>?
I would check the logs at the proxy or email servers, if possible.
Also, is SSL enable in your SMTP server?
@hiyan commented on GitHub (Feb 5, 2020):
Shot in the dark here...
1) is this a valid email address - admin@bw.<base_domain>? (note: "bw." inlcuded)
2) can "username" send email as admin@bw.<base_domain>?
3) I would check the logs at the proxy or email servers, if possible.
Also, is SSL enable in your SMTP server?
Thanks a lot for your comments. You pointed me in the right direction
Valid email address -- you were totally correct. I didn't enter a valid email address. Once I corrected this, things proceeded past the error of invalid email address
SSL related
I'm using postfix as my smtp relay. Here are my postfix settings that pertain to SSL for smtpd:
Its kind of another ball of wax --
I know many users have asked about this one. Client settings are usually controlled with the directive:
smtp_explicit_tls = yes or smtp_explicit_tls = no (no is the default).
In terms of how this relates to postfix -- settings are found both in the /etc/master.cf and /etc/services file.
Within master.cf, you'll see two broad sections under the headings of
submission inet n - n - - smtpd
smtps inet n - n - - smtpd
Both submission and smtps are services controlled by the master daemon. submission refers to implicit TLS (where the connection is upgraded and encrypted after connecting and receiving TLS header) and smtps refers to explicit TLS (whereby the connection is encrypted from the start). Postfix by default has submission enabled, but smtps is not enabled. The master.cf needs to be modified to enable smtps (along with the various suboptions) to enable smtps. The /etc/services file links the name of the service with the various port. In my /etc/services file submission was:
submission 587/tcp
submission 587/udp
smtps was not even listed. I needed to add an entry into the file for smtps
smtps 465/tcp
smtps 465/udp
So once the changes on the postfix side where made -- on the bitwarden side you could choose either
Implicit TLS with port 465 (In admin console: Check box that says Use Explicit TLS and select 465)
Or
Explicit TLS with port 587 (In admin console: Do not check box that says Use Explicit TLS and select 587)
Sorry about the long post but I hope this works. I also posting my master_cf file here for reference in case it helps someone:
#
# Postfix master process configuration file. For details on the format
# of the file, see the master(5) manual page (command: "man 5 master" or
# on-line: http://www.postfix.org/master.5.html).
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (no) (never) (100)
# ==========================================================================
smtp inet n - n - - smtpd
#smtp inet n - n - 1 postscreen
#smtpd pass - - n - - smtpd
#dnsblog unix - - n - 0 dnsblog
#tlsproxy unix - - n - 0 tlsproxy
submission inet n - n - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=may
-o smtpd_sasl_auth_enable=yes
-o smtpd_tls_auth_only=yes
# -o smtpd_reject_unlisted_recipient=no
# -o smtpd_client_restrictions=$mua_client_restrictions
-o smtpd_client_restrictions=permit_sasl_authenticated,permit_mynetworks,reject
# -o smtpd_helo_restrictions=$mua_helo_restrictions
# -o smtpd_sender_restrictions=$mua_sender_restrictions
# -o smtpd_recipient_restrictions=permit_sasl_authenticated,permit_mynetworks,reject
-o smtpd_relay_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
-o cleanup_service_name=subcleanup
smtps inet n - n - - smtpd
-o syslog_name=postfix/smtps
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
# -o smtpd_reject_unlisted_recipient=no
-o smtpd_client_restrictions=permit_sasl_authenticated,permit_mynetworks,reject
# -o smtpd_helo_restrictions=$mua_helo_restrictions
# -o smtpd_sender_restrictions=$mua_sender_restrictions
# -o smtpd_recipient_restrictions=
-o smtpd_relay_restrictions=permit_sasl_authenticated,permit_mynetwoks,reject
-o milter_macro_daemon_name=ORIGINATING
-o cleanup_service_name=subcleanup
#628 inet n - n - - qmqpd
pickup unix n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
subcleanup unix n - - - 0 cleanup
-o header_checks=regexp:/etc/postfix/submission_header_checks
qmgr unix n - n 300 1 qmgr
#qmgr unix n - n 300 1 oqmgr
tlsmgr unix - - n 1000? 1 tlsmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
trace unix - - n - 0 bounce
verify unix - - n - 1 verify
flush unix n - n 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - n - - smtp
relay unix - - n - - smtp
-o syslog_name=postfix/$service_name
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - n - - showq
error unix - - n - - error
retry unix - - n - - error
discard unix - - n - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - n - - lmtp
anvil unix - - n - 1 anvil
scache unix - - n - 1 scache
postlog unix-dgram n - n - 1 postlogd
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent. See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
#maildrop unix - n n - - pipe
# flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
#
# ====================================================================
#
# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
#
# Specify in cyrus.conf:
# lmtp cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
#
# Specify in main.cf one or more of the following:
# mailbox_transport = lmtp:inet:localhost
# virtual_transport = lmtp:inet:localhost
#
# ====================================================================
#
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
#
#cyrus unix - n n - - pipe
# user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
#
# ====================================================================
#
# Old example of delivery via Cyrus.
#
#old-cyrus unix - n n - - pipe
# flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
#
# ====================================================================
#
# See the Postfix UUCP_README file for configuration details.
#
#uucp unix - n n - - pipe
# flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# ====================================================================
#
# Other external delivery methods.
#
#ifmail unix - n n - - pipe
# flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
#
#bsmtp unix - n n - - pipe
# flags=Fq. user=bsmtp argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient
#
#scalemail-backend unix - n n - 2 pipe
# flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store
# ${nexthop} ${user} ${extension}
#
#mailman unix - n n - - pipe
# flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
# ${nexthop} ${user}
@kevdogg commented on GitHub (Feb 5, 2020):
@hiyan
Thanks a lot for your comments. You pointed me in the right direction
1. Valid email address -- you were totally correct. I didn't enter a valid email address. Once I corrected this, things proceeded past the error of invalid email address
2. SSL related
I'm using postfix as my smtp relay. Here are my postfix settings that pertain to SSL for smtpd:
```
smtpd_tls_key_file = /etc/letsencrypt/postfix.<base_domain>/privkey.pem
smtpd_tls_cert_file = /etc/letsencrypt/postfix.<base_domain>/fullchain.pem
smtpd_tls_loglevel = 1
tls_random_source = dev:/dev/urandom
tls_random_exchange_name = /var/lib/postfix/prng_exch
smtpd_use_tls = yes
smtpd_tls_security_level = may
smtpd_tls_auth_only = yes
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1, !TLSv1.2
smtpd_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1, !TLSv1.2
tls_preempt_cipherlist = no
smtpd_tls_session_cache_timeout = 3600s
smtpd_tls_session_cache_database = btree:/var/lib/postfix/smtpd_tls_cache
tls_random_source = dev:/dev/urandom
```
Many of these settings corresponded to those recommended by the Mozilla Generator: https://ssl-config.mozilla.org/#server=postfix&version=3.4.8&config=modern&openssl=1.1.1d&guideline=5.4
In terms of Use Explicit TLS setting
- Its kind of another ball of wax --
I know many users have asked about this one. Client settings are usually controlled with the directive:
smtp_explicit_tls = yes or smtp_explicit_tls = no (no is the default).
In terms of how this relates to postfix -- settings are found both in the /etc/master.cf and /etc/services file.
Within master.cf, you'll see two broad sections under the headings of
submission inet n - n - - smtpd
smtps inet n - n - - smtpd
Both submission and smtps are services controlled by the master daemon. submission refers to implicit TLS (where the connection is upgraded and encrypted after connecting and receiving TLS header) and smtps refers to explicit TLS (whereby the connection is encrypted from the start). Postfix by default has submission enabled, but smtps is not enabled. The master.cf needs to be modified to enable smtps (along with the various suboptions) to enable smtps. The /etc/services file links the name of the service with the various port. In my /etc/services file submission was:
submission 587/tcp
submission 587/udp
smtps was not even listed. I needed to add an entry into the file for smtps
smtps 465/tcp
smtps 465/udp
So once the changes on the postfix side where made -- on the bitwarden side you could choose either
Implicit TLS with port 465 (In admin console: Check box that says Use Explicit TLS and select 465)
Or
Explicit TLS with port 587 (In admin console: Do not check box that says Use Explicit TLS and select 587)
Sorry about the long post but I hope this works. I also posting my master_cf file here for reference in case it helps someone:
```
#
# Postfix master process configuration file. For details on the format
# of the file, see the master(5) manual page (command: "man 5 master" or
# on-line: http://www.postfix.org/master.5.html).
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (no) (never) (100)
# ==========================================================================
smtp inet n - n - - smtpd
#smtp inet n - n - 1 postscreen
#smtpd pass - - n - - smtpd
#dnsblog unix - - n - 0 dnsblog
#tlsproxy unix - - n - 0 tlsproxy
submission inet n - n - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=may
-o smtpd_sasl_auth_enable=yes
-o smtpd_tls_auth_only=yes
# -o smtpd_reject_unlisted_recipient=no
# -o smtpd_client_restrictions=$mua_client_restrictions
-o smtpd_client_restrictions=permit_sasl_authenticated,permit_mynetworks,reject
# -o smtpd_helo_restrictions=$mua_helo_restrictions
# -o smtpd_sender_restrictions=$mua_sender_restrictions
# -o smtpd_recipient_restrictions=permit_sasl_authenticated,permit_mynetworks,reject
-o smtpd_relay_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
-o cleanup_service_name=subcleanup
smtps inet n - n - - smtpd
-o syslog_name=postfix/smtps
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
# -o smtpd_reject_unlisted_recipient=no
-o smtpd_client_restrictions=permit_sasl_authenticated,permit_mynetworks,reject
# -o smtpd_helo_restrictions=$mua_helo_restrictions
# -o smtpd_sender_restrictions=$mua_sender_restrictions
# -o smtpd_recipient_restrictions=
-o smtpd_relay_restrictions=permit_sasl_authenticated,permit_mynetwoks,reject
-o milter_macro_daemon_name=ORIGINATING
-o cleanup_service_name=subcleanup
#628 inet n - n - - qmqpd
pickup unix n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
subcleanup unix n - - - 0 cleanup
-o header_checks=regexp:/etc/postfix/submission_header_checks
qmgr unix n - n 300 1 qmgr
#qmgr unix n - n 300 1 oqmgr
tlsmgr unix - - n 1000? 1 tlsmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
trace unix - - n - 0 bounce
verify unix - - n - 1 verify
flush unix n - n 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - n - - smtp
relay unix - - n - - smtp
-o syslog_name=postfix/$service_name
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - n - - showq
error unix - - n - - error
retry unix - - n - - error
discard unix - - n - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - n - - lmtp
anvil unix - - n - 1 anvil
scache unix - - n - 1 scache
postlog unix-dgram n - n - 1 postlogd
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent. See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
#maildrop unix - n n - - pipe
# flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
#
# ====================================================================
#
# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
#
# Specify in cyrus.conf:
# lmtp cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
#
# Specify in main.cf one or more of the following:
# mailbox_transport = lmtp:inet:localhost
# virtual_transport = lmtp:inet:localhost
#
# ====================================================================
#
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
#
#cyrus unix - n n - - pipe
# user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
#
# ====================================================================
#
# Old example of delivery via Cyrus.
#
#old-cyrus unix - n n - - pipe
# flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
#
# ====================================================================
#
# See the Postfix UUCP_README file for configuration details.
#
#uucp unix - n n - - pipe
# flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# ====================================================================
#
# Other external delivery methods.
#
#ifmail unix - n n - - pipe
# flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
#
#bsmtp unix - n n - - pipe
# flags=Fq. user=bsmtp argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient
#
#scalemail-backend unix - n n - 2 pipe
# flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store
# ${nexthop} ${user} ${extension}
#
#mailman unix - n n - - pipe
# flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
# ${nexthop} ${user}
```
Glad to help. Unfortunately, I have zero experience with setting up a SMTP so cant really help you there, just a thought for you to check on your setup.
Hope it's working for you.
@hiyan commented on GitHub (Feb 6, 2020):
Glad to help. Unfortunately, I have zero experience with setting up a SMTP so cant really help you there, just a thought for you to check on your setup.
Hope it's working for you.
Unless you're particularly interested in setting up your own mail server, it would probably be a lot easier just to use a service like SendGrid, Mailjet, etc. These offer a free tier that let you send a small amount of emails per day.
@jjlin commented on GitHub (Feb 6, 2020):
Unless you're particularly interested in setting up your own mail server, it would probably be a lot easier just to use a service like SendGrid, Mailjet, etc. These offer a free tier that let you send a small amount of emails per day.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @kevdogg on GitHub (Feb 5, 2020).
I've seen previous thread addressing this issue however no solution was presented except upgrade to latest version.
I'm using bitwarden_rs from container. BW 2.12.1
Here is my docker-compose.yml file (with selected parts redacted)
On the host running docker, I ran a similar test -- I set up a postfix server to relay mail through the LAN postfix server which then relays through gmail. Setup looks like:
Arch Linux (postfix)-------------->| Arch Linx VM (Reverse Proxy)
docker image --------------------| -->Postfix server ----------------->Gmail ------> user
So I can send mail from the bw host, relayed through postfix running on Arch Linux VM, relayed through Gmail and then sent to user
I configured BW to relay mail through the Reverse Proxy Postfix server (however clearly it didn't work).
I'm not sure what email address it having a problem building
To trigger Bitwarden to send the email -- I'm clicking on box on main page enabled (Verify Email).
I'll provide more information as needed -- thanks for any help.
@kevdogg commented on GitHub (Feb 5, 2020):
I further tried this experiment going through Bitwarden Admin panel and then trying to send an email through the Invite User dialog
I popped open F12 and under network tab this is what I found:
@hiyan commented on GitHub (Feb 5, 2020):
Shot in the dark here...
Also, is SSL enable in your SMTP server?
@kevdogg commented on GitHub (Feb 5, 2020):
@hiyan
Thanks a lot for your comments. You pointed me in the right direction
Valid email address -- you were totally correct. I didn't enter a valid email address. Once I corrected this, things proceeded past the error of invalid email address
SSL related
I'm using postfix as my smtp relay. Here are my postfix settings that pertain to SSL for smtpd:
Many of these settings corresponded to those recommended by the Mozilla Generator: https://ssl-config.mozilla.org/#server=postfix&version=3.4.8&config=modern&openssl=1.1.1d&guideline=5.4
In terms of Use Explicit TLS setting
I know many users have asked about this one. Client settings are usually controlled with the directive:
smtp_explicit_tls = yes or smtp_explicit_tls = no (no is the default).
In terms of how this relates to postfix -- settings are found both in the /etc/master.cf and /etc/services file.
Within master.cf, you'll see two broad sections under the headings of
submission inet n - n - - smtpd
smtps inet n - n - - smtpd
Both submission and smtps are services controlled by the master daemon. submission refers to implicit TLS (where the connection is upgraded and encrypted after connecting and receiving TLS header) and smtps refers to explicit TLS (whereby the connection is encrypted from the start). Postfix by default has submission enabled, but smtps is not enabled. The master.cf needs to be modified to enable smtps (along with the various suboptions) to enable smtps. The /etc/services file links the name of the service with the various port. In my /etc/services file submission was:
submission 587/tcp
submission 587/udp
smtps was not even listed. I needed to add an entry into the file for smtps
smtps 465/tcp
smtps 465/udp
So once the changes on the postfix side where made -- on the bitwarden side you could choose either
Implicit TLS with port 465 (In admin console: Check box that says Use Explicit TLS and select 465)
Or
Explicit TLS with port 587 (In admin console: Do not check box that says Use Explicit TLS and select 587)
Sorry about the long post but I hope this works. I also posting my master_cf file here for reference in case it helps someone:
@hiyan commented on GitHub (Feb 6, 2020):
Glad to help. Unfortunately, I have zero experience with setting up a SMTP so cant really help you there, just a thought for you to check on your setup.
Hope it's working for you.
@jjlin commented on GitHub (Feb 6, 2020):
Unless you're particularly interested in setting up your own mail server, it would probably be a lot easier just to use a service like SendGrid, Mailjet, etc. These offer a free tier that let you send a small amount of emails per day.
@dani-garcia commented on GitHub (May 13, 2020):
Closed due to inactivity.