Linux

Testing SSL on the Commandline

This is a useful one for testing dovecot when setting up SSL: openssl s_client -connect localhost:993 -quiet If you get a ‘Connection Refused’, you have my permission to swear loudly. For me, the C bomb echoed around these four walls several times.

SMS Alerts with Nagios

I use Nagios a lot. If it’s not for the peace of mind that I know that my, and my clients infrastructure is monitored, its for the obsessive compulsiveness of the statistics. Admittedly, stats-wise I use Munin now, however, for monitoring everything I use Nagios. One of the awesome things about Nagios is how you can configure it to do various things…

Monitoring SSL Certificate Expiry in Nagios

Ok, so this is a little quick and dirty, but it does what is needed. Perhaps if I was not in such a rush I could create something better. Create a file called check_ssl with the following, preferably in the same location as your nagios plugins, or somewhere sensible (and make note of the full path for later): #!/usr/bin/php <?php $hostname =…

Enable HTTP2 in Apache

HTTP/2 is the second major version of the HTTP protocol used by web servers. It is based on Google’s SPDY protocol. It is the first new version of HTTP since HTTP 1.1, which was standardised way back in 1997. By the end of 2015, most major bowsers (Chrome, Opera, Firefox, Internet Explorer 11, Safari, Amazon Silk and Edge) added HTTP/2 support by the end of 2015. At…

Quick and Dirty Rundown for PSAD

This is a very quick and dirty rundown on what to do to set up PSAD to manage blocking naughty people. There are lots of guides with a lot of fluff. This is a bare-bones, no-BS version of this. I have run this through Ubuntu 16.10, but you may be lucky! sudo iptables -P INPUT ACCEPT sudo iptables -F sudo iptables -S…

PHP Error Reporting

If PHP is not reporting errors within an application (say for example a built-in error handler, or suppression), the following can be added to Apache’s vhost file: php_admin_value error_reporting 6135 php_admin_value display_errors 1 However, if you do not have access to the vhost, the following lines can be added to a .htaccess file within the script’s location: php_value error_reporting 6135 php_value display_errors…

Extracting a table from a gzipped SQL Dump

The following snippet can be used to extract a table from a MySQL backup file created with mysqldump. It is ideal when working with massive databases, and is something I use once in a while myself. zcat backupfilename.sql.gz | sed -n -e ‘/CREATE TABLE.*`tableToRecover`/,/CREATE TABLE/p’ > tableToRecover.sql If you wish to extact a table, and re-gzip it, the following will be more…