Showing posts with label Fortigate. Show all posts
Showing posts with label Fortigate. Show all posts

Thursday, December 16, 2021

Optimization of fortigate IPS



  1. IPS signature need select according to infrastructure environment 
    Eg:-  if  we are not have Linux servers this ips signature can disable (default behavior of ips is to monitor TCP/IP packet)
  2. Interzone to interzone or inside interfaces to inside interfaces traffic don't call ips profile. this will affect fortigate memory /CPU
  3. Only allow/call ips security profile (in firewall rule) from inside zone to outside zone 
  4. Always create global profile and call in other VDOMs
  5. Always trigger IPS engine update manually using #execute update-ips from global mode (if the updates are not coming from fortiguard cloud) 


  • Always check the fortigate OS compatibility with IPS engine .



  • In this case the IPS engine is outdated with version 6.4.2 fortigate OS built (above picture)
  • Ones upgraded the ips we must restart the IPS engine using


    # diag test app ipsmonitor 99 (from global mode cli)

    #diag autoupdate versions | grep "IPS Attack" -A 6 (this command will help us to see the updated version from cli )

IPS Attack Engine
---------
Version: 6.00036
Contract Expiry Date: Sat Jan 16 2021
Last Updated using manual update on Mon Aug 31 14:17:05 2020
Last Update Attempt: Mon Oct  5 22:49:27 2020
Result: No Updates

                  Wednesday, November 24, 2021

                  How to troubleshoot the IPS issues in fortigate firewalls

                   How to find problem with IPS in fortigate firewall?


                  In our case issues is High memory utilization in the devices so start the capture memory process first.

                  1st step

                  #diagnose hardware sysinfo memory

                  Run Time:  41 days, 16 hours and 7 minutes

                  4U, 0N, 1S, 94I, 0WA, 0HI, 1SI, 0ST; 3615T, 764F

                         ipsengine    23181      S <    12.7     3.6   ( Noticed that the IPS engine is taking lot of memory)

                         ipsengine    23183      S <     4.9     3.7

                         ipsengine    23180      S <     4.9     3.7

                         scanunitd     3505      S <     4.9     0.6

                         ipsengine    23179      S <     2.9     3.7

                           miglogd      262      S       0.9     1.9

                                                   

                  2d step

                  # diag debug crashlog read          >>>>Not able to find anything related to ips engine

                   
                  3d step

                  n0_fw (global) # get sys fortiguard-service status

                  NAME               VERSION LAST UPDATE          METHOD    EXPIRE

                  AV Engine           6.149  2020-05-29 21:34:00  manual    2025-08-11 23:59:59

                  Virus Definitions   89.7121  2021-11-23 10:04:37  scheduled 2025-08-11 23:59:59

                  Extended set        89.7121  2021-11-23 10:04:37  scheduled 2025-08-11 23:59:59

                  Flow-based Virus Definitions  89.7121  2021-11-23 10:04:37  scheduled 2025-08-11 23:59:59

                  Attack Definitions  6.741  2015-12-01 02:30:00  manual    2025-08-11 23:59:59  Find this outdated

                  Attack Extended Definitions  18.200  2021-11-22 20:05:11  scheduled 2025-08-11 23:59:59

                  IPS Malicious URL Database  3.195  2021-11-22 20:05:11  scheduled 2025-08-11 23:59:59

                  IPS/FlowAV Engine   6.071  2021-02-17 20:28:04  scheduled 2025-08-11 23:59:59

                  IPS Config Script   1.009  2019-06-06 14:02:00  manual    2025-08-11 23:59:59

                  Application Definitions  18.199  2021-11-18 20:07:31  scheduled 2025-08-11 23:59:59

                  Industrial Attack Definitions  6.741  2015-12-01 02:30:00  manual    n/a

                    

                  4th step

                  (Solution for this we need update the IPS from cli using below command)

                  #execute update-ips  (In global mode)

                  Note: Performing the activity of upgrading IPS engine will terminate all TCP sessions. This will have impact to firewall. Make sure that you schedule this activity

                   Few more commands to trouble shoot the IPS engine

                  diagnose test application ipsmonitor 5 (This command will help us to bypass the IPS for monitoring)

                  diagnose ips packet status (This will help to check ips packet counters/monitor the traffic for ips)

                  dia ips session list

                  dia test application ipsmonitor 13 >     This will  soft restart the ips 

                  diagnose ips packet status

                  diag ips session performance

                  diag ips session performance

                  diag ips signature status

                  diag ips  packet status

                  n0_fwl_i (global) # dia ips session list

                  Total TCP sessions: 165

                  SESSION id:105637489 serial:754130096 proto:6 group:0 age:6 idle:6 flag:0x200027

                          feature:0x202 encap:0 ignore:1,0 ignore_after:0,204800

                    C-212.224.76.233:44882, S-94.154.20.19:80

                    state: C-ESTABLISHED/731/0/0/0/0, S-ESTABLISHED/0/0/0/0/0 pause:0, paws:0

                    expire: 24

                    app: unknown:0 last:0 unknown-size:0

                    cnfm: http

                    set: http sip rtsp

                    asm: http

                  n0_fwl1_i (global) # dia test application ipsmonitor 13

                  Session List: pid=23179

                  vf=4 proto=6 194.154.20.10:49770->92.168.217.1:3306

                  vf=4 proto=6 82.4.241.19:39352->94.154.20.7:443

                  Total session :26660


                  n0_fwl1_i (global) # diag ips session performance


                  PERFORMANCE STATISTICS

                  name           :       sess |       pkts   cycles |       pkts   cycles

                  decoder        :          0 | 1007720701        0 |          0        0

                  session        :          0 | 1007720701        0 |          0        0

                  protocol       :          0 |  969665012        0 |          0        0

                  application    :          0 | 1544856777        0 |   63603439        0

                  detect         :          0 |          0        0 |          0        0

                  match          :          0 | 2096202687        0 |          0        0

                  NC match       :          0 | 2931515123        0 |          0        0

                  Cross Tag      :          0 |  107154002        0 |          0        0

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

                  Wednesday, November 17, 2021

                  Cheat sheet FortiGate For Troubleshooting

                   L3 Diagnose Commands 
                  -------------------------------------
                   · Diagnose Ip Arp List
                   · Debug Flow
                   · Diagnose Debug Flow Show Console Enable
                   · Diagnose Debug Enable
                   · Diag Debug Flow Trace Start 
                   · Diagnose Debug Flow Trace Stop
                   · Diagnose Debug 
                   
                  --------------------------------------------
                  CPU Usage Diagnose Commands
                  --------------------------------------------
                   · Get System Performance Status
                   · Diagnose Sys Top 1
                   · Diagnose Sys Top
                   · Diagnose Sys Top-Summary
                   · Diagnose Hardware Test Suite All
                   
                  --------------------------------------
                  Crash Logs Diagnose Commands
                  --------------------------------------
                   · Diagnose Debug  Crashlog Read
                  ----------------------------------------------------
                  Fortigate Hardware Diagnose Commands 
                  ----------------------------------------------------
                   · Get Hardware Status
                   · Get Hardware Npu Mp6 Port-List
                  Network Process Work In Interface Level  L1 Issues
                  -------------------------------------------------
                   · Diagnose Sys Session List
                   · Diag Netlink Aggregate Name Agg1
                   · Diagnose Npu Spm List
                  Firewall Disk Space Or To Format The Firewall Disk 
                  --------------------------------------------------------- 
                   · Get Hardware Status
                   · Execute Disk List
                   · Execute Disk Format
                  CPU Use And Memory 
                  --------------------------------------------------------
                  CPU#    Diagnose Hardware Sysinfo Cpu
                  Mem#    Diagnose Hardware Sysinfo Memory

                  Log
                  ------
                  Diagnose Log Test  ( Test If The Logs Are Generating) 
                  Execute Backup Disk Alllogs {FTP}Tftp |USB)
                  Note:- User-Anonymize We Can Set The Log For Users 
                  ---------------------------------------------------

                  Basic Commands
                  -----------------------------------------------
                  Administrative User Only 
                  ----------------------------------
                  Get System Status
                  Show Full Configuration System Interface <Port>
                  Show System Interface <Port>
                  How Do You Restrict Logins To FortiGate To Be Only From Specific IP Addresses?
                   A. Disable HTTPS Access On Interface
                   B. Configure Trusted Host
                  User Administrator
                  ---------------------------------------------
                  System > Admin Profiles  (Ro View The Admin Profile)
                  Network > Interfaces  >Address >Administrator Access 
                  Transparent Mode MAC Table 
                  --------------------------------------------
                  Diagnose Netlink Brct1 Name Host < VDOM1>.B
                  Debug Commands Routing Table Display 
                  --------------------------------------------------------
                   • Get Router Info Routing-Table All 
                   • Get Router Info Routing-Table Database  : To See The Inactive Routes From Routing Table
                   • Diagnose Firewall Proute List   : - To View Policy Routing Table 

                  RPF Checks
                  --------------------------------------- 
                   • Strict-Src-Check Disable (Loose RPF )(Default)
                   • Strict-Src-Check Enble  (Strict RPF)
                   • Set Strict-Src-Check Disable 
                  Packet Capture In Fortigate 
                   • Diagnose Sniffer Packet <Interface> <Filter><Timestamp><Frame Size>
                   • Ctrl +C To Stop The Packet Capture 
                   • Diagnose Sniffer Packet Any 'Host 192.168.1.254 And Icmp" 3
                   • Diagnose Sniffer Packet Any 'Port 443' 4   (It Will Show In/Out Packet

                  Tuesday, April 13, 2021

                  Backup User to pull the configuration from fortigate using SSL keys

                  In configuration we are setting up 2 trust host to pull the configuration using any backup 
                  software "Rancid" or scripts.


                   fwl1(backup) # show

                  config system admin
                      edit "backup"
                          set trusthost1 1.2.4.107 255.255.255.255
                          set trusthost2 1.28.49.1 255.255.255.255
                          set accprofile "super_admin"
                          set vdom "root"
                          set ssh-public-key1 "ssh-rsa M+hK0a60Hw== rancid"  >>>Full key need to put here
                          set ssh-public-key2 "ssh-rsa +Yptf rancid" >>>>>>>>>>>>full key need put here
                          
                      next
                  end
                  



                  Monday, February 4, 2019

                  Fortigate Vdom

                  VDOM administration

                  Super _admin profile can have access to all VDOM

                  Policy- based routes configuration in

                  Network > policy routes

                  Enable the ipv6 / or any other feature

                  System>Feature visibility    (to view the feature set)

                  Fortigate ECMP

                  Config system settings

                  Set v4-ecmp-mode [source-ip-based ] by default
                  ---------------------------------------------------------------------
                  Learning mode :- in Fortinet Enable devices detection on the source interfaces

                  Traffic shapers  :- - Shared traffic

                  For mapping the more than one services we can create  :- services object


                  Session table in fortigate

                  Session diagnose (output)

                  Session table >   Fortiview > all sessions

                  TCP default TTL vale for session table on firewall

                  3600 sec default vale

                  Firewall services> firewall policies >global sessions

                  Clear any previous filters
                  ------------------------------------------------------------
                  Diagnose sys session filter clear
                  Diagnose sys session list
                  Diagnose sys session clear


                  Eg :- Diagnose sys session filter dst 10.200.1.254
                  Diag sys session filter dport 80
                  Diag sys session list


                  Show the routing table
                  ------------------------------------------
                  Get router info routing-table all 

                  Optimization of fortigate IPS

                  IPS signature need select according to infrastructure environment  Eg:-  if  we are not have Linux servers this ips signature can disable (d...