Notification not working

General support for problems installing or using Deluge
mhertz
Compulsive Poster
Compulsive Poster
Posts: 1060
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Notification not working

Postby mhertz » Fri Jan 08, 2021 1:54 am

You're most welcome, just sad it didn't came to anything for you. I'm affraid i'm not clever enough to look into that part of smtplib internal issues, and also cannot reproduce myself as stated so hard to troubleshoot/test etc. Back when I last saw a report about ssl errors occuring for some in yarss2 plugin, then as I didn't know how to fix either, and neither could reproduce, then workarounded by disabling ssl verification in the https feed-retrievals, but this plugin uses smtp protocol and not https, so I don't think that same trick will work, and don't know how control that for smtp, if wanted, for workarounding the issue. Just in case, but highly unlikely, then I added the same trick to notifications2 plugin as I did with yarss2 for the affected, but as said, don't get your hopes up: https://paste.c-net.org/PenchantMyriad (just disabling ssl/tls in plugin doesn't work and no mails get sent no matter which ports or smtp servers i've tried, three of each'ish)

btw, if you acess the running image in a terminal(I believe it's this from a lookup: 'docker exec -it deluge /bin/bash') and run these commands, then do they connect fine or also hick-up?

Code: Select all

telnet smtp.gmail.com 587

Code: Select all

openssl s_client -connect smtp.gmail.com:587 -starttls smtp

mhertz
Compulsive Poster
Compulsive Poster
Posts: 1060
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Notification not working

Postby mhertz » Fri Jan 08, 2021 2:35 pm

Also btw, if you can open such a terminal in the running deluge image as suggessted previously, then maybe we can get a better debug message out for what actually fails, and little easier for me to possible suggest a test for how to e.g. workaround by changing ssl default context, but i'm not sure I can do that "in blind", but atleast we can get proper debug message and know in what part specifically failure happens.

So if you could start such e.g. 'docker exec -it deluge /bin/bash' during deluge running and then if you can run this file(python filename.py or python3 filename.py not sure on your distro) and if not then copy paste or type, by first entering 'python' or 'python3' and hit return, and then afterwards this liitle code section, line after line, I just cooked up to make a connection to gmail smtp server through smtplib, same module plugin uses, and send a mail threw it, with debug-logging enabled - just add email and password into 'user' and 'pw' vars first:

Code: Select all

from smtplib import SMTP
user=""
pw=""
server = SMTP('smtp.gmail.com', 587)
server.set_debuglevel(1)
server.ehlo()
server.starttls()
server.login(user,pw)
server.sendmail(user, user, "test")
server.quit()

kevindd992002
Leecher
Leecher
Posts: 68
Joined: Thu Jun 13, 2019 2:56 pm

Re: Notification not working

Postby kevindd992002 » Fri Jan 08, 2021 3:27 pm

Your docker exec syntax is correct. I'm familiar with it and I usually open a terminal inside of the running container when troubleshooting things. That's how I got the /usr/lib references in my previous posts. Here you go:

For the openssl test:

Code: Select all

root@f55733cd79cc:/# openssl s_client -connect smtp.gmail.com:587 -starttls smtp
CONNECTED(00000005)


So no connection issue to port 587 there and the TLS handshake was successful (no certificate errors).

For the py test:

Code: Select all

>>> from smtplib import SMTP
>>> user="username redacted"
>>> pw="password redacted"
>>> server = SMTP('smtp.gmail.com', 587)
>>> server.set_debuglevel(1)
>>> server.ehlo()
send: 'ehlo [192.168.20.101]\r\n'
reply: b'250-smtp.gmail.com at your service, [ip address redacted]\r\n'
reply: b'250-SIZE 35882577\r\n'
reply: b'250-8BITMIME\r\n'
reply: b'250-STARTTLS\r\n'
reply: b'250-ENHANCEDSTATUSCODES\r\n'
reply: b'250-PIPELINING\r\n'
reply: b'250-CHUNKING\r\n'
reply: b'250 SMTPUTF8\r\n'
reply: retcode (250); Msg: b'smtp.gmail.com at your service, [ip address redacted]\nSIZE 35882577\n8BITMIME\nSTARTTLS\nENHANCEDSTATUSCODES\nPIPELINING\nCHUNKING\nSMTPUTF8'
(250, b'smtp.gmail.com at your service, [ip address redacted]\nSIZE 35882577\n8BITMIME\nSTARTTLS\nENHANCEDSTATUSCODES\nPIPELINING\nCHUNKING\nSMTPUTF8')
>>> server.starttls()
send: 'STARTTLS\r\n'
reply: b'220 2.0.0 Ready to start TLS\r\n'
reply: retcode (220); Msg: b'2.0.0 Ready to start TLS'
server.login(user,pw)
server.sendmail(user, user, "test")
server.quit()

mhertz
Compulsive Poster
Compulsive Poster
Posts: 1060
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Notification not working

Postby mhertz » Fri Jan 08, 2021 9:20 pm

Sorry Kevin, I also thought to myself that you obviously would know that since posting usefull troubleshooting data so much, and it's me that's a docker/LSIO noob here :)

