panw-aci-doctor.py is a tool that allows Palo Alto Network Panorama to Dynamically Quarantine Infected Guests On Cisco ACI.
The workflow that panw-aci-doctor will take to Dynamically Quarantine Infected Guests is:
- Source machine initiate malicious traffic.
- Palo Alto Networks NGFW detect the malicious activity.
- Palo Alto Networks NGFW share logs with Panorama.
- Panorama initiate API call via HTTP profile to the panw-aci-doctor middleware. The API call from Panorama will include the IP address of the infected workload.
- Using the IP address, The panw-aci-doctor resolves all the relevant information from APIC (I.e. workload MAC address, tenant, app-profile, BD, etc), and move that workload to a new micro EPG. Using MAC Address Filter as selection attribute.
- The infected workload will move to uEPG and it will be isolated.
- Python3
- The following python modules (see requirements.txt)
- requests
- flask
- flask_restful
$ git clone https://github.com/mohanadelamin/panw-aci-doctor.git
$ cd panw-aci-doctor
$ pip3 install -r requirements.txt
-
In home directry create new folder on the home directory
$ mkdir ~/panw-aci-doctor
-
Create new file named .doctor.config
$ vim .doctor.conf
-
Add the following to the .doctor.config file
[doctor_config] USER= PASS= APIC= CERT_PATH= KEY_PATH= PORT= DEBUG=
-
Fill the config file above with the required information:
- Mandatory fields USER: ACI APIC username PASS: ACI APIC password APIC= ACI APIC 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-aci-doctor will listen. (Default is 80 or 443 if SSL is required) 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-aci-doctor Manager.
- Enter a Name for panw-aci-doctor.
- Enter the IP Address of the pan-aci-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/uepg/$dst"
- In the Payload section enter "Dummy"
- Click Ok
Step 2: Define the match criteria for when Panorama will trigger the API call to panw-aci-doctor, and attach the HTTP profile.
- Select Panorama > Log Settings.
- 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-aci-doctor machine
- Run the script
$ python3 panw-aci-doctor.py
panw-aci-doctor is for illustrative purposes only. This software is supplied "AS IS" without any warranties and support.