jokob-sk / NetAlertX

🖧🔍 WIFI / LAN intruder detector. Scans for devices connected to your network and alerts you if new and unknown devices are found.
GNU General Public License v3.0
3.06k stars 184 forks source link

Problem with sending reports #136

Closed segatrsrv closed 1 year ago

segatrsrv commented 1 year ago

Hello, there was a problem with sending reports to Telegram. docker image I use the latest one. Maybe an error in the settings?

Thanks in advance for your help.

Paste last few lines from pialert.log


Traceback (most recent call last):
  File "/home/pi/pialert/back/pialert.py", line 2598, in <module>
    sys.exit(main())       
  File "/home/pi/pialert/back/pialert.py", line 307, in main
    email_reporting()
  File "/home/pi/pialert/back/pialert.py", line 1715, in email_reporting
    send_email (mail_text, mail_html)
  File "/home/pi/pialert/back/pialert.py", line 1926, in send_email
    smtp_connection.sendmail (REPORT_FROM, REPORT_TO, msg.as_string())
  File "/usr/lib/python3.9/smtplib.py", line 892, in sendmail
    raise SMTPDataError(code, resp)
smtplib.SMTPDataError: (554, b'Error: Post "https://api.telegram.org/bot***/sendMessage?disable_web_page_preview=true": dial tcp: lookup api.telegram.org on 127.0.0.11:53: read udp 127.0.0.1:39834->127.0.0.11:53: i/o timeout')
mkdir: cannot create directory '/run/php': File exists

Paste your pialert.conf (remove personal info)


#-------------------------------------------------------------------------------
#  Pi.Alert
#  Open Source Network Guard / WIFI & LAN intrusion detector 
#
#  pialert.conf - Back module. Configuration file
#-------------------------------------------------------------------------------
#  Puche 2021        pi.alert.application@gmail.com        GNU GPLv3
#-------------------------------------------------------------------------------

# GENERAL settings
# ----------------------

PRINT_LOG               = False
TIMEZONE                = '*******'
PIALERT_WEB_PROTECTION  = False
PIALERT_WEB_PASSWORD    = '***************************************'

INCLUDED_SECTIONS       = ['internet', 'new_devices', 'down_devices', 'events']   # Specifies which events trigger notifications. 
                                                                                  # Remove the event type(s) you don't want to get notified on 
                                                                                  # Overrides device-specific settings in the UI.
SCAN_CYCLE_MINUTES      = 5            # delay between scans

# EMAIL settings
# ----------------------
SMTP_SERVER             = '172.23.0.30'
SMTP_PORT               = 2525
SMTP_USER               = 'use2r@gmail.com'
SMTP_PASS               = 'password'
SMTP_SKIP_TLS           = True
SMTP_SKIP_LOGIN         = True

REPORT_MAIL             = True
REPORT_FROM             = 'Pi.Alert <' + SMTP_USER +'>'
REPORT_TO               = 'user@gmail.com'
REPORT_DEVICE_URL       = 'http://pi.alert/deviceDetails.php?mac='
REPORT_DASHBOARD_URL    = 'http://pi.alert/'

# Webhook settings
# ----------------------
REPORT_WEBHOOK          = False
WEBHOOK_URL             = 'http://n8n.local:5555/webhook-test/aaaaaaaa-aaaa-aaaa-aaaaa-aaaaaaaaaaaa'
WEBHOOK_PAYLOAD         = 'json'       # webhook payload data format for the "body > attachements > text" attribute 
                                       # in https://github.com/jokob-sk/Pi.Alert/blob/main/docs/webhook_json_sample.json 
                                       #   supported values: 'json', 'html' or 'text'
                                       #   e.g.: for discord use 'html'
WEBHOOK_REQUEST_METHOD  = 'GET'        # POST, GET...

