0x2142 / frigate-notify

Event notifications for a standalone Frigate NVR instance
https://frigate-notify.0x2142.com/
MIT License
88 stars 7 forks source link

Set From address to use in SMTP alert #123

Open szafar opened 3 weeks ago

szafar commented 3 weeks ago

Hi. I am trying to use smtp fro frigate notifications. The configuration looks valid but any notification is dropped because I get this error message: WRN Unable to send alert error="send failed: getting sender address: no FROM address set" event_id=xxx. How do you set the Frrom address?

Regards.

freefd commented 3 weeks ago

Hi @szafar, please provide the frigate-notify configuration you're using (do not forget to obscure sensitive things like credentials, etc).

The FROM field in a message will be populated from user configuration property of SMTP notifier: https://github.com/0x2142/frigate-notify/blob/main/notifier/smtp.go#L32

Potentially, an incorrect configuration can occur if your SMTP relay does not require authentication and you have not set both user and password properties in the configuration. In this case, the SMTP notifier will set FROM field in the message as empty string.

0x2142 commented 3 weeks ago

Hm, perhaps I should add a dedicated FROM field for cases like this. Honestly I figured I was the only one who probably used SMTP 😅

szafar commented 3 weeks ago

Hi, I am still unable to configure as now I am getting this error when using self signed certs: WRN Unable to send alert error="dial failed: tls: failed to verify certificate: x509: cannot validate certificate for 192.168.X.X because it doesn't contain any IP SANs" I normally use letsencrypt certs but that causes another error: WRN Unable to send alert error="dial failed: 454 TLS currently unavailable". In this case the corresponding error in exim4 is: TLS error on connection from notify ( ) [172.18.0.3] (cert/key setup: cert=yes key=yes): Error while reading file. Trying to figure out what it is causing this.

Regards,

On Mon, Aug 19, 2024 at 11:35 AM Matt Schmitz @.***> wrote:

Hm, perhaps I should add a dedicated FROM field for cases like this. Honestly I figured I was the only one who probably used SMTP 😅

— Reply to this email directly, view it on GitHub https://github.com/0x2142/frigate-notify/issues/123#issuecomment-2296869045, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2K2XY57YEBPM36PKSG2Z3ZSIGFLAVCNFSM6AAAAABMVXO3K2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJWHA3DSMBUGU . You are receiving this because you were mentioned.Message ID: @.***>

szafar commented 3 weeks ago

Hi, My SMTP config looks like this:

smtp: enabled: true server: 192.168.X.Y port: 25 tls: True user: notifier password: XXXX recipient: @.***

Regards,

On Sun, Aug 18, 2024 at 7:48 AM freefd @.***> wrote:

Hi @szafar https://github.com/szafar, please provide the frigate-notify configuration you're using (do not forget to obscure sensitive things like credentials, etc).

The FROM field in a message will be populated from user configuration property of SMTP notifier https://frigate-notify.0x2142.com/latest/config/file/#smtp: https://github.com/0x2142/frigate-notify/blob/main/notifier/smtp.go#L32

Potentially, an incorrect configuration can occur if your SMTP relay does not require authentication and you have not set both user and password properties in the configuration. In this case, the SMTP notifier will set FROM field in the message as empty string https://github.com/0x2142/frigate-notify/blob/main/config/config.go.

— Reply to this email directly, view it on GitHub https://github.com/0x2142/frigate-notify/issues/123#issuecomment-2295232877, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2K2X4NCXBALE4XWJKLSZDZSCC2DAVCNFSM6AAAAABMVXO3K2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJVGIZTEOBXG4 . You are receiving this because you were mentioned.Message ID: @.***>

szafar commented 3 weeks ago

BTW followed this to configure my exim4 ... https://ubuntu.com/server/docs/install-and-configure-exim4

On Mon, Aug 19, 2024 at 11:46 AM Sohail Zafar @.***> wrote:

Hi, I am still unable to configure as now I am getting this error when using self signed certs: WRN Unable to send alert error="dial failed: tls: failed to verify certificate: x509: cannot validate certificate for 192.168.X.X because it doesn't contain any IP SANs" I normally use letsencrypt certs but that causes another error: WRN Unable to send alert error="dial failed: 454 TLS currently unavailable". In this case the corresponding error in exim4 is: TLS error on connection from notify ( ) [172.18.0.3] (cert/key setup: cert=yes key=yes): Error while reading file. Trying to figure out what it is causing this.

Regards,

On Mon, Aug 19, 2024 at 11:35 AM Matt Schmitz @.***> wrote:

Hm, perhaps I should add a dedicated FROM field for cases like this. Honestly I figured I was the only one who probably used SMTP 😅

— Reply to this email directly, view it on GitHub https://github.com/0x2142/frigate-notify/issues/123#issuecomment-2296869045, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2K2XY57YEBPM36PKSG2Z3ZSIGFLAVCNFSM6AAAAABMVXO3K2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJWHA3DSMBUGU . You are receiving this because you were mentioned.Message ID: @.***>

freefd commented 3 weeks ago
WRN Unable to send alert error="dial failed: tls: failed to verify certificate: x509: cannot validate certificate for 192.168.X.X because it doesn't contain any IP SANs"

It seems there should be ignoressl option like other notifier modules have.

0x2142 commented 3 weeks ago

Agreed. I can bundle that into the next release