jhuckaby / Cronicle

A simple, distributed task scheduler and runner with a web based UI.
http://cronicle.net
Other
3.47k stars 370 forks source link

Mail with SMTP #447

Open Jonbj opened 2 years ago

Jonbj commented 2 years ago

Summary

Can't send mail with internal SMTP

Steps to reproduce the problem

Configure a task with notification error

Your Setup

"base_app_url": "http://IP:3012", "email_from": "noreply@domain.com", "smtp_hostname": "mail.domain.com", "smtp_port": 465, "mail_options": { "secure": false, "auth": { "user": "user", "pass": "pass" }, "connectionTimeout": 10000, "greetingTimeout": 10000, "socketTimeout": 10000 },

Operating system and version?

Ubuntu Server 20.04

Node.js version?

16

Cronicle software version?

Latest

Are you using a multi-server setup, or just a single server?

Single

Are you using the filesystem as back-end storage, or S3/Couchbase?

Filesystem

Can you reproduce the crash consistently?

Yes

Log Excerpts

Failed to send e-mail for job: jktyi8gk301: mail@domain.com: Error: certificate has expired

Graxo commented 8 months ago

Did you get this to work?

markusglaetzner commented 6 months ago

I have identically config and same problem: firewall log tell me, server sends mail on the defined port, but I do not get mails.

iovcho commented 2 months ago

I have the same issue: cronicle latest version SMTP credentials and settings are valid

` "email_from": "alarms@domain.com", "smtp_hostname": "mail.domain.com", "smtp_port": 25, "secret_key": "xxxx",

    "mail_options": {
    "secure": false,
    "auth": { "user": "alarms@domain.com", "pass": "xxxx" },
    "connectionTimeout": 10000,
    "greetingTimeout": 10000,
    "socketTimeout": 10000
    },

`

And the error is: Error: certificate has expired

[1714131596.586][2024-04-26 14:39:56][cronicle-xxx][5463][User][error][email][Failed to send e-mail: Error: certificate has expired][{"name":"recover_password","data":"To: user@other-domain.com\nFrom: alarms@domain.com\nSubject: Forgot your Cronicle password?\n\nHey Administrator,\n\nSomeone recently requested to have your password reset on your Cronicle account. To make sure this is really you, this confirmation was sent to the e-mail address we have on file for your account. If you really want to reset your password, please click the link below. If you cannot click the link, copy and paste it into your browser.\n\nhttp://a.b.c.d:3012/#Login?u=admin&h=aef170046c3d2000389aa13b56de43754fbc0255ece764ee77f960bf5d850f0a\n\nThis password reset page will expire after 24 hours.\n\nIf you suspect someone is trying to hack your account, here is the information we gathered from the request:\n\nDate/Time: 4/26/2024, 2:39:55 PM\nIP Address: 1.2.3.4\nUser Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36\n\nRegards,\nThe Cronicle Team\n"}]

iovcho commented 2 months ago

OK, I fix the issue with error "Failed to send e-mail: Error: certificate has expired" I Just added: "tls": { "rejectUnauthorized": false },

{
        "base_app_url": "http://localhost:3012",
        "email_from": "alarms@domain.com",
        "smtp_hostname": "mail.domain.com",
        "smtp_port": 25,
        "secret_key": "xxx",

        "mail_options": {
        "secure": false,
        "debug": false,
        "port": 25,
        "tls": { "rejectUnauthorized": false },
        "auth": { "user": "alarms@domain.com", "pass": "xxx" },
        "connectionTimeout": 10000,
        "greetingTimeout": 10000,
        "socketTimeout": 10000
        },

        "log_dir": "logs",

....
jhuckaby commented 2 months ago

@iovcho I'm glad you found a workaround, but please be VERY careful setting rejectUnauthorized:false. This is like unplugging your smoke alarm because the sound is hurting your ears. An expired certificate is a problem, and this setting is basically bypassing / ignoring it.

Without certificate validation, you could suffer from man-in-the-middle attacks, etc.

So anyway, just please proceed with extreme caution. You're running in "danger mode".