# Apprise settings
#-----------------------
REPORT_APPRISE          = False
APPRISE_HOST            = 'http://localhost:8000/notify'
APPRISE_URL             = 'mailto://smtp-relay.sendinblue.com:587?from=user@gmail.com&name=apprise&user=user@gmail.com&pass=password&to=user@gmail.com'

# NTFY (https://ntfy.sh/) settings
# ----------------------
REPORT_NTFY             = False
NTFY_HOST               = 'https://ntfy.sh'
NTFY_TOPIC              = 'replace_my_secure_topicname_91h889f28'
NTFY_USER               = 'user'       # set username... 
NTFY_PASSWORD           = 'passw0rd'   # ...and password if authentication is used https://docs.ntfy.sh/config/#users-and-roles

# PUSHSAFER (https://www.pushsafer.com/) settings
# ----------------------
REPORT_PUSHSAFER        = False
PUSHSAFER_TOKEN         = 'ApiKey'

# MQTT settings
# ----------------------
REPORT_MQTT             = False
MQTT_BROKER             = '192.168.1.2'
MQTT_PORT               = 1883
MQTT_USER               = 'mqtt'
MQTT_PASSWORD           = 'passw0rd'
MQTT_QOS                = 0
MQTT_DELAY_SEC          = 2            # delay in seconds, increase if not all devices are created in Home Assistant

# DynDNS
# ----------------------
# QUERY_MYIP_SERVER       = 'https://diagnostic.opendns.com/myip'
QUERY_MYIP_SERVER       = 'http://ipv4.icanhazip.com'
DDNS_ACTIVE             = False
DDNS_DOMAIN             = 'your_domain.freeddns.org'
DDNS_USER               = 'dynu_user'
DDNS_PASSWORD           = 'A0000000B0000000C0000000D0000000'
DDNS_UPDATE_URL         = 'https://api.dynu.com/nic/update?'

# PIHOLE settings
# ----------------------
PIHOLE_ACTIVE           = False                         # if enabled you need to map '/etc/pihole/pihole-FTL.db' in docker-compose.yml
PIHOLE_DB               = '/etc/pihole/pihole-FTL.db'
DHCP_ACTIVE             = False                         # if enabled you need to map '/etc/pihole/dhcp.leases' in docker-compose.yml
DHCP_LEASES             = '/etc/pihole/dhcp.leases'

# arp-scan options & samples
# ----------------------
#
# Scan local network (default)
# SCAN_SUBNETS    = '--localnet'
#
# Scan two subnets
# SCAN_SUBNETS    = '192.168.11.0/24 192.168.144.0/24'
#
# Scan using interface eth0
# SCAN_SUBNETS    = '--localnet --interface=eth0'
#
# Scan multiple interfaces (eth1 and eth0):
# SCAN_SUBNETS    = [ '192.168.1.0/24 --interface=eth1', '192.168.1.0/24 --interface=eth0' ]

SCAN_SUBNETS            = '--localnet'

# Maintenance Task Settings
# ----------------------
DAYS_TO_KEEP_EVENTS = 90

Paste your docker-compose.yml and .env (remove personal info)

docker-compose.yml


version: '3.5'
services:

#Pi-hole
  PiHole:
    container_name: PiHole
    image: pihole/pihole:latest
    ports:
      - 53:53/tcp
      - 53:53/udp
      - 8880:80/tcp
      - 4443:443/tcp
    environment:
      TZ: ${TZ}
      WEBPASSWORD: ${PI_HOLE_PASSWORD}
    volumes:
      - ${USERDIR}/pihole/etc-pihole:/etc/pihole
      - ${USERDIR}/pihole/etc-dnsmasq.d:/etc/dnsmasq.d
    cap_add:
      - NET_ADMIN
    restart: always
    networks:
      default:
        ipv4_address: 172.23.0.2

