Saturday, September 5, 2020

Enabling coredump on a Cisco ASA Firewall

Here's a nice link in configuring a coredump in a Cisco ASA Firewall. This feature takes a snapshot of the ASA memory when a system crash occur, which can give useful information to Cisco TAC engineer in their troubleshooting.

 

LAB-ASA5515x# show coredump filesystem  

 

'disk0:' has no coredump filesystem

LAB-ASA5515x# conf t

LAB-ASA5515x(config)# coredump ?    

 

configure mode commands/options:

  enable  Enable coredump generation to filesystem

LAB-ASA5515x(config)# coredump enable

 

WARNING: Enabling coredump on an ASA5515 platform will delay the reload of

the system by up to 30 minutes in the event of software forced reload.

The exact time depends on the size of the coredump generated.

 

Proceed with coredump filesystem allocation of 1000 MB

on 'disk0:' (Note this may take a while) ? [confirm]

filesys_image created ok: disk0:coredumpfsysimage.bin

 

Making coredump file system image!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

 

<OUTPUT TRUNCATED>


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Coredump file system image created & mounted successfully

 

/dev/loop0 on /mnt/disk0/coredumpfsys type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)

 

 

LAB-ASA5515x(config)# dir

 

Directory of disk0:/

 

95     -rwx  111550464    06:02:40 Oct 15 2019  asa984-10-smp-k8.bin

96     -rwx  33696792     06:04:16 Oct 15 2019  asdm-7122.bin

11     drwx  4096         06:08:18 Oct 15 2019  log

22     drwx  4096         06:08:58 Oct 15 2019  crypto_archive

25     drwx  4096         06:09:04 Oct 15 2019  coredumpinfo

98     -rwx  4799         05:14:28 Oct 26 2019  oldconfig_2019Oct26_0514.cfg

23     drwx  4096         05:25:12 Nov 24 2019  snmp

104    -rwx  72771616     04:22:02 May 20 2020  anyconnect-win-4.8.03052-webdeploy-k9.pkg

105    -rwx  111624192    04:22:42 May 20 2020  asa984-20-smp-k8.bin

110    -rwx  1048576000   03:28:09 Jul 29 2020  coredumpfsysimage.bin

1      drwx  16384        03:27:39 Jul 29 2020  coredumpfsys

 

6 file(s) total size: 1378223863 bytes

7994437632 bytes total (6615339008 bytes free/82% free)

 

 

LAB-ASA5515x(config)# no coredump enable

LAB-ASA5515x(config)# dir

 

Directory of disk0:/

 

95     -rwx  111550464    06:02:40 Oct 15 2019  asa984-10-smp-k8.bin

96     -rwx  33696792     06:04:16 Oct 15 2019  asdm-7122.bin

11     drwx  4096         06:08:18 Oct 15 2019  log

22     drwx  4096         06:08:58 Oct 15 2019  crypto_archive

25     drwx  4096         06:09:04 Oct 15 2019  coredumpinfo

98     -rwx  4799         05:14:28 Oct 26 2019  oldconfig_2019Oct26_0514.cfg

23     drwx  4096         05:25:12 Nov 24 2019  snmp

104    -rwx  72771616     04:22:02 May 20 2020  anyconnect-win-4.8.03052-webdeploy-k9.pkg

105    -rwx  111624192    04:22:42 May 20 2020  asa984-20-smp-k8.bin

110    -rwx  1048576000   03:28:09 Jul 29 2020  coredumpfsysimage.bin

1      drwx  16384        03:27:39 Jul 29 2020  coredumpfsys

 

6 file(s) total size: 1378223863 bytes

7994437632 bytes total (6615339008 bytes free/82% free)

 

LAB-ASA5515x(config)# delete disk0:/coredumpfsysimage.bin

 

Delete filename [coredumpfsysimage.bin]?

 

Delete disk0:/coredumpfsysimage.bin? [confirm]

 

