email-oauth2-proxy: "Refused connection" when using versions 2023-03-09 or 2023-05-18 in Windows
Hello, I’m back, and I’m still unable to run the emailproxy without a console window. As explained in #134, I would like to run the proxy in a way that does make available the systray icon, but does not require a console window. Since #134 was closed, I updated my installation of eamil-oauth2-proxy, and recompiled using the --noconsole option, as follows:
.\pyinstaller --noconsole --onefile emailproxy.py --hidden-import timeago.locales.en
Running the executable no longer causes a crash, and I do see the systray icon but no console window (as desired).
However, when attempting to send email via SMTP, my email client logs the following error:
25908 16: 9.48 Open 127.0.0.1:1587
25908 8: 9.50 Dialog: "Could not connect to "localhost"\r\n"
25908 8: 9.50 Dialog: "\r\n"
25908 8: 9.50 Dialog: "Cause: connection refused (10061)"
Running the proxy in debug mode, the log file only shows the following:
2023-06-26 22:40:46,268: Initialising Email OAuth 2.0 Proxy (version 2023-05-18) from config file C:\Program Installation Files\Email-OAuth2-Proxy_portable\dist\emailproxy.config
2023-06-26 22:40:46,276: Starting POP server at localhost:1995 (unsecured) proxying outlook.office365.com:995 (SSL/TLS)
2023-06-26 22:40:46,291: Starting SMTP server at localhost:1587 (unsecured) proxying smtp.office365.com:587 (STARTTLS)
2023-06-26 22:40:46,291: Initialised Email OAuth 2.0 Proxy - listening for authentication requests. Connect your email client to begin
2023-06-26 22:41:34,735: Stopping Email OAuth 2.0 Proxy
I have checked that an previously compiled executable (which does have a console window) still runs properly and allows the email client to connect to port 1587 for sending by SMTP.
Please advise.
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 18 (7 by maintainers)
I understand, I was just confused why the emailproxy seems to be inconsistent as to when it triggers involvement of the firewall.
IMAP, POP and SMTP all use TCP.
Thank you both for following up – this is really helpful.
It does seem like switching the proxy’s default
local_addressvalue to::would resolve this, and also in most cases avoid the need to investigate other issues that have been reported for related reasons (e.g., #152, #162, #178).I will test this in various scenarios, and assuming all goes well, plan to integrate this change in the next release.
local_address = 127.0.0.1localhost(i.e.,127.0.0.1)localhost6(i.e.,::1)local_address = ::1localhost(i.e.,127.0.0.1)localhost6(i.e.,::1)local_address = ::localhost(i.e.,127.0.0.1)localhost6(i.e.,::1)Looks coherent, but I’m not sure it was intentional to require users to add a
local_address = ::setting for all servers (probably should be the new default) 😃Regarding which of the two diffs has effect, it’s the second, on line 1925:
local_addressfrom all serversAF_INETon line1925localhostworklocalhost6do not workAF_UNSPECon line1925localhostdo not worklocalhost6workIn the tests above I left
AF_UNSPECon line1516(it has no effect anyway).BTW, I do all the testing on
Fedora 38installed on the real HW (not VM, containers, …).I believe I have the same problem. Up to
2023-02-08everything is fine, starting with2023-03-09I get connection errors.I have boiled it down to
socket_family=socket.AF_UNSPECvs.socket_family=socket.AF_INET:I use the proxy for:
mutt, which works fine withsocket_family=socket.AF_UNSPEConly if I replacelocalhost(mapped to127.0.0.1) withlocalhost6(mapped to::1).fetchmail, same behavior asmutt(error when configured withlocalhost, fine when configured withlocalhost6).Regardless, I still do not see why setting
socket_family=socket.AF_UNSPECwould require the use of IPv6 addressing.