Skip to main content

Auditing Cisco configuration - CIS RAT

CIS RAT (Centre for Internet Security - Router Assessment Tool) is a free Perl tool that audits Cisco config files against CIS benchmarks, it creates an HTML report and shows where your config meets or fails CIS benchmark. We can audit against benchmark level 1 and 2.The tool is supported on both Linux and Windows (though getting it to work on Windows required a bit of source code tweaking). 


RAT can audit configuration of the following devices:
  • IOS
  • ASA
  • PIX
  • FWSM
RAT can be downloaded here: 

Installation on Windows requires ActiveState Perl to be installed. Detailed installation instruction can be found in "rat\etc\install.win32.txt" upon extraction. 


Upon installing RAT I had to edit "rat.pl" and change the following (this shouldn't be required so it may work in your case)

  • line 669: to point to the correct directory
    • use lib 'c:\rat\lib';.
  • lines 746 & 747: again hard coding the paths
    • $ncat_prog        = $PROG_PREFIX . '\bin\ncat.pl';
    • $ncat_report_prog = $PROG_PREFIX . '\bin\ncat_report.pl'

RAT allows us to customize set of "checks" we want to perform. This step is not required if you want to audit against actual CIS benchmark, in most cases however, we will want to edit it to align it with our Security Policy. 

Run "ncat_config.pl":

"C:\rat\bin>perl ncat_config.pl -s customorules.conf"

The script will ask a number of questions and allow you to customize set of checks it'll perform. It'll then save "customrules.conf". For example if you have a separate management network (for VTY access or SNMP) that you already protect with ACLs you may not want to apply additional local ACLs, which is required by the "default" CIS benchmark. Another example is exec timeout. CIS requires that the timeout is set to 10 while your security policy may require 5.  

Running RAT:

By default RAT uses rule set for IOS devices, so we don't need to specify -t. 

c:\>perl rat.pl  -r customrules.conf "c:\confs\10.10.10.10.txt"



To audit PIX, ASA, FWSM we need to use option "-t" to specify config type:


c:\>perl rat.pl -t cisco-firewall -r customrules.conf "c:\confs\ 10.10.10.100.txt"


I have run into issue where RAT will fail with the following error:


"Nested quantifiers in regex; marked by <-- HERE in m/IOSSNMPCommunity->** <-- "


This happens when "snmp-server community" option is set to asterisks. That would be the case if you copy the IOS config file from CiscoWorks.  Just delete the asterisks and re-run the script. 

Comments

Popular posts from this blog

x.509 Certificates - Critical vs non-critical extensions

Extensions are used to associate additional information with the user or the key.  Each certificate extension has three attributes - extnID, critical, extnValue extnID - Extension ID - an OID that specifies the format and definitions of the extension critical - Critical flag - Boolean value extnValue - Extension value  Criticality flag specifies whether the information in an extension is important. If an application doesn't recognize the extension marked as critical, the certificate cannot be accepted. If an extension is not marked as critical (critical value False) it can be ignored by an application. In Windows, critical extensions are marked with a yellow exclamation mark,  View certificate extensions using OpenSSL: # openssl x509 -inform pem -in cert.pem -text -noout (output abbreviated)         X509v3 extensions:             X509v3 Key Usage: critical                 Digital Signature, Key Encipherment             X509v3 Subject Key Identifier

Count number of lines - 'findstr'

How do I count number of lines in a command output? findstr /r/n "^" | find /c ":" Above commands will display number of lines output by whatever command (well, nearly whatever) you specify in the front.  For example:  C:\>ping localhost | findstr /r/n "^" | find /c ":" FINDSTR: // ignored 12 This comes handy if you want to find out how many OUs you have in Active Directory: dsquery ou  -limit 0 | findstr /r/n "^" | find /c ":" How many user accounts there are: dsquery user -limit 0 | findstr /r/n "^" | find /c ":" Computers: dsquery computer -limit | findstr /r/n "^" | find /c ":"

Cisco ASA Certificate Revocation Checking

ASA supports status verification using CRLs and OCSP. CRL can be retrieved using HTTP, LDAP or SCEP. Revocation checking using CRL: Over HTTP: ciscoasa(config)# crypto ca trustpoint ASDM_TrustPoint2 ciscoasa(config-ca-trustpoint)# revocation-check crl ciscoasa(config-ca-crl)# protocol http By default ASA will use address listed in CDP extension of the certificate that is being validated.  To override default behaviour we need to add the following in the CRL configuration context. ciscoasa(config-ca-crl)# policy static ciscoasa(config-ca-crl)# url 1 http://cdpurl.kp.local/crl.crl Over LDAP: Certificate I'm using for this lab, doesn't have LDAP address in its CDP extension. Therefore I'm using "policy static"  to specify LDAP URL where CRL can be retrieved.  ciscoasa(config)# crypto ca trustpoint ASDM_TrustPoint2 ciscoasa(config-ca-trustpoint)# revocation-check crl ciscoasa(config-ca-trustpoint)# crl configure ciscoasa