simonrob/email-oauth2-proxy

Client not authenticated to send mail using CCG

dremba opened this issue · 1 comments

dremba commented

Hi,

I am trying to authenticate with CCG, but I always get the error: 530 5.7.57 Client not authenticated to send mail. [FR5P281CA0041.DEUP281.PROD.OUTLOOK.COM 2024-10-09T10:39:31.988Z 08DCE8162EC4E3C0]

My goal is that no user has to authenticate manually, but that the proxy accepts all mails that come from the specific domain and the email is entered in the config. Is this possible?
This is my configuration:

[IMAP-143]
server_address = outlook.office365.com
server_port = 993
local_address = 192.168.9.121

[SMTP-25]
server_address = smtp-mail.outlook.com
server_port = 587
server_starttls = True
local_address = 192.168.9.121

[@mail.test.info]
token_url = https://login.microsoftonline.com/<tenant_id>/oauth2/v2.0/token
oauth2_scope = https://outlook.office365.com/.default
oauth2_flow = client_credentials
client_id = sclient_id>
client_secret = <secret_id>

[emailproxy]
delete_account_token_on_password_error = False
encrypt_client_secret_on_first_use = False
use_login_password_as_client_credentials_secret = False
allow_catch_all_accounts = True

[test@mail.test.info]

This is what the log looks like:

2024-10-09 12:05:36,190: Accepting new connection from 192.168.9.76:50779 to SMTP server at 192.168.9.121:25 (unsecured) proxying smtp-mail.outlook.com:587 (STARTTLS)
2024-10-09 12:05:36,249: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587) --> [ Client connected ]
2024-10-09 12:05:36,249: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587)     <-- b'220 FR3P281CA0003.outlook.office365.com Microsoft ESMTP MAIL Service ready at Wed, 9 Oct 2024 10:05:35 +0000 [08DCE70F14EFF0DC]\r\n'
2024-10-09 12:05:36,249: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587) <-- b'220 FR3P281CA0003.outlook.office365.com Microsoft ESMTP MAIL Service ready at Wed, 9 Oct 2024 10:05:35 +0000 [08DCE70F14EFF0DC]\r\n'
2024-10-09 12:05:36,249: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587) --> b'EHLO DESKTOP-SVBSKDJ\r\n'
2024-10-09 12:05:36,265: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587)     --> b'EHLO DESKTOP-SVBSKDJ\r\n'
2024-10-09 12:05:36,280: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587)     <-- b'250-FR3P281CA0003.outlook.office365.com Hello [81.27.123.138]\r\n'
2024-10-09 12:05:36,280: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587)     <-- b'250-SIZE 157286400\r\n'
2024-10-09 12:05:36,280: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587)     <-- b'250-PIPELINING\r\n'
2024-10-09 12:05:36,280: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587)     <-- b'250-DSN\r\n'
2024-10-09 12:05:36,282: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587)     <-- b'250-ENHANCEDSTATUSCODES\r\n'
2024-10-09 12:05:36,282: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587)     <-- b'250-STARTTLS\r\n'
2024-10-09 12:05:36,282: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587)     <-- b'250-8BITMIME\r\n'
2024-10-09 12:05:36,282: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587)     <-- b'250-BINARYMIME\r\n'
2024-10-09 12:05:36,282: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587)     <-- b'250-CHUNKING\r\n'
2024-10-09 12:05:36,282: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587)     <-- b'250 SMTPUTF8\r\n'
2024-10-09 12:05:36,282: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587)     --> b'STARTTLS\r\n'
2024-10-09 12:05:36,282: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587)     <-- b'220 2.0.0 SMTP server ready\r\n'
2024-10-09 12:05:36,282: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587) <-> [ Starting TLS handshake ]
2024-10-09 12:05:36,688: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587) [ Successfully negotiated SMTP server STARTTLS connection - re-sending greeting ]
2024-10-09 12:05:36,688: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587)     --> b'EHLO DESKTOP-SVBSKDJ\r\n'
2024-10-09 12:05:36,726: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587) <-> [ TLSv1.3 handshake complete ]
2024-10-09 12:05:36,746: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587)     <-- b'250-FR3P281CA0003.outlook.office365.com Hello [81.27.123.138]\r\n'
2024-10-09 12:05:36,746: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587)     <-- b'250-SIZE 157286400\r\n'
2024-10-09 12:05:36,746: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587)     <-- b'250-PIPELINING\r\n'
2024-10-09 12:05:36,746: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587)     <-- b'250-DSN\r\n'
2024-10-09 12:05:36,765: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587)     <-- b'250-ENHANCEDSTATUSCODES\r\n'
2024-10-09 12:05:36,765: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587)     <-- b'250-AUTH LOGIN XOAUTH2\r\n'
2024-10-09 12:05:36,765: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587)     <-- b'250-8BITMIME\r\n'
2024-10-09 12:05:36,765: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587)     <-- b'250-BINARYMIME\r\n'
2024-10-09 12:05:36,765: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587)     <-- b'250-CHUNKING\r\n'
2024-10-09 12:05:36,765: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587)     <-- b'250 SMTPUTF8\r\n'
2024-10-09 12:05:36,765: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587) <-- b'250-FR3P281CA0003.outlook.office365.com Hello [81.27.123.138]\r\n250-SIZE 157286400\r\n250-PIPELINING\r\n250-DSN\r\n250-ENHANCEDSTATUSCODES\r\n250-AUTH PLAIN LOGIN\r\n250-8BITMIME\r\n250-BINARYMIME\r\n250-CHUNKING\r\n250 SMTPUTF8\r\n'
2024-10-09 12:05:36,765: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587) --> b'MAIL FROM:<test@mail.test.info>\r\n'
2024-10-09 12:05:36,765: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587)     --> b'MAIL FROM:<test@mail.test.info>\r\n'
2024-10-09 12:05:41,759: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587)     <-- b'530 5.7.57 Client not authenticated to send mail. [FR3P281CA0003.DEUP281.PROD.OUTLOOK.COM 2024-10-09T10:05:41.067Z 08DCE70F14EFF0DC]\r\n'
2024-10-09 12:05:41,759: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587) <-- b'530 5.7.57 Client not authenticated to send mail. [FR3P281CA0003.DEUP281.PROD.OUTLOOK.COM 2024-10-09T10:05:41.067Z 08DCE70F14EFF0DC]\r\n'
2024-10-09 12:05:41,775: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587) <-- [ Server disconnected ]
2024-10-09 12:05:41,775: SMTP (192.168.9.76:50779-{192.168.9.121:25}-smtp-mail.outlook.com:587) --> [ Client disconnected ]

I have tested sending from different clients with and without a password. The same error every time.
With the other methods such as use_login_password_as_client_credentials_secret it works without any problems.

Thank you for any help.

Your email client is trying to send email without logging in. This would be an issue with or without the proxy, so you'll need to address this first.