I have a server with 6 ip addresses added via cPanel. I'm having troubles limiting the IP address my clients can use as an outgoing IP address in their PHP script. Some of them are running proxies and using the CURLOPT_INTERFACE to switch from the server IP address to other clients IP address.

I'm not sure how to limit CURLOPT_INTERFACE to just the server IP address or bind it to the server + the clients dedicated IP address...


Try using firewall rules to restrict IP address usage to the user assigned to them.

For instance, let's say that the user bob is the only person who should use IP address His user ID is 503.

Then we will deny any other user ID to make outgoing connections using that IP address:

iptables -I OUTPUT -m owner ! --uid-owner 503 -s -j REJECT --reject-with icmp-admin-prohibited

Any other users will then get a Permission denied if they try to make outgoing connections with this IP address.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.