UFW script for Logwatch

I enabled UFW on an Ubuntu server recently and started getting all manner of stuff in my logwatch reports. It activated a section called 'iptables' and started logging every line in syslog with [UFW BLOCK] in it. It was marginally interesting, but not really worth the space devoted to it, so I decided to write a little script to parse the UFW log and summarise the top Blocked Hosts and top Blocked Ports. Therefore I could easily see if there was a change in pattern.

Read more

Power Mutt usage.

I always install mutt when I'm setting up a server, mainly because I use it to send myself files from the command line, for local examination or archiving. Its quicker than using scp, ssh, or (heaven forbid) ftp. Plus you can use it in shell scripts. For example; But recently I was troubleshooting a server … Read more

Dos Boot Disks Under Linux

Sometimes you have no choice and you need to boot into a DOS boot disk — to upgrade your BIOS for example, or to run Seagate's SeaTools, as I had to recently. This can be a headache when you're using Linux. I was having issues with the SeaTools' own boot disk, as I wanted to … Read more

Viewing heavily commented config files

Just a quick one, as I haven't posted for a while. This is a cool trick for getting the juice out of heavily commented files. In particular I used this on /etc/samba/smb.conf, but also good for apache2.conf, php.ini etc. The magic is this. grep -v -e "^#" -e "^;" -e "^$" /etc/samba/smb.conf Basically, ignore all … Read more

Joomla and mysterious memory usage

I've been running a server which has a fairly busy Joomla site on it. The server has 2Gb RAM, and is running nginx, php5-fpm and mysql, and not much else. However it would run for a while and then the disk would start swapping out. Not a lot, but enough to cause a few issues. If I restarted the server, memory usage would start at something like this

>$ free
 total       used       free
 Mem:       2048036    1024048     1023988
 Swap:      4192960          0    4192960

After about a day it would look like this

>$ free
             total       used       free    
Mem:       2048036    1924048      73988   
Swap:      4192960          0    4192960

And eventually it would have a flurry of activity which would make it look like this

>$ free
             total       used       free    
Mem:       2048036    1924048      23988   
Swap:      4192960       4567     4188393

Read more