PAN-OS - Block Destination Service
This playbook blocks a destination IP and service (TCP or UDP port) by creating a rule for a specific device group on PAN-OS.
PAN-OS by Palo Alto Networks · 22 tasks · 13 inputs · 0 outputs
Details
| ID | PAN-OS - Block Destination Service |
|---|---|
| From Version | 5.0.0 |
| Tasks | 22 |
README
This playbook blocks a destination IP and service (TCP or UDP port) by creating a rule for a specific device group on PAN-OS.
Dependencies
This playbook uses the following sub-playbooks, integrations, and scripts.
Sub-playbooks
- PAN-OS Commit Configuration
Integrations
- Panorama
Scripts
- Set
- SetAndHandleEmpty
Commands
- pan-os-create-service
- pan-os-list-addresses
- pan-os-create-address
- pan-os-list-services
- pan-os-create-rule
Playbook Inputs
| Name | Description | Default Value | Required |
|---|---|---|---|
| LogForwarding | Panorama log forwarding object name. | Optional | |
| IP | IP address to block. | Optional | |
| AutoCommit | This input establishes whether to commit the configuration automatically. True - Commit automatically. False - Commit manually. |
False | Optional |
| DeviceGroup | Target Device Group. | Optional | |
| Port | Destination port to block. | Optional | |
| Protocol | Protocol | Optional | |
| ServiceNamePrefix | Prefix of the Service name to be created. | xsoar-service- | Optional |
| RuleNamePrefix | Prefix of the Rule name to be created. | xsoar-rule- | Optional |
| ObjectNamePrefix | Prefix of the object name to be created. | xsoar-object- | Optional |
| WhereRule | Where to move the rule. If you specify “before” or “after”, you need to supply the “dst” argument. (Default is: ‘top’) | top | Optional |
| SourceZone | A comma-separated list of source zones. | Optional | |
| DestinationZone | A comma-separated list of destination zones. | Optional | |
| SecondaryDeviceGroup | If the rule, address and service are created in the “Shared” location, we need to know what device groups we can push to because it isn’t possible to push to the “Shared” location. | Optional |
Playbook Outputs
There are no outputs for this playbook.
Playbook Image

Inputs
LogForwarding— Panorama log forwarding object name.IP— IP address to block.AutoCommit— This input establishes whether to commit the configuration automatically. True - Commit automatically. False - Commit manually.DeviceGroup— Target Device Group.Port— Destination port to block.Protocol— ProtocolServiceNamePrefix— Prefix of the Service name to be created.RuleNamePrefix— Prefix of the Rule name to be created.ObjectNamePrefix— Prefix of the object name to be created.WhereRule— Where to move the rule. If you specify "before" or "after", you need to supply the "dst" argument. (Default is: 'top')SourceZone— A comma-separated list of source zones.DestinationZone— A comma-separated list of destination zones.SecondaryDeviceGroup— If the rule, address and service are created in the "Shared" location, we need to know what device-groups we can push to because it isn't possible to push to the "Shared" location.
Commands used
pan-os-create-address
pan-os-create-rule
pan-os-create-service
pan-os-list-addresses
pan-os-list-services
Flowchart
id: PAN-OS - Block Destination Service version: -1 name: PAN-OS - Block Destination Service description: 'This playbook blocks a destination IP and service (TCP or UDP port) by creating a rule for a specific device group on PAN-OS. ' starttaskid: "0" tasks: "0": id: "0" taskid: 005aa0e7-2fdc-44c6-8121-592ba45ac1f0 type: start task: id: 005aa0e7-2fdc-44c6-8121-592ba45ac1f0 version: -1 name: "" iscommand: false brand: "" description: '' nexttasks: '#none#': - "1" separatecontext: false continueonerrortype: "" view: |- { "position": { "x": 265, "y": 50 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 isoversize: false isautoswitchedtoquietmode: false "1": id: "1" taskid: 930de9d7-f0b5-432f-8bc3-9312671c0544 type: condition task: id: 930de9d7-f0b5-432f-8bc3-9312671c0544 version: -1 name: Palo Alto Networks PAN-OS enabled? description: Check whether PAN-OS integration is enabled. type: condition iscommand: false brand: "" nexttasks: '#default#': - "4" "yes": - "15" separatecontext: false conditions: - label: "yes" condition: - - operator: isExists left: value: complex: root: modules filters: - - operator: isEqualString left: value: simple: modules.brand iscontext: true right: value: simple: Panorama - - operator: isEqualString left: value: simple: modules.state iscontext: true right: value: simple: active accessor: brand iscontext: true continueonerrortype: "" view: |- { "position": { "x": 265, "y": 165 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 isoversize: false isautoswitchedtoquietmode: false "2": id: "2" taskid: 684389af-e828-4088-85f1-0f8eb7223bc3 type: regular task: id: 684389af-e828-4088-85f1-0f8eb7223bc3 version: -1 name: Panorama - Create custom block rule description: Creates a policy rule. script: '|||pan-os-create-rule' type: regular iscommand: true brand: "" nexttasks: '#none#': - "29" scriptarguments: action: simple: drop destination: complex: root: PanoramaAddress destination_zone: complex: root: inputs.DestinationZone device-group: complex: root: inputs.DeviceGroup log_forwarding: complex: root: inputs.LogForwarding filters: - - operator: isNotEmpty left: value: simple: inputs.LogForwarding iscontext: true pre_post: simple: pre-rulebase rulename: simple: ${inputs.RuleNamePrefix} - ${incident.id} service: complex: root: PanoramaServiceName source_zone: complex: root: inputs.SourceZone where: complex: root: inputs.WhereRule separatecontext: false continueonerrortype: "" view: |- { "position": { "x": 770, "y": 2605 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 isoversize: false isautoswitchedtoquietmode: false "4": id: "4" taskid: d936a766-4d24-4de6-89dc-dec0c66fa629 type: title task: id: d936a766-4d24-4de6-89dc-dec0c66fa629 version: -1 name: Done type: title iscommand: false brand: "" description: '' separatecontext: false continueonerrortype: "" view: |- { "position": { "x": 265, "y": 3120 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 isoversize: false isautoswitchedtoquietmode: false "7": id: "7" taskid: c68b90a0-a448-4e1f-81f6-063efc5b8242 type: regular task: id: c68b90a0-a448-4e1f-81f6-063efc5b8242 version: -1 name: PAN-OS - Create address object description: Creates an address object script: '|||pan-os-create-address' type: regular iscommand: true brand: "" nexttasks: '#none#': - "11" scriptarguments: device-group: complex: root: inputs.DeviceGroup ip_netmask: complex: root: inputs.IP transformers: - operator: concat args: prefix: {} suffix: value: simple: /32 name: complex: root: PanoramaAddress separatecontext: false continueonerrortype: "" view: |- { "position": { "x": 600, "y": 2190 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 isoversize: false isautoswitchedtoquietmode: false "10": id: "10" taskid: 41890197-ea43-4d94-8746-6221d39b4d83 type: playbook task: id: 41890197-ea43-4d94-8746-6221d39b4d83 version: -1 name: PAN-OS Commit Configuration description: Commit the PAN-OS Panorama or firewall configuration.\nIf specified as Panorama, it also pushes the policies to the specified device group in the instance. playbookName: PAN-OS Commit Configuration type: playbook iscommand: false brand: "" nexttasks: '#none#': - "4" scriptarguments: device-group: complex: root: inputs.DeviceGroup separatecontext: true continueonerrortype: "" loop: iscommand: false exitCondition: "" wait: 1 max: 100 view: |- { "position": { "x": 560, "y": 2950 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 isoversize: false isautoswitchedtoquietmode: false "11": id: "11" taskid: c40550d4-c929-49c9-84c9-62a18bcdb285 type: condition task: id: c40550d4-c929-49c9-84c9-62a18bcdb285 version: -1 name: AutoCommit defined? description: Check whether auto-commit is enabled. type: condition iscommand: false brand: "" nexttasks: '#default#': - "21" "yes": - "2" separatecontext: false conditions: - label: "yes" condition: - - operator: isEqualString left: value: complex: root: inputs.AutoCommit iscontext: true right: value: simple: "True" ignorecase: true continueonerrortype: "" view: |- { "position": { "x": 990, "y": 2365 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 isoversize: false isautoswitchedtoquietmode: false "14": id: "14" taskid: b4e03523-eb69-4680-83fd-2ef3fdb63cac type: regular task: id: b4e03523-eb69-4680-83fd-2ef3fdb63cac version: -1 name: Commit PAN-OS Instance manually description: Commit manually on PAN-OS. type: regular iscommand: false brand: "" nexttasks: '#none#': - "4" separatecontext: false continueonerrortype: "" view: |- { "position": { "x": 1390, "y": 2950 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 isoversize: false isautoswitchedtoquietmode: false "15": id: "15" taskid: 33c3588e-276a-4cb3-884f-b0a0a406c797 type: condition task: id: 33c3588e-276a-4cb3-884f-b0a0a406c797 version: -1 name: Is there an IP/Service/Port to block? description: Check whether there is an IP/Service/Port to block. type: condition iscommand: false brand: "" nexttasks: '#default#': - "4" "yes": - "16" separatecontext: false conditions: - label: "yes" condition: - - operator: isExists left: value: complex: root: inputs.IP iscontext: true - - operator: isExists left: value: complex: root: inputs.Port iscontext: true - - operator: isExists left: value: complex: root: inputs.Protocol iscontext: true continueonerrortype: "" view: |- { "position": { "x": 520, "y": 340 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 isoversize: false isautoswitchedtoquietmode: false "16": id: "16" taskid: b7e39257-2d04-4b00-8efe-2a0c0f96feb3 type: regular task: id: b7e39257-2d04-4b00-8efe-2a0c0f96feb3 version: -1 name: List Panorama Services description: Returns a list of addresses. script: '|||pan-os-list-services' type: regular iscommand: true brand: "" nexttasks: '#none#': - "17" scriptarguments: device-group: complex: root: inputs.DeviceGroup separatecontext: false continueonerrortype: "" view: |- { "position": { "x": 680, "y": 510 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 isoversize: false isautoswitchedtoquietmode: false "17": id: "17" taskid: 97a5a32c-62ae-4957-8954-c7a072e4c7b1 type: regular task: id: 97a5a32c-62ae-4957-8954-c7a072e4c7b1 version: -1 name: Find Panorama Service description: Set a value in context under the key you entered. If no value is entered, the script doesn't do anything. scriptName: SetAndHandleEmpty type: regular iscommand: false brand: "" nexttasks: '#none#': - "18" scriptarguments: append: simple: "false" key: simple: PanoramaServiceName value: complex: root: Panorama.Services filters: - - operator: isEqualString left: value: simple: Panorama.Services.DestinationPort iscontext: true right: value: simple: inputs.Port iscontext: true - - operator: isEqualString left: value: simple: Panorama.Services.Protocol iscontext: true right: value: simple: inputs.Protocol iscontext: true ignorecase: true - - operator: startWith left: value: simple: Panorama.Services.Name iscontext: true right: value: simple: inputs.ServiceNamePrefix iscontext: true accessor: Name transformers: - operator: uniq - operator: FirstArrayElement separatecontext: false continueonerrortype: "" view: |- { "position": { "x": 680, "y": 670 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 isoversize: false isautoswitchedtoquietmode: false "18": id: "18" taskid: 278d5df2-14c7-4b6c-84cb-5a54153537bc type: condition task: id: 278d5df2-14c7-4b6c-84cb-5a54153537bc version: -1 name: Is there an existing Service? description: Check whether the service exists in PAN-OS. type: condition iscommand: false brand: "" nexttasks: '#default#': - "20" "yes": - "25" separatecontext: false conditions: - label: "yes" condition: - - operator: isNotEmpty left: value: complex: root: PanoramaServiceName iscontext: true continueonerrortype: "" view: |- { "position": { "x": 680, "y": 835 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 isoversize: false isautoswitchedtoquietmode: false "19": id: "19" taskid: ab77f3d4-51b4-49c9-8b66-d03156e47013 type: regular task: id: ab77f3d4-51b4-49c9-8b66-d03156e47013 version: -1 name: Create Panorama Service description: Creates a service. script: '|||pan-os-create-service' type: regular iscommand: true brand: "" nexttasks: '#none#': - "25" scriptarguments: description: simple: Created by Cortex XSOAR destination_port: simple: ${inputs.Port} device-group: complex: root: inputs.DeviceGroup name: complex: root: PanoramaServiceName protocol: complex: root: inputs.Protocol separatecontext: false continueonerrortype: "" view: |- { "position": { "x": 990, "y": 1180 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 isoversize: false isautoswitchedtoquietmode: false "20": id: "20" taskid: 9b8629d6-9077-4ede-8f74-5e5fb6cf5463 type: regular task: id: 9b8629d6-9077-4ede-8f74-5e5fb6cf5463 version: -1 name: Set Service Name description: Set a value in context under the key you entered. scriptName: Set type: regular iscommand: false brand: "" nexttasks: '#none#': - "19" scriptarguments: key: simple: PanoramaServiceName value: simple: ${inputs.ServiceNamePrefix}${inputs.Port}-${inputs.Protocol} separatecontext: false continueonerrortype: "" view: |- { "position": { "x": 990, "y": 1020 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 isoversize: false isautoswitchedtoquietmode: false "21": id: "21" taskid: 98acab2e-5ff7-482d-88d9-f6adb811f278 type: regular task: id: 98acab2e-5ff7-482d-88d9-f6adb811f278 version: -1 name: Panorama - Create custom block rule description: Creates a policy rule. script: '|||pan-os-create-rule' type: regular iscommand: true brand: "" nexttasks: '#none#': - "14" scriptarguments: action: simple: drop destination: complex: root: PanoramaAddress destination_zone: complex: root: inputs.DestinationZone device-group: complex: root: inputs.DeviceGroup log_forwarding: complex: root: inputs.LogForwarding filters: - - operator: isNotEmpty left: value: simple: inputs.LogForwarding iscontext: true pre_post: simple: pre-rulebase rulename: simple: ${inputs.RuleNamePrefix} - ${incident.id} service: complex: root: PanoramaServiceName source_zone: complex: root: inputs.SourceZone where: complex: root: inputs.WhereRule separatecontext: false continueonerrortype: "" view: |- { "position": { "x": 1390, "y": 2605 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 isoversize: false isautoswitchedtoquietmode: false "24": id: "24" taskid: 2dfca826-2d99-4424-8086-321cea3bf0ea type: condition task: id: 2dfca826-2d99-4424-8086-321cea3bf0ea version: -1 name: Is there an existing Address? description: Check whether the service exists in PAN-OS. type: condition iscommand: false brand: "" nexttasks: '#default#': - "28" "yes": - "11" separatecontext: false conditions: - label: "yes" condition: - - operator: isNotEmpty left: value: complex: root: PanoramaAddress iscontext: true right: value: {} continueonerrortype: "" view: |- { "position": { "x": 990, "y": 1825 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 isoversize: false isautoswitchedtoquietmode: false "25": id: "25" taskid: f00ead84-3a3a-408a-8d0c-7b56d59f3573 type: regular task: id: f00ead84-3a3a-408a-8d0c-7b56d59f3573 version: -1 name: List Panorama Addresses description: Returns a list of addresses. script: Panorama|||pan-os-list-addresses type: regular iscommand: true brand: Panorama nexttasks: '#none#': - "27" separatecontext: false continueonerrortype: "" view: |- { "position": { "x": 990, "y": 1370 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 isoversize: false isautoswitchedtoquietmode: false "26": id: "26" taskid: 359d953c-0d9a-485d-806b-af1ef1959c47 type: regular task: id: 359d953c-0d9a-485d-806b-af1ef1959c47 version: -1 name: Find Panorama Address description: Set a value in context under the key you entered. If no value is entered, the script doesn't do anything. scriptName: SetAndHandleEmpty type: regular iscommand: false brand: "" nexttasks: '#none#': - "24" scriptarguments: append: simple: "false" key: simple: PanoramaAddress value: complex: root: Panorama.Addresses filters: - - operator: isEqualString left: value: simple: Panorama.Addresses.IP_Netmask iscontext: true right: value: simple: ${ip_netmask} iscontext: true ignorecase: true - - operator: startWith left: value: simple: Panorama.Addresses.Name iscontext: true right: value: simple: inputs.ObjectNamePrefix iscontext: true transformers: - operator: uniq - operator: FirstArrayElement separatecontext: false continueonerrortype: "" view: |- { "position": { "x": 990, "y": 1670 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 isoversize: false isautoswitchedtoquietmode: false "27": id: "27" taskid: 705cbce1-bd94-44e8-89fa-bf45694bd8a0 type: regular task: id: 705cbce1-bd94-44e8-89fa-bf45694bd8a0 version: -1 name: Set Address Name description: Set a value in context under the key you entered. scriptName: Set type: regular iscommand: false brand: "" nexttasks: '#none#': - "26" scriptarguments: key: simple: ip_netmask value: complex: root: inputs.IP transformers: - operator: concat args: prefix: {} suffix: value: simple: /32 separatecontext: false continueonerrortype: "" view: |- { "position": { "x": 990, "y": 1520 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 isoversize: false isautoswitchedtoquietmode: false "28": id: "28" taskid: 81671bd8-cd23-4dad-8c8b-56d192bb4cf5 type: regular task: id: 81671bd8-cd23-4dad-8c8b-56d192bb4cf5 version: -1 name: Set Address Name description: Set a value in context under the key you entered. scriptName: Set type: regular iscommand: false brand: "" nexttasks: '#none#': - "7" scriptarguments: key: simple: PanoramaAddress value: simple: ${inputs.ObjectNamePrefix}${inputs.IP} separatecontext: false continueonerrortype: "" view: |- { "position": { "x": 600, "y": 2040 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 isoversize: false isautoswitchedtoquietmode: false "29": id: "29" taskid: 93958d7c-611a-412f-8e50-52f0e98b3db7 type: condition task: id: 93958d7c-611a-412f-8e50-52f0e98b3db7 version: -1 name: Is device-group "shared"? description: Checks if the device group is "shared", because in that case we need to push to the actual device-groups that reference firewalls. type: condition iscommand: false brand: "" nexttasks: '#default#': - "10" "yes": - "30" separatecontext: false conditions: - label: "yes" condition: - - operator: isEqualString left: value: complex: root: inputs.DeviceGroup iscontext: true right: value: simple: shared ignorecase: true continueonerrortype: "" view: |- { "position": { "x": 770, "y": 2770 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 isoversize: false isautoswitchedtoquietmode: false "30": id: "30" taskid: 19d7b705-1fdb-481a-8bf4-affaff21c091 type: playbook task: id: 19d7b705-1fdb-481a-8bf4-affaff21c091 version: -1 name: PAN-OS Commit Configuration description: Commit the PAN-OS Panorama or Firewall configuration.\nIf specified as Panorama, it also pushes the policies to the specified device group in the instance. playbookName: PAN-OS Commit Configuration type: playbook iscommand: false brand: "" nexttasks: '#none#': - "4" scriptarguments: device-group: complex: root: inputs.SecondaryDeviceGroup separatecontext: true continueonerrortype: "" loop: iscommand: false exitCondition: "" wait: 1 max: 100 view: |- { "position": { "x": 970, "y": 2950 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 isoversize: false isautoswitchedtoquietmode: false view: |- { "linkLabelsPosition": { "15_16_yes": 0.59, "15_4_#default#": 0.1, "18_20_#default#": 0.54, "1_4_#default#": 0.1, "24_11_yes": 0.54, "29_10_#default#": 0.48, "29_30_yes": 0.6 }, "paper": { "dimensions": { "height": 3135, "width": 1505, "x": 265, "y": 50 } } } inputs: - key: LogForwarding value: {} required: false description: Panorama log forwarding object name. playbookInputQuery: - key: IP value: {} required: false description: IP address to block. playbookInputQuery: - key: AutoCommit value: simple: "False" required: false description: |- This input establishes whether to commit the configuration automatically. True - Commit automatically. False - Commit manually. playbookInputQuery: - key: DeviceGroup value: {} required: false description: Target Device Group. playbookInputQuery: - key: Port value: {} required: false description: Destination port to block. playbookInputQuery: - key: Protocol value: {} required: false description: Protocol playbookInputQuery: - key: ServiceNamePrefix value: simple: xsoar-service- required: false description: Prefix of the Service name to be created. playbookInputQuery: - key: RuleNamePrefix value: simple: xsoar-rule- required: false description: Prefix of the Rule name to be created. playbookInputQuery: - key: ObjectNamePrefix value: simple: xsoar-object- required: false description: Prefix of the object name to be created. playbookInputQuery: - key: WhereRule value: simple: top required: false description: 'Where to move the rule. If you specify "before" or "after", you need to supply the "dst" argument. (Default is: ''top'')' playbookInputQuery: - key: SourceZone value: {} required: false description: A comma-separated list of source zones. playbookInputQuery: - key: DestinationZone value: {} required: false description: A comma-separated list of destination zones. playbookInputQuery: - key: SecondaryDeviceGroup value: {} required: false description: If the rule, address and service are created in the "Shared" location, we need to know what device-groups we can push to because it isn't possible to push to the "Shared" location. playbookInputQuery: outputs: [] tests: - No Tests fromversion: 5.0.0 contentitemexportablefields: contentitemfields: {} supportedModules: - agentix - xsiam