Re: [Proftpd-user] ProxyPassReverseServers option combined with IfClass directive
HASENOHR Paul via Proftp-user <[email protected]> Fri, 21 Feb 2025 15:40:59 +0000
| Newsgroups | gmane.network.proftpd.user |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I just tested this patch on 1.3.8c and it worked perfectly. Thanks a lot, it is really great!
I would have an additional question: While doing some tests, I also tried to use IfUser combined with "IfSessionOptions PerUnauthenticatedUser" on 1.3.9rc3 but it seems that IfSessionOptions does not have any effect. Is it working only with SFTP?
Ideally, if possible, I would have liked to take advantage of the "IfSessionOptions PerUnauthenticatedUser" functionality to do something like that:
IfSessionOptions PerUnauthenticatedUser
<IfClass welcome_net1>
<IfUser regex USER_A.*>
ProxyReverseServers ftp://server1.xxxx.yyy.it
</IfUser>
ProxyReverseServers file:/usr/local/proftpd/var/ftp/proxy/backends/%U.json
ProxyReverseServers ftp://server2. xxxx.yyy.it
</IfClass>
<IfClass !welcome_net1>
ProxyReverseServers file:/usr/local/proftpd/var/ftp/proxy/backends/%U.json
ProxyReverseServers ftp://server2. xxxx.yyy.it
</IfClass>
Should it even work?
Thank you for your support.
Best regards,
Paul
-----Original Message-----
From: TJ Saunders <[email protected]>
Sent: Thursday, February 20, 2025 10:34 PM
To: HASENOHR Paul (JRC-ISPRA) <[email protected]>; ProFTPD Users <[email protected]>
Subject: Re: [Proftpd-user] ProxyPassReverseServers option combined with IfClass directive
> Thank you for your suggestions. Unfortunately, it does not solve the
> issue as only the last occurrence of ProxyReverseServers within an
> IfClass section seems to be processed.
I've reproduced this issue locally, and identified the cause and necessary fix; see:
https://urldefense.com/v3/__https://github.com/Castaglia/proftpd-mod_proxy/pull/287__;!!DOxrgLBm!FQmEWzRxFJggVD1IY2vnuH8h29VuSzTjH0ezVKmr4m5kwUwS7VOVK_s-yssxLjinkiI9G9X3iQ3UskJkMFE$
The mod_proxy module needs to set flags on the directives that it expects to see multiple times; these flags are used by mod_ifsession, when it does its merging, to know whether to expect multiple occurrences of a directive, or not. Without these flags, mod_ifsession thinks that the ProxyReverseServers directive should only appear once, and removes the other occurrences from the in-memory config database (and thus it doesn't matter the ordering of the directives).
The above PR has worked for my local tests; would you care to try it out for your needs, verify that it works as you expect?
Cheers,
TJ
_______________________________________________
ProFTPD Users List <[email protected]>
Unsubscribe problems?
http://www.proftpd.org/list-unsub.html