Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to send email; trying to use SSL when it is supposed to be disabled #3406

Open
ritterwolf opened this issue May 9, 2024 · 2 comments

Comments

@ritterwolf
Copy link

I've been trying to figure out why Huginn is unable to send email at work and I've made no progress in two days. It's complaining about an SSL error, but is configured to not use SSL to connect to our SMTP server.

default@c1eb31df9c12:~$ env | sort | grep SMTP # domain and server are redacted
SMTP_DOMAIN=example.com
SMTP_ENABLE_STARTTLS_AUTO=false
SMTP_PORT=25
SMTP_SERVER=mailserver.int

Error trace:

                        SSL_connect returned=1 errno=0 peeraddr=10.xxx.xxx.xxx:25 state=error: unsupported protocol
/usr/local/lib/ruby/3.2.0/net/protocol.rb:46:in `connect_nonblock'
/usr/local/lib/ruby/3.2.0/net/protocol.rb:46:in `ssl_socket_connect'
/app/vendor/bundle/ruby/3.2.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:690:in `tlsconnect'
/app/vendor/bundle/ruby/3.2.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:666:in `do_start'
/app/vendor/bundle/ruby/3.2.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:611:in `start'
/app/vendor/bundle/ruby/3.2.0/gems/mail-2.8.1/lib/mail/network/delivery_methods/smtp.rb:109:in `start_smtp_session'
/app/vendor/bundle/ruby/3.2.0/gems/mail-2.8.1/lib/mail/network/delivery_methods/smtp.rb:100:in `deliver!'
/app/vendor/bundle/ruby/3.2.0/gems/mail-2.8.1/lib/mail/message.rb:2145:in `do_delivery'
/app/vendor/bundle/ruby/3.2.0/gems/mail-2.8.1/lib/mail/message.rb:253:in `block in deliver'
/app/vendor/bundle/ruby/3.2.0/gems/actionmailer-6.1.7.3/lib/action_mailer/base.rb:559:in `block in deliver_mail'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/notifications.rb:203:in `block in instrument'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/notifications.rb:203:in `instrument'
/app/vendor/bundle/ruby/3.2.0/gems/actionmailer-6.1.7.3/lib/action_mailer/base.rb:557:in `deliver_mail'
/app/vendor/bundle/ruby/3.2.0/gems/mail-2.8.1/lib/mail/message.rb:253:in `deliver'
/app/vendor/bundle/ruby/3.2.0/gems/actionmailer-6.1.7.3/lib/action_mailer/message_delivery.rb:119:in `block in deliver_now'
/app/vendor/bundle/ruby/3.2.0/gems/actionmailer-6.1.7.3/lib/action_mailer/rescuable.rb:17:in `handle_exceptions'
/app/vendor/bundle/ruby/3.2.0/gems/actionmailer-6.1.7.3/lib/action_mailer/message_delivery.rb:118:in `deliver_now'
/app/app/models/agents/email_agent.rb:59:in `block (2 levels) in receive'
/app/app/models/agents/email_agent.rb:50:in `each'
/app/app/models/agents/email_agent.rb:50:in `block in receive'
/app/vendor/bundle/ruby/3.2.0/gems/activerecord-6.1.7.3/lib/active_record/relation/delegation.rb:88:in `each'
/app/vendor/bundle/ruby/3.2.0/gems/activerecord-6.1.7.3/lib/active_record/relation/delegation.rb:88:in `each'
/app/app/models/agents/email_agent.rb:49:in `receive'
/app/app/jobs/agent_receive_job.rb:8:in `perform'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/execution.rb:48:in `block in perform_now'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
/app/vendor/bundle/ruby/3.2.0/gems/i18n-1.13.0/lib/i18n.rb:322:in `with_locale'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/translation.rb:9:in `block (2 levels) in <module:Translation>'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `instance_exec'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/time/zones.rb:66:in `use_zone'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/timezones.rb:9:in `block (2 levels) in <module:Timezones>'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `instance_exec'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/instrumentation.rb:21:in `block in instrument'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/notifications.rb:203:in `block in instrument'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/notifications.rb:203:in `instrument'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/instrumentation.rb:31:in `instrument'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/instrumentation.rb:14:in `block (2 levels) in <module:Instrumentation>'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `instance_exec'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/logging.rb:22:in `block in tag_logger'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/tagged_logging.rb:99:in `block in tagged'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/tagged_logging.rb:37:in `tagged'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/tagged_logging.rb:99:in `tagged'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/logging.rb:22:in `tag_logger'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/logging.rb:15:in `block (2 levels) in <module:Logging>'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `instance_exec'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:137:in `run_callbacks'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/execution.rb:47:in `perform_now'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/execution.rb:25:in `block in execute'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/railtie.rb:47:in `block (4 levels) in <class:Railtie>'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/execution_wrapper.rb:91:in `wrap'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/reloader.rb:72:in `block in wrap'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/execution_wrapper.rb:91:in `wrap'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/reloader.rb:71:in `wrap'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/railtie.rb:46:in `block (3 levels) in <class:Railtie>'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `instance_exec'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:137:in `run_callbacks'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/execution.rb:23:in `execute'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/queue_adapters/delayed_job_adapter.rb:42:in `perform'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/backend/base.rb:81:in `block in invoke_job'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:61:in `block in initialize'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:66:in `execute'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/backend/base.rb:78:in `invoke_job'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:231:in `block (2 levels) in run'
/app/vendor/bundle/ruby/3.2.0/gems/timeout-0.3.2/lib/timeout.rb:189:in `block in timeout'
/app/vendor/bundle/ruby/3.2.0/gems/timeout-0.3.2/lib/timeout.rb:196:in `timeout'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:231:in `block in run'
/usr/local/lib/ruby/3.2.0/benchmark.rb:311:in `realtime'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:230:in `run'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:313:in `block in reserve_and_run_one_job'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:61:in `block in initialize'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:66:in `execute'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:313:in `reserve_and_run_one_job'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:214:in `block in work_off'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:213:in `times'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:213:in `work_off'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:176:in `block (4 levels) in start'
/usr/local/lib/ruby/3.2.0/benchmark.rb:311:in `realtime'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:175:in `block (3 levels) in start'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:61:in `block in initialize'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:66:in `execute'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:174:in `block (2 levels) in start'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:173:in `loop'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:173:in `block in start'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/plugins/clear_locks.rb:7:in `block (2 levels) in <class:ClearLocks>'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:79:in `block (2 levels) in add'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:61:in `block in initialize'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:79:in `block in add'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:66:in `execute'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:172:in `start'
/app/lib/delayed_job_worker.rb:6:in `run'
/app/app/concerns/long_runnable.rb:71:in `block in run!'

We're using docker compose to run it, using the huginn/huginn-single-process image. It was working before I upgraded Huginn last week. I tried going back a few versions, even as far back as 6 months ago and I keep getting the same error.

Doing anything to the mail server isn't an option, that's out of my hands. I need to disable SSL/TLS/STARTTLS in a way that works.

@michalmiddleton
Copy link

michalmiddleton commented May 25, 2024

Hi @ritterwolf There was an update to net-smtp, that broke unauthenticated smtp for me. It may be worth trying the specific tag before the update - see my issue
Nevermind, just noticed that your log output still runs on the older net-smtp version

@virtadpt
Copy link
Collaborator

I ran into this a while back, and after updating Ruby, Huginn, and all of the gems it requires, I had to dig through the code and set a few more things in huginn/.env:

  • SMTP_AUTHENTICATION=login
  • SMTP_SSL=false
  • SMTP_OPENSSL_VERIFY_MODE=none
  • SMTP_OPENSSL_CA_PATH=
    • Yes, it should be blank.
  • SMTP_OPENSSL_CA_FILE=/etc/ssl/certs/ca-certificates.crt
    • That's where it is on my Ubuntu machines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants