handle xt_recent from syslog-ng 2

The solution from Block outdated clients won´t work with syslog-ng 3.4.2, because syslog-ng syslog-ng uses “lseek()” to get the end of /proc/net/xt_recent/something while the program() destination just starts the program. Withe the destination file you get log-entries like: Aug 29 00:00:44 mx03.schaal-24.de syslog-ng[20351]: Error suspend timeout has elapsed, attempting to […]


bash – remove last char(s) from string 1

The last character of a string is very easy to remove in bash. out=”remove last char!” echo “${out%?}” returns remove last char To remove the last two characters: out=”remove last char!” echo “${out%%??}” returns remove last cha or use out=”remove last char!” echo ${out:0:$((${#out})) – 2} to also get remove […]


change document root of mod_suexec

In mod_suexec, ‘document_root’ can not be changed because it is compiled directly. To change the default path of debian (/ var / www), you must either re-compile mod_suexec or even use the suexec-custom package. apt-get install apache2-suexec-custom After that, the directory can be changed in / etc/apache2/suexec/www-data: /srv/www public_html/php-fcgi # […]


php $_POST with special characters

I just wondered why $private_key=$_POST[‘pkey’]; doesn´t work, when I use a variable with AJAX, which also contains a +. The solution is surprisingly simple: PHP changes fields containing the characters space, dot and others to ensure compatibility with the (obsolete) register_globals. There are many workarounds. I use this function: function […]


Bash – using variables outside a while loop 2

The bash runs every loop (while or for) in a subshell. The values for a variable defined inside such a loop / subshell are not available outside. #!/bin/bash t=0 while read line; do   t=$(( t + 1 )) done < /etc/passwd echo $t Returns 0 for $t but inside the […]


secure MySQL-replication with stunnel 2

I use stunnel to secure my MySQL-replication. MySQL itself offers SSH, but it´s not so simple to install. If stunnel works on your sytsme, you can use it for much more daemons/ports (secure imap, pop3, http). With stunnel only the remote connects to the master server use the tunnel. Local […]


Simply disable IPv6

There are various possibilities to deactivate IPv6 on linux-systems. You can modify entries under /proc, experiment with the kernel modules or god knows what all. I prefer to add just one entry to the grub-option. So i can easily reactivate IPv6 with one step. ipv6.disable=1 After a reboot, the IPv6 […]


postfix with SPF (Sender Policy Framework) 1

To prevent faked sender-adresses i recommend to use Sender Policy Framework (see www.openspf.org/Introduction). You can easily add the SPF-Modul from openspf.org to postfix. You need these three perl-modules Mail::SPF Net::DNS::Resolver::Programmable NetAddr::IP After installing the requied modules, get the SPF-modul from here. Extract the archiv and copy postfix-policyd-spf-perl to /usr/lib/postfix kopiert. […]