Archive for the ‘Linux’ Category

Squid on custom port and SELinux – “Cannot open HTTP Port” problem

Posted on the May 8th, 2008 under IT, Linux by Konrad Żak

If you’d like to run squid on custom port i.e. 8080 with SELinux in enforcing state, be sure to set squid_disable_trans to on – it’s default set to off. Otherwise, squid will not be able to bind to port with “Cannot open HTTP Port” error.

[root@ulisses ~]# getsebool -a | grep squid_disable_trans
squid_disable_trans --> off
[root@ulisses ~]# setsebool -P squid_disable_trans 1
[root@ulisses ~]# getsebool -a | grep squid_disable_trans
squid_disable_trans --> on

Simple service watchdog

Posted on the January 15th, 2008 under IT, Linux by Konrad Żak

Recently I got some trouble with saslauthd unexpectly dying. Despite strong will to discover cause of problems I needed badly some kind of watchdog bringing dead service back to life. Yes, there is still inittab respawn at your disposal, but it has some major drawbacks.

Consider this simple shell script:

#!/bin/sh
# give the $4 service $1 seconds to start
sleep $1
# then every $2 seconds check if it's running by looking
# for $3 string in the list of processes...
# and if it's not running restart the $4 service
while true; do if [[ ! `ps -efw |grep -v grep |grep -v $0 |grep $3|awk '{print $2}'` ]]; then service $4 restart > /dev/null 2>&1;fi;sleep $2;done

It’s expected to run from /etc/rc.local like that:

/usr/local/bin/watchdog 60 60 saslauthd saslauthd&

SQLgrey Postfix greylisting service little fix

Posted on the January 29th, 2007 under Linux, Postfix by Konrad Żak

As SQLgrey 1.6.7 init script is always reporting success neverthless of real status of starting/stoping service. You’ll find patch solving this behavior attached.

Patch of sqlgrey-1.6.7 init file (init/sqlgrey in source distro)