Skip to content

A simple Linux kernel module for blocking a destination TCP port.

Notifications You must be signed in to change notification settings

amkgi/linux-kernel-portblocker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Simple destination TCP port blocker

Usage:

Build and load the module:

git clone https://github.com/amkgi/linux-kernel-portblocker
cd linux-kernel-portblocker
make
sudo insmod port_blocker.ko tcp_port=22

The default port is 80.

Testing:

curl ya.ru

Monitoring:

sudo dmesg -w | grep port_blocker

Unload the module:

sudo rmmod port_blocker

Links:

  1. The Linux Kernel Module Programming Guide
  2. Linux Kernel Communication — Netfilter Hooks

Tested on kernel 6.1.50-1-generic in Astra Linux 1.7.5.