I want to set up a datacap system for a server I am running a proxy on.
I'm not interested in throttling bandwidth.
I just want to limit port to x GB per month
Users will be blocked if they:
data cap has been hit but the monthly time is still left we can stop total traffic via deleting the user
monthly time has been completed but the user has not hit the data cap we will delete the user
The server is a Debian 8 machine. Just a regular box.
Clients connect to it via squid. The server is a proxy server.
The server accepts connections on port 33128 to 33218
Each port is bound to a squid user account.
User Bandwith is tracked via Sarg and updated every Minute via cron job
I want to stop accepting connections on a per port basis once a data limit and or monthly time is reached.
PS: When I say port, I mean port number (33128-33228)
The solution i need made:
parse squid logs for the traffic used per user;
create firewall rules on the ports the client arrive, and accounting for the traffic used (probably easier). see Traffic stats per network port . Just be aware that a server reboot resets the iptable stats, so it would be wiser to save them to an SQL database. (on a controlled reboot maybe iptables saves the traffic stats, however you can have a crash or power failure).
Part 2 of this task which will be to integrate the datacap into e-commerce like woocommerce so users can purchase more data, which would reactivate the squid account and remove the block.
15 freelancere byder i gennemsnit $443 på dette job
I have experience with similar project based on squid. Available to start immediately and complete as soon as possible. Please contact to discuss details if you are interested. Best Regards, Ilya