panw-nutanix-doctor.py is a tool that allows Palo Alto Network Panorama to Dynamically Quarantine Infected Guests On Nutanix environment.
The workflow that panw-nutanix-doctor will take to Dynamically Quarantine Infected Guests is:
- Source machine initiates malicious traffic.
- Palo Alto Networks NGFW detects malicious activity.
- Palo Alto Networks NGFW share logs with Panorama.
- Panorama initiates API calls via HTTP profile to the panw-nutanix-doctor middleware. The API call from Panorama will include the IP address of the infected workload.
- Using the IP address, The panw-nutanix-doctor resolves all the relevant information from Nutanix PRISM (I.e., workload UUID and spec) and attach quarantine category and value (For example, quarantine:Strict)
- The infected workload will be isolated and will not be able to initiate or receive any packet.
- Python3
- The following python modules (see requirements.txt)
- requests
- flask
- flask_restful
$ git clone https://github.com/mohanadelamin/panw-nutanix-doctor.git
$ cd panw-nutanix-doctor
$ pip3 install -r requirements.txt
-
In home directry create new folder on the home directory
$ mkdir ~/panw-nutanix-doctor
-
Create new file named .doctor.config
$ vim .doctor.conf
-
Add the following to the .doctor.config file
[doctor_config] USER= PASS= PRISM= CERT_PATH= KEY_PATH= PORT= DEBUG=
-
Fill the config file above with the required information:
- Mandatory fields
- USER: PRISM username
- PASS: PRISM password
- PRISM= PRISM IP address
- Optional fields
- CERT_PATH: add the certificate file path if the connection from panorama need to be over SSL.
- KEY_PATH: add the key file path if the connection from panorama need to be over SSL.
- PORT: add the port in which panw-nutanix-doctor will listen. (Default is 80 or 443 if SSL is required)
- LENGTH: number of vms to be pulled by the API. Default is 100
- DEBUG: allowed values are "yes" or "no".
- Select Panorama > Server Profiles > HTTP and Add a new HTTP Server Profile.
- Enter a descriptive Name
- Select Add to provide the details of panw-nutanix-doctor Manager.
- Enter a Name for panw-nutanix-doctor.
- Enter the IP Address of the panw-nutanix-doctor.
- Select the Protocol (HTTP or HTTPS). The default Port is 80 or 443 respectively.
- Select POST under the HTTP Method column.
- Select Payload Format and select the log type Threat.
- Add a descriptive Name
- In the URI section add "/api/nutanix
- In the Payload section enter ** {"ip": "$src", "category": "Quarantine", "value": "Default"} **
- Click Ok
Step 2: Define the match criteria for when Panorama will trigger the API call to panw-nutanix-doctor, and attach the HTTP profile.
- Select Panorama > Collector Groups > Collector Log Forwarding for Threat or Traffic logs.
- On the Threat section click Add
- Add a descriptive Name
- Click Add on the HTTP section
- Select the HTTP profile.
- Click Ok
- Login to the panw-nutanix-doctor machine
- Run the script
$ python3 panw-nutanix-doctor.py
panw-nutanix-doctor is for illustrative purposes only. This software is supplied "AS IS" without any warranties and support.