bigbluebutton / greenlight

A really simple end-user interface for your BigBlueButton server.
GNU Lesser General Public License v3.0
797 stars 3.79k forks source link

SMTP authentication error, need more debug infos #5400

Closed nderambure closed 1 year ago

nderambure commented 1 year ago

Hello !

Using Greenlight 3.0.6.1 on BBB 2.6.12, installed from the famous one command line.

I'm trying to change the SMTP config, since I've migrated my domain name management from gandi.net to infomaniak.com. Note that it was working fine with gandi.net, using port 465. But the config for infomaniak.com gives me error of authentication (see below).

Infomaniak recommendations are there.

I've tried those configurations, without success (anonymized) :

On port 465 :

SMTP_SENDER_EMAIL=me@mydomain.fr
SMTP_SENDER_NAME=John
SMTP_SERVER=mail.infomaniak.com
SMTP_PORT=465
SMTP_DOMAIN=mydomain.fr
SMTP_USERNAME=me@mydomain.fr
SMTP_PASSWORD=xxxxxxxxxxx
SMTP_AUTH=PLAIN
SMTP_STARTTLS_AUTO=true (and also with false)
# SMTP_STARTTLS=false
# SMTP_TLS=false
# SMTP_SSL_VERIFY=true (and also uncomment)

On port 587 :

SMTP_SENDER_EMAIL=me@mydomain.fr
SMTP_SENDER_NAME=John
SMTP_SERVER=mail.infomaniak.com
SMTP_PORT=587
SMTP_DOMAIN=mydomain.fr
SMTP_USERNAME=me@mydomain.fr
SMTP_PASSWORD=xxxxxxxxxxx
SMTP_AUTH=PLAIN
SMTP_STARTTLS_AUTO=true (and also with false)
# SMTP_STARTTLS=false (and also with true)
SMTP_TLS=true
# SMTP_SSL_VERIFY=true (and also uncomment)

For all tested configurations I check :

root@mybox ~/greenlight-v3 # docker exec -it greenlight-v3 bundle exec rake configuration:check
Checking required environment variables:
Passed
Checking connection to Postgres Database:
Passed
Checking connection to Redis Cache:
Passed
Checking connection to BigBlueButton:
Passed
Checking connection to SMTP Server
I, [2023-09-05T23:27:27.206849 #160]  INFO -- : Delivered mail 64f7b95ca051d_a0133835a7@b7291fa2c5ef.mail (2550.8ms)
Failed - Unable to connect to SMTP Server - Net::SMTPAuthenticationError

In the docker logs I've this part :

I, [2023-09-05T23:27:53.429120 #140]  INFO -- : [7f54ea13-9581-4563-b26b-2fcc7602d123] [ActiveJob] Enqueued ActionMailer::MailDeliveryJob (Job ID: e9d6e684-8acd-4d6b-99c3-4b0860d1cfd4) to Async(greenlight_v3_production_mailing) with arguments: "UserMailer", "activate_account_email", "deliver_now", {:params=>{:user=>#<GlobalID:0x00007fb136f9fb70 @uri=#<URI::GID gid://greenlight/User/35a6b585-a64c-43b8-a2cf-0c2ce3de0003>>, :activation_url=>"https://bbb.coolname.fr/activate_account/3Ri4vCNoZI4tpx0qsOsgvqLyU361AkzQHJcPfhhN", :base_url=>"https://bbb.coolname.fr", :provider=>"greenlight"}, :args=>[]}
I, [2023-09-05T23:27:53.432767 #140]  INFO -- : [ActiveJob] [ActionMailer::MailDeliveryJob] [e9d6e684-8acd-4d6b-99c3-4b0860d1cfd4] Performing ActionMailer::MailDeliveryJob (Job ID: e9d6e684-8acd-4d6b-99c3-4b0860d1cfd4) from Async(greenlight_v3_production_mailing) enqueued at 2023-09-05T23:27:53Z with arguments: "UserMailer", "activate_account_email", "deliver_now", {:params=>{:user=>#<GlobalID:0x00007fb136d87180 @uri=#<URI::GID gid://greenlight/User/35a6b585-a64c-43b8-a2cf-0c2ce3de0003>>, :activation_url=>"https://bbb.coolname.fr/activate_account/3Ri4vCNoZI4tpx0qsOsgvqLyU361AkzQHJcPfhhN", :base_url=>"https://bbb.coolname.fr", :provider=>"greenlight"}, :args=>[]}
I, [2023-09-05T23:27:53.487756 #140]  INFO -- : [7f54ea13-9581-4563-b26b-2fcc7602d123] [active_model_serializers] Rendered CurrentUserSerializer with ActiveModelSerializers::Adapter::Json (1.93ms)
I, [2023-09-05T23:27:53.487988 #140]  INFO -- : [7f54ea13-9581-4563-b26b-2fcc7602d123] method=POST path=/api/v1/users.json format=json controller=Api::V1::UsersController action=create status=201 allocations=45702 duration=307.54 view=2.50 db=74.17 time=2023-09-05 23:27:53 UTC host=greenlight
I, [2023-09-05T23:27:53.549602 #140]  INFO -- : [9110aaf5-c118-4450-b238-ff04d0870d4f] [active_model_serializers] Rendered ActiveModel::Serializer::Null with Hash (0.05ms)
I, [2023-09-05T23:27:53.549829 #140]  INFO -- : [9110aaf5-c118-4450-b238-ff04d0870d4f] method=GET path=/api/v1/sessions.json format=json controller=Api::V1::SessionsController action=index status=200 allocations=534 duration=1.74 view=0.38 db=0.31 time=2023-09-05 23:27:53 UTC host=
I, [2023-09-05T23:27:53.626340 #140]  INFO -- : [f6f8b573-a57a-46d5-8bf7-6aad76125dfe] [active_model_serializers] Rendered ActiveModel::Serializer::Null with Hash (0.05ms)
I, [2023-09-05T23:27:53.626577 #140]  INFO -- : [f6f8b573-a57a-46d5-8bf7-6aad76125dfe] method=GET path=/api/v1/site_settings.json format=json controller=Api::V1::SiteSettingsController action=index status=200 allocations=1628 duration=5.40 view=0.37 db=1.70 time=2023-09-05 23:27:53 UTC host=greenlight
I, [2023-09-05T23:27:55.216025 #140]  INFO -- : [ActiveJob] [ActionMailer::MailDeliveryJob] [e9d6e684-8acd-4d6b-99c3-4b0860d1cfd4] Delivered mail 64f7b9796dada_8ca5dc8542d@b7291fa2c5ef.mail (1767.2ms)
E, [2023-09-05T23:27:55.216322 #140] ERROR -- : [ActiveJob] [ActionMailer::MailDeliveryJob] [e9d6e684-8acd-4d6b-99c3-4b0860d1cfd4] Error performing ActionMailer::MailDeliveryJob (Job ID: e9d6e684-8acd-4d6b-99c3-4b0860d1cfd4) from Async(greenlight_v3_production_mailing) in 1786.62ms: Net::SMTPAuthenticationError (535 5.7.8 Error: authentication failed:
):
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:1088:in `check_auth_response'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:845:in `auth_plain'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:837:in `public_send'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:837:in `authenticate'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:670:in `do_start'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:611:in `start'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/mail-2.8.1/lib/mail/network/delivery_methods/smtp.rb:109:in `start_smtp_session'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/mail-2.8.1/lib/mail/network/delivery_methods/smtp.rb:100:in `deliver!'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/mail-2.8.1/lib/mail/message.rb:2145:in `do_delivery'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/mail-2.8.1/lib/mail/message.rb:253:in `block in deliver'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/actionmailer-7.0.5.1/lib/action_mailer/base.rb:588:in `block in deliver_mail'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5.1/lib/active_support/notifications.rb:206:in `block in instrument'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5.1/lib/active_support/notifications.rb:206:in `instrument'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/actionmailer-7.0.5.1/lib/action_mailer/base.rb:586:in `deliver_mail'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/mail-2.8.1/lib/mail/message.rb:253:in `deliver'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/actionmailer-7.0.5.1/lib/action_mailer/message_delivery.rb:119:in `block in deliver_now'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/actionmailer-7.0.5.1/lib/action_mailer/rescuable.rb:17:in `handle_exceptions'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/actionmailer-7.0.5.1/lib/action_mailer/message_delivery.rb:118:in `deliver_now'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/actionmailer-7.0.5.1/lib/action_mailer/mail_delivery_job.rb:23:in `perform'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activejob-7.0.5.1/lib/active_job/execution.rb:59:in `block in _perform_job'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/i18n-1.14.1/lib/i18n.rb:322:in `with_locale'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activejob-7.0.5.1/lib/active_job/translation.rb:9:in `block (2 levels) in <module:Translation>'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5.1/lib/active_support/callbacks.rb:127:in `instance_exec'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5.1/lib/active_support/callbacks.rb:127:in `block in run_callbacks'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5.1/lib/active_support/core_ext/time/zones.rb:65:in `use_zone'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activejob-7.0.5.1/lib/active_job/timezones.rb:9:in `block (2 levels) in <module:Timezones>'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5.1/lib/active_support/callbacks.rb:127:in `instance_exec'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5.1/lib/active_support/callbacks.rb:127:in `block in run_callbacks'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5.1/lib/active_support/callbacks.rb:138:in `run_callbacks'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activejob-7.0.5.1/lib/active_job/execution.rb:58:in `_perform_job'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activejob-7.0.5.1/lib/active_job/instrumentation.rb:20:in `_perform_job'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activejob-7.0.5.1/lib/active_job/execution.rb:46:in `perform_now'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activejob-7.0.5.1/lib/active_job/instrumentation.rb:14:in `block in perform_now'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activejob-7.0.5.1/lib/active_job/instrumentation.rb:25:in `block in instrument'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5.1/lib/active_support/notifications.rb:206:in `block in instrument'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5.1/lib/active_support/notifications.rb:206:in `instrument'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activejob-7.0.5.1/lib/active_job/instrumentation.rb:35:in `instrument'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activejob-7.0.5.1/lib/active_job/instrumentation.rb:14:in `perform_now'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activejob-7.0.5.1/lib/active_job/logging.rb:18:in `block in perform_now'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5.1/lib/active_support/tagged_logging.rb:99:in `block in tagged'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5.1/lib/active_support/tagged_logging.rb:37:in `tagged'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5.1/lib/active_support/tagged_logging.rb:99:in `tagged'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activejob-7.0.5.1/lib/active_job/logging.rb:25:in `tag_logger'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activejob-7.0.5.1/lib/active_job/logging.rb:18:in `perform_now'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activejob-7.0.5.1/lib/active_job/execution.rb:24:in `block in execute'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activejob-7.0.5.1/lib/active_job/railtie.rb:54:in `block (4 levels) in <class:Railtie>'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5.1/lib/active_support/execution_wrapper.rb:92:in `wrap'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5.1/lib/active_support/reloader.rb:72:in `block in wrap'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5.1/lib/active_support/execution_wrapper.rb:92:in `wrap'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5.1/lib/active_support/reloader.rb:71:in `wrap'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activejob-7.0.5.1/lib/active_job/railtie.rb:53:in `block (3 levels) in <class:Railtie>'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5.1/lib/active_support/callbacks.rb:127:in `instance_exec'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5.1/lib/active_support/callbacks.rb:127:in `block in run_callbacks'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5.1/lib/active_support/callbacks.rb:138:in `run_callbacks'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activejob-7.0.5.1/lib/active_job/execution.rb:22:in `execute'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/activejob-7.0.5.1/lib/active_job/queue_adapters/async_adapter.rb:70:in `perform'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:352:in `run_task'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:343:in `block (3 levels) in create_worker'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `loop'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `block (2 levels) in create_worker'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:333:in `catch'
/usr/src/app/vendor/bundle/ruby/3.2.0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:333:in `block in create_worker'

I'm trying to have more infos about this authentication failure. I've checked that inside greenlight docker, in the file config/environments/production.rb, I've the line : config.action_mailer.raise_delivery_errors.

Note that I'm using the very same email (here me@mydomain.fr) in WP-SMTP in Wordpress, configured with port 587 and TLS (works also with 465 SSL with TLS auto) and it works fine. I also use it in many nextclouds instances (and it works too) configured like this (anonymized) :

  'mail_domain' => 'mydomain.fr',
  'mail_from_address' => 'me@mydomain.fr',
  'mail_smtpauth' => 1,
  'mail_smtpauthtype' => 'PLAIN',
  'mail_smtpmode' => 'smtp',
  'mail_smtpname' => 'me@mydomain.fr',
  'mail_smtppassword' => 'xxxxxxxxxx',
  'mail_smtphost' => 'mail.infomaniak.com',
  'mail_smtpport' => '465',
  'mail_smtpsecure' => 'ssl',

So it works in other context than in Greenlight.

I must say I'm stuck here :) Thanks for your help !

nderambure commented 1 year ago

Any thoughts about having more debug infos to see what is the real error ? I've triple checked password, and as I sayed, it works on other services... Thx !

lonesomewalker commented 1 year ago

Either use starttls OR tls. Both will not work.

SMTP_STARTTLS_AUTO=true
SMTP_STARTTLS=true
# SMTP_TLS=false
# SMTP_SSL_VERIFY=true (and also uncomment)

And yes, this is poorly documented.

b01xy commented 1 year ago

Hello, Thanks @lonesomewalker for your reply, I work with @nderambure to make the bbb work

but with those parameters, same results :

SMTP_AUTH=PLAIN
SMTP_STARTTLS_AUTO=false
SMTP_STARTTLS=true
SMTP_TLS=false
SMTP_SSL_VERIFY=true
Checking connection to BigBlueButton:
Passed
Checking connection to SMTP Server
I, [2023-09-22T10:33:17.227331 #152]  INFO -- : Delivered mail 650d6d682c055_981338-3fd@0e5986d62653.mail (5048.0ms)
Failed - Unable to connect to SMTP Server - Net::ReadTimeout

Linked to https://github.com/bigbluebutton/greenlight/issues/4760#issuecomment-1730508219 ?

I'm puzzled

nderambure commented 1 year ago

Hello,

Some tests with tcpdump and it appears our Greenlight does not take into account any change in the /root/greenlight-v3/.env file.

Greenlight is rebooted any time we change something in the .env file using :

docker restart greenlight-v3.

We have also tried to remove the .env file, and still, Greenlight is using a somewhat cached configuration (always the same).

So to sum up, after firstly changing .env file from our gandi.net config to infomaniak.com config, it has keeped a "cached" config for infomaniak that did not work, and then, any change is not taken into account.

Is there somewhere the .env file is stored as a cache ? And if yes, how to reset this ?

Thanks.

JeanPluzo commented 1 year ago

Hi @nderambure , AFAIK there's no "cached" .env file. I think you're restarting your container without rebuilding it, which will NOT take changes into account. See this post. Also, I think it's different if you restart with docker restart and docker compose restart.

Regards, J.

nderambure commented 1 year ago

Hello @JeanPluzo and thx for your reply.

Ok, I've figured it out.... docker-compose restart or docker restart greenlight-v3 does not recheck .env (no rebuild so)...

Just did a docker-compose down and docker-compose up -d, and it finally works.

This is a thing I won't forget regarding docker.

Thx all for your help !