Any way to get the client's connecting port number?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Any way to get the client's connecting port number?

Russel McDonald
Hi, is there any way to get the port number of the connecting client available to the adapter through ECAP interface? Not just the IP but the port number as well. I found that I can do that by a tiny change but it has to be int he squid source:
In adaptation\ecap\XActionRep.cc, method clientIpValue:
I added the sprintf:
sprintf(&ntoabuf[strlen(ntoabuf)], ":%d", client_addr.port());
            return libecap::Area::FromTempBuffer(ntoabuf, strlen(ntoabuf));

The adapter then has access to the client's connecting port. I use that information to then look up the PID of the connecting process and hence user, using a Windows dll and method with increased privs.

So is there any existing way to get that port without a squid change? And if not then would the team be amenable to my joining as a dev contributor and submitting that? It could be as a separate value/option so as to not break any existing apps relying on that particular string just having the IP.

Russel McDonald


_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: Any way to get the client's connecting port number?

Alex Rousskov
On 2/27/19 2:22 PM, Russel McDonald wrote:
> is there any way to get the port number of the connecting client
> available to the adapter through ECAP interface?

Yes, there is: http://www.squid-cache.org/Doc/config/adaptation_meta/

For example, the following configuration snippet relays (where
available) the MAC address (or equivalent), the source IP address, and
the TCP source port of the client-to-Squid connection to the adaptation
transaction via the X-Client-Details ICAP header or the eCAP meta-header:

  adaptation_meta X-Client-Details "%>eui@%>a:%>p"

Alex.
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users