#PiAlert
  pialert:
    container_name: PiAlert
    image: "jokobsk/pi.alert:latest"
    network_mode: "host"
    restart: always
    volumes:
      - ${USERDIR}/pialert/config:/home/pi/pialert/config
      - ${USERDIR}/pialert/db/pialert.db:/home/pi/pialert/db/pialert.db
      - ${USERDIR}/pihole/etc-pihole/pihole-FTL.db:/etc/pihole/pihole-FTL.db
    environment:
      TZ: ${TZ}
      PORT: 20211
      HOST_USER_ID: ${LOCAL_USER}
      HOST_USER_GID: ${LOCAL_USER}

#SMTP_to_Telegram
  smtp_to_telegram:
    image: kostyaesmukov/smtp_to_telegram
    container_name: SMTP_to_Telegram
    restart: always
    environment:
      ST_TELEGRAM_CHAT_IDS: ${TELEGRAM_CHATID}
      ST_TELEGRAM_BOT_TOKEN: ${TELEGRAM_TOKEN}
      ST_TELEGRAM_MESSAGE_TEMPLATE: "Subject: {subject}\\n\\n{body}"
    networks:
      default:
        ipv4_address: 172.23.0.30

networks:
  default:
    name: guard
    external: false
    ipam:
     driver: default
     config:
       - subnet: 172.23.0.0/24
jokob-sk commented 1 year ago

Hi @segatrsrv !

Thanks for reaching out!

Hummm...I don't see anything wrong in the configuration itself (if I didn't miss something). I have a few questions:

1) Did this setup work before? 2) Did it just stop working with the newest image? 3) Did you try an alternative notification method for testing purposes? (e.g. plain email or NTFY just to test the notifications are working otherwise) 4) I haven't used the SMTP_to_telegram image, so not sure, but are there any error logs in that image? 5) Did you update SMTP_to_telegram recently as well?

Hope I can help, j

segatrsrv commented 1 year ago
  1. Did this setup work before?

it worked, but I haven't updated your image for a long time (I can't specify the exact release, which worked without problems)

  1. Did it just stop working with the newest image?

this is the problem that when installing the first notification goes away and is successfully delivered to Telegram, and after that this error begins to appear

  1. Did you try an alternative notification method for testing purposes? (e.g. plain email or NTFY just to test the notifications are working otherwise)

I tried, but I couldn't send emails from Docker, so I switched to SMTP_to_Telegram. With other apps it works correctly and without failures

  1. I haven't used the SMTP_to_telegram image, so not sure, but are there any error logs in that image?

there is a log and it matches log.alert

time="2022-12-29T17:30:56Z" level=debug msg="Writing response to client: \n554 Error: Post \"https://api.telegram.org/bot***/sendMessage?disable_web_page_preview=true\": dial tcp: lookup api.telegram.org on 127.0.0.11:53: read udp 127.0.0.1:38988->127.0.0.11:53: i/o timeout\r\n"
time="2022-12-29T17:30:56Z" level=debug msg="Client sent: rset"
time="2022-12-29T17:30:56Z" level=debug msg="Writing response to client: \n250 2.1.0 OK\r\n"
time="2022-12-29T17:30:56Z" level=debug msg="Client sent: "
time="2022-12-29T17:30:56Z" level=warning msg="Client closed the connection: 172.23.0.1" error=EOF
time="2022-12-29T17:31:08Z" level=debug msg="[0.0.0.0:2525] Waiting for a new client. Next Client ID: 3520"
time="2022-12-29T17:31:08Z" level=info msg="Handle client [172.23.0.1], id: 3519"
time="2022-12-29T17:31:08Z" level=debug msg="Writing response to client: \n220 5de9edc94043 SMTP Guerrilla(unknown) #3519 (1) 2022-12-29T17:31:08Z\r\n"
time="2022-12-29T17:31:08Z" level=debug msg="Client sent: ehlo [127.0.1.1]"
time="2022-12-29T17:31:08Z" level=debug msg="Writing response to client: \n250-5de9edc94043 Hello\r\n250-SIZE 50000000\r\n250-PIPELINING\r\n250-ENHANCEDSTATUSCODES\r\n250 HELP\r\n"
time="2022-12-29T17:31:08Z" level=debug msg="Client sent: mail FROM:<use2r@gmail.com> size=7979"
time="2022-12-29T17:31:08Z" level=debug msg="Writing response to client: \n250 2.1.0 OK\r\n"
time="2022-12-29T17:31:08Z" level=debug msg="Client sent: rcpt TO:<user@gmail.com>"
time="2022-12-29T17:31:08Z" level=debug msg="Writing response to client: \n250 2.1.5 OK\r\n"
time="2022-12-29T17:31:08Z" level=debug msg="Client sent: data"
time="2022-12-29T17:31:08Z" level=debug msg="Writing response to client: \n354 Enter message, ending with '.' on a line by itself\r\n"
time="2022-12-29T17:31:18Z" level=error msg="Post \"https://api.telegram.org/bot***/sendMessage?disable_web_page_preview=true\": dial tcp: lookup api.telegram.org on 127.0.0.11:53: read udp 127.0.0.1:38284->127.0.0.11:53: i/o timeout"
  1. Did you update SMTP_to_telegram recently as well?

