paloalto防火墙接口使用方法及实例

本文档详细介绍了如何使用Palo Alto Networks设备的API进行各种操作,包括获取API密钥、创建和管理IP地址及其组、提交配置更改、查看系统信息等关键步骤。

1.获取账号相关的唯一API KEY  

  windows:https://x.x.x.x/api/?type=keygen&user=username&password=password
  linux:curl -k -X GET https:///x.x.x.x/api/?type=keygen&user=username&password=password

2.新建IP地址:以heimingdan_9.9.9.9为例

  https://x.x.x.x/api/?key=apikey&type=config&action=set&xpath=/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/address/entry[@name='heimingdan_9.9.9.9']&element=<ip-netmask>9.9.9.9/32</ip-netmask>

3.将IP地址添加到IP地址组:以将heimingdan_9.9.9.9添加到heimingdan_extranet为例  

  https://x.x.x.x/api/?key=apikey&type=config&action=set&xpath=/config/devices/entry/vsys/entry[@name='vsys1']/address-group/entry[@name='heimingdan_extranet']&element=<static><member>heimingdan_9.9.9.9</member></static>

4.提交更改

  https://x.x.x.x/api/?key=apikey&type=commit&action=partial&cmd=<commit><partial><admin><member>paapi1</member></admin></partial></commit>

  查看提交结果:https://x.x.x.x/api/?key=apikey&type=op&cmd=<show><jobs><id>33607</id></jobs></show>

5.将IP地址移除IP地址组

  https://x.x.x.x/api/?key=apikey&type=config&action=delete&xpath=/config/devices/entry/vsys/entry[@name='vsys1']/address-group/entry[@name='heimingdan_extranet']/static/member[text()='heimingdan_9.9.9.9']

6.删除IP地址

  https://x.x.x.x/api/?key=apikey&type=config&action=delete&xpath=/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/address/entry[@name='heimingdan_9.9.9.9']

7.获取系统信息

  curl -k 'https://x.x.x.x//api/?type=op&cmd=<show><system><info></info></system></show>&key=apikey'

 

转载于:https://www.cnblogs.com/xinghen1216/p/10712098.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值