New Extension for Plesk. Antivirus Protection to enhance your server security. Why choose Flex Antivirus?
Integrates Cloudflare to block IPs. Compatible with classic ASP and PHP via the extension's COM object.
By adding 2 extra lines of code you can connect to Cloudflare. CloudFlareLogin and CloudflareDomain
BlockIp(IP,Rulename)From your web page — in your index.asp, index.php, or any section of your application — you can call this function to block an IP address through Firewall Manager. It requires valid credentials for a domain in Plesk.
| Parameter | Type | Required | Description |
|---|---|---|---|
| Username | String | Required | Plesk domain user with access to the extension. |
| Password | String | Required | Password for the Plesk domain user. |
| FormatOutput | String | Optional | Response format: xml (default) or json. |
| IP | String | Required | IPv4 or IPv6 address to be blocked. |
| CloudFlareLogin | String | Required | Cloudflare email and token key |
| CloudflareDomain | String | Required | Domain integrated with Cloudflare |
Important: Use this function on pages protected with your own authentication. Exposing the call without protection allows any user to block arbitrary IPs.
Instantiate the FlexFirewallManager.Admin COM object, set the credentials, and call UnlockIP(). The response is parsed as XML.
' Create COM object instance
Set App = CreateObject("FlexFirewallManager.Admin")
App.FormatOutput = "xml"
App.Username = "Plesk Domain User"
App.Password = "Plesk Domain Password"
App.CloudFlareLogin("Cloudflare Email" , "Cloudflare Token")
App.CloudflareDomain = "Domain Name"
' IP to block
Dim strIP : strIP = "123.123.123.123"
Dim returnstring : returnstring = App.BlockIp(strIP)
You can use FormatOutput = "json" if you prefer to parse the response with JSON.parse instead of XML. JSON format is recommended for modern applications.
In PHP, instantiate the COM object with new COM(). Use json format to parse the response directly with json_decode().
// Create COM object instance
$app = new COM("FlexFirewallManager.Admin");
$app->FormatOutput = "json";
$app->Username = "Plesk Domain User";
$app->Password = "Plesk Domain Password";
// IP to unblock
$strIP = "123.123.123.123";
$app->CloudFlareLogin("Cloudflare Email","Cloudflare Token");
$app->CloudflareDomain = "Domain Name";
// Method 2
$returnstring = $app->BlockIp($strIP);
// Parse JSON response
$appjson = json_decode($returnstring);
if ($appjson->result) {
echo "IP Blocked " . $strIP;
}
Tip: You can combine this function with an internal administration form so your users can self-manage blocking their own IP without needing access to the Plesk panel.
Keep the following in mind when integrating this function into your application:
BlockIp() with an authenticated user session.
FlexFirewallManager.Admin COM object requires Windows Server with the extension installed.