I installed the latest image (and it turns out he recently updated, before that he hadn't updated "Last pushed 20 days ago by kostyaesmukov" for a long time)

By searching for an error, I found the following similar problems, where everything boils down to incorrect report formation

@jokob-sk Thank you for your help, and I apologize for my English

jokob-sk commented 1 year ago

Hi @segatrsrv !

Thanks for investigating!

According to the linked issues, this seems an upstream bug. What I think is happening is that the email which goes thru doesn't contain a character which causes this issue, the next one does. If I'm correct, there are I think 2 ways how to solve this:

1) I implement a text-only email option 2) You use a different middle-ware instead of smtp_to_telegram

I think apprise supports telegram as well, so if you could, give it a try: https://github.com/caronc/apprise/wiki/Notify_telegram

If others reading see value in implementing number 1, please do let me know and I'll consider it.

EDIT: Your English is great, don't apologize 👍 EDIT2:

  1. Did this setup work before?

it worked, but I haven't updated your image for a long time (I can't specify the exact release, which worked without problems)

This makes me wonder. I didn't touch the email sending code as far as I remember. Either way, can you try apprise if it is not too much work and if the issue persists, I'll look into debugging smtp_to_telegram.

Thanks, j

segatrsrv commented 1 year ago

Hi @jokob-sk

A few days ago, I completely reinstalled my Stack on VM (Virtual Machine), and messages started coming, and continue to arrive in Telegram without problems =)).

I have deleted only one line from my "docker-compose.yml", namely "ST_TELEGRAM_MESSAGE_TEMPLATE: "Subject: {subject}\\n\\n{body}"".

The error in "smtp_to_telegram" continues to be displayed periodically, but messages are successfully received every time with each alert

Errors in "smtp_to_telegram"

time="2023-01-02T17:42:36Z" level=debug msg="[0.0.0.0:2525] Waiting for a new client. Next Client ID: 78" time="2023-01-02T17:42:36Z" level=info msg="Handle client [172.23.0.1], id: 77" time="2023-01-02T17:42:36Z" level=debug msg="Writing response to client: \n220 64e9bc96689b SMTP Guerrilla(unknown) #77 (1) 2023-01-02T17:42:36Z\r\n" time="2023-01-02T17:42:36Z" level=debug msg="Client sent: ehlo [127.0.1.1]" time="2023-01-02T17:42:36Z" level=debug msg="Writing response to client: \n250-64e9bc96689b Hello\r\n250-SIZE 50000000\r\n250-PIPELINING\r\n250-ENHANCEDSTATUSCODES\r\n250 HELP\r\n" time="2023-01-02T17:42:36Z" level=debug msg="Client sent: mail FROM:use2r@gmail.com size=3607" time="2023-01-02T17:42:36Z" level=debug msg="Writing response to client: \n250 2.1.0 OK\r\n" time="2023-01-02T17:42:36Z" level=debug msg="Client sent: rcpt TO:user@gmail.com" time="2023-01-02T17:42:36Z" level=debug msg="Writing response to client: \n250 2.1.5 OK\r\n" time="2023-01-02T17:42:36Z" level=debug msg="Client sent: data" time="2023-01-02T17:42:36Z" level=debug msg="Writing response to client: \n354 Enter message, ending with '.' on a line by itself\r\n" time="2023-01-02T17:42:36Z" level=debug msg="Writing response to client: \n250 2.0.0 OK: queued as f527e4024949e2592f3fef1d20d138a1\r\n" time="2023-01-02T17:42:36Z" level=debug msg="Client sent: quit" time="2023-01-02T17:42:36Z" level=debug msg="Writing response to client: \n221 2.0.0 Bye\r\n"

