Showing posts with label #CCIE #NETWORKSECURITY #PCNSE #PCNSA #PALOALTONETWORKS. Show all posts
Showing posts with label #CCIE #NETWORKSECURITY #PCNSE #PCNSA #PALOALTONETWORKS. Show all posts

Monday, October 2, 2023

Using Python and Netmiko to Access and Retrieve Palo Alto Firewall Data

In this post, I will be using the python code below to login a my Palo Alto Firewall using NETMIKO.
the code defines two functions that we will use to get the information we need from the Firewall.
note that you can replicate the function to add other (net_connect.send_commands)
then print out, or even more that you can also add more IP addresses 
for example: pan2_ip and pan3_ip then you will only need to use the last two lines of the code:
pan2_ip= get_int(pan2_ip)
print(pan2_ip)
import netmiko

pan_ip= '192.168.1.250'

username='python'
password='python1234'
device_type='paloalto_panos' #this must be one of the types supported by Netmiko
port='22'

#get the system information of the PANOS
def get_info(ip):
net_connect = netmiko.ConnectHandler(ip=ip, device_type=device_type, username=username,password=password, port=port)
return net_connect.send_command('show system info')
pan_info= get_info(pan_ip)
print(pan_info)

#get the IP information of the PANOS
def get_int(ip):
net_connect = netmiko.ConnectHandler(ip=ip, device_type=device_type, username=username,password=password, port=port)
return net_connect.send_command('show interface all')
pan_ip= get_int(pan_ip)
print(pan_ip)
#end

Monday, June 7, 2021

Change Global Protect portal logo

 It is nice and good idea to replace the Global Protect logo to your company logo.

to be more professional and to give better impression about your company attention to details.


in this post, I will be showing you how to do that:

First of all you need to have global protect portal (web based VPN page) enabled.

go to : Network > Global Protect > Portals > General

As you can see  > you should have the interface (outside) and it's IP address 

under appearance: Portal Login Page is set to customized-page.html


Note, in your case you would not see the custom page in the drop list because you did not create it yet.

here is how to create this page:

Go to Device > Response pages >

you will find a list of pages used in your firewall, find and click on Global Protect Portal Login Page

then, select the "Default" and export as shown in the image below:


Once you downloaded it, you can open the ".html" page that you downloaded and edit with texteditor

as you can see below:

change the image source to a different source than the original one, in my case I'm recalling it from the link of a server lab, you can see the highlighted link below:


 once you finished editing this page, save it as (NAME.html)

Go again to Response Pages and select Global Protect portal login page:



Now you can go to the first step and select the new customized page from the drop list and commit your configs.

Hope this was useful!

Samer R. Saleem

Thursday, June 3, 2021

Security Policy Testing on PaloAlto Firewall

Firewalls in an active working environment will always be susceptable to change in configuration, hosts will be added to new policies and removed later, or added to one or more of the security policies at the same time, this of course will cause some problems at some point, especially if the rule hits were not as intended to be and some server or IP will lose access to internet or DMZ.

Here we will see how to find out if the same host was added to one or more security rules by simulating a trace which is similar to packet tracer of the Cisco ASA firewalls to some extent. 

How to test your configuration for a specific host to see in which policy it might be?

What if the host was used in more than security policy?

 

Security Policy Testing on PaloAlto Firewall

How to know If there is conflict for the same host?

 

There are two ways for the same test.

A.    Go to Device > Troubleshooting

B.    Go to Security Policy > Select “Test Policy” which can be found at the bottom bar

 

Both of these options will do the same thing.

 

So let’s see how it works.

Using option B, we are going to press on the test policy option which you can see "in the right corner of the screen"

we will start filling the details:

1. Source interface (Inside, outside, DMZ) in our case it is (Inside)

2. Destination Interface (Insidde, outside, DMZ) in our case it is (Outside)

3. Select the protocol type (TCP, UDP, ICMP) for this example we are going to use (ICMP)

once you selected the ICMP, the destination port is no longer needed.


Here as you can see below, our source will be a host that was added previsouly to a security rule named (DIRECT-INTERNET-ACCESS) and the ip address of this host is (10.211.112.2)

The destination in our policy is Google (8.8.8.8)


there is another useful option that can be seen in the screen below:

"Show all potential match rules until first allow rule"


once you entered all details as the in the screen, you can scroll-down to "excute" option and press it, right away you will see the "test result" showing the matching rule "Direct-Internet-Access"

Now you can select this rule and check out it's "result details" tab on the right.

scroll-down to the end, now you can see if the Action is "Allowed or Denied"

Type is "interzone or universal" 




You can then see if there is duplicate for the same host IP with another rule that might cause a hit and prevent the host from working in another intended way, and resolve the misconfiguration.



Hope this was useful!


Samer R. Saleem



Friday, May 14, 2021

Enable sending PaloAlto Firewall logs to Email Account

 If you are using PALO-ALTO Firewalls, which they are great products according to my experience, you would not want to be connected all the time to check events/threats and monitor the everything all the time.

this would be time waste and of course you will not get better benefits from sitting the whole time in front of the screen.

 

Other way is enabling log forwarding to an external receiver.

the options available to forward the logs are as below:

1. SNMP

2. EMAIL

3. SYSLOG

4. HTTP

Creating Log forwarding, select the option and click on ADD:













Go to Objects > Log Forwarding > Add

Now add the information below:












Select from the Log type drop list> I'm selecting threats which will check vulnerabilities and Viruses and File checking and this of course will include Wildfire submissions as you can see in my email list below






A great option to use here will be EMAIL, you can send threats for a specific rule to your EMAIL Inbox.

For Example, an important rule like incoming rules used to allow emails coming inbound to Exchange server or security policy rule for the traffic allowed to hosts accessing internet.


 

you will be able to add the option to get alerts for threats coming in emails for example.

here is how to enable the Log forwarding to email:

you should see a drop list under the option Log Forwarding:



at the end this what you will start seeing in your email feed:

The type is threat, source IP and destination IP, the name of the policy which in my case is INCOMING-EMAIL, Logset which is the log type we chose as logging forward to email











 

 

 

 

 

 

 

 

 

 

 

 

you can do the same for any log forward enabled policy.

Hope this was useful!

#CCIE #NETWORKSECURITY #PCNSE #PCNSA #PALOALTONETWORKS

Samer R.Saleem



Automating Network Configurations with Jinja2 and Python: A Step-by-Step Guide

 In this post, I worked on collecting a code that works with Jinja template. the nice thing in working with Jinja is that you can have basel...