Create Securit policy with API

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Create Securit policy with API

Cyber Elite
Cyber Elite

Okay so below is what I've been attempting to use for the creation of policies automatically though the API; however when I run it I simply get a Success output and the rule never actually completes. Can anybody tell me where this is missformated? 

 

 

/api/?type=config&action=get&xpath=/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/rulebase/security/rules/[@name='$NewRule']&element=<source><member>$Source</member></source><destination><member>$Destination</member></destination><service><member>$Service</member></service><application><member>$Application</member></application><action>$Action</action><source-user><member>$srcuser</member></source-user><option><disable-server-response-inspection>no</disabled-server-response-inspection></option><negate-source>$negsource</negate-source><negate-destination>$negdest</negate-destination><disabled>$disabled</disabled><log-start>$logstart</log-start><log-end>$logend</log-end><description>$description</description><from><member>$srczone</member></from><to><member>$dstzone</member></to>

1 accepted solution

Accepted Solutions

L4 Transporter

you should open a TAC case because this command should create an error message.

 

You need to fix the XPATH as you forget an 'entry' for the rule:

 

/api/?type=config&action=get&xpath=/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/rulebase/security/rules/entry[@name...

 

View solution in original post

2 REPLIES 2

L4 Transporter

you should open a TAC case because this command should create an error message.

 

You need to fix the XPATH as you forget an 'entry' for the rule:

 

/api/?type=config&action=get&xpath=/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/rulebase/security/rules/entry[@name...

 

Glad it was something simple. I actually just realized a few minutes ago that I was also running get instead of set; when you run set you do actually get a malformed entry but when you run get it just says success regarless if there is a rule that matches the name or not even when I add the missing 'entry' statement. 

  • 1 accepted solution
  • 2315 Views
  • 2 replies
  • 0 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!