LAB-ASA5515x(config)# delete disk0:/coredumpfsys        

 

Delete filename [coredumpfsys]?

 

Delete disk0:/coredumpfsys? [confirm]

 

 

%Error deleting disk0:/coredumpfsys (Device or resource busy)

LAB-ASA5515x(config)# delete ?

 

exec mode commands/options:

  /noconfirm  Do not prompt for confirmation

  /recursive  Recursive delete

  /replicate  Execute delete operation on standby unit as well

  disk0:      File to be deleted

  disk1:      File to be deleted

  flash:      File to be deleted

LAB-ASA5515x(config)# delete /recursive ?

 

exec mode commands/options:

  /noconfirm  Do not prompt for confirmation

  /replicate  Execute delete operation on standby unit as well

  disk0:      File to be deleted

  disk1:      File to be deleted

  flash:      File to be deleted

LAB-ASA5515x(config)# delete /recursive disk0:/coredumpfsys

 

Delete filename [coredumpfsys]?

 

Examine files in directory disk0:/coredumpfsys? [confirm]

 

Delete disk0:/coredumpfsys? [confirm]

 

%Error Removing dir disk0:/coredumpfsys (Device or resource busy)

 

 

LAB-ASA5515x(config)# rmdir coredumpfsys

 

Remove directory filename [coredumpfsys]?

 

Delete disk0:/coredumpfsys? [confirm]

 

%Error Removing dir disk0:/coredumpfsys (Device or resource busy)


Friday, August 14, 2020

Configuration Backup and Restore in a Cisco ASA Firewall

There's an easy way to backup and restore the configuration file in a Cisco ASA Firewall using ASDM.

To backup the ASA config, go to Tools > Backup Configurations.

Click Browse Local > select a folder/directory on local PC > type a file name.

 

Unselect Backup All > select Running-configuration > click Backup.

Click Close when finished.

 

The backup is a zip/compressed file.

 

I tried to opened running-config.cfg with Notepad.

 

I tried to change the hostname and saved the config.

 

LAB-ASA5515x# configure terminal

LAB-ASA5515x(config)# hostname TEST-ASA5515x

TEST-ASA5515x(config)# write memory

Building configuration...

Cryptochecksum: 749bb846 da22d270 e721ff08 18564731

 

5995 bytes copied in 0.760 secs

[OK]

 

 

In order to restore or revert back the ASA config, go to Tools > Restore Configurations

 

 

Click Browse Local > select the backup zip file created earlier > click Next.

 

Select Running configuration > Restore.

 

I'm not running ASA failover (HA). Click Yes to Continue.

 

Click Replace.


 

I re-login to ASDM and notice the hostname was reverted back to LAB-ASA5515x.

 

The ASA restore feature doesn't need a device reboot. Notice the Device Uptime didn't reset.

 

 

Friday, July 3, 2020

Cisco ASA Firewall Verify Command

I had an incident wherein an image was successfully transferred to a Cisco device but the file size was slightly different. You can use the ASA verify command in order to check the integrity of an image file and ensure it wasn't corrupted during the file transfer.


To view the ASA MD5 or SHA-512 hash published in Cisco's website, just hover on the file name (a hyperlink) > click on the clipboard icon. Below is the complete SHA-512 hash which should be the same output with the verify command.

8b77f39037e74bbcd396d78faf4f337c998bd7a8143ed599a48194597ffb064b70f2fb068be757109d80f2b3dcbc53ce9e2a944328ac95e8a4af9f4aa3e98e64

ciscoasa# dir

Directory of disk0:/

<SNIP>

159    -rwx  111919104    14:54:42 Jun 13 2019  asa992-52-smp-k8.bin

14 file(s) total size: 676519403 bytes
8238202880 bytes total (4337901568 bytes free/52% free)


The ASA verify command will perform a SHA-512 hash calculation by default.

