Differences

This shows you the differences between two versions of the page.

Link to this comparison view

sred:laborator_3._dedicated_firewall_security [2020/11/13 16:35]
horia.stoenescu [Setup]
sred:laborator_3._dedicated_firewall_security [2022/11/04 14:40] (current)
horia.stoenescu Moved syslog exercise to lab5 and changed grading
Line 1: Line 1:
 ========== Lab 4. Dedicated firewall security (part 2) - FTD ========== ========== Lab 4. Dedicated firewall security (part 2) - FTD ==========
  
-==== Setup ====+ ==== Setup ====
  
 === Story === === Story ===
-After deploying and configuring successfully the FTDand also creating a basic topology with just 1 internal client, we decided to create another internal zone (called **internal2** ​for branch ​for example) that will host another Ubuntu client. Moreover, we studied in depth some features of FTD and decided to apply them in our secured network:+After deploying and configuring successfully the FTD and creating a basic topology with just 1 internal client, we decided to create another internal zone called **internal2** for a secondary ​branch. Moreover, we studied in depth some features of FTD and decided to apply them in our secured network:
  
 - traffic filtering based on **URL categories** - traffic filtering based on **URL categories**
Line 12: Line 12:
 - **IDS/IPS** for network traffic investigation of possible attacks - **IDS/IPS** for network traffic investigation of possible attacks
  
-- **SSL decryption** for in-depth analysis+- **SSL decryption** for traffic ​in-depth analysis
  
 - logging to **syslog** server to generate alerts - logging to **syslog** server to generate alerts
Line 18: Line 18:
 Other features include: Other features include:
  
