Using Linux Kernel Modules (LKM) and Netfilter to implement a packet filtering module. This module will filter packets based on hard coded rules. Effectively creating a simple firewall.
Environment is a NAT network with two machines on it:
- Machine A (has firewall installed on it)
- Machine B
- Outbound telnet traffic from Machine A to Machine B.
- Inbound telnet traffic to Machine A from Machine B.
- Outbound SSH (Secure Shell) traffic from Machine A to Machine B.
- Inbound SSH traffic to Machine A from Machine B.
- Access from Machine A to a specific external website.
Uses a bash script to run the commands
$ make
$ sudo ./reload.sh
Build
$ make
Install module into the Kernel
$ sudo insmod myfirewall.ko
Check that module was loaded
$ lsmod | grep myfire
To check log for the kernal files
$ sudo dmesg | tail -10
To uninstall Module
$ sudo rmmod myfirewall