Tuesday, May 21, 2013

How to see a Pre Shared Key for Site to Site VPN on Cisco ASA

To see the pre shared key for any Sites to Site VPN simply type the following in CLI:

more system:running-config | begin tunnel-group


This will change:



tunnel-group 10.55.55.55 type ipsec-l2l
tunnel-group 10.55.55.55 ipsec-attributes
pre-shared-key *****


Into:


tunnel-group 10.55.55.55 type ipsec-l2l
tunnel-group 10.55.55.55 ipsec-attributes
pre-shared-key fgaJcXri3zVq


More information about seeing the pre shared key on 6.3 here:
http://www.packetsent.com/2011/11/display-vpn-preshared-key-on-cisco-pix.html

How to Make PPTP Connections Work Through a Cisco ASA

The most common reason  I find that PPTP connections do not work is because the inspect for PPTP it not enabled.

This is how you enable the inspect in the default inspection class:


conf t

policy-map global_policy
 class inspection_default
  inspect pptp
end
wr mem


This is needed whenever PAT is being used.

More details here:
http://www.cisco.com/en/US/docs/security/asa/asa82/configuration/guide/inspect_basic.html#wp1432892

How to Capture ARP Requests on a Cisco ASA

Many times I have had to prove that the firewall was not receiving any ARP replies from the workstation / router / switch / or server here is how I did it:

Log into the CLI and create a capture looking for only ARP request:

capture [CAP_NAME] interface [INT_NAME] ethernet-type arp

//Example
ASA# capure arpcap interface servers ethernet-type arp
ASA# show capture arpcap

//This is an example of a devices that is not responding to ARP:
   1: 20:26:41.822046 arp who-has 10.55.55.55 tell 10.55.55.1
   2: 20:26:43.622508 arp who-has 10.55.55.55 tell 10.55.55.1
   3: 20:26:44.622462 arp who-has 10.55.55.55 tell 10.55.55.1
//We can see the firewall (10.55.55.1) is requesting an ARP for 10.55.55.55 but there is no reply

//This is an example of a devices that is responding to ARP requests:

   1: 20:30:59.077226 arp who-has 10.55.55.55 tell 10.55.55.1
   2: 20:30:59.077562 arp reply 10.55.55.55 is-at 0:45:00:07:a7:00

//We can see the firewall (10.55.55.1) is requesting an ARP for 10.55.55.55 and gets a reply that it has mac address 0:45:00:07:a7:00


You of course and also do a show arp to see the current arp table but the capture will prove the device is not arping or it will help you find if two or multiple devices are arping for the same IP address.

Cisco ASA Renaming Network Objects, Service Objects, Access Lists, and Details about Object-Groups

Renaming objects on the ASA is very simple:

NOTE: You cannot rename object-groups as of version 9.1 make sure you pick the correct name the first time!
Updating the objects names will automatically update the references in the policy.

Renaming Network Objects:
object network OLD_NAME rename NEW_NAME

Renaming Service Objects:
object service OLD_NAME rename NEW_NAME

Renaming Access Lists:
access-list OLD_NAME rename NEW_NAME


Tuesday, June 5, 2012

How to Download Packet Captures as a PCAP File to Use in Wireshark on a Cisco ASA

If you need to download your packet captures on a Cisco ASA/PIX so you can import them into Wireshark it is a very simple process.

I assume the following is true:
1. You have http (ASDM) access to the firewall
2. You already have a capture with captured packets: (See here how to create a capture)
If you want to just see the capture in the browser first to make sure there are packets you can do the following:

Command Format:
https://FW_IP/admin/capture/CAP_NAME
Example: 
https://10.55.55.55/admin/capture/jcap

Once you know you have data in your capture you can download the pcap by doing the following:

Command Format:
https://FW_IP/admin/capture/CAP_NAME/pcap
Example:
https://10.55.55.55/admin/capture/jcap/pcap



How to Capture traffic on a Cisco ASA with No Config Changes

Problem: You need to capture traffic between 1.1.1.1 and 2.2.2.2

In previous version of ASA/PIX code (7.2 and below) you had to go into config mode add a bi-directional access-list and then apply the packet capture. As of 7.2.1 you no longer have to do that and it makes creating captures a lot quicker and no configuration changes are made to the firewall since no access-list are created.


Command Format:
capture [CAP_NAME] interface [INT_NAME] match ip host x.x.x.x host x.x.x.x
Example: 
capture jcap interface inside match ip host 1.1.1.1 host 2.2.2.2

