Course: Networks Security (CCY3201)
Lecturer: Prof. Dr. Ayman Adel Abdel-Hamid
TAs: Abdelrahman Solyman
Date: May 2025
-
Ahmed Walid Ibrahim
-
Ahmed Mohamed Mahmoud
- Project Overview
- Part 1: TLS Implementation
- Part 2: SSH Configuration
- Bonus: Firewall IDS
- Deliverables
- Team Plan
This project demonstrates the implementation and analysis of secure network communications using TLS/SSL and SSH protocols, along with firewall and intrusion detection system configuration. The project is divided into three main parts:
- TLS Implementation - Creating a secure HTTPS web application using OpenSSL
- SSH Configuration - Setting up secure SSH connections with key-based authentication
- Bonus: Firewall IDS - Implementing pfSense with Snort for network security
- Client VM: Kali Linux (Part 1) and Fedora Linux (Part 2)
- Server VM: Kali Linux
- Firewall VM: pfSense
- Vulnerable VM: Metasploitable2
Implementation of a secure HTTPS web application using OpenSSL with certificate generation, TLS client-server communication, and traffic analysis using Wireshark.
First, we created a Root Certificate Authority (CA) to sign both client and server certificates.
Commands used:
mkdir ~/tls_cert && cd ~/tls_cert
openssl genrsa -out rootCA.key 2048
openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1024 -out rootCA.pem -config root.cnfConfiguration Files:
openssl genrsa -out server.key 2048
openssl req -new -key server.key -out server.csr -config server.cnf
openssl x509 -req -in server.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out server.crt -days 500 -sha256 -extfile server.cnf -extensions v3_reqopenssl genrsa -out client.key 2048
openssl req -new -key client.key -out client.csr
openssl x509 -req -in client.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out client.crt -days 500 -sha256Best Practices for Certificate Storage:
- Root CA Private Key: Stored securely with restricted access (600 permissions)
- Server Private Key: Stored on server with limited access (600 permissions)
- Client Private Key: Stored on client with user-only access (600 permissions)
- Public Certificates: Can be shared (644 permissions)
File Locations:
- Root CA files: Root CA Directory
- Server files: Server Directory
- Client files: Client Directory
The server application implements HTTPS using Python's ssl module with OpenSSL certificates.
Key Features:
- TLS/SSL encryption
- Certificate-based authentication
- Simple HTTP response with HTML content
The client connects to the server using TLS with certificate verification.
Traffic was captured during the TLS handshake and data exchange process.
Captured Files:
The captured traffic shows the complete TLS handshake process:
- Client Hello
- Server Hello
- Certificate Exchange
- Key Exchange
- Finished Messages
- Application Data
Using the session key to decrypt the captured TLS traffic reveals the plain HTTP packets.
TLS Version: TLS 1.3 Cipher Suite: TLS_AES_256_GCM_SHA384 Key Exchange: ECDHE (Elliptic Curve Diffie-Hellman Ephemeral) Authentication: RSA with SHA-256
Configuration of SSH service with key-based authentication
sudo apt update
sudo apt upgrade
sudo apt install openssh-server openssh-client
sudo systemctl enable ssh # To have it autostart
sudo systemctl start ssh # To start it for only this sessionGenerated two key pairs using different algorithms:
ED25519 Keys:
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -C "ahmed@ahmedpc"RSA Keys:
ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -C "ahmed@ahmedpc"Initial connection using password authentication:
ssh ahmed@192.168.1.10Copied public key to server:
ssh-copy-id -i ~/.ssh/id_ed25519.pub ahmed@192.168.1.10ssh -i ~/.ssh/id_ed25519 ahmed@192.168.1.10Configured Konsole from host operating system for SSH access:
- OpenSSH key through the Terminal Emulator
- Configured connection settings
- Tested both password and key authentication
Disabled password authentication to enforce key-only access:
sudo nano /etc/ssh/sshd_config
# Set: PasswordAuthentication no
# Set: PubkeyAuthentication yes
sudo systemctl restart sshCaptured SSH traffic during key-based authentication:
Generated detailed SSH logs using verbose mode:
ssh -vvv -i ~/.ssh/id_ed25519 ahmed@192.168.1.10Log Files:
The captured traffic and verbose logs reveal:
- SSH Version: SSH-2.0-OpenSSH_9.9
- Key Exchange: curve25519-sha256
- Host Key Algorithm: ssh-ed25519
- Encryption: chacha20-poly1305@openssh.com
- MAC: implicit (AEAD cipher)
Implementation of pfSense firewall with Snort/Suricata IDS to control network traffic and detect intrusions, specifically blocking direct access to Metasploitable2 and monitoring for Nmap scans.
graph TD
A[Metasploitable2<br/>192.168.179.136] <--> D
E <--> C[Kali Linux<br/>192.168.2.128]
subgraph "WAN Network"
A
end
subgraph "pfSense Router/Firewall"
D[WAN Interface<br/>192.168.179.149]
B[pfSense Core]
E[LAN Interface<br/>192.168.2.130]
D <--> B
B <--> E
end
subgraph "LAN Network"
C
end
A -.->|Direct Access<br/>BLOCKED| C
style A fill:#ffcccc
style B fill:#ccffcc
style C fill:#cceeff
style D fill:#ffffcc
style E fill:#ffffcc
- Client Network: 192.168.1.0/24
- DMZ Network: 192.168.2.0/24 (Metasploitable2)
- pfSense Interfaces: WAN, LAN, DMZ
- pfSense VM: Configured as router/firewall
- Metasploitable2 VM: Deployed in isolated DMZ
- Network Isolation: Direct client-to-vulnerable machine access blocked
- WAN Interface: Internet connection
- LAN Interface: Client network (192.168.1.0/24)
- DMZ Interface: Vulnerable machine network (192.168.2.0/24)
Configured routing to force all traffic through pfSense:
Client → pfSense LAN → pfSense DMZ → Metasploitable2
- Installed Snort package on pfSense
- Configured rule sets for intrusion detection
- Enabled logging for security events
Custom rules to detect:
- Port scanning activities
- Nmap signatures
- Vulnerable service access attempts
Identified vulnerable services on Metasploitable2:
- SSH (Port 22): Weak credentials
- HTTP (Port 80): Web application vulnerabilities
- FTP (Port 21): Anonymous access
- Telnet (Port 23): Unencrypted communicatio
Applied firewall rules to block access to two vulnerable services:
- FTP (Port 21): Anonymous access vulnerability
- Telnet (Port 23): Unencrypted communication
Performed Nmap scan from client to test IDS detection:
nmap -sS -O -v 192.168.179.136The IDS successfully detected and logged the Nmap scan:
- Blocked connection attempts to disabled services
- Traffic ro
- Access control enforcement
- Port scan detection
- Suspicious traffic patterns
- Security event correlation
IDS Log File: IDS Logs
All project files and documentation are available in the GitHub repository: https://github.com/ahmeddwalid/networks-security-TermProject
- Ahmed Mohamed:
- Part 1: TLS Implementation
- Certificate generation and configuration
- Server application development
- Traffic capture and analysis
- Client application development
- Traffic decryption
- Protocol analysis and documentation
- Part 1: TLS Implementation
- Ahmed Walid:
- Part 2: SSH Configuration
- SSH server installation and configuration
- Key generation and management
- Konsole setup and configuration
- SSH client configuration
- Traffic capture and analysis
- Verbose logging and documentation
- Part 2: SSH Configuration
-
Together:
-
pfSense installation and configuration
-
Network architecture setup
-
Firewall rule implementation
-
IDS configuration and monitoring
-
Vulnerability assessment
-
Log analysis
-
Testing and validation
-
All objectives were met with proper documentation, traffic capture, and security analysis demonstrating a thorough understanding of network security principles and implementation practices.
/Screenshots/rootca_generation.png)
/Screenshots/root_cnf.png)
/Screenshots/client_cert_generation.png)
/Screenshots/serverpy.png)
/Screenshots/clientpy.png)
/Screenshots/wireshark_capture.png)
/Screenshots/runningTheServer.png)
/Screenshots/runningTheClient.png)
/Screenshots/tls_cert.png)
/Screenshots/1EnableSSH.png)
/Screenshots/3ed25519KeygenOnHostMachine.png)
/Screenshots/4RSAKeygenOnHostMachine.png)
/Screenshots/2ConnecUsingSSH.png)
/Screenshots/5Copied25519SSHKeyToKaliVM.png)
/Screenshots/keybasedlogin.png)
/Screenshots/10ConfiguringToUseGeneratedKey.png)
/Screenshots/Kali%20Linux-2025-05-16-18-50-33.png)
/Screenshots/Wireshark_SSH_Captured_Traffic.png)
/Screenshots/SSHVerboseOutput.png)












