rsyslog selective logging with multiple postfix instances

Scenario – one Linux box runs multiple Postfix instances. By default they all log to /var/log/mail.log which makes it difficult to see what’s going on without using grep and so on. The server already uses rsyslog, and Postfix is configured to specify a syslog_name to each instance. i.e /etc/postfix-blah/main.cf contains “syslog_name = postfix-blah” rsyslog allows… Continue reading rsyslog selective logging with multiple postfix instances

SSL Commands

I keep forgetting these one line OpenSSL commands – perhaps if they are here, I’ll remember — Create private key file : openssl genrsa -out server.key 2048 Create certificate signing request (to send to e.g. GoDaddy) – openssl req -new -key server.key -out server.csr  Verify a certificate – openssl verify file.name To convert a .crt… Continue reading SSL Commands

MySQL table defragmentation (python script)

I’ve written the below Python script to defragment MySQL database tables. This should work with both InnoDB and MyISAM table formats, and is just calling “OPTIMIZE TABLE blah.foo”. It rummages through the information_schema for tables which may be defragmented. You should be able to run it on any Debian based system without making any alterations.… Continue reading MySQL table defragmentation (python script)

Chocolate headed pirates

My son woke up at 6am crying quite loudly this morning – he’d been having a nightmare involving a Chocolate Headed Pirate being mean and nasty to him. Personally I think a chocolate headed pirate would be quite tasty – although perhaps it’d be a bit more than I could eat in one sitting (or… Continue reading Chocolate headed pirates

Spring trip to Barcelona

I made this.... sort of.

Well, sort of random. As I don’t normally bother to upload any pictures and so on, I thought I might as well for once – and I said I’d send my father a postcard, but then failed to …. perhaps this will make up for it. I didn’t notice any postcard selling shops either – perhaps… Continue reading Spring trip to Barcelona

WTFs per minute

I’m currently refactoring some legacy third party PHP code, and as the old saying goes, the real metric is WTFs per minute. So, just to entertain any readers, how about : Writing pagination links for a search form, but if there are more than 20 pages of results, add 20 onto whatever the maximum number… Continue reading WTFs per minute

Solr and WordPress (instructions/howto)

This is for Tomcat5.5 (on Debian Lenny), WordPress 3.1 and Solr 3.4. The intention is to use the solr-for-wordpress plugin (see github ). Lenny does include a Solr package (v1.2) which is somewhat outdated (and not supported by the upstream solr-for-wordpress wordpress plugin, hence we can’t use it). Install Tomcat (and Java) apt-get install sun-java6-jre… Continue reading Solr and WordPress (instructions/howto)

wp-mobile-detector is insecure (wordpress plugin)

It seems installing the wp-mobile-detector plugin on your wordpress site is a bad idea {tm} A customer’s web server has the following requests in it : [24/Aug/2011:02:10:47 +0100] “HEAD /wp-content/plugins/wp-mobile-detector/timthumb.php?src=http://superflickr.com.nu/index.php HTTP/1.1” 200 – “-” “Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.7.12) Gecko/20050919 Firefox/1.0.7” [24/Aug/2011:02:10:48 +0100] “GET /wp-content/plugins/wp-mobile-detector/cache/27a44a2d2bea4a693389c325a1125aa6.php HTTP/1.1” 200 52 “-” “Mozilla/5.0 (Windows; U;… Continue reading wp-mobile-detector is insecure (wordpress plugin)

Slim Framework – using middleware for page caching in the front controller

The SlimFramework is a ‘minimal’ PHP5 framework. We’re using it in one project, integrating with Smarty, Propel and the Zend Framework (as I don’t like Zend_View, it didn’t seem worth using Zend_Controller_Action, although what we do have is very similar to one). Anyway, when creating your front controller in Slim, you can define ‘middleware‘ (i.e.… Continue reading Slim Framework – using middleware for page caching in the front controller