Score:0

Limit parallel active connections per ip

uz flag

So basically we are providing an API, where people connect remotely. The idea is to deny everyone the access/ping to the IP of our server, except the whitelisted people (which are our customers). I was able to reach that goal with CSF. Then I thought it was the case to add a thread limitation, so I wanted to set a maximum number of parallel connections to our server available for one IP, and the first issue came: the command

iptables -A -s customerIP -p tcp --syn --dport 80 -m connlimit –connlimit-above NUMBER -j REJECT --reject-with tcp-reset

was fully ignored since the whitelisted customers have full access and the above rule is ignored (we were using csf and I read that iptables gives priority to rules in the order they are added: so if you whitelist an IP and then add a limitation, the limitation will be ignored). So I am looking if on ipfire is possible to have a whitelisted only access and setup max threads/parallel connection per IP (the rules must be IP based, not general rule).

SECOND QUESTION

Last thing is related to flushing rules. Let’s say a customer buys 100 threads then his subscription ends: what should we do? How can we flush all the rules for that IP?

On csf it would be possible to remove the IP manually from the whitelist (csf.allow) and then restart the CSF -a, but it would not be one of our best strategies. The issue comes when I have to remove the threads limitations from iptables, not from csf, because it seems that on iptables it is not possible to flush rules for a specific IP. I have found a script that remove rules for a specific Ip but it doesn’t seem updated, and it seems not supported anymore.

SUMMARY

So basically I am looking if IPFIRE provides the following things:

  1. commands on console/API for automatic tasks from CRM (whmcs)
  2. flush rules X IP
  3. threads/parallel connections/concurrent connections limit X IP.

Thank you!

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.