Enable/Disable security rules via XML API

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Please sign in to see details of an important advisory in our Customer Advisories area.

Enable/Disable security rules via XML API

L1 Bithead

Hi all,

is it possible to enable / disable an existing security rule via XML API ?

Looking at the documentation (both the XML config guide and the api on the firewall) I found no useful informations on this topic Smiley Sad

thank's !

4 REPLIES 4

L5 Sessionator

Hi,

You can do so using the following command:

To disable:

https://<ip>/api/?type=config&action=set&xpath=/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/rulebase/security/rules/entry[@name='<rule-name>']&element=<disabled>yes</disabled>

To enable:

https://<ip>/api/?type=config&action=set&xpath=/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/rulebase/security/rules/entry[@name='<rule-name>']&element=<disabled>no</disabled>

Great Answer ...

bat thank you for being awesome.  question: any idea why a get on the same xpath (without the element arg) won't simply return an XML object with the state of a security rule?

e.g. https://firewall/api/?type=config&action=get&xpath=%2Fconfig%2Fdevices%2Fentry%5B%40name%3D%27localh... returns something completely useless, like:

<response status="success" code="19">

     <result/>

</response>

What the deuce does that tell me?  Neither the status or the code change based on the state of the rule, so...

Hi cjsteele

To know the status of rule query should be:

https://<ip>/api/?type=config&action=get&xpath=/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/rulebase/security/rules/entry[@name='<rule-name>']/disabled


Let me know if this is what you are looking for.

  • 6511 Views
  • 4 replies
  • 1 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!