Mittwoch, 30. Januar 2013

inetd superserver client ip retrieval

If you have ever used the internet superserver inetd and connected it to a bash script and wondered how to retrieve the ip and port of the client, here is the solution:

/etc/inetd.conf
666 stream tcp nowait root /opt/client_ip.sh

/opt/client_ip.sh
#!/bin/bash
read ip port <<< `getpeername`
# $ip now contains the ip
# $port now contains the port


Maybe you need to apt-get install tcputils to install getpeername.

Sonntag, 27. Januar 2013

Horde spitting out 404 on task creation

As I recently setup a server with Debian Squeeze and some groupware stuff, there was but one little problem, creating a new task in horde lead to a solid 404 on "horde/nag/t/save". Abusing Google in order to find a solution often lead to people suggesting one should enable mod_rewrite, but it was already enabled.
Another approach was changing AllowOverride directive on the vhost from none to all. But guess what, that was also correct.
So I had to investigate a little bit myself and found out that the
/usr/share/horde/.htaccess
file was missing a RewriteBase.

So in a nutshell, make sure /usr/share/horde/.htaccess looks somewhat like this:

# IMPORTANT: DO NOT EDIT THIS FILE!
# It will be overwritten with any future upgrade.

allow from all

<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteBase /horde
   RewriteCond   %{REQUEST_FILENAME}  !-d
   RewriteCond   %{REQUEST_FILENAME}  !-f
   RewriteRule ^(.*)$ rampage.php [QSA,L]
</IfModule>

Why this thing?

Because I often stumble across blogs containing solutions for my admin related problems and thus I thought, well maybe I'll give something back, so here it is.