-- **remote access VPN** (used to create a gateway for remote users connection to internal network - like we use GP for eve-ng access) ​- will be studied in detail and implemented on Fortigate machines+High availability (**HA**used to provide redundancy or load balancing ​- will be studied in detail and implemented on Fortigate machines ​[[https://​ocw.cs.pub.ro/​courses/​sred/​lab5|here]]. Use cases of HA active-passive:​ failover in case of crashes, OS updates of active instance and connection needs to remain up (we may have a website that needs to have 24/7 availability and a patch update is required)
  
-High availability or **HA** (used to provide redundancy or load balancing) - will be studied also in detail and implemented on Fortigate machines. Use cases of HA active-passivefailover in case of crashes, OS updates of active instance and connection needs to remain up (we may have a website that needs to have 24/7 availability and a patch update is required)+- **remote access VPN** (used to create a gateway for remote users connection to internal network - like we use GlobalProtect for eve-ng access) - will be studied also in detail and implemented on Fortigate machines ​[[https://​ocw.cs.pub.ro/​courses/​sred/​lab9|here]] ​
  
 === Topology === === Topology ===
 The topology here is almost the same as the one from the last lab, the only difference being the new zone (called inside2) with another client (client2, which is the Kali VM). The topology here is almost the same as the one from the last lab, the only difference being the new zone (called inside2) with another client (client2, which is the Kali VM).
  
-{{:​sred:​lab4_topology.png?​800|}} +{{:​sred:​lab4_topology.png?​750| }}
-==== Setup ====+
  
-Cisco 7200 is now changed with the FTD and UbuntuVM and KaliVM are now put in the same network and zone (a private one). InternetVM remains in the same network and zone (public one). The topology is as follows: 
- 
-{{:​sred:​lab3_sred_topologie.png?​650|}} 
- 
-== FTD == 
-The **firewall** has a 90 days trial available license, with 4 vCPUs configured, 8196 MB RAM and 4 network adapters (1 for a paravirtualized interface using host-only adapter in VBox network 192.168.56.0/​24 and the rest using Generic Driver adapter - internal configured in GNS3). See [[https://​www.cisco.com/​c/​en/​us/​td/​docs/​security/​firepower/​quick_start/​kvm/​ftdv-kvm-gsg.html#​pgfId-3315592|here]] on Table 1 the requirements for deploying VM. 
- 
-It has four GigabitEthenet interfaces (1 is used for **management** and the rest of 3 for **traffic**) and due to the internals of virtual machine, the last 2 are added in the zones from above: 
-  - GigabitEthernet2 is connected to InternetVM - zone **outside_area** ​ 
-  - GigabitEthernet3 is connected to internal area switch - zone **inside_area** 
-Also, GigabitEthernet0 corresponds to the management interface which is not attached to any other interface in GNS3 (it is attached to vm area of virtualBox, the gateway being your host machine). ​ 
- 
-<note warning> 
-For not creating confusions, in the following lines we are going to use the exact names for the traffic interfaces, as follows: 
-  * GigabitEthernet3 (from GNS3) is GigabitEthernet0/​1 in FTD (with logical name **inside**). We will use for it **GigabitEthernet0/​1** OR **inside** 
-  * GigabitEthernet2 (from GNS3) is GigabitEthernet0/​0 in FTD (with logical name **outside**). We will use for it **GigabitEthernet0/​0** OR **outside** 
- 
-Moreover, all operations are exemplified for WebUI (FDM for Firepower machine). If you would like to use CLI, you can start by looking at this [[https://​www.cisco.com/​c/​en/​us/​td/​docs/​security/​firepower/​60/​configuration/​guide/​fpmc-config-guide-v60/​fpmc-config-guide-v60_appendix_01011110.html|documentation]],​ but when using such devices for the first time, is highly recommended to use in the beginning the GUI of it. 
- 
-Outside interface is in network: **172.31.0.0/​24** 
- 
-Inside interface is in network: **192.168.45.0/​24** 
-</​note>​ 
- 
-After configuring FTD, there is need to **deploy configuration** (commit it) in order to take effect (be aware that deployments on virtual devices may take up to 3 minutes, so try to do this as rare as possible). A nice feature offered by Cisco is that a configuration difference is given for entities to have a better look over the newer version before committing. You can also download the current configuration in JSON format (is automatically deleted from FTD after deploying new changes) to have a snapshot just for analysis (it cannot be uploaded to machine). 
- 
-<note important>​ 
-One of the components that require a license on FTD is the deployment. Without it, you cannot do any new configuration and the machine becomes mostly non usable (rely only on already found configuration on it). 
-</​note>​ 
- 
-FTD also has configured a default policy rule that lets any traffic from inside to outside (and no started traffic from outside to inside). 
- 
-<​note>​ 
-After booting up the firewall in GNS3, wait for approximately 10 minutes for accessing the firepower management center (FMC or the webUI manager of the FTD). To access it, simply go to a browser and introduce the management ip address **192.168.56.102** with https protocol. 
-</​note>​ 
- 
-<​note>​ 
-The credentials for FTD: 
- 
-user: **admin** 
- 
-password: **Admin123** 
- 
-</​note>​ 
-== InternetVM == 
-This machine has 2 interfaces: ​ 
-  - **enp0s3**: use to connect to internal area (with packets filterted by FTD). Assigned address 172.31.0.2/​24. 
-  - **enp0s8**: use to connect the machine to the Internet (using NAT cloud) 
- 
-It has ip routing activated and an iptables nat rule with MASQUERADE added. ​ 
- 
-<note tip> 
-In /​etc/​network/​interfaces,​ the interface enp0s3 is configured permanently with address + netmask and a route to internal area: 
-<​code>​ 
-student@internet:​~#​ cat /​etc/​network/​interfaces 
-[...] 
-auto enp0s3 
-iface enp0s3 inet static 
-    address 172.31.0.2 
-    netmask 255.255.255.0 
-    up route add -net 192.168.45.0 netmask 255.255.255.0 gw 172.31.0.1 
-</​code>​ 
-Is it best not to do any modifications here.  
-But, if you need to restart the networking service after modifications are made in this file, use: 
-<​code>​ 
-student@internet:​~#​ sudo /​etc/​init.d/​networking restart 
-[ ok ] Restarting networking (via systemctl): networking.service 
-</​code>​ 
- 
-A default route to the internet via next hop 192.168.159.2 (default gateway) is also added, alongside a route via firewall to internal subnet. 
- 
-Also, if there is any other default route (different than the one from above), delete it. 
-</​note>​ 
- 
-FTD has added in the configuration the default route (route to 0.0.0.0/0) via hip next hop 172.31.0.2. 
- 
-<note important>​ 
-For InternetVM there is a configuration issue on the machine (the interface enp0s3 gets the ip address 172.31.0.1 - corresponds to fw). As a workaround for now, do the following: 
-<​code>​ 
-student@internet:​~#​ sudo ifdown enp0s3; sudo ifup enp0s3 
-student@internet:​~#​ sudo ip a del 172.31.0.1/​24 dev enp0s3 
-</​code>​ 
-After this, verify the ip address again on enp0s3: 
-<​code>​ 
-student@internet:​~#​ ip a s dev enp0s3 
-[...] 
-   inet 172.31.0.2/​24 [...] scope global enp0s3 
-</​code>​ 
-</​note>​ 
- 
-This device also has installed a basic apache2 server (with index file in /​var/​www/​html) which is inactive by default. For the next exercises you can use it if you want. Enable it using: 
-<​code>​ 
-student@internet:​~#​ sudo service apache2 start 
-student@internet:​~#​ sudo service apache2 status 
-apache2.service 
-[...] 
-Active: active (running) 
-[...] 
-</​code> ​ 
-Test it with curl from endpoints (ubuntu or kali VMs). 
- 
-== Clients == 
-UbuntuVM and KaliVM are both connected to the same switch and IP addresses added via DHCP. The inside interface from FTD has a static ip configured: 192.168.45.1/​24 with a DHCP server configured for it. The address pool is 192.168.45.46-192.168.45.254. You can find the server on Device > System Settings > DHCP server and add/edit the current one if you like. A default route is injected also to endpoints via 192.168.45.1 (their gateway). The machines should receive after booting the IP addresses on enp0s3 (Ubuntu) and eht0 (Kali). 
- 
-<note important>​ 
-After boot, start manually DHCP process on both clients (receive the IP, default route and also use only locally configured DNS servers - 8.8.8.8 and 8.8.4.4): 
-<​code>​ 
-student@ubuntu:​~#​ sudo dhclient enp0s3 
-student@ubuntu:​~#​ ifconfig enp0s3 
-enp0s3: [...] 
-    inet 192.168.45.47 netmask 255.255.255.0 [...] 
-[...] 
-</​code>​ 
- 
-Verify the default route using: 
-<​code>​ 
-student@ubuntu:​~#​ ip r s 
-default via 192.168.45.1 dev enp0s3 # static route 
-192.168.45.0/​24 dev enp0s3 [...] # directly connected network 
-</​code>​ 
-</​note>​ 
- 
- 
-Before starting the exercises, ping google.ro (or any other website) from FTD and internal machines to be sure internet is reachable from them. For Cisco VM, you can send icmp-echo requests using the CLI from GUI (the button near the deploy one). Note that the syntax is limited to commands like ping,​traceroute or show. 
 ==== Exercises ==== ==== Exercises ====
  
Line 158: Line 33:
 </​note>​ </​note>​
  
-=== e1. [1p] New guy in network ===+=== e1. [2p] New guy in network ===
 Remember that we deployed the firewall with 4 interfaces: 1 for mgmt and the rest of 3 for traffic (only 2 of them inside and outside where used and configured). Then, there is 1 left we need to configure for inside traffic data. Remember that we deployed the firewall with 4 interfaces: 1 for mgmt and the rest of 3 for traffic (only 2 of them inside and outside where used and configured). Then, there is 1 left we need to configure for inside traffic data.
  
Line 169: Line 44:
 - connect it to to G0/2 found on FTD and start both nodes - connect it to to G0/2 found on FTD and start both nodes
  
-- go to FDM and enable the 3rd interface in routed mode, name it inside2 and create a new dhcp server to apply to it+- go to FDM and enable the 3rd interface in routed mode, name it inside2, ip 192.168.46.1 ​and create a new dhcp server to apply to it (you can use the pool: 192.168.46.2 - 192.168.46.254)
  
-- create a new security zone named inside2 and also the corresponding nat and access policy rules+- create a new security zone named inside2 ​(linked with the new interface) ​and also the corresponding nat and access policy rules
  
 Test if client2 has Internet access. Test if client2 has Internet access.
Line 190: Line 65:
 - test access to other websites like google.com, digi24.ro etc. - test access to other websites like google.com, digi24.ro etc.
  
-=== e3. [1p] File policy ===+=== e3. [2p] File policy ===
 We can block a client from downloading malware file from websites, emails, ftp server etc. by using file policy in an access policy. There is need firstly to enable the following licenses: threat and malware, then create an access policy with action Allow (the only action where file policy can be used), from zones inside and inside2 to outside zone. This will protect internal users from downloading any known malware by Talos. ​ We can block a client from downloading malware file from websites, emails, ftp server etc. by using file policy in an access policy. There is need firstly to enable the following licenses: threat and malware, then create an access policy with action Allow (the only action where file policy can be used), from zones inside and inside2 to outside zone. This will protect internal users from downloading any known malware by Talos. ​
  
 There are 2 options for this feature: There are 2 options for this feature:
  
-1. **Block malware all**: check the file downloaded and if it is identified as malware, block the download and generate logs (monitoring > malware). See this option as prevention (ips like).+1. **Block malware all** - use this one: check the file downloaded and if it is identified as malware, block the download and generate logs (monitoring > malware). See this option as prevention (ips like).
  
 2. **Malware Cloud lookup**: this will only check the file and generate logs if it's identified as a threat, but the download is still possible for clients. See this option as detection (ids like). 2. **Malware Cloud lookup**: this will only check the file and generate logs if it's identified as a threat, but the download is still possible for clients. See this option as detection (ids like).
Line 225: Line 100:
 Regarding rules, some of them can be removed on different versions of FTD. For example, in Snort currently there are multiple nmap rules deleted, like this [[https://​www.snort.org/​rule_docs/​1-469|one]]. You can try to search for them on Intrusion policy with no results. Regarding rules, some of them can be removed on different versions of FTD. For example, in Snort currently there are multiple nmap rules deleted, like this [[https://​www.snort.org/​rule_docs/​1-469|one]]. You can try to search for them on Intrusion policy with no results.
 </​note>​ </​note>​
 +
 +Create a new access policy rule: from inside and inside2 to inside2 and inside, action Allow. Deploy and go to Kali machine (client2).
  
 Firstly, we will use a reverse tcp attack from attacker machine. Firstly, we will use a reverse tcp attack from attacker machine.
Line 237: Line 114:
 </​code> ​ </​code> ​
  
-Create a new access ​policy rule: from inside and inside2 to inside2, action Allow, and inside with Intrusion policy ​enabled and maximum detectionDeploy and go to Kali machine ​(client2).+Modify the policy rule from aboveenable 'Intrusion policy' with '​Maximum Detection'​This is necessary ​to be added after scp as the crafted file will be identified as threat ​(named **128|6|SSH_EVENT_PAYLOAD_SIZE**), making the copy not possible. In a real life scenario, this part needs to be secured by mail solutions and identified as spam containing possible malware.
  
 <note warning> <note warning>
-Do not use it on Inside-outside rule as some valid traffic I've seen it identified (like nslookup responses from 8.8.8.8 are blocked). I will investigate this false positives and come with a response.+Do not use it on Inside-outside rule as some valid traffic I've seen it identified (like nslookup responses from 8.8.8.8 are blocked). I will investigate this false positives and come with a response ​in future.
 </​note>​ </​note>​
  
Line 279: Line 156:
  
 === e5. [1p] Staying in the middle ===  === e5. [1p] Staying in the middle === 
 +<note important>​
 +Before moving to this exercise, make sure you disable Intrusion policy from the rule created earlier. Reason: deployment takes a lotes with maximum policy in place.
 +</​note>​
 +
 We can inspect also encrypted traffic using FTD in two ways: We can inspect also encrypted traffic using FTD in two ways:
  
Line 287: Line 168:
 To be easier for configuration,​ we will use only the first option. From Polices > SSL decryption > enable decrypt re-sign and download the CA certificate,​ then upload it to client1. To be easier for configuration,​ we will use only the first option. From Polices > SSL decryption > enable decrypt re-sign and download the CA certificate,​ then upload it to client1.
  
-Create a policy for traffic coming from inside to outside zone and for other fields keep any. After commit, try to access any website and see the browser error: unknown_issuer. This is because it does not know about that issuer/CA the ftd is currently using. To solve this, add the uploaded CA in it's trust store.+<​note>​ 
 +If you have RDP enabled for client1 Linux machine, just copy and paste the cert to a new file on home dir ca_ftd.pem.  
 + 
 +If not, use this [[https://​privnote.com/​|site]] to add the CA cert as it is in pem format, then open it from client1 and save it to home dir as ca_ftd.pem. 
 +</​note>​ 
 + 
 +Create a policy for traffic coming from inside to outside zone and for other fields keep any. After commit, try to access any website and see the browser error: unknown_issuer. This is because it does not know about that issuer/CA the ftd is currently using. To solve this, add the uploaded CA in it's trust store (from Mozilla preferences > search for certificates > view certificates > import > select ca_ftd.pem file > enable 'trust this ca to identify websites'​ and ok). Try again to access websites with http over tls (microsoft.com,​ digi24.ro etc.). Check also the cert of each and the issuer CN (it should be '​firepower'​ or the hostname of your FTD).
  
 <note important>​ <note important>​
Line 309: Line 196:
  
 Of course, using the method do not decrypt, we can except some websites based on url, users, certificate or tls version from decryption (we may not want to to decrypt health or banking data for our users). Of course, using the method do not decrypt, we can except some websites based on url, users, certificate or tls version from decryption (we may not want to to decrypt health or banking data for our users).
-</​note>​ 
- 
-=== e7. [2p] Send some logs === 
- 
-{{:​sred:​lab4_syslog.png?​800|}} 
- 
-As logging is limited on our FTD device, we can use an external device for log collection. This can be a syslog server, that we will configure firstly on our linux router VM. 
- 
-To configure it, do the following: 
-<​code>​ 
-sudo apt-get update 
-sudo apt-get install syslog-ng 
-sudo mv /​etc/​syslog-ng/​syslog-ng.conf /​etc/​syslog-ng/​syslog-ng.conf.bkup # same the default one  
-sudo vim /​etc/​syslog-ng/​syslog-ng.conf 
- 
-# add here: 
-@version: 3.5 
-@include "​scl.conf"​ 
-@include "​`scl-root`/​system/​tty10.conf"​ 
-    options { 
-        time-reap(30);​ 
-        mark-freq(10);​ 
-        keep-hostname(yes);​ 
-        }; 
-    source s_local { system(); internal(); }; 
-    source s_network { 
-        syslog(transport(udp) port(1025));​ 
-        }; 
-    destination d_local { 
-    file("/​var/​log/​syslog-ng/​messages_${HOST}"​);​ }; 
-    destination d_logs { 
-        file( 
-            "/​var/​log/​syslog-ng/​logs.txt"​ 
-            owner("​root"​) 
-            group("​root"​) 
-            perm(0777) 
-            ); }; 
-    log { source(s_local);​ source(s_network);​ destination(d_logs);​ }; 
- 
-# create the log dir and restart the server 
-sudo mkdir /​var/​log/​syslog-ng 
-sudo touch /​var/​log/​syslog-ng/​logs.txt 
-sudo service syslog-ng restart 
- 
-# check the service if it is LISTENING on port 1025 
-sudo netstat -atupn | grep 1025 
-</​code>​ 
- 
-After this, go to another terminal on Router VM and test the syslog server: 
-<​code>​ 
-logger -n 10.3.0.84 -P 1025 "​testing my new syslog server"​ 
-</​code>​ 
- 
-And from another terminal, check the logs.txt file: 
-<​code>​ 
-tail -f /​var/​log/​syslog-ng/​logs.txt 
-Nov 10 10:00:00 ubuntu eve: testing my new syslog server 
-</​code>​ 
- 
-Do the same thing from FTD expert mode and check with tail logs.txt: 
-<​code>​ 
-> expert 
-admin@ciscoasa:​~$ logger -n 10.3.0.84 -P 1025 "​testing syslog from ftd" 
-</​code>​ 
- 
-Next, go to FDM and configure syslog for client. There are 3 important parts here: 
- 
-1. create the syslog server object 
- 
-2. enable logging for remote device and select severity level as informational ​ 
- 
-3. create a new access policy rule with:  
-  
-   - in: inside and inside2 
-   - out: outside 
-   - application:​ ICMP 
-   - action: ALLOW 
-   - logging: at the end of connection and send connection events to syslog server (configured at step 1). Note that all these events are informational and can also be seen locally on FTD : Monitoring > Events 
- 
-<​note>​ 
-For more info about syslog-ng, see [[https://​www.techrepublic.com/​article/​how-to-use-syslog-ng-to-collect-logs-from-remote-linux-machines/​|here]]. 
 </​note>​ </​note>​
  
sred/laborator_3._dedicated_firewall_security.1605278111.txt.gz · Last modified: 2020/11/13 16:35 by horia.stoenescu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0