From 509846fa0b9e27f7adec0895dcf351795814d7f4 Mon Sep 17 00:00:00 2001 From: Robert Langhammer Date: Sun, 24 Nov 2019 23:42:28 +0100 Subject: [PATCH] It is possible to DoS the server with massiv call of simple babelweb. Here we generate the dumpfile only once per minute and a short description top optimize apache2 on Debian (i don't know what you can do, if you use nginx) Signed-off-by: christiand Signed-off-by: Robert Langhammer --- README.md | 4 ++++ index.php | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1ce0abe..023707c 100644 --- a/README.md +++ b/README.md @@ -13,3 +13,7 @@ The haserl version for slim devices without php ### Requirements * haserl * netcat with ipv6 support + +## Apache 2 settings +To avoid OOM Killer it's usefull to reduce the MaxConnectionsPerChild on apache2. On Debian open /etc/apache2/mods-enabled/mpm_prefork.conf and reduce MaxConnectionsPerChild. +Do not use more then 10 MaxConnectionsPerChild per Gigabyte RAM on your System. diff --git a/index.php b/index.php index 6eb81f9..56b242b 100644 --- a/index.php +++ b/index.php @@ -23,7 +23,10 @@ '.$file.''); + + if (filemtime($file) < time()-10) { + shell_exec('echo "dump" | nc ::1 33123 -q 1 > '.$file.''); + } $file_handle = fopen($file, 'r'); $set=0;