Attempting to use Fastmail for SMTP, and syncing users from LDAP following the wiki page.
Here's my (redacted) compose file:
version: '3'
services:
bitwarden:
image: bitwardenrs/server:1.9.1
restart: always
volumes:
- ./bw-data:/data
environment:
- WEBSOCKET_ENABLED=true
- SIGNUPS_ALLOWED=false
- INVITATIONS_ALLOWED=true
- SMTP_HOST=smtp.fastmail.com
- [email protected]
- SMTP_PORT=465
- SMTP_SSL=true
- [email protected]
- SMTP_PASSWORD=bar
- DOMAIN=https://bitwarden.example.com
- ADMIN_TOKEN=baz
ldap:
image: vividboarder/bitwarden_rs_ldap:latest
restart: always
depends_on:
- bitwarden
volumes:
- ./ldap.toml:/config.toml:ro
environment:
- CONFIG_PATH=/config.toml
When the ldap service attempts an invite it timeouts, with bitwarden_rs throwing the following error:
[bitwarden_rs::error][ERROR] Error sending email. Complete
Is there any way to get more information than that, what exactly went wrong?
Complete logs, email addresses redacted:
ldap_1 | 2019-07-17T10:28:17.904808750Z Try to invite user: [email protected]
bitwarden_1 | 2019-07-17T10:28:17.922424846Z [2019-07-17 10:28:17][rocket::rocket][INFO] POST /admin/invite application/json:
bitwarden_1 | 2019-07-17T10:28:17.922481147Z [2019-07-17 10:28:17][_][INFO] Matched: POST /admin/invite (invite_user)
ldap_1 | 2019-07-17T10:28:47.922780566Z thread 'main' panicked at 'Could not call with http://bitwarden:80/admin/invite. Error { kind: Io(Custom { kind: TimedOut, error: StringError("timed out") }), url: Some("http://bitwarden/admin/invite") }', src/bw_admin.rs:134:21
ldap_1 | 2019-07-17T10:28:47.922874851Z note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
bitwarden_1 | 2019-07-17T10:28:49.088176717Z [2019-07-17 10:28:49][rocket::rocket][INFO] POST /admin/ application/x-www-form-urlencoded:
bitwarden_1 | 2019-07-17T10:28:49.088257990Z [2019-07-17 10:28:49][_][INFO] Matched: POST /admin (post_admin_login)
bitwarden_1 | 2019-07-17T10:28:49.092042487Z [2019-07-17 10:28:49][_][INFO] Outcome: Success
bitwarden_1 | 2019-07-17T10:28:49.092105254Z [2019-07-17 10:28:49][_][INFO] Response succeeded.
bitwarden_1 | 2019-07-17T10:28:49.116387629Z [2019-07-17 10:28:49][rocket::rocket][INFO] GET /admin/users:
bitwarden_1 | 2019-07-17T10:28:49.116445315Z [2019-07-17 10:28:49][_][INFO] Matched: GET /admin/users (get_users)
bitwarden_1 | 2019-07-17T10:28:49.118417870Z [2019-07-17 10:28:49][_][INFO] Outcome: Success
bitwarden_1 | 2019-07-17T10:28:49.118456414Z [2019-07-17 10:28:49][_][INFO] Response succeeded.
ldap_1 | User with email already exists: [email protected]
ldap_1 | Sent invites to 0 user(s).
bitwarden_1 | 2019-07-17T10:29:18.188538987Z [2019-07-17 10:29:18][bitwarden_rs::error][ERROR] Error sending email. Complete
bitwarden_1 | 2019-07-17T10:29:18.188618254Z [2019-07-17 10:29:18][_][INFO] Outcome: Success
bitwarden_1 | 2019-07-17T10:29:18.189187438Z [2019-07-17 10:29:18][_][INFO] Response succeeded.
I'm not sure what's going on, but to rule out any issues with the LDAP sync part, can you go to the admin interface (login with token) and try to send invite directly from there? See if you spot anything in logs.
Disabled the ldap sync service and attempted to invite manually, this is the complete log from when I clicked the invite button:
bitwarden_1 | 2019-07-18T07:32:03.654010403Z [2019-07-18 07:32:03][rocket::rocket][INFO] POST /admin/invite/ application/json:
bitwarden_1 | 2019-07-18T07:32:03.654083063Z [2019-07-18 07:32:03][_][INFO] Matched: POST /admin/invite (invite_user)
nginx_1 | 2019-07-18T07:33:03.654558141Z 2019/07/18 07:33:03 [error] 6#6: *44 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 10.20.0.2, server: bitwarden.lab, request: "POST /admin/invite/ HTTP/2.0", upstream: "http://192.168.100.2:80/admin/invite/", host: "bitwarden.lab", referrer: "https://bitwarden.lab/admin"
nginx_1 | 2019-07-18T07:33:03.655061160Z 10.20.0.2 - - [18/Jul/2019:07:33:03 +0000] "POST /admin/invite/ HTTP/2.0" 504 167 "https://bitwarden.lab/admin" "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0" "-"
bitwarden_1 | 2019-07-18T07:33:03.925418295Z [2019-07-18 07:33:03][bitwarden_rs::error][ERROR] Error sending email. Complete
bitwarden_1 | 2019-07-18T07:33:03.925490447Z [2019-07-18 07:33:03][_][INFO] Outcome: Success
bitwarden_1 | 2019-07-18T07:33:03.925500583Z [2019-07-18 07:33:03][_][INFO] Response succeeded.
Also got a confirm popup in the browser saying "Error inviting user: Unknown error", I got this at the same time nginx reported the timeout in the logs.
My nginx config, sans SSL options:
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name bitwarden.lab;
# ssl params
client_max_body_size 128M;
location / {
proxy_pass http://bitwarden:80/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /notifications/hub {
proxy_pass http://bitwarden:3012;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /notifications/hub/negotiate {
proxy_pass http://bitwarden:80/;
}
}
I had similar issues. Enabling "Use explicit TLS" in the Admin Panel did the trick! Just wondering if there is a environment variable to set this setting.

SMTP_EXPLICIT_TLS=true did it.

That solved it for me, thanks!
Most helpful comment
SMTP_EXPLICIT_TLS=truedid it.