The problem seems to lie in one of the two blocks (subject\body).

Regarding "Notify_telegram" I will try to install it the other day, I already had experience installing it, but I refused in favor of "smtp_to_telegram" as a more rational tool, because not all applications can interact with "Notify" (at least with which I work), but absolutely everyone can send messages via smtp. I'll write later how it turned out...

I attached a short message (which is not working now) and a full message (which works, but is not convenient to read and does not fit in the notification curtain) to understand the problem\situation. short message full message

jokob-sk commented 1 year ago

Hey there!

Could you please elaborate on:

(which is not working now) and a full message (which works, but is not convenient to read and does not fit in the notification curtain)

Do you have screenshot of a badly formatted message? I'm not sure how I can help in this regard since you are using middle-ware.

You can use a different middleware as well, such as n8n which I use myself.

j

segatrsrv commented 1 year ago

Hi, @jokob-sk.

I found the root of the problem, it turned out to be a Pi-Hole. Without (Pi-Hole) everything works with any restrictions on the "smtp_to_telegram" side, including "ST_TELEGRAM_MESSAGE_TEMPLATE" (if it will be useful to anyone). I haven't figured out exactly what the problem is yet (there is a suspicion of the network, or rather that it is not divided into internal and external, I plan to share this through Traefik). At the same time, if you put it in turn (Pi-alert\ smtp_to_telegram \ Pi-hole), then everything works, but only until the first reboot, and then writes the connection error again, while there are no locks or errors in the pi-hole logs.

@jokob-sk I'm sorry for the trouble, it's definitely not about Pi-alert.

But since I've already bothered you, I wanted to write a wish for future improvements to pi.alert: in the Report in Events, to be able to change the order of display of blocks, i.e. now "Name: \MAC: \IP: \Time: \Event: \More Info:" (at least this is how it is displayed for me), to a different display order (Name: \Event: \IP: \Time: \MAC: \More Info:). By the way, "More Info:" I always have an empty one (but it's not critical)

P.S. I want to say - Thank you very much for your work, Pi-Alert in Docker is really one of the most useful programs that brings real benefits.

P.S.2. thank you for "n8n" it's really a worthwhile thing, but I didn't quite understand how to get data from pi.alert? what integration do you use to connect to pi.alert?

jokob-sk commented 1 year ago

Hi @segatrsrv ,

Thanks for the nice words, really appreciate them :)

Glad to hear you narrowed the issue down further.

No need to apologize ;)

Regarding the request: I assume you mean in the sent emails? I'll consider it when doing work around that area of the app. Thanks for the suggestion!

Regarding n8n, you can set up PiAlert sending a webhook to n8n, n8n catches the webhook, then you have the full JSON data (see sample here) of the alert and you can re-structure it however you want into a new email (or any other notification supported by n8n) and forward it. Here are a few screenshots of a very simple sample setup:

Create a simple n8n workflow

n8n workflow

Specify your email template

See sample JSON if you want to see the JSON paths used in the email template below Email template

Get your webhook in n8n

n8n webhook URL

Configure PiAlert to point to the above URL

PiAlert config

WAdama commented 1 year ago