I'm guessing it's a TLS/smtplib/python issue, as even though it shows the notifications plugin issue from a ssl.c file, so sounding like ssl issue, then the initial connection is first transfered to TLS after the TLS handshake(obviously), and guessing handshake happens over openssl, so would error out there regardless, but could be wrong. Your last real output from the script was from starttls() and although shows connected, then there's no debug output after, and on my end there's alot more info about sending the mail and generating it - and you got a timeout error in deluge with the plugin, so it seems it is hanging, and probably will error out if waiting some time, i'm guessing, and you didn't get a mail neither in gmail inbox with "test" as only message, right? I get such on my end whenever running that script/commands.

You cannot disable SSL/TLS in the plugin as stated, as wont work sending mail, but can you please check this code, which only uses ssl and not tls and check if you get a mail and more/better debug output, and works here:

Code: Select all

from smtplib import SMTP_SSL
user=""
pw=""
server = SMTP_SSL('smtp.gmail.com', 465)
server.set_debuglevel(1)
server.ehlo()
server.login(user,pw)
server.sendmail(user, user, "test")
server.quit()

Also, could you test this tls version with forcing v1.1 as I saw reported some issues with some later versions for some:

Code: Select all

from smtplib import SMTP
import ssl
sc = ssl.create_default_context()
sc.options |= ssl.OP_NO_TLSv1_2 | ssl.OP_NO_TLSv1_3
sc.minimum_version = ssl.TLSVersion ["TLSv1_1"]
user=""
pw=""
server = SMTP('smtp.gmail.com', 587)
server.set_debuglevel(1)
server.ehlo()
server.starttls(context=sc)
server.login(user,pw)
server.sendmail(user, user, "test")
server.quit()

And last with extra cert disabling added for full closure:

Code: Select all

from smtplib import SMTP
import ssl
sc = ssl.create_default_context()
sc.options |= ssl.OP_NO_TLSv1_2 | ssl.OP_NO_TLSv1_3
sc.minimum_version = ssl.TLSVersion ["TLSv1_1"]
sc.check_hostname = False
sc.verify_mode = ssl.CERT_NONE
user=""
pw=""
server = SMTP('smtp.gmail.com', 587)
server.set_debuglevel(1)
server.ehlo()
server.starttls(context=sc)
server.login(user,pw)
server.sendmail(user, user, "test")
server.quit()

If finding a way to call smtplib working for your situation, then I can see about if I can add it to the plugin in an alternartive version for your usecase.

mhertz
Compulsive Poster
Compulsive Poster
Posts: 1060
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Notification not working

Postby mhertz » Sat Jan 09, 2021 6:57 pm