And while this rule looks like it would only capture traffic if sources from 1.1.1.1 it is actually automatically bidirectional so will capture traffic if it sources from either address.

To see and manage your captures issue the following command:
show capture - This will list all fo the captures running on the ASA/PIX
show capture [CAP_NAME] - this will show the actually packets captured in the captures

clear capture [CAP_NAME] - this will clear the captures for one capture

no cap [CAP_NAME] - this will completely remove and stop the capture

There are many more options such as ports and protocols you can find those in the reference guide here:

http://www.cisco.com/en/US/docs/security/asa/asa82/command/reference/c1.html#wp2129312

##############################

Here are some more captures I regularly use:

Change the capture to gather whole subnets:
Example: 
capture jcap interface inside match ip 1.1.1.0 255.255.255.0 2.2.2.0 255.255.255.0

If you need to see all the the traffic to and from one address you could make a capture like this:
Example: 
capture jcap interface inside match ip host 1.1.1.1 any

Capture ARP request and replies with the following:
Example: 
capture arpcap interface inside ethernet-type arp





















How to failover the standby ASA from the primary ASA

If for some reason you cant access the standby firewall but need you reload it and only have access to the primary firewall you can easily reboot the standby firewall by issuing the following command via cli:

failover reload-standby



Tuesday, March 6, 2012

How to Configure URL Filtering - Websense on a Cisco ASA



This is the standard configuration I use to bring up websense on the firewall. There are other options available you can check those out in the Cisco Links

url-server (inside) vendor websense host 10.55.55.55 timeout 15 protocol TCP version 4  
url-block url-mempool 1500
url-block url-size 4
url-block block 128

filter url http 10.40.40.0 255.255.255.0 0.0.0.0 0.0.0.0 longurl-truncate allow
filter https 443 10.40.40.0 255.255.255.0 0.0.0.0 0.0.0.0 longurl-truncate allow
filter ftp 21 10.40.40.0 255.255.255.0 0.0.0.0 0.0.0.0 allow

---------------------

Note if you wanted to filter any ip going anywhere for http, https, and ftp use the following:

filter url http 0 0 0 0 longurl-truncate allow

filter https 443 0 0 0 0 longurl-truncate allow
filter ftp 21 0 0 0 0 allow

**Side Note: The Allow command in the filter allows the websense to fail-open, without the allow command it will fail-close if the ASA detects the websense is down it will just start blocking all traffic that needs filtered by websense, since the websense is down.**


Cisco How to Document:
http://www.cisco.com/en/US/products/hw/vpndevc/ps2030/products_configuration_example09186a008088517b.shtml

More options:
I have included the link to the command line reference which can be found here:
http://www.cisco.com/en/US/docs/security/asa/asa82/command/reference/uz.html#wp1625866

Websense How to document, starts on page 9:
http://www.websense.com/content/support/library/web/v71/wws_pdfs/install_cisco.pdf



If you want to check the status if your Websense is up do the following:


CiscoASA#show url-server statistics

Global Statistics:
--------------------
URLs total/allowed/denied         73/33/40
URLs allowed by cache/server      0/4
URLs denied by cache/server       0/15
HTTPSs total/allowed/denied       145/140/5
HTTPSs allowed by cache/server    0/18
HTTPSs denied by cache/server     0/1
FTPs total/allowed/denied         0/0/0
FTPs allowed by cache/server      0/0
FTPs denied by cache/server       0/0
Requests dropped                  0
Server timeouts/retries           0/0
Processed rate average 60s/300s   0/0 requests/second
Denied rate average 60s/300s      0/0 requests/second
Dropped rate average 60s/300s     0/0 requests/second

Server Statistics:
--------------------
10.55.55.55                       UP
  Vendor                          websense
  Port                            15868
  Requests total/allowed/denied   145/140/5
  Server timeouts/retries         0/0
  Responses received              145
  Response time average 60s/300s  0/0

URL Packets Sent and Received Stats:
------------------------------------
Message                 Sent    Received
STATUS_REQUEST          1789    1701
LOOKUP_REQUEST          1456    1566
LOG_REQUEST             0       NA

Errors:
-------
RFC noncompliant GET method     0
URL buffer update failure       0

Friday, December 23, 2011

How to Force a Manual Failover on a Cisco ASA via Command Line



Forcing a manual failover via command line can be done in two different ways.

######################################

On the active firewall you can do the following:


CiscoASA# no failover active

-----------------------------------------------------------------------------

On the standby firewall you can do the following:

CiscoASA# failover active

#######################################


Personally I prefer force the failover from the standby unit.

Wednesday, December 21, 2011