Hi @jokob-sk it seems I have a similar problem just with e-mail, I don't use any other messaging. After error the container restarts.

Find attached the part of the log with the error maessages and a cleaned config file. But the error messages indicates it's the same or at least a very similar problem.

If you need further information, just ask...

And also from my side, thanks for the work.

pialert.zip

jokob-sk commented 1 year ago

Hi @WAdama !

Your SMTP configuration seems to be the issue:

[2023-01-06 23:01:01] Scan: Nmap for max 120s (2.0min) per device
        Estimated max delay: 0s (0.0min)
  Check if something to report
    Changes detected, sending reports
      Sending report by Email
Traceback (most recent call last):
  File "/home/pi/pialert/back/pialert.py", line 3264, in <module>
    sys.exit(main())       
  File "/home/pi/pialert/back/pialert.py", line 726, in main
    send_notifications()
  File "/home/pi/pialert/back/pialert.py", line 2389, in send_notifications
    send_email (mail_text, mail_html)
  File "/home/pi/pialert/back/pialert.py", line 2594, in send_email
    smtp_connection = smtplib.SMTP (SMTP_SERVER, SMTP_PORT)
  File "/usr/lib/python3.9/smtplib.py", line 253, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib/python3.9/smtplib.py", line 341, in connect
    (code, msg) = self.getreply()
  File "/usr/lib/python3.9/smtplib.py", line 398, in getreply
    raise SMTPServerDisconnected("Connection unexpectedly closed")
smtplib.SMTPServerDisconnected: Connection unexpectedly closed
Nothing to do here.
mkdir: cannot create directory '/run/php': File exists
Starting nginx: nginx.

Can you try to adjust your SMTP settings or use a different SMTP provider? E.g. I can assist you with send in blue, which has the following config:

# Email
#---------------------------
REPORT_MAIL=True
SMTP_SERVER='smtp-relay.sendinblue.com'
SMTP_PORT=587
REPORT_TO='toemail@gmail.com'
REPORT_FROM='Pi.Alert <email@gmail.com>'
SMTP_SKIP_LOGIN=False
SMTP_USER='email@gmail.com'
SMTP_PASS='passw0rd'
SMTP_SKIP_TLS=False

Hope this helps, j

WAdama commented 1 year ago

@jokob-sk I'm not quite sure, I can follow you. This is a configuration I use for several other services and it never caused a problem. So which part in your opinion is causing this?

But to be on the sure side, I will test another provider.

Regards Ingo

WAdama commented 1 year ago

Problem solved in my case. It seems the mail component of Pi.Alert can't work with port 465 TLS for mail sending.

Thankfully Strato allows also for mail sending STARTTLS over port 587. Changing to this made the mailing work.

jokob-sk commented 1 year ago

@WAdama thanks for the update!

Glad to hear it works now. I still think it was a configuration issue (maybe you needed to specify to skip TLS as it was on a different port?) not sure, but I'm using pretty standard email sending code here: https://github.com/jokob-sk/Pi.Alert/blob/main/back/pialert.py#L2397

Anyway, glad it's working for you now!

WAdama commented 1 year ago

The difference between 465 and 587 is that 465 starts direct with SSL/TLS where 587 is on start plain text and then negotiates out if SSL/TLS is possible and changes then to SSL/TLS.

So 465 would be the better choice.

And if you look in your code line 2398 you try to open a STARTTLS connection. So I think this is causing the the error.

jokob-sk commented 1 year ago

Hey @WAdama !

Thanks for the info!

And if you look in your code line 2398 you try to open a STARTTLS connection. So I think this is causing the the error.

If you enable the SMTP_SKIP_TLS setting that part of the code is skipped so you can use your 465 port instead

WAdama commented 1 year ago

Enable SMTP_SKIP_TLS does not do the trick, the container crashes again.

I think in this case the problem is that 465 is TLS.

It should be documented that the mail option supports only STARTTLS but not pure TLS.

jokob-sk commented 1 year ago

