API BlockIp::add_ip question
The API documentation for BlockIp::add_ip says "This function blocks IP addresses from accessing a cPanel account's domains." Does this mean it blocks the specified IP from ALL hosted account domains under the same cPanel installation (the entire server) like the CSF Firewall Deny IP interface in WHM, or is this somehow blocking the IP from accessing only the domains on one specific hosted user account?
Thanks!
-
HI @swbrains It will add an .htaccess entry in the domain's .htaccess, just as would happen if you were to block an IP from the UI. This blocks it from accessing that account's domain's only. The resulting .htaccess entry if using their example would be the following: deny from 192.0.2.0
I also found that a typo in the function will cause it to fail and opened a case for this. The function should beBlockIP
notBlockIp0 -
Thanks. Is there any API function analogous to the Deny IP function in the firewall when you log into WHM? 0 -
Hi @swbrains Sort of, there is a way to block IP's via API for the whole server (WHM) but it's not going to utilize the firewall nor will it utilize an .htaccess block. The WHMAPI1 functions associated with cPHulk would do this for you WHM API 1 Sections - cPHulk - Developer Documentation - cPanel Documentation If you're using CSF and you wanted to block an IP address, while they don't have an API that I'm aware of the command is simply: csf -d0 -
Thanks. That's good info! 0
Please sign in to leave a comment.
Comments
4 comments