This repository is an example of a custom KEA hook implementation. The hook implements a simple function to protect a DHCP server from DDOS attacks by setting a timer between user attempts to request an address.
The hook is implemented only for kea-dhcp4 service.
runtime-logging - Boolean type (by default: false). Determines whether to log lease rejection events from clients to the log file.
renew-rejected-addresses - Boolean type (by default: false). Determines whether the last address request timer should be updated even if the address was rejected by the server.
enabled - Boolean type. Determines the hook's operating status. False - disabled. True - enabled.
requests-interval-seconds - Unsigned Integer. Specifies the number of seconds after which the client is allowed to request the address again.
max-clients-storage-size - Unsigned Integer. While the hook is running, its memory stores information about users MAC addresses and the time of their last attempt to request an address. This parameter determines the number of clients that can be simultaneously stored in the hook's memory.
{
"enabled": true,
"runtime-logging": true,
"renew-rejected-addresses": true,
"requests-interval-seconds": 10,
"max-clients-storage-size": 100
}- Install kea-dev package (In Arch it is part of the KEA package, in other distributions it may be a separate package).
- Clone this repository
git clone https://github.com/sanua356/kea-hook-simple-ddos-guard.git. - Go to the repository directory
cd ./kea-hooks-simple-ddos-guard. - Make the build script executable
chmod +x ./build.sh. - Run build script
./build.sh(sudo rights may be required). - Find ".so" library in current directory.
- Clone KEA official repository:
git clone https://gitlab.isc.org/isc-projects/kea.git. - Clone current repository in KEA repository path
/src/hooks/dhcp/. - In file
meson.buildby path/src/hooks/dhcppaste new linesubdir('simple-ddos-guard'). - Run
meson compile -C buildin terminal. - After compilation the library file is located at the path
/build/src/hooks/dhcp/simple-ddos-guard.
MIT