Get Virtualizor

Virtualizor uses linux's iptables to manage the server firewall. The Firewall API allows you to manage the server firewall where you can perform multiple operations such as blocking/allowing ports and restarting firewall and much more. The API response will contain the "output" key which consists of the output of the iptables after execution of the firewall rule.

HTTP Request



actGETfirewallThe action specified to perform operation on the firewall of the serverYes
startPOST1/0Start the firewall service if parameter is setNo
stopPOST1/0Stop the firewall service if parameter is setNo
statusPOST1/0Send status fo the firewall serviceNo
restartPOST1/0Restart the firewal serviceNo
versionPOST1/0Returns the version of the firewallNo
blockPOST1/0Blocks the specified portNo
allowPOST1/0Allows the specified portNo
portPOSTIntThe port which needs to be blocked or allowedNo
ip_blockPOST1/0Blocks the specified IP AddressNo
ip_allowPOST1/0Allows the specified IP AddressNo
searchPOST1/0Searches rule for the ip specifiedNo
ipPOSTtextThe ip that needs to be blocked or allowedNo

Sample Code



    $key =  'your_api_key';
    $pass = 'your_api_pass';
    $ip = 'your_server_ip';

    $admin = new Virtualizor_Admin_API($ip, $key, $pass);

    $post = array();
    $post['status'] = 1;        //here status is set, which will return the status of the firewall

    $output = $admin->firewall($post);




    "title": "Firewall Services ",
    "output": ["iptables: Firewall is not running."],
    "timenow": "1471411564",
    "time_taken": "0.113"
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list