Mailing List Archive

[Bug 2708] New: Using Socks proxy with an open connection
https://bugs.exim.org/show_bug.cgi?id=2708

Bug ID: 2708
Summary: Using Socks proxy with an open connection
Product: Exim
Version: 4.92
Hardware: x86
OS: Linux
Status: NEW
Severity: bug
Priority: medium
Component: Logging
Assignee: unallocated@exim.org
Reporter: george.cindea@solarwinds.com
CC: exim-dev@exim.org

Hello,

I have encountered an issue when trying to send a bunch of emails using Proxy
Protocol.

What I'm trying to do?

From Server 1(Danted) ---- > Proxy Server(Danted) ---> Server

Sending one email:

2021-03-22 12:55:07 [25313] 1lOJmi-0004yD-On => test@server1 R=server1_socks
T=remote_smtp_batv_socks H=server2 [IPV6_ip] PRX=[proxy_local_address]
I=[server_1_ip] C="250 OK id=1lOK5L-0003i1-Jt"
2021-03-22 12:55:07 [25313] 1lOJmi-0004yD-On Completed

Sending more emails in one open session(using swaks multiple times and exim
-qff):

2021-03-26 08:50:18 [2509] 1lPiAX-0000eP-Lb => test@server1
R=dnslookup_relay_to_domains T=remote_smtp H=server1 [IPV4_ip] PRX=[ip of
server used as proxy] I=[IPV4_ip] CV=yes C="250 OK id=1lPiAb-0005cs-W9"
2021-03-26 08:50:18 [2509] 1lPiAX-0000eP-Lb Completed
2021-03-26 08:50:18 [2512] 1lPi8p-0000Ro-Uq => test@server1
R=dnslookup_relay_to_domains T=remote_smtp H=server1 [IPV4_ip]
I=[10.0.111.176]* CV=no C="250 OK id=1lPiAc-0005cs-Sl"
2021-03-26 08:50:18 [2512] 1lPi8p-0000Ro-Uq Completed

The mail with id 1lPi8p-0000Ro-Uq is using an open connection and the PRX is
not set, even if the mail is send by proxy.


The behavior:

1. Sending one email from server1-> proxy server -> server2 in Exim's logs the
PRX=[ip of server used as proxy] is pointing to the right interface.
2. Sending more emails from server1 -> proxy server -> server2 when an open
connection is enabled(I=[]*]) in Exim's logs only the first email has PRX=[]
enabled, the rest of the emails don't have PRX added in the log line.
3. In ACL, when printing the value of $proxy_session and $proxy_local_address,
for the first email $proxy_session is True and $proxy_local_address has the
address of the right interface, but for the rest of the emails the value is
NULL for both variables.
3. Somehow, when using an open connection(in logs I=[]*) the PRX=[] is missing.

I'm sure that the emails are sending using the Proxy Protocol, but the logging
is somehow buggy.


================= Code =======================

#ifdef SUPPORT_SOCKS
if (LOGGING(proxy) && proxy_local_address)
{
g = string_append(g, 3, US" PRX=[", proxy_local_address, US"]");
if (LOGGING(outgoing_port))
g = string_fmt_append(g, ":%d", proxy_local_port);
}
#endif

=============================================


================= Acl =======================

# Check to see if are using a proxy connection
warn
# For messages that have recipients with different settings
# this is sometimes wrongly set to true. It looks like
# the value isn't cleared between recipients.
!condition = ${if eq{$acl_arg3}{no_socks}}
condition = $proxy_session
!condition = ${if eq{$proxy_local_address}{}}
set acl_c_real_sending_ip_address = $proxy_local_address

=============================================

--
You are receiving this mail because:
You are on the CC list for the bug.
--
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##