Re: [Proftpd-user] Limit download count per file and user and period

"Block, Clemens" <[email protected]>
Newsgroups gmane.network.proftpd.user
Message-ID <AM6PR10MB2357CC1C5B82A83465FDE319E0930@AM6PR10MB2357.EURPRD10.PROD.OUTLOOK.COM>
Hi!

Thank you for the quick answer.
I already use mod_exec in another term and thought about using ExecBeforeCommand here too.
No problem to fetch DB and maybe get back a “download counts exceeded”.
But than I have to inject something back from the script to the READ request
which announces an error code “pemission denied” and break the READ request.
Don’t know how to achieve this with mod_exec.

Regards
   Clemens

Von: Anton Luka Šijanec <[email protected]>
Gesendet: Freitag, 26. Juni 2020 17:25
An: [email protected]
Betreff: Re: [Proftpd-user] Limit download count per file and user and period

Hello!

If you do not manage to find another solution, you can try to write your own scripts to modify counters in your user SQL table. You can achieve that through mod_exec.

You can use ExecOnCommand on a small C script on the READ command (it will only be used if READ was successful) that makes an SQL query.

In unistd.h there is a function:
int getlogin_r(char *buf, size_t bufsize);
which you can use to get the username, because the script is ran as the user that is logged in (probably for security reasons).

mod_exec link: http://www.proftpd.org/docs/contrib/mod_exec.html

regards and good luck!

--
Anton Luka Šijanec
https://sijanec.eu/
+386 64/176-345
[email protected]<mailto:[email protected]> (mail & xmpp)
https://sijanec.eu/pgp-key.txt


-------- Original Message --------
Subject: [Proftpd-user] Limit download count per file and user and period
From: "Block, Clemens"
To: [email protected]<mailto:[email protected]>
CC:


Hi Group!

Has anybody a solution to limit downloads per file and user and time period?
That means for more than one session (as mod_quotatab do).

Details:
We are delivering asset data to a high amount of user.
Data are updated weekly, but all data stayed in the same folder.
User get report about changed data and should be able to download new files.
But we want to prevent (due to bandwith and data transfer costs),
that user downloads all data again and again for convenience.
Therefore we would like to limit downloads per file and user.
Maybe only three times a month or so.
Of course we could run external jobs to manipulate counter, which means
counter resetting must not be part of the base function.

Environment:
We are using ProFTPd 1.3.6 with a mysql databases as user and log backend

Thx in advance for your hints
    Clemens

_______________________________________________
ProFTPD Users List   <[email protected]>
Unsubscribe problems?
http://www.proftpd.org/list-unsub.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.