I saw that the LSIO deluge image was using ubuntu 18.04.1, so I downloaded the iso and fired it up in a VM to test the code-sections I posted earlier plus deluge and the moded plugin, in the livecd - unfortuently could not reproduce there neither, as works fine for me with deluge and the moded notifications or notifications2, and the code bits all works, so gets email in inbox afterwards(should be run with 'python3' but anyway worked too with just 'python', but 'python3' is best to test). The last two code-exmples failed, because the openssl version included in that ubuntu was v1.1.0g, or 1.1.1 if upgraded, and didn't have such object 'tlsversion' like I had in more recent openssl, or if part of python's ssl wrapper module I dunno, which was 3.6.5 in that ubuntu and upgraded 3.6.9, but anyway, so I had to delete that line and then worked and got mail each time.

Anyway, it's pretty hard to work in blind and try come up with solutions, and annoying for you to test alot of failed attempts, so please test anyway what I posted before, but i'm going to see if I can figure out how to try that docker image myself in a vm if possible without it taking to much time, and then testing from there, since else I cannot reproduce, in now arch, 3 different ubuntu versions and win10.

I'll return if finding some usefull later on, if not takes to much time - I have some free time on my hands currently, and don't mind a challenge, but neither don't wanna spend way too much time on it, but lets see how goes :)

EDIT('S):

- I got docker setup in a linux VM and installed the LSIO deluge image there and for now just tested the commands I posted previously, in opened terminal of running container, and which works fine for me and sends mail out correctly, except as said before that the tlsversion attribute isn't supported in one of these installed components and so needs deleting that line in last two versions. I'll test with the modified plugin tomorrow and report back but i'm pretty sure it will work because the code example that you tested last, I just rechecked that it's pretty much the same calls the plugin uses for calling smtplib, so shouldn't change anything, and so will make me not be able to go any further then, sorry.

- Just checked deluge in the linux VMs deluge LSIO docker image with notifications2 smtp.gmail.com, 587, ssl/tls, and worked fine and got mail in inbox. Sadly this is out of my reach unfortunetly then.

- I always thought docker images where full distro's each(so practically just a type of VMs wrapped with a frontend), and so always thought to myself it seemed wildly ineffecient/bloated and especially if running multiple images, but I see after actually reading little up on it that it uses the host systems kernel etc, so I searched your older posts to find if you disclosed your distro and version and saw you're on debian NAS and synology NAS - could you please give me exact versions of each(and if updated after install or "vanilla") and if happens both places? If not to much trouble then maybe I could test through a livecd iso or something if available(no NAS knowledge whatsoever myself), or if I have to, make quick VM install - if solving/workarounding this issue if possible, then obviously would be helpful for other users of said systems as you.

kevindd992002
Leecher
Leecher
Posts: 68
Joined: Thu Jun 13, 2019 2:56 pm

Re: Notification not working

Postby kevindd992002 » Mon Jan 11, 2021 9:50 am

mhertz wrote:Sorry Kevin, I also thought to myself that you obviously would know that since posting usefull troubleshooting data so much, and it's me that's a docker/LSIO noob here :)

I'm guessing it's a TLS/smtplib/python issue, as even though it shows the notifications plugin issue from a ssl.c file, so sounding like ssl issue, then the initial connection is first transfered to TLS after the TLS handshake(obviously), and guessing handshake happens over openssl, so would error out there regardless, but could be wrong. Your last real output from the script was from starttls() and although shows connected, then there's no debug output after, and on my end there's alot more info about sending the mail and generating it - and you got a timeout error in deluge with the plugin, so it seems it is hanging, and probably will error out if waiting some time, i'm guessing, and you didn't get a mail neither in gmail inbox with "test" as only message, right? I get such on my end whenever running that script/commands.

You cannot disable SSL/TLS in the plugin as stated, as wont work sending mail, but can you please check this code, which only uses ssl and not tls and check if you get a mail and more/better debug output, and works here:

Code: Select all

from smtplib import SMTP_SSL
user=""
pw=""
server = SMTP_SSL('smtp.gmail.com', 465)
server.set_debuglevel(1)
server.ehlo()
server.login(user,pw)
server.sendmail(user, user, "test")
server.quit()

Also, could you test this tls version with forcing v1.1 as I saw reported some issues with some later versions for some:

Code: Select all

from smtplib import SMTP
import ssl
sc = ssl.create_default_context()
sc.options |= ssl.OP_NO_TLSv1_2 | ssl.OP_NO_TLSv1_3
sc.minimum_version = ssl.TLSVersion ["TLSv1_1"]
user=""
pw=""
server = SMTP('smtp.gmail.com', 587)
server.set_debuglevel(1)
server.ehlo()
server.starttls(context=sc)
server.login(user,pw)
server.sendmail(user, user, "test")
server.quit()

And last with extra cert disabling added for full closure:

Code: Select all

from smtplib import SMTP
import ssl
sc = ssl.create_default_context()
sc.options |= ssl.OP_NO_TLSv1_2 | ssl.OP_NO_TLSv1_3
sc.minimum_version = ssl.TLSVersion ["TLSv1_1"]
sc.check_hostname = False
sc.verify_mode = ssl.CERT_NONE
user=""
pw=""
server = SMTP('smtp.gmail.com', 587)
server.set_debuglevel(1)
server.ehlo()
server.starttls(context=sc)
server.login(user,pw)
server.sendmail(user, user, "test")
server.quit()

If finding a way to call smtplib working for your situation, then I can see about if I can add it to the plugin in an alternartive version for your usecase.


No worries, you're obviously more well-versed than me with python.I'm a noob so thank you for really helping here.

First test result:

Code: Select all

>>> from smtplib import SMTP_SSL
>>> user="redacted"
>>> pw="redacted"
>>> server = SMTP_SSL('smtp.gmail.com', 465)
server.set_debuglevel(1)
server.ehlo()
server.login(user,pw)
server.sendmail(user, user, "test")
server.quit()


Second test result:

Code: Select all

>>> from smtplib import SMTP
>>> import ssl
>>> sc = ssl.create_default_context()
>>> sc.options |= ssl.OP_NO_TLSv1_2 | ssl.OP_NO_TLSv1_3
>>> sc.minimum_version = ssl.TLSVersion ["TLSv1_1"]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'ssl' has no attribute 'TLSVersion'
>>> user="redacted"
>>> pw="redacted"
>>> server = SMTP('smtp.gmail.com', 587)
>>> server.set_debuglevel(1)
>>> server.ehlo()
send: 'ehlo [192.168.20.101]\r\n'
reply: b'250-smtp.gmail.com at your service, [redacted]\r\n'
reply: b'250-SIZE 35882577\r\n'
reply: b'250-8BITMIME\r\n'
reply: b'250-STARTTLS\r\n'
reply: b'250-ENHANCEDSTATUSCODES\r\n'
reply: b'250-PIPELINING\r\n'
reply: b'250-CHUNKING\r\n'
reply: b'250 SMTPUTF8\r\n'
reply: retcode (250); Msg: b'smtp.gmail.com at your service, [redacted]\nSIZE 35882577\n8BITMIME\nSTARTTLS\nENHANCEDSTATUSCODES\nPIPELINING\nCHUNKING\nSMTPUTF8'
(250, b'smtp.gmail.com at your service, [redacted]\nSIZE 35882577\n8BITMIME\nSTARTTLS\nENHANCEDSTATUSCODES\nPIPELINING\nCHUNKING\nSMTPUTF8')
>>> server.starttls(context=sc)
send: 'STARTTLS\r\n'
reply: b'220 2.0.0 Ready to start TLS\r\n'
reply: retcode (220); Msg: b'2.0.0 Ready to start TLS'
server.login(user,pw)
server.sendmail(user, user, "test")
server.quit()


Third test result:

Code: Select all

>>> from smtplib import SMTP
>>> import ssl
>>> sc = ssl.create_default_context()
>>> sc.options |= ssl.OP_NO_TLSv1_2 | ssl.OP_NO_TLSv1_3
>>> sc.minimum_version = ssl.TLSVersion ["TLSv1_1"]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'ssl' has no attribute 'TLSVersion'
>>> sc.check_hostname = False
>>> sc.verify_mode = ssl.CERT_NONE
>>> user="redacted"
>>> pw="redacted"
>>> server = SMTP('smtp.gmail.com', 587)
>>> server.set_debuglevel(1)
>>> server.ehlo()
send: 'ehlo [192.168.20.101]\r\n'
reply: b'250-smtp.gmail.com at your service, [redacted]\r\n'
reply: b'250-SIZE 35882577\r\n'
reply: b'250-8BITMIME\r\n'
reply: b'250-STARTTLS\r\n'
reply: b'250-ENHANCEDSTATUSCODES\r\n'
reply: b'250-PIPELINING\r\n'
reply: b'250-CHUNKING\r\n'
reply: b'250 SMTPUTF8\r\n'
reply: retcode (250); Msg: b'smtp.gmail.com at your service, [redacted]\nSIZE 35882577\n8BITMIME\nSTARTTLS\nENHANCEDSTATUSCODES\nPIPELINING\nCHUNKING\nSMTPUTF8'
(250, b'smtp.gmail.com at your service, [redacted]\nSIZE 35882577\n8BITMIME\nSTARTTLS\nENHANCEDSTATUSCODES\nPIPELINING\nCHUNKING\nSMTPUTF8')
>>> server.starttls(context=sc)
send: 'STARTTLS\r\n'
reply: b'220 2.0.0 Ready to start TLS\r\n'
reply: retcode (220); Msg: b'2.0.0 Ready to start TLS'
server.login(user,pw)
server.sendmail(user, user, "test")
server.quit()

kevindd992002
Leecher
Leecher
Posts: 68
Joined: Thu Jun 13, 2019 2:56 pm

Re: Notification not working

Postby kevindd992002 » Mon Jan 11, 2021 10:00 am

mhertz wrote:I saw that the LSIO deluge image was using ubuntu 18.04.1, so I downloaded the iso and fired it up in a VM to test the code-sections I posted earlier plus deluge and the moded plugin, in the livecd - unfortuently could not reproduce there neither, as works fine for me with deluge and the moded notifications or notifications2, and the code bits all works, so gets email in inbox afterwards(should be run with 'python3' but anyway worked too with just 'python', but 'python3' is best to test). The last two code-exmples failed, because the openssl version included in that ubuntu was v1.1.0g, or 1.1.1 if upgraded, and didn't have such object 'tlsversion' like I had in more recent openssl, or if part of python's ssl wrapper module I dunno, which was 3.6.5 in that ubuntu and upgraded 3.6.9, but anyway, so I had to delete that line and then worked and got mail each time.

Anyway, it's pretty hard to work in blind and try come up with solutions, and annoying for you to test alot of failed attempts, so please test anyway what I posted before, but i'm going to see if I can figure out how to try that docker image myself in a vm if possible without it taking to much time, and then testing from there, since else I cannot reproduce, in now arch, 3 different ubuntu versions and win10.

I'll return if finding some usefull later on, if not takes to much time - I have some free time on my hands currently, and don't mind a challenge, but neither don't wanna spend way too much time on it, but lets see how goes :)

EDIT('S):

- I got docker setup in a linux VM and installed the LSIO deluge image there and for now just tested the commands I posted previously, in opened terminal of running container, and which works fine for me and sends mail out correctly, except as said before that the tlsversion attribute isn't supported in one of these installed components and so needs deleting that line in last two versions. I'll test with the modified plugin tomorrow and report back but i'm pretty sure it will work because the code example that you tested last, I just rechecked that it's pretty much the same calls the plugin uses for calling smtplib, so shouldn't change anything, and so will make me not be able to go any further then, sorry.

- Just checked deluge in the linux VMs deluge LSIO docker image with notifications2 smtp.gmail.com, 587, ssl/tls, and worked fine and got mail in inbox. Sadly this is out of my reach unfortunetly then.

- I always thought docker images where full distro's each(so practically just a type of VMs wrapped with a frontend), and so always thought to myself it seemed wildly ineffecient/bloated and especially if running multiple images, but I see after actually reading little up on it that it uses the host systems kernel etc, so I searched your older posts to find if you disclosed your distro and version and saw you're on debian NAS and synology NAS - could you please give me exact versions of each(and if updated after install or "vanilla") and if happens both places? If not to much trouble then maybe I could test through a livecd iso or something if available(no NAS knowledge whatsoever myself), or if I have to, make quick VM install - if solving/workarounding this issue if possible, then obviously would be helpful for other users of said systems as you.


Yes, docker images are very lightweight compared to traditional VM's. You can literally spin up a container very easily without consuming significant resources. Ok, your test results are obviously not the same with mine, which is weird. And yes, I do have both Debian and Synology NAS but I'm doing all these tests on the Debian box. I would have to check with the deluge containers I have in my Synology NAS.

For Debian, here's what I have:

Code: Select all

root@epsilon:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 10 (buster)
Release:        10
Codename:       buster
root@epsilon:~# uname -r
5.8.0-0.bpo.2-amd64


Also, I'm not sure if it matters but I have the following Deluge plugins installed:

AutoRemovePlus
Label
SimpleExtractor

For the Synology NAS, you cannot spin up a VM for that because they use their own proprietary OS (DSM) though it is also Linux-based:

Code: Select all

root@synology:~# uname -r
3.10.105


But if it matters, it is using the latest DSM version which is 6.2.3-25426 Update 3 and I'm using a Synology DS1817+.

mhertz
Compulsive Poster
Compulsive Poster
Posts: 1060
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Notification not working

Postby mhertz » Mon Jan 11, 2021 10:08 am

Thanks, appreciate your tests, and info - I'll test the Debian setup later and report the results, it's strange it seems hanging after TLS is started - we could test different tlsversions forced, and Gmail demands encryption I read, but better I do myself than going back and fourth - are you fully up to date on that Debian or vanilla?

Edit: Sorry disregard, I can see that from the kernel version, just woke up :)

kevindd992002
Leecher
Leecher
Posts: 68
Joined: Thu Jun 13, 2019 2:56 pm

Re: Notification not working

Postby kevindd992002 » Mon Jan 11, 2021 11:19 am

Yeah, I have an updated Debian.

As for the Synology, I started fresh because the Deluge container I have there was not setup for Notifications to work ever. I put the Notifications2 egg in the plugins folder, restarted the container, and saw both Notifications and Notifications2 in the plugins section of the webUI (expected). So now, I unchecked Notifications and checked Notifications2. I configured Notifications2 in the Notifications2 submenu, clicked Apply and then Ok, but I don't see the "notifications-core.conf" being updated. When I restart the container, the configurations is lost. I also tried this with the original Notifications plugin and it also doesn't save to the file.

Any ideas?

EDIT: I removed the Notifications2 egg, restarted the container, and used the original Notifications egg to configure notifications-core.conf. I then reinstalled your egg and the conf remained. So it looks there's some conflict happening?

kevindd992002
Leecher
Leecher
Posts: 68
Joined: Thu Jun 13, 2019 2:56 pm

Re: Notification not working

Postby kevindd992002 » Mon Jan 11, 2021 12:20 pm

Synology test result:

So it worked! It also gave me the critical security alert warning like you and I just turned on less secure apps access for that as a workaround for the test. So I'm not really sure why it's not working for my Debian box considering that the deluge docker containers are exactly the same.


Return to “Support”

Who is online

Users browsing this forum: No registered users and 8 guests