can't disable IPSec tunnel over API

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

can't disable IPSec tunnel over API

L0 Member

I've taken the instructions to extract the XML command from the debug console.

 

<request cmd="edit" obj="/config/devices/entry[@name='localhost.localdomain']/network/tunnel/ipsec/entry[@name='my-ipsec-tunnel']/disabled" cookie="7684494492332192">
 <disabled>yes</disabled>
</request>

When i tried using pan-python-0.14.0, it failed thus:

 

$ python3 panxapi.py -h my.firewall -K LUFRPT0yY2VpTWIzSjZQYUZEdzN4MHdoMXl0eFBKOUE9N29ZQ29HMndocmdLbjVJZWVkWWwrVFJPV0N6RmZVU1pJc1pjLzBnS2Fwdz0= -x -o '<request cmd="edit" obj="/config/devices/entry[@name='localhost.localdomain']/network/tunnel/ipsec/entry[@name='my-ipsec-tunnel']/disabled" cookie="7684494492332192"><disabled>yes</disabled></request>'
op: error [code="17"]: " request -> disabled is unexpected"
<response code="17" status="error"><msg><line> request -&gt; disabled is unexpected</line></msg></response>

Also tried using curl:

 

$ curl --globoff 'https://my.firewall/api/key=LUFRPT0yY2VpTWIzSjZQYUZEdzN4MHdoMXl0eFBKOUE9N29ZQ29HMndocmdLbjVJZWVkWWwrVFJPV0N6RmZVU1pJc1pjLzBnS2Fwdz0=&type=config&action=edit&xpath=/config/devices/entry[@name='localhost.localdomain']/network/tunnel/ipsec/entry[@name='my-ipsec-tunnel']&element=<disabled>yes</disabled>'
<!DOCTYPE html>
<html><head><title>Document Error: Not Found</title></head>
<body><h2>Access Error: 404 -- Not Found</h2>
<p>Can't locate document: /api/key=LUFRPT0yY2VpTWIzSjZQYUZEdzN4MHdoMXl0eFBKOUE9N29ZQ29HMndocmdLbjVJZWVkWWwrVFJPV0N6RmZVU1pJc1pjLzBnS2Fwdz0=&amp;type=config&amp;action=edit&amp;xpath=/config/devices/entry[@name=localhost.localdomain]/network/tunnel/ipsec/entry[@name=my-ipsec-tunnel]&amp;element=&lt;disabled&gt;yes&lt;/disabled&gt;</p>
</body>
</html>

What am i missing?

1 accepted solution

Accepted Solutions

No, the /disabled is necessary.  Turns out that -o is for operational commands; for 'edit' commands, you have to use -e.

 

$ python3 panxapi.py -h my.firewall -K LUFRPT0yY2VpTWIzSjZQYUZEdzN4MHdoMXl0eFBKOUE9N29ZQ29HMndocmdLbjVJZWVkWWwrVFJPV0N6RmZVU1pJc1pjLzBnS2Fwdz0= -x -e '<disabled>yes</disabled>' "/config/devices/entry[@name='localhost.localdomain']/network/tunnel/ipsec/entry[@name='my-ipsec-tunnel']/disabled"
edit: success [code="20"]: "command succeeded"
<response code="20" status="success"><msg>command succeeded</msg></response>

 

View solution in original post

2 REPLIES 2

L4 Transporter
I don't know the pan-python module, but I assume the "/disabled" is too much (you already have it in the XML snippet). When running it via curl, you need either to quote the single-quote ' in the URL or use double-quotes " to embrace the URL.

No, the /disabled is necessary.  Turns out that -o is for operational commands; for 'edit' commands, you have to use -e.

 

$ python3 panxapi.py -h my.firewall -K LUFRPT0yY2VpTWIzSjZQYUZEdzN4MHdoMXl0eFBKOUE9N29ZQ29HMndocmdLbjVJZWVkWWwrVFJPV0N6RmZVU1pJc1pjLzBnS2Fwdz0= -x -e '<disabled>yes</disabled>' "/config/devices/entry[@name='localhost.localdomain']/network/tunnel/ipsec/entry[@name='my-ipsec-tunnel']/disabled"
edit: success [code="20"]: "command succeeded"
<response code="20" status="success"><msg>command succeeded</msg></response>

 

  • 1 accepted solution
  • 3893 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!