avoid OOM
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 <fff@chrisi01.de>
This commit is contained in:
parent
d553bfc0df
commit
5b082a9509
10
README.md
10
README.md
|
@ -4,12 +4,10 @@ A very simple Babel Web for babeld v1.8
|
|||
|
||||
## index.php
|
||||
The php version for gateways
|
||||
### Requirements
|
||||
* php
|
||||
* netcat-openbsd (ipv6)
|
||||
|
||||
## babel.html
|
||||
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
|
||||
|
|
|
@ -23,7 +23,12 @@
|
|||
<?php
|
||||
error_reporting(0);
|
||||
$file="/tmp/babeldump";
|
||||
shell_exec('echo "dump" | nc ::1 33123 -q 1 > '.$file.'');
|
||||
|
||||
if (filemtime($file) < time()-60) {
|
||||
shell_exec("rm $file && touch $file");
|
||||
shell_exec('echo "dump" | nc ::1 33123 -q 0 > '.$file.'');
|
||||
echo "File generate";
|
||||
}
|
||||
|
||||
$file_handle = fopen($file, 'r');
|
||||
$set=0;
|
||||
|
|
Loading…
Reference in New Issue