I’m a docker noob and today I copy-pasted my way into BW installation using Google Cloud, debian and docker. My own BW is up and I’m extremely proud of myself. But I can’t get SMTP to work.
My setup:
Linux instance-1 4.9.0-6-amd64 #1 SMP Debian 4.9.88-1+deb9u1 (2018-05-07) x86_64 GNU/Linux
Docker version 18.03.1-ce, build 9ee9f40
docker-compose version 1.21.2, build a133471
eskela@instance-1:~$ docker images -a
REPOSITORY TAG IMAGE ID CREATED SIZE
mprasil/bitwarden latest f06b75ff79c2 2 days ago 82.8MB
certbot/certbot latest aee207f30a81 2 weeks ago 116MB
bitwarden/web 1.27.0 58a90dd0d0bc 4 weeks ago 337MB
bitwarden/setup 1.20.0 92cf588d9809 4 weeks ago 227MB
bitwarden/admin 1.20.0 75bdfb65c0bb 4 weeks ago 349MB
bitwarden/icons 1.20.0 7e428b5e9a08 4 weeks ago 333MB
bitwarden/identity 1.20.0 2d7a8e6c1d6d 4 weeks ago 365MB
bitwarden/api 1.20.0 2a6fc370972f 4 weeks ago 418MB
bitwarden/mssql 1.20.0 00f82eb00bbe 4 weeks ago 1.43GB
bitwarden/attachments 1.20.0 29d47575712a 4 weeks ago 333MB
bitwarden/nginx 1.20.0 3a686270aab0 4 weeks ago 111MB
Here are my steps:
Config:
[email protected]
globalSettings__mail__smtp__host=smtp.mailgun.org
globalSettings__mail__smtp__username=postmaster@bw.mysweetdomain.com
globalSettings__mail__smtp__password=CUTCUTCUTCUT
globalSettings__mail__smtp__ssl=true
globalSettings__mail__smtp__port=587
globalSettings__mail__smtp__useDefaultCredentials=false
globalSettings__disableUserRegistration=false
[email protected]
I set up domain in mailgun (including all TXT, MX entries), I added my admin email as authorised recipient in Mailgun (required for free accounts).
I tested credentials + 587 port using SMTP Diag Tool and I’m able to send to mailgun smtp and receive on my admin email using above credentials. I’m 99% confident that SMTP credentials are correct, but there seems to be no way to ensure my SMTP Diag Tool is attempting via SSL or TSL.
I attempted to send myself magical admin-login link from my BW installation and here’s error log:
eskela@instance-1:~/bwdata/logs$ find . -name "*" -type f
./mssql/log.trc
./mssql/errorlog
./mssql/sqlagentstartup.log
./mssql/system_health_0_131751220620300000.xel
./mssql/errorlog.1
./mssql/sqlagent.out
./mssql/HkEngineEventFile_0_131751220607630000.xel
./admin/Admin/20180703.txt
./nginx/error.log
./nginx/access.log
eskela@instance-1:~/bwdata/logs$ cd admin/Admin/
eskela@instance-1:~/bwdata/logs/admin/Admin$ cat 20180703.txt
2018-07-03 20:08:15.698 +00:00 [Error] Error sending mail with primary service, using backup.
System.InvalidOperationException: Cannot find compilation library location for package 'Microsoft.Win32.Registry'
at Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths(ICompilationAssemblyResolver resolver, List`1 assemblies)
at Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths()
at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
at RazorLight.Compilation.DefaultMetadataReferenceManager.Resolve(Assembly assembly)
at RazorLight.Compilation.RoslynCompilationService.EnsureOptions()
at RazorLight.Compilation.RoslynCompilationService.get_ParseOptions()
at RazorLight.Compilation.RoslynCompilationService.CreateCompilation(String compilationContent, String assemblyName)
at RazorLight.Compilation.RoslynCompilationService.CompileAndEmit(GeneratedRazorTemplate razorTemplate)
at RazorLight.TemplateFactoryProvider.CreateFactory(GeneratedRazorTemplate razorTemplate)
at RazorLight.TemplateFactoryProvider.<CreateFactoryAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at RazorLight.RazorLightEngine.<CompileTemplateAsync>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at RazorLight.RazorLightEngine.<CompileRenderAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Bit.Core.Services.RazorMailService.<SendPasswordlessSignInAsync>d__15.MoveNext() in /Users/kyle/Projects/bitwarden/core/src/Core/Services/Implementations/RazorMailService.cs:line 221
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Bit.Core.Services.BackupMailService.<SendPasswordlessSignInAsync>d__14.MoveNext() in /Users/kyle/Projects/bitwarden/core/src/Core/Services/Implementations/BackupMailService.cs:line 160
I tried to create new user (registration is not disabled) and got following log:
eskela@instance-1:~/bwdata/logs/api/Api$ cat 20180703.txt
2018-07-03 20:16:14.085 +00:00 [Error] Cannot open database "vault" requested by the login. The login failed.
Login failed for user 'sa'.
System.Data.SqlClient.SqlException (0x80131904): Cannot open database "vault" requested by the login. The login failed.
Login failed for user 'sa'.
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionPool.WaitForPendingOpen()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Dapper.SqlMapper.<QueryAsync>d__31`1.MoveNext() in C:\projects\dapper\Dapper\SqlMapper.Async.cs:line 389
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Bit.Core.Repositories.SqlServer.UserRepository.<GetByEmailAsync>d__3.MoveNext() in /Users/kyle/Projects/bitwarden/core/src/Core/Repositories/SqlServer/UserRepository.cs:line 31
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Bit.Core.Identity.UserStore.<FindByEmailAsync>d__6.MoveNext() in /Users/kyle/Projects/bitwarden/core/src/Core/Identity/UserStore.cs:line 49
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Bit.Core.Identity.UserStore.<FindByNameAsync>d__8.MoveNext() in /Users/kyle/Projects/bitwarden/core/src/Core/Identity/UserStore.cs:line 73
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Identity.UserValidator`1.<ValidateUserName>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Identity.UserValidator`1.<ValidateAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Identity.UserManager`1.<ValidateUserInternal>d__169.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Identity.UserManager`1.<CreateAsync>d__73.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Identity.UserManager`1.<CreateAsync>d__78.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Bit.Core.Services.UserService.<RegisterUserAsync>d__27.MoveNext() in /Users/kyle/Projects/bitwarden/core/src/Core/Services/Implementations/UserService.cs:line 227
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Bit.Api.Controllers.AccountsController.<PostRegister>d__6.MoveNext() in /Users/kyle/Projects/bitwarden/core/src/Api/Controllers/AccountsController.cs:line 48
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeInnerFilterAsync>d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextExceptionFilterAsync>d__23.MoveNext()
ClientConnectionId:9809d9fb-1aec-425c-81c4-0183b60e057b
Error Number:4060,State:1,Class:11
(note to above, my username was not ‘sa’, not sure if it means anything)
I tried changing to other ports: 25, 465, bitwarden.sh restart was done after each, followed by an attempt to send email with admin link. This also didn’t procure an email.
Is there any smtp port (outbound?) that I would need to manually open up from docker? Any help will be appreciated.