Category: Firewalls & Network Security

Cisco ASA, Fortinet, Juniper SRX and other firewalls, NAT, high availability, ISE and NAC, IPS and secure device configuration.

  • ISE (Identity Services Engine) Basic Configuration and Commands

    Cisco Switch Dot1x Config:

    Configuring Global AAA Parameters:

    conf t
    username admin privilege 15 secret Cisco123
    aaa new-model
    aaa authentication login default local
    aaa authentication dot1x default group radius
    aaa authorization network default group radius
    aaa accounting dot1x default start-stop group radius

    radius server Our-ISE
    address ipv4 192.168.1.105 auth-port 1812 acct-port 1813
    key Cisco123
    automate-tester username testuser
    exit

    aaa group server radius Our-Group
    server name Our-ISE
    exit

    radius-server dead-criteria time 3 tries 3
    radius-server deadtime 15
    aaa server radius dynamic-author
    client 192.168.1.222
    server-key Cisco123
    exit

    ip radius source-interface gig 0/1
    radius-server vsa send authentication
    radius-server vsa send accounting

    dot1x system-auth-control
    ip adevice tracking
    end

    wr

    Switch Port Configuration:

    conf t
    vlan 10,20,30,80,999

    int range fa 0/1-8
    switchport host
    switchport access vlan 999
    authentication priority dot1x mab
    authentication order dot1x mab
    authentication event fail action next-method
    authentication event server dead action authorise vlan 10
    authentication event server alive action reinitialize
    authentication host-mode multi-domain
    authentication violation restrict
    mab
    dot1x pae authenticator
    dot1x timeout tx-period 5
    authentication port-control auto
    end

    wr

    Verification and Troubleshooting:
    show int status (to check vlans the interfaces are)
    show vlan brief (to see if the vlan now exists and an authenticated port it assigned to it)
    show authentication sessions
    show authentication sessions int fa 0/1 (MAC/IP/user/status/DACL/success/failure)

    ISE:
    Operations>RADIUS>Live Logs>Magnifying glass (detail) (shows the matching 5200 successful policy set/Authentication policy/Authorization policy)(Shows Switch/NAS IP and the switch port number)

  • Upload ASA software image without ASDM (CLI)(Using SCP)

    (use pscp for windows)
    https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

    ASA:

    ssh scopy enable

    PC:
    pscp C:\Users\fali\Desktop\asa964-17-lfbff-k8.SPA

    ABCCorp@196.29.167.170:disk0:asa964-17-lfbff-k8.SPA

    (use pscp -1 …… for version 1)

    ASA: 

    no boot system disk0:/asa952-6-lfbff-k8.SPA
    boot system disk0:/asa964-17-lfbff-k8.SPA
    boot system disk0:/asa952-6-lfbff-k8.SPA
    wr mem
    reload in 8:00

  • Script to create objects from a text file and add it to an object-group

    New mgmt_cli method:
    #mgmt_cli add network –batch IPs-ListFile.csv -r true

    Excel sheet file format with column headings:
    name,subnet,subnet-mask

    Old DBEdit Method:
    foreach($ip in Get-Content ip1.txt){
    Write-Host “create host_plain BlkIP_$ip”
    Write-Host “modify network_objects BlkIP_$ip ipaddr $ip”
    Write-Host “addelement network_objects Blocked_IP1 ” network_objects:BlkIP_$ip”
    Write-Host “update network_objects Blocked_IP1”
    }

  • Example NAT Rules (Important)

    (Note: NAT rules are looked at, but not implemented until after the security policy run)

    PAT (Inside to Outside): Many-to-One, Hide NAT, Source NAT:
    NAT Rule:
    Sourcezone: Inside | SourceIP: PrivateIP/InsideSubnet | DestinationZone: Outside | DestinationIP: Any | DestinationInterface: OutsideInterface |
    SourceAddressTranslation:(TranslateType: DynamicIP&Port | AddressType: Interface | Interface: OutsideInterface | IP: PublicIP)
    Security Policy: 
    Sourcezone: Inside | SourceIP: PrivateIP/InsideSubnet | DestinationZone: Outside | DestinationIP: Any | Service: http

    Many-to-Many NAT

    A variation on the simple hide NAT policy, is to add more source addresses if more are available. If, for example, your ISP provided a public subnet of /29 or larger, you have additional IP addresses that can be used for all sorts of things. If your internal network is quite large, these additional addresses may be needed to prevent oversubscription of the NAT pool.

    For this configuration the Address Type is changed from ‘Interface’ to ‘translated Address.’ Then the available IP addresses are added either as an IP range, or an IP subnet:

    2016-09-28_16-15-33.png

    The firewall will select an IP from the available pool based on a hash of the source IP address. This source address will remain the same for all sessions from that source IP. The source port will still be randomized.

    If the source ports need to remain the same (some applications may require a specific source port) the Translation Type can be set to Dynamic IP, which will preserve the client’s source port per session. The translated address is assigned by ‘next available’ which means there are some caveats:

    • No more than 32.000 consecutive IP addresses are supported
    • The translated addresses pool needs to be of the same size or greater than your internal number of hosts, as each internal host is assigned its own translated address

    If the above criteria are usually met but could sometimes be broken, a backup can be set to fail back to Dynamic IP and Port. Both the Translated Address and the Interface Address options are available, the default is none:

    2016-09-28_16-46-49.png

    Source NAT (DMZ server) (Perspective of the Server): (Bi-directional)
    NAT Rule:
    Sourcezone: DMZ | SourceIP: PrivateIP | DestinationZone: outside | DestinationIP: Any | DestinationInterface: OutsideInterface |
    SourceAddressTranslation:(TranslateType: Static | TranslatedAddress: PublicIP (Bi-directional))
    Security Policy:
    (Remains the same i.e. PostNATZones and PreNATAddreses)
    Sourcezone: Outside | SourceIP: Any | DestinationZone: DMZ | DestinationIP: PublicIP | Service: http

    Destination NAT (DMZ Server) (Perspective of the Client): Destination NAT Example—One-to-One Mapping:(Uni-Directional: Allows PAT)
    NAT Rule:
    Sourcezone: Outside | SourceIP: Any | DestinationZone: Outside | DestinationIP: PublicIP | DestinationInterface: OutsideInterface |
    DestinationAddressTranslation:(TranslatedAddress: PrivateIP)
    Security Policy:
    (Remains the same i.e. PostNATZones and PreNATAddreses)
    Sourcezone: Outside | SourceIP: Any | DestinationZone: DMZ | DestinationIP: PublicIP | Service: http

    Destination NAT with Port Translation Example:

    Destination NAT Example—One-to-Many Mapping:

    Source and Destination NAT Example:

    In some scenarios it may be required to perform source and destination NAT at the same time. One common example is a U-Turn situation, where internal hosts need to connect to an internal server, that is on the same network as the client, on it’s public IP address.

    To be able to reach internal resources on a public IP, a new NAT policy needs to be created to accomodate trust to untrust translation.

    If source translation is not included in this policy, the server will receive packets with the original source address, causing the server to send reply packets directly to the client.

    This creates an asymmetric loop: client-firewall-server-client and the firewall session will be terminated as it violates TCP sanity checks.

    The solution is to add source translation to, for example, the firewall IP, so the server’s reply packets are sent to the firewall, allowing for ‘stateful’ sessions.

    2016-09-29_17-13-56.png

    In this example, NAT rules translate both the source and destination IP address of packets between the clients and the server.

    Source NAT—The source addresses in the packets from the clients in the Trust-L3 zone to the server in the Untrust-L3 zone are translated from the private addresses in the network 192.168.1.0/24 to the IP address of the egress interface on the firewall (10.16.1.103). Dynamic IP and Port translation causes the port numbers to be translated also.

    Destination NAT—The destination addresses in the packets from the clients to the server are translated from the server’s public address (80.80.80.80) to the server’s private address (10.2.133.15).

    source_dest_nat_example.png

    The following address objects are created for destination NAT.
    • Server-Pre-NAT: 80.80.80.80
    • Server-post-NAT: 10.2.133.15
    The following screen shots illustrate how to configure the source and destination NAT policies for the example.
    source_dest_nat_ss_original.png
    source_dest_nat_ss_translated.png
    To verify the translations, use the CLI command show session all filter destination 80.80.80.80. A client address 192.168.1.11 and its port number are translated to 10.16.1.103 and a port number. The destination address 80.80.80.80 is translated to 10.2.133.15.

     

  • ASA not allowing ping to distant or far interface IP

    When i try to ping from inside lan to firewall DMZ interface IP it is not pingable and but from inside users i am able to ping firewall inside interface IP address.
    e.g:
    I have following scenario where i am trying to ping from 10.30.1.100 PC to ASA interface 10.20.1.1 not pinging but i can ping 10.20.1.100 so why ASA not allowing to ping distant interfaces?

    Solution:
    You cannot ping the far interfaces by design. There is nothing you can do to change that behavior, this is done as a security measure by the ASA ( Built-in feature).

    The adaptive security appliance only responds to ICMP traffic sent to the interface that traffic comes in on; you cannot send ICMP traffic through an interface to a far interface.
    https://www.cisco.com/c/en/us/td/docs/security/asa/asa82/command/reference/cmd_ref/i1.html#wp1697623

    “For security purposes the security appliance does  not support far-end interface ping, that is pinging the IP address of  the outside interface from the inside network.”

    https://www.cisco.com/c/en/us/td/docs/security/asa/asa72/configuration/guide/conf_gd/trouble.pdf

     

  • Syslog (Cisco ASA)

    Syslog Packet:

    The syslog packet size is limited to 1024 bytes and carries the following information:

     

    Facility

    Severity

    Hostname

    Timestamp

    Message

    —

    Syslog Port numbers:

    When sending messages using UDP the destination port is usually 514

    When sending messages using TCP the destination port is usually 1468

    —

    Syslog Message Format:

    Message

    This is the text of the syslog message, along with some additional information about the process that generated the message. The syslog messages generated by Cisco IOS devices begin with a percent sign (%) and use the following format:

     

    %FACILITY-SEVERITY-MNEMONIC: Message-text

    Following is a description of each field:

     

    FACILITY— Refers to the source of the message, such as a hardware device, a protocol, or a module of the system software. Note that this FACILITY is Cisco specific and is only relevant within the message string. It is different from the facility defined in RFC 3164 for the syslog protocol.

    SEVERITY— This is similar to the severity defined in Table 4-2.

    MNEMONIC— This is a device-specific code that uniquely identifies the message.

    Message-text— This is a text string that describes the message and can contain details such as port numbers and network addresses.

    Following is a sample syslog message generated by a Cisco IOS device:

     

    *Mar  6 22:48:34.452 UTC: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0,

    changed state to up

    Note that the message begins with a special character (*) and that the timestamp includes the time-zone information. The message was generated by the LINEPROTO facility at severity 5 (Notice). The MNEMONIC UPDOWN along with the message-text describe the event.

    —

    Facility:

    The facility allow administrators to logically separate messages (e.g. write them to separate files, forward them to different destinations, etc.)

    Each Syslog message includes a priority value at the beginning of the text. The priority value ranges from 0 to 191 and is made up of a Facility value and a Level value.

    Facility

    Syslog messages are broadly categorized on the basis of the sources that generate them. These sources can be the operating system, the process, or an application. These categories, called facility, are represented by integers, as shown in Table 4-1. The local use facilities are not reserved and are available for general use. Hence, the processes and applications that do not have pre-assigned facility values can choose any of the eight local use facilities. As such, Cisco devices use one of the local use facilities for sending syslog messages.

    The Facility value is a way of determining which process of the machine created the message. Since the Syslog protocol was originally written on BSD Unix, the Facilities reflect the names of Unix processes and Daemons.

    The priority value is calculated using the following formula:

    Priority = Facility * 8 + Level

     

    Table 4-1. Facility Values

    Facility 0

    Kernel messages 1

    User-level messages 2

    Mail system 3

    System daemons 4

    Security/authorization messages 5

    Messages generated internally by Syslogd 6

    Line printer subsystem 7

    Network news subsystem 8

    UUCP subsystem 9

    Clock daemon 10

    Security/authorization messages 11

    FTP daemon 12

    NTP subsystem 13

    Log audit 14

    Log alert 15

    Clock daemon 16

    Local use 0 (local0) 17

    Local use 1 (local1) 18

    Local use 2 (local2) 19

    Local use 3 (local3) 20

    Local use 4 (local4) 21

    Local use 5 (local5) 22

    Local use 6 (local6) 23

    Local use 7 (local7) 24

    —

    Severity Level:

    The source or facility that generates the syslog message also specifies the severity of the message using a single-digit integer, as shown in Table 4-2.

    The higher severity numbers “include” the lower severity numbers.

    Table 4-2: The list of severity Levels:

    0       Emergency: system is unusable

    1       Alert: action must be taken immediately

    2       Critical: critical conditions

    3       Error: error conditions

    4       Warning: warning conditions

    5       Notice: normal but significant condition

    6       Informational: informational messages

    7       Debug: debug-level messages

    Recommended practice is to use the Notice or Informational level for normal messages.

     

    A detailed explanation of the severity Levels:

    DEBUG: Info useful to developers for debugging the app, not useful during operations

    INFORMATIONAL: Normal operational messages – may be harvested for reporting, measuring throughput, etc – no action required

    NOTICE: Events that are unusual but not error conditions – might be summarized in an email to developers or admins to spot potential problems – no immediate action required

    WARNING: Warning messages – not an error, but indication that an error will occur if action is not taken, e.g. file system 85% full – each item must be resolved within a given time

    ERROR: Non-urgent failures – these should be relayed to developers or admins; each item must be resolved within a given time

    ALERT: Should be corrected immediately – notify staff who can fix the problem – example is loss of backup ISP connection

    CRITICAL: Should be corrected immediately, but indicates failure in a primary system – fix CRITICAL problems before ALERT – example is loss of primary ISP connection

    EMERGENCY: A “panic” condition – notify all tech staff on call? (earthquake? tornado?) – affects multiple apps/servers/sites…

    —

    Syslog IDs:

    https://www.cisco.com/c/en/us/td/docs/security/asa/syslog/b_syslog.html

    https://www.cisco.com/c/en/us/td/docs/security/asa/syslog/b_syslog/syslogs-sev-level.html

    —

    Event(All event classes) Lists:

    Event List can be used to filter syslogs IDs (syslog ID or a range) sent to a logging destination.

    —

    Logging Filters:

    Logging filters are used for logging destinations e.g. Syslog Servers, Email, ASDM, Internal buffers, Console, SSH, SNMP trap and attach the Event List to is as well.

    —

    Message/Event Class:

    Use the message class in order to send all messages associated with a class to the specified output location e.g. auth, config, ha, snmp, vpn, ssl etc.

    —

    Syslog servers:

    Simply define the destination IPs to send the logs (usual port number udp/514).

  • Creating objects on ASA from a file of IPs and Putting then in an object group (CLI)

    Power Shell Script (Run it straight from powershell prompt/file must be in the same directory):

    ASA:
    object-group network Log4j_BadIP_Grp

    foreach($ip in Get-Content ip1.txt)
    {
    Write-output “object network Log4j_BadIP_$ip” | Tee-Object -FilePath ‘C:\Users\fali\output_asa.txt’ -append
    Write-output “Description NOC-2682-Created by FAli(Nettitude) on 18/12/2021” | Tee-Object -FilePath ‘C:\Users\fali\output_asa.txt’ -append
    Write-output “host $ip” | Tee-Object -FilePath ‘C:\Users\fali\output_asa.txt’ -append
    Write-output “object-group network Log4j_BadIP_Grp” | Tee-Object -FilePath ‘C:\Users\fali\output_asa.txt’ -append
    Write-output “Description NOC-2682-Created by FAli(Nettitude) on 18/12/2021” | Tee-Object -FilePath ‘C:\Users\fali\output_asa.txt’ -append
    Write-output “network-object object Log4j_BadIP_$ip” | Tee-Object -FilePath ‘C:\Users\fali\output_asa.txt’ -append
    }

  • Syslog on ASA

    Syslog Packet:

    The syslog packet size is limited to 1024 bytes and carries the following information:

     

    Facility

    Severity

    Hostname

    Timestamp

    Message

    —

    Syslog Port numbers:

    When sending messages using UDP the destination port is usually 514

    When sending messages using TCP the destination port is usually 1468

    —

    Syslog Message Format:

    Message

    This is the text of the syslog message, along with some additional information about the process that generated the message. The syslog messages generated by Cisco IOS devices begin with a percent sign (%) and use the following format:

     

    %FACILITY-SEVERITY-MNEMONIC: Message-text

    Following is a description of each field:

     

    FACILITY— Refers to the source of the message, such as a hardware device, a protocol, or a module of the system software. Note that this FACILITY is Cisco specific and is only relevant within the message string. It is different from the facility defined in RFC 3164 for the syslog protocol.

    SEVERITY— This is similar to the severity defined in Table 4-2.

    MNEMONIC— This is a device-specific code that uniquely identifies the message.

    Message-text— This is a text string that describes the message and can contain details such as port numbers and network addresses.

    Following is a sample syslog message generated by a Cisco IOS device:

     

    *Mar  6 22:48:34.452 UTC: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0,

    changed state to up

    Note that the message begins with a special character (*) and that the timestamp includes the time-zone information. The message was generated by the LINEPROTO facility at severity 5 (Notice). The MNEMONIC UPDOWN along with the message-text describe the event.

    —

    Facility:

    The facility allow administrators to logically separate messages (e.g. write them to separate files, forward them to different destinations, etc.)

    Each Syslog message includes a priority value at the beginning of the text. The priority value ranges from 0 to 191 and is made up of a Facility value and a Level value.

    Facility

    Syslog messages are broadly categorized on the basis of the sources that generate them. These sources can be the operating system, the process, or an application. These categories, called facility, are represented by integers, as shown in Table 4-1. The local use facilities are not reserved and are available for general use. Hence, the processes and applications that do not have pre-assigned facility values can choose any of the eight local use facilities. As such, Cisco devices use one of the local use facilities for sending syslog messages.

    The Facility value is a way of determining which process of the machine created the message. Since the Syslog protocol was originally written on BSD Unix, the Facilities reflect the names of Unix processes and Daemons.

    The priority value is calculated using the following formula:

    Priority = Facility * 8 + Level

     

    Table 4-1. Facility Values

    Facility 0

    Kernel messages 1

    User-level messages 2

    Mail system 3

    System daemons 4

    Security/authorization messages 5

    Messages generated internally by Syslogd 6

    Line printer subsystem 7

    Network news subsystem 8

    UUCP subsystem 9

    Clock daemon 10

    Security/authorization messages 11

    FTP daemon 12

    NTP subsystem 13

    Log audit 14

    Log alert 15

    Clock daemon 16

    Local use 0 (local0) 17

    Local use 1 (local1) 18

    Local use 2 (local2) 19

    Local use 3 (local3) 20

    Local use 4 (local4) 21

    Local use 5 (local5) 22

    Local use 6 (local6) 23

    Local use 7 (local7) 24

    —

    Severity Level:

    The source or facility that generates the syslog message also specifies the severity of the message using a single-digit integer, as shown in Table 4-2.

    The higher severity numbers “include” the lower severity numbers.

    Table 4-2: The list of severity Levels:

    0       Emergency: system is unusable

    1       Alert: action must be taken immediately

    2       Critical: critical conditions

    3       Error: error conditions

    4       Warning: warning conditions

    5       Notice: normal but significant condition

    6       Informational: informational messages

    7       Debug: debug-level messages

    Recommended practice is to use the Notice or Informational level for normal messages.

     

    A detailed explanation of the severity Levels:

    DEBUG: Info useful to developers for debugging the app, not useful during operations

    INFORMATIONAL: Normal operational messages – may be harvested for reporting, measuring throughput, etc – no action required

    NOTICE: Events that are unusual but not error conditions – might be summarized in an email to developers or admins to spot potential problems – no immediate action required

    WARNING: Warning messages – not an error, but indication that an error will occur if action is not taken, e.g. file system 85% full – each item must be resolved within a given time

    ERROR: Non-urgent failures – these should be relayed to developers or admins; each item must be resolved within a given time

    ALERT: Should be corrected immediately – notify staff who can fix the problem – example is loss of backup ISP connection

    CRITICAL: Should be corrected immediately, but indicates failure in a primary system – fix CRITICAL problems before ALERT – example is loss of primary ISP connection

    EMERGENCY: A “panic” condition – notify all tech staff on call? (earthquake? tornado?) – affects multiple apps/servers/sites…

    —

    Syslog IDs:

    https://www.cisco.com/c/en/us/td/docs/security/asa/syslog/b_syslog.html

    https://www.cisco.com/c/en/us/td/docs/security/asa/syslog/b_syslog/syslogs-sev-level.html

    —

    Event(All event classes) Lists:

    Event List can be used to filter syslogs IDs (syslog ID or a range) sent to a logging destination.

    —

    Logging Filters:

    Logging filters are used for logging destinations e.g. Syslog Servers, Email, ASDM, Internal buffers, Console, SSH, SNMP trap and attach the Event List to is as well.

    —

    Message/Event Class:

    Use the message class in order to send all messages associated with a class to the specified output location e.g. auth, config, ha, snmp, vpn, ssl etc.

    —

    Syslog servers:

    Simply define the destination IPs to send the logs (usual port number udp/514).