18 May

Vim: vim behaves as vi and drives you nuts – how to fix

For some reason vim on Debian went crazy and stopped worked as vim. This is how to make it work like vim instead of vi.

cp /usr/share/vim/vim74/vimrc_example.vim ~/.vimrc

and change

" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
set mouse=a
endif

to

" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
set mouse=r
endif

Hooray.

18 Aug

Workaround for ‘/usr/lib/rpm/debugedit: canonicalization unexpectedly shrank by one character’

There’s a bug in rpm package: https://bugzilla.redhat.com/show_bug.cgi?id=304121

It causes the following error while building rpm packages:

/usr/lib/rpm/debugedit: canonicalization unexpectedly shrank by one
character

As a workaround you can use this command:

rpmbuild -bb rpmbuild/SPECS/package.spec -D 'debug_package %{nil}'

It will disable building of debug package and that’s it.

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.