From a09c23d8de36c00b75af2311045f9571766a5a65 Mon Sep 17 00:00:00 2001 From: Florent Daigniere Date: Sat, 8 Apr 2023 10:26:22 +0200 Subject: [PATCH] Fix it --- core/dovecot/conf/dovecot.conf | 7 ++++ tests/compose/core/05_connectivity.py | 51 ++++++++++++++++++++------- towncrier/newsfragments/2756.bugfix | 1 + 3 files changed, 46 insertions(+), 13 deletions(-) create mode 100644 towncrier/newsfragments/2756.bugfix diff --git a/core/dovecot/conf/dovecot.conf b/core/dovecot/conf/dovecot.conf index 15d6ed72..ebcd97aa 100644 --- a/core/dovecot/conf/dovecot.conf +++ b/core/dovecot/conf/dovecot.conf @@ -122,6 +122,13 @@ service imap-login { } } +service pop3-login { + inet_listener pop3 { + port = 110 + haproxy = yes + } +} + ############### # Delivery ############### diff --git a/tests/compose/core/05_connectivity.py b/tests/compose/core/05_connectivity.py index ea7486a6..8b94f4c2 100755 --- a/tests/compose/core/05_connectivity.py +++ b/tests/compose/core/05_connectivity.py @@ -6,28 +6,29 @@ import smtplib import os SERVER='localhost' -USERNAME='test@mailu.io' +USERNAME='user@mailu.io' PASSWORD='password' def test_imap(server, username, password): + print(f'Authenticating to imaps://{username}:{password}@{server}:993/') with imaplib.IMAP4_SSL(server) as conn: conn.login(username, password) - if conn.status('inbox')[0] != 'OK': - print(f'Authenticating to imaps://{username}:{password}@{server}:993/ failed!') - os.exit(101) + conn.noop() + print('OK') + print(f'Authenticating to imaps://{username}:{password}@{server}:143/') with imaplib.IMAP4(server) as conn: conn.starttls() conn.login(username, password) - if conn.status('inbox')[0] != 'OK': - print(f'Authenticating to imap://{username}:{password}@{server}:143/ failed!') - os.exit(101) + conn.noop() + print('OK') + print(f'Authenticating to imap://{username}:{password}@{server}:143/') try: with imaplib.IMAP4(server) as conn: conn.login(username, password) print(f'Authenticating to imap://{username}:{password}@{server}:143/ worked without STARTTLS!') os.exit(102) - except imaplib.error: - pass + except imaplib.IMAP4.error: + print('NOK') def test_pop3(server, username, password): print(f'Authenticating to pop3s://{username}:{password}@{server}:995/') @@ -36,6 +37,7 @@ def test_pop3(server, username, password): conn.user(username) conn.pass_(password) conn.close() + print('OK') print(f'Authenticating to pop3s://{username}:{password}@{server}:110/') conn = poplib.POP3(server) conn.stls() @@ -43,6 +45,7 @@ def test_pop3(server, username, password): conn.user(username) conn.pass_(password) conn.close() + print('OK') print(f'Authenticating to pop3://{username}:{password}@{server}:110/') try: conn = poplib.POP3(server) @@ -53,25 +56,47 @@ def test_pop3(server, username, password): print(f'Authenticating to pop3://{username}:{password}@{server}:110/ worked without STARTTLS!') os.exit(103) except poplib.error_proto: - pass + print('NOK') def test_SMTP(server, username, password): + print(f'Authenticating to smtps://{username}:{password}@{server}:465/') with smtplib.SMTP_SSL(server) as conn: conn.ehlo() conn.login(username, password) - with smtplib.SMTP(server) as conn: + print('OK') + print(f'Authenticating to smtps://{username}:{password}@{server}:587/') + with smtplib.SMTP(server, 587) as conn: conn.ehlo() conn.starttls() conn.ehlo() conn.login(username, password) + print('OK') try: + print(f'Authenticating to smtp://{username}:{password}@{server}:587/') + with smtplib.SMTP(server, 587) as conn: + conn.ehlo() + conn.login(username, password) + except smtplib.SMTPNotSupportedError: + print('NOK') + #port 25 should fail + try: + print(f'Authenticating to smtps://{username}:{password}@{server}:25/') + with smtplib.SMTP(server) as conn: + conn.ehlo() + conn.starttls() + conn.ehlo() + conn.login(username, password) + except smtplib.SMTPNotSupportedError: + print('NOK') + try: + print(f'Authenticating to smtp://{username}:{password}@{server}:25/') with smtplib.SMTP(server) as conn: conn.ehlo() conn.login(username, password) - print(f'Authenticating to smtp://{username}:{password}@{server}:25/ worked without STARTTLS!') + print(f'Authenticating to smtp://{username}:{password}@{server}:587/ worked without STARTTLS!') os.exit(104) except smtplib.SMTPNotSupportedError: - pass + print('NOK') if __name__ == '__main__': test_imap(SERVER, USERNAME, PASSWORD) diff --git a/towncrier/newsfragments/2756.bugfix b/towncrier/newsfragments/2756.bugfix new file mode 100644 index 00000000..1eee6f41 --- /dev/null +++ b/towncrier/newsfragments/2756.bugfix @@ -0,0 +1 @@ +Fix a bug preventing POP3 from being usable