@WAdama Thansk for letting me know!

Hopefully this will fix it: https://github.com/jokob-sk/Pi.Alert/commit/121b5cdf32c71ba13653de9c170cb036521f189e

This is not yet in the production image, just in the dev image. Will be part of the next release

WAdama commented 1 year ago

I'll wait for next release. It is working, so I have no hurry, if it's ok for you...

jokob-sk commented 1 year ago

Should be in the latest production image. Closing for now, will re-open if issues persist.

WAdama commented 1 year ago

Hi @jokob-sk

I just had time to test it and I'm afraid the problem still persists. This is the actual log content: [2023-01-14 13:39:09] Scan Devices: arp-scan start Processing scan results Devices Detected.......: 16 arp-scan detected..: 14 Pi-hole detected...: +0 New Devices........: 0 Devices in this cycle..: 16 Down Alerts........: 0 New Down Alerts....: 0 New Connections....: 0 Disconnections.....: 2 IP Changes.........: 0 Updating DB Info Sessions Events (connect / discconnect) Creating new devices Updating Devices Info Voiding false (ghost) disconnections Pairing session events (connection / disconnection) Creating sessions snapshot Inserting scan results into Online_History Skipping repeated notifications sys.exit(main()) File "/home/pi/pialert/back/pialert.py", line 541, in main send_notifications() File "/home/pi/pialert/back/pialert.py", line 2182, in send_notifications send_email (mail_text, mail_html) File "/home/pi/pialert/back/pialert.py", line 2387, in send_email Check if something to report Changes detected, sending reports Sending report by Email smtp_connection = smtplib.SMTP (SMTP_SERVER, SMTP_PORT) File "/usr/lib/python3.9/smtplib.py", line 253, in __init__ (code, msg) = self.connect(host, port) File "/usr/lib/python3.9/smtplib.py", line 341, in connect (code, msg) = self.getreply() File "/usr/lib/python3.9/smtplib.py", line 398, in getreply raise SMTPServerDisconnected("Connection unexpectedly closed") smtplib.SMTPServerDisconnected: Connection unexpectedly closed Nothing to do here. mkdir: cannot create directory '/run/php': File exists Starting nginx: nginx.

jokob-sk commented 1 year ago

Hummm, what SMTP service are you using so I can create a test account there and test it there with a 465 port?

WAdama commented 1 year ago

That's a paid mail service over Strato.de. That's a service provider in Germany with several services like mail, website or servers. www.strato.de

But I think there's no test account creatable.

But just checked: You can test it with gmx.net. They also support strict TLS over port 465 and the behaviour is the same: Check if something to report Changes detected, sending reports Sending report by Email Traceback (most recent call last): File "/home/pi/pialert/back/pialert.py", line 3139, in sys.exit(main())
File "/home/pi/pialert/back/pialert.py", line 541, in main send_notifications() File "/home/pi/pialert/back/pialert.py", line 2182, in send_notifications send_email (mail_text, mail_html) File "/home/pi/pialert/back/pialert.py", line 2387, in send_email smtp_connection = smtplib.SMTP (SMTP_SERVER, SMTP_PORT) File "/usr/lib/python3.9/smtplib.py", line 253, in init (code, msg) = self.connect(host, port) File "/usr/lib/python3.9/smtplib.py", line 341, in connect (code, msg) = self.getreply() File "/usr/lib/python3.9/smtplib.py", line 398, in getreply raise SMTPServerDisconnected("Connection unexpectedly closed") smtplib.SMTPServerDisconnected: Connection unexpectedly closed

jokob-sk commented 1 year ago

Hey!

I've added more logging (and a force SSL option) in the latest release which I've released a couple of hours ago. The additional debug output might help you to find what's the issue in your setup.

If you happen to figure out how to get this working, please let me know and I can write a guide around it.

Thanks! j

jokob-sk commented 1 year ago

This Gmail as SMTP guide might help you as well. Closing for now and will re-open if needed.