Whitelist a host when using denyhosts

I’m using this excellent tool on my hosting server called denyhosts. It basically scans trough auth.log for repeated failed attempts to login in order to block brute force attackers. It can also get a list of offending ip-s from other usesrs of DenyHosts who configured their instalation to share attacker ip’s. All nice and well until you mistype your password one to many times. Or 127.0.0.1 gets added to the list like it happened today for me. So, you need to add a few ip’s to a whitelist.

It’s easy. Create a file called allowed-hosts in /var/lib/denyhosts or whatever you set your work dir for. Inside this file you can list ip’s that should be whitelisted.

Easily send mail from a bash script

Did you ever need to have e-mail’s sent from within a bash script? Maybe alert you of errors encountered? Me too.

Here’s an easy way on how to do it:

Did you ever need to have e-mail’s sent from within a bash script? Maybe alert you of errors encountered? Me too.

Here’s an easy way on how to do it:
[ccNe_bash]
#!/bin/bash
# email send script example
#
# subject of email
SUBJECT=”BASH SAYS HELLO”
# destination
EMAIL=”user@yourdomain.com”
# Email body
EMAILMESSAGE=”/tmp/messagebody.txt”
echo “Email sent from BASH” > $EMAILMESSAGE
echo “Another text line” >> $EMAILMESSAGE
# send message using /bin/mail
/bin/mail -s “$SUBJECT” “$EMAIL” < $EMAILMESSAGE
[/ccNe_bash]
Easy.

Configure the behaviour of backspace in Firefox for Linux

It’s a mystery for me why on windows firefox developers have conceived one use for backspace and another for firefox on linux.

If you are coming from windows and moving onto linux you might be used to press backspace to go back one page in Firefox. Well you’re in for a small surprise – id doesn’t work.

You need to go to about:config

browser.backspace_action as either 0 or 1.

0 means that the backspace button will go back a page in the session history
1 means that pressing the backspace key will scroll up one page in the current document

Mobile formula one site and application

Hey,

I used up until last race the nice live-f1 application to see live timings in the linux terminal. But starting with the last race I couldn’t. But today I got great news. The official Formula 1 website just released a mobile version available at mobile.formula1.com and oh joy and happiness they also released a mobile application that will offer Live Timings on your mobile phone.

To my biggest surprise, my symbian based Nokia E71 is supported. I seriously awaited to only see android and iphone there because they are all the rage. I suppose it’s because Formula 1 is much more popular in europe. Anyways I have live timings on my phone for free now.

Also many more services are available for your phone for free – like sms text services – that I find very nice.

So have fun !

Authentication problems with postfix, courier, mysql and virtual domains

I outgrew my shared hosting and decided to go for a dedicated virtual server. I chose Linode but I will leave that for another article.

I decided to use postfix + courier + mysql and virtual domains for my mail setup. Everythig was configured fine and dandy according to the documentation. But I kept getting this in the logs:
[ccNe_bash]
Mar 6 13:54:42 saslauthd [5734]: pam_mysql – required option “db” is not set Mar 6 13:54:42 saslauthd [5734]: DEBUG: auth_pam: pam_authenticate failed: Error in service module
Mar 6 13:54:42 saslauthd [5734]: do_auth : auth failure: [user=test@xxxxxxx.com] [service=smtp] [realm=xxxxxxx.com] [mech=pam] [reason=PAM auth error]
[/ccNe_bash]
I went over the config files over and over again searching for mistakes, because I usually mix something up but nothing worked. After some time I realized that the error “db” not set is more important than I thought. It meant that it’s not about wrong passwords copied from examples.

Well, the problem was that in /etc/pam.d/smtp  the password for the mysql user cannot contain the # character. And my password had. I have used a random password generator and by luck it contained a #. Everything after that was ignored, that’s why it said db not set. That’s a lost hour for nothing. Everywhere elese in the many config files containing this password it’s ok to have a # but not here.