ciscoasa# verify ?

  /md5      Compute an MD5 signature for a file
  /sha-512  Compute a SHA-512 signature for a file
  disk0:    File to be verified
  disk1:    File to be verified
  flash:    File to be verified

ciscoasa# verify disk0:/asa992-52-smp-k8.bin
Verifying file integrity of disk0:/asa992-52-smp-k8.bin
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Done!
Embedded Hash SHA-512: 5c5c0b42f5d6dc467aee47df48fdc21ab64a47be2e8098c6579b0287094feed3d609849b423f1748432f5a0173934f395bd741fbd2a1464cc796e482b91300c9
Computed Hash SHA-512: 5c5c0b42f5d6dc467aee47df48fdc21ab64a47be2e8098c6579b0287094feed3d609849b423f1748432f5a0173934f395bd741fbd2a1464cc796e482b91300c9
CCO Hash      SHA-512:
8b77f39037e74bbcd396d78faf4f337c998bd7a8143ed599a48194597ffb064b70f2fb068be757109d80f2b3dcbc53ce9e2a944328ac95e8a4af9f4aa3e98e64
Signature Verified

Sunday, June 21, 2020

Clear Cisco ASA AnyConnect and Site-to-Site VPN Sessions Counters

You can monitor and clear the VPN session counters or statistics in a Cisco ASA Firewall using: show vpn-sessiondb summary and clear vpn-sessiondb statistics global commands, respectively.


ciscoasa# show vpn-sessiondb summary                
---------------------------------------------------------------------------
VPN Session Summary
---------------------------------------------------------------------------
                               Active : Cumulative : Peak Concur : Inactive
                             ----------------------------------------------
AnyConnect Client            :      0 :        660 :           2 :        0
  SSL/TLS/DTLS               :      0 :        660 :           2 :        0
IKEv1 IPsec/L2TP IPsec       :      0 :        206 :           5
Site-to-Site VPN             :      7 :      50169 :          11
  IKEv1 IPsec                :      7 :      50169 :          11
---------------------------------------------------------------------------
Total Active and Inactive    :      7             Total Cumulative :  51035
Device Total VPN Capacity    :    250
Device Load                  :     3%
---------------------------------------------------------------------------


ciscoasa# clear vpn-sessiondb statistics global
INFO: Global session data cleared

ciscoasa# show vpn-sessiondb summary            

 No sessions to display.

Statistics have been cleared 1 time(s) since reboot


Friday, May 22, 2020

File Transfer Between Local PC and Cisco ASA Flash via ASDM

Aside from FTP, TFTP and SCP file transfers, there's an alternative way of transferring ASA files (OS, ASDM, AnyConnect images, etc.) to the Cisco ASA flash memory (disk0:) via ASDM. The file transfer is slow compared to an FTP but it gets the job done. You can transfer files from your local PC to the ASA flash via ASDM by going to Tools > File Management.


Select File Transfer > Between Local PC and Flash.


Select a file > select disk0: (ASA flash) > click the right arrow.




As best practice, validate the ASA image file using either the MD5 or SHA-512 hash file validation command to ensure the file wasn't compromised. You can compare the output from Cisco's download page.

ciscoasa# verify /md5 disk0:/asa9xyz-smp-k8.bin

<OUTPUT TRUNCATED>

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Done!
verify /MD5 (disk0:/asa9xyz-smp-k8.bin) = b6d183a5e0b273b5fd40fd8a3ac76bed

Saturday, April 4, 2020

Cisco ASA Firewall clear xlate Command

When you change the route and NAT policy on the ASA firewall, you'll sometimes need to forcefully clear the NAT table using the clear xlate command. This will re-establish the connection on the remote firewall or a VPN device where the remote admin is unavailable or doesn't want to reboot or clear their device.

ciscoasa# show conn | inc 192.168.26.2  
<BLANK>

ciscoasa# clear xlate ?  

  debug      Enter this keyword for debug information
  detail     Enter this keyword for detailed information
  global     Enter this keyword to specify global ip range
  gport      Enter this keyword to specify global port(s)
  interface  Enter this keyword to specify an interface
  local      Enter this keyword to specify local ip range
  lport      Enter this keyword to specify local port(s)
  state      Enter this keyword to specify state
  <cr>

ciscoasa# clear xlate global 200.11.10.5 local 192.168.26.2

ciscoasa# show conn | inc 192.168.26.2
TCP outside 123.21.13.11:50810 CUSTOMER 192.168.26.2:445, idle 0:00:04, bytes 0, flags SaAB
TCP outside 185.176.2.10:40872 CUSTOMER 192.168.26.2:33392, idle 0:00:05, bytes 0, flags SaAB
TCP outside 185.176.2.2:59627 CUSTOMER 192.168.26.2:3375, idle 0:00:22, bytes 0, flags SaAB
UDP outside 128.223.5.10:61677 CUSTOMER 192.168.26.2:33523, idle 0:01:19, bytes 0, flags -

<OUTPUT TRUNCATED>

Sunday, March 1, 2020

Cisco ASA 5500 Firewall Password Recovery

Here's a good link in performing a password recovery on a Cisco ASA 5500 first generation firewall . I performed a password recover on a Cisco ASA 5510 firewall below:

Evaluating BIOS Options ...
Launch BIOS Extension to setup ROMMON

Cisco Systems ROMMON Version (1.0(11)2) #0: Thu Jan 26 10:43:08 PST 2006

Platform ASA5510

Use BREAK or ESC to interrupt boot.
Use SPACE to begin boot immediately.
Boot interrupted.                              

Management0/0
Ethernet auto negotiation timed out.
Interface-4 Link Not Established (check cable).


Default Interface number-4 Not Up


Use ? for help.
rommon #0> confreg

Current Configuration Register: 0x00000041
Configuration Summary:
  boot default image from Flash
  ignore system configuration


Do you wish to change this configuration? y/n [n]: y
enable boot to ROMMON prompt? y/n [n]:
enable TFTP netboot? y/n [n]:
enable Flash boot? y/n [n]:
select specific Flash image index? y/n [n]:
disable system configuration? y/n [n]: y
go to ROMMON prompt if netboot fails? y/n [n]:
enable passing NVRAM file specs in auto-boot mode? y/n [n]:
disable display of BREAK or ESC key prompt during auto-boot? y/n [n]:

Current Configuration Register: 0x00000040
Configuration Summary:
  boot ROMMON
  ignore system configuration

Update Config Register (0x40) in NVRAM...

rommon #1> boot
Launching BootLoader...
Boot configuration file contains 2 entries.


Loading disk0:/asa917-9-k8.bin...


<OUTPUT TRUNCATED>


                Restricted Rights Legend

Use, duplication, or disclosure by the Government is
subject to restrictions as set forth in subparagraph
(c) of the Commercial Computer Software - Restricted
Rights clause at FAR sec. 52.227-19 and subparagraph
(c) (1) (ii) of the Rights in Technical Data and Computer
Software clause at DFARS sec. 252.227-7013.

                Cisco Systems, Inc.
                170 West Tasman Drive
                San Jose, California 95134-1706

Ignoring startup configuration as instructed by configuration register.

INFO: Power-On Self-Test in process.
...........................................................
INFO: Power-On Self-Test complete.

INFO: MIGRATION - Saving the startup errors to file 'flash:upgrade_startup_errors_201910220639.log'
Type help or '?' for a list of available commands.
ciscoasa> enable
Password:
ciscoasa# configure terminal
ciscoasa(config)#

***************************** NOTICE *****************************

Help to improve the ASA platform by enabling anonymous reporting,
which allows Cisco to securely receive minimal error and health
information from the device. To learn more about this feature,

