03 Oct

Postfix: how to disable local delivery

if you need to send emails from your Postfix server using MX records instead of local delivery you should leave the following line empty:

mydestination = $myhostname, localhost.$mydomain, localhost

in /etc/postfix/main.cf.
This way:

mydestination =

And restart the server:

/etc/init.d/postfix restart
25 Aug

How to minify HTML files

To provide best website performance it makes sense to minify static HTML files. There several ways to do that. One of the most easiest is to use django-htmlmin. To install run:

python-pip install django-htmlmin

To minify run:

pyminify index.html > index_minified.html

It would make sense to tar/zip files before you minify them.

You can also use it as a library for Flask and, obviously, Django. Check the documentation to get the details.

14 Mar

fail2ban setup on Centos

fail2ban is a simple daemon (written in Python, BTW) which monitors your Linux server logs and is able to prevent bruteforce attacks by adding bad IP addresses to iptables. This is a simple self reminder on how to setup it.

yum install fail2ban
vim /etc/fail2ban/jail.conf

If you want fail2ban to only notify you  (and not add them to iptables) modify the configuratio files this way:

action = sendmail-whois[name=SSH, [email protected], [email protected]]

It would be wise to add your IP addresses to be ignored:

ignoreip = 127.0.0.1/8

Start:

service fail2ban start

Enable auto start:

chkconfig fail2ban on

Now if somebody tries to brueforce your SSH you’ll get a mail.