How to Create a Subinterface on a Cisco ASA


If you need to create a subinterface on an ASA  you will need the following information:


1. Identify which interface is going to be used on the firewall
2. Identify which subinterface ID is going to be used. Vaild IDs are 1 through 4294967293
3. Identify which VLAN ID is going to be used, I would recommend using the same VLAN ID as the subinterface ID however only IDs support for VLANS are 1 through 4094
4. (Optional) identify a nameif for the interface
4a If required identify a security level
4b. If required identify IP address and mask.




Here is an example of creating a subinterface ID 990 with vlan 990 and it is also a named interface so access list could be binded to the interface




ASA(config)# interface GigabitEthernet0/1.990
ASA(config-subif)# description Subinterface Vlan 990
ASA(config-subif)#   vlan 990
ASA1(config-subif)#   nameif VLAN990
INFO: Security level for "VLAN990" set to 0 by default.
ASA(config-subif)#   security-level 50
ASA(config-subif)#   ip address 10.10.10.1 255.255.255.0 standby 10.10.10.2
ASA(config-subif)# no shutdown
ASA(config-subif)# exit

Thursday, December 15, 2011

How to compare firewall policies between two IBM Proventia M



If you have to RMA an IBM Proventia M firewall and move the policy from one firewall to another one there is a simple test you can perform to make sure the policy on the new RMA firewall is the same as the old one. Once you have applied the snapshot to the new RMA firewall. Run the following command on both firewalls:

[root@proventiaM root]# cd /etc/crm/policies/cml/NetworkProtector/fwm/
[root@proventiaM fwm]# ls -la
total 92
drwxr-xr-x 2 root root 4096 Aug 8 2009 .
drwxr-xr-x 39 root root 4096 Mar 12 2008 ..
-rw-r--r-- 1 root root 27778 Aug 8 2009 npfwm1_0.xml
-rw-r--r---1 root root 16131 Mar 12 2008 npfwm1_0.xml.bak
-rw-r--r-- 1 root root 4908 May 15 2007 npfwm2_0_0.xml
-rw-r--r-- 1 root root 9335 May 15 2007 npfwm3_0_0.xml
-rw-r--r-- 1 root root 11702 May 15 2007 npfwm4_0_0.xml
-rw-r--r-- 1 root root 8169 May 15 2007 npfwm4_1_0.xml

[root@proventiaM fwm]# md5sum npfwm1_0.xml
06e78c571413e8f78fe0db58a0f070b7 npfwm1_0.xml

or simply:


md5sum /etc/crm/policies/cml/NetworkProtector/fwm/npfwm1_0.xml



This gives you the checksum value of the firewall policy file which is npfwm1_0.xml and is a lot quicker than having to compare the policy line by line especially if you have a large policy.





Wednesday, December 14, 2011

How to tell if a Proventia M is in HA mode via SSH




If you need to check if an ISS / IBM Proventia M is in High Availability mode or which firewall is primary or secondary check the following via ssh:

cat /etc/sysconfig/ham

The output will be, no such file, primary, or secondary.


[root@proventiaM root]# cat /etc/sysconfig/ham
cat: /etc/sysconfig/ham: No such file or directory <-------- Means NOT part of an HA cluster


[root@proventiaM root]# cat /etc/sysconfig/ham
HAOASTATE=primary <-------------Means this devices is currently the primary firewall in cluster


[root@proventiaM root]# cat /etc/sysconfig/ham
HAOASTATE=secondary <-------------Means this devices is currently the secondary firewall in cluster

Tuesday, December 13, 2011

Cisco ASA Renaming Access List

Save yourself some time and rename your access-list instead of having to recreate them all!

On Cisco ASA version 8.0(2) and above you can rename an access-list:

access-list OLD_NAME rename NEW_NAME



Wednesday, November 16, 2011

Display VPN preshared key on a Cisco Pix 6.3

Displaying the preshared key for vpn site to site tunnels on Pix 6.3 devices, I always thought was impossible until I came across this:


Basically you can get the PSK via the http service on the firewall.

You will need to do the following:
1. Enable the http server
2. Allow access to the firewall via the http service
3. Use your browser to get the PSK

Here is the command line (CLI) Code:

conf t
http server enable
http 10.10.10.10 255.255.255.255 inside

Then connect to https://FW_IP/config

This will only work if the name inside is the name of the interface that we connect to this can be changed if needed.

Also you must use a NON pix username account.

If you need to create one use this command:

username NEW_USER password PASSWORD_FOR_USER priv 15

Let me know if you have any questions.