Would you like to enable anonymous error reporting to help improve
the product? [Y]es, [N]o, [A]sk later:
ciscoasa(config)# write erase
Erase configuration in flash memory? [confirm]
[OK]
ciscoasa(config)# no config-register
ciscoasa(config)# write memory
Building configuration...
Cryptochecksum: 5c9a33a9 3f5cb4cd 26554b4a efd76652

2225 bytes copied in 3.300 secs (741 bytes/sec)
[OK]

ciscoasa(config)# reload
Proceed with reload? [confirm]
ciscoasa(config)#


***
*** --- START GRACEFUL SHUTDOWN ---
Shutting down isakmp
Shutting down License Controller
Shutting down File system


***
*** --- SHUTDOWN NOW ---
Process shutdown finished


<OUTPUT TRUNCATED>


Evaluating BIOS Options ...
Launch BIOS Extension to setup ROMMON

Cisco Systems ROMMON Version (1.0(11)2) #0: Thu Jan 26 10:43:08 PST 2006

Platform ASA5510

Use BREAK or ESC to interrupt boot.
Use SPACE to begin boot immediately.
                                               
Launching BootLoader...
Default configuration file contains 1 entry.

Searching / for images to boot.

Loading /asa912-k8.bin... Booting...


<OUTPUT TRUNCATED>


                Restricted Rights Legend

Use, duplication, or disclosure by the Government is
subject to restrictions as set forth in subparagraph
(c) of the Commercial Computer Software - Restricted
Rights clause at FAR sec. 52.227-19 and subparagraph
(c) (1) (ii) of the Rights in Technical Data and Computer
Software clause at DFARS sec. 252.227-7013.

                Cisco Systems, Inc.
                170 West Tasman Drive
                San Jose, California 95134-1706

Reading from flash...
!
Configuration Compatibility Warning:
 The version 9.1(7)9 configuration may contain syntax that is
 not backward compatible with the 9.1(2) image that is loaded.

*** Output from config line 7, "ASA Version 9.1(7)9 "

ssh stricthostkeycheck
     ^
ERROR: % Invalid Hostname
*** Output from config line 65, "ssh stricthostkeycheck"
.
Cryptochecksum (unchanged): 5c9a33a9 3f5cb4cd 26554b4a efd76652

INFO: Power-On Self-Test in process.
...........................................................
INFO: Power-On Self-Test complete.
Type help or '?' for a list of available commands.
ciscoasa> enable
Password: <HIT ENTER>
ciscoasa# show version

Cisco Adaptive Security Appliance Software Version 9.1(2)
Device Manager Version 7.1(1)52

Compiled on Thu 09-May-13 15:37 by builders
System image file is "disk0:/asa912-k8.bin"
Config file at boot was "startup-config"

ciscoasa up 1 min 4 secs

Hardware:   ASA5510, 1024 MB RAM, CPU Pentium 4 Celeron 1600 MHz,
Internal ATA Compact Flash, 256MB
BIOS Flash M50FW080 @ 0xfff00000, 1024KB

Encryption hardware device : Cisco ASA-55xx on-board accelerator (revision 0x0)
                             Boot microcode        : CN1000-MC-BOOT-2.00
                             SSL/IKE microcode     : CNLite-MC-SSLm-PLUS-2_05
                             IPSec microcode       : CNlite-MC-IPSECm-MAIN-2.08
                             Number of accelerators: 1

 0: Ext: Ethernet0/0         : address is 001e.13f0.3168, irq 9
 1: Ext: Ethernet0/1         : address is 001e.13f0.3169, irq 9
 2: Ext: Ethernet0/2         : address is 001e.13f0.316a, irq 9
 3: Ext: Ethernet0/3         : address is 001e.13f0.316b, irq 9
 4: Ext: Management0/0       : address is 001e.13f0.316c, irq 11
 5: Int: Not used            : irq 11
 6: Int: Not used            : irq 5

Licensed features for this platform:
Maximum Physical Interfaces       : Unlimited      perpetual
Maximum VLANs                     : 100            perpetual
Inside Hosts                      : Unlimited      perpetual
Failover                          : Active/Active  perpetual
Encryption-DES                    : Enabled        perpetual
Encryption-3DES-AES               : Enabled        perpetual
Security Contexts                 : 2              perpetual
GTP/GPRS                          : Disabled       perpetual
AnyConnect Premium Peers          : 2              perpetual
AnyConnect Essentials             : Disabled       perpetual
Other VPN Peers                   : 250            perpetual
Total VPN Peers                   : 250            perpetual
Shared License                    : Disabled       perpetual
AnyConnect for Mobile             : Disabled       perpetual
AnyConnect for Cisco VPN Phone    : Disabled       perpetual
Advanced Endpoint Assessment      : Disabled       perpetual
UC Phone Proxy Sessions           : 2              perpetual
Total UC Proxy Sessions           : 2              perpetual
Botnet Traffic Filter             : Disabled       perpetual
Intercompany Media Engine         : Disabled       perpetual
Cluster                           : Disabled       perpetual

This platform has an ASA 5510 Security Plus license.

Serial Number: JMX12021234
Running Permanent Activation Key: 0xfe3bfc5c 0x0cd4fce4 0x10e2f59c 0x90b03123 0xc2112456
Configuration register is 0x1
Configuration has not been modified since last system restart.

ciscoasa# sh run
: Saved
:
ASA Version 9.1(2)
!
hostname ciscoasa
enable password 8Ry2YjIyt7RRXU24 encrypted
names
!
interface Ethernet0/0
 shutdown
 no nameif
 no security-level
 no ip address
!
interface Ethernet0/1
 shutdown
 no nameif
 no security-level
 no ip address
!
interface Ethernet0/2
 shutdown
 no nameif
 no security-level
 no ip address
!            
interface Ethernet0/3
 shutdown
 no nameif
 no security-level
 no ip address
!
interface Management0/0
 shutdown
 no nameif
 no security-level
 no ip address
!
ftp mode passive
pager lines 24
no failover
icmp unreachable rate-limit 1 burst-size 1
no asdm history enable
arp timeout 14400
no arp permit-nonconnected
timeout xlate 3:00:00
timeout pat-xlate 0:00:30
timeout conn 1:00:00 half-closed 0:10:00 udp 0:02:00 icmp 0:00:02
timeout sunrpc 0:10:00 h323 0:05:00 h225 1:00:00 mgcp 0:05:00 mgcp-pat 0:05:00
timeout sip 0:30:00 sip_media 0:02:00 sip-invite 0:03:00 sip-disconnect 0:02:00
timeout sip-provisional-media 0:02:00 uauth 0:05:00 absolute
timeout tcp-proxy-reassembly 0:01:00
timeout floating-conn 0:00:00
dynamic-access-policy-record DfltAccessPolicy
user-identity default-domain LOCAL
no snmp-server location
no snmp-server contact
crypto ipsec security-association pmtu-aging infinite
crypto ca trustpool policy
telnet timeout 5
ssh timeout 5
ssh key-exchange group dh-group1-sha1
console timeout 0
threat-detection basic-threat
threat-detection statistics access-list
no threat-detection statistics tcp-intercept
!
!
prompt hostname context
call-home reporting anonymous prompt 2
call-home
 profile CiscoTAC-1
  no active
  destination address http https://tools.cisco.com/its/service/oddce/services/DDCEService
  destination address email callhome@cisco.com
  destination transport-method http
  subscribe-to-alert-group diagnostic
  subscribe-to-alert-group environment
  subscribe-to-alert-group inventory periodic monthly
  subscribe-to-alert-group configuration periodic monthly
  subscribe-to-alert-group telemetry periodic daily
Cryptochecksum:5c9a33a93f5cb4cd26554b4aefd76652
: end