Turning off ipV6 in Ubuntu 16

My home router doesn’t handle IPv6, and for that matter, neither does my ISP, so I get a lot of IPv6 related garbage in my syslog and kern.log. To turn it off, you need to create a new file, rather than editing a system file, and then reload these settings.

sudo nano /etc/sysctl.d/95-disable-ipv6.conf
#add the following lines
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
# reload kernel parameters
sudo service procps reload
# Check that its taken ... the result of this should be 1
cat /proc/sys/net/ipv6/conf/all/disable_ipv6

Nice.

Secret WordPress Options Page

OK, so maybe its not a complete secret, but after around 10 years of running WordPress I only just found out about it. Here it is:

http://domain.com/wp-admin/options.php

Obviously you have to be logged in as admin. This basically gives you access to the wp_options table without having to go to a separate database management app, or do some mysql command line ninja.

Who knew? Its not on a menu, probably to hide it from fat fingers, but hey, I wish I’d known about this earlier. Would have saved me a few hours over the course of my work life.

Blocking irritating PLDT Billing popups

So you forgot to pay your bill. It happens. PLDT used to set an automated phone call to call you once a day until you paid. Now they have something much more irritating, and something that feels borderline illegal. What they do is they hijack your internet connection. Every four or five page loads, they inject an HTML frame with a monster ad, which sits on top of all your work. You have no choice but to click on the button which takes you to a page with the amount you owe (which means they know which IP is your account BTW).

However there is no way to remove the popup, which sits on top of your browser. There is no ‘close window’ button, which means your only choice is to refresh the page, or close the window and re-open it. Too bad if you were working on something and hadn’t pressed the save button: that’s now gone. And even after you pay, the popup sticks around for a day or two … (how hard can it be to automatically cancel it?)

So how do we block it? The frame is an iframe which uses an IP address 210.213.253.135, so we can’t use DNS blocking or hostfile blocking. So changing the routing table seems to be the way to go.

On Linux, using sudo if necessary:

# check routing table
route -n
# Add rule
route add 210.213.253.135 gw 127.0.0.1 lo
# check routing table again
route -n
# check desired result
ip route get 210.213.253.135

Gotcha

Getting logwatch to print out a list of apt packages with upgrades

Useful one to have appear in your inbox in the morning. Have just done this on a server, so I thought I’d put it here to remind myself. This works for debian and Ubuntu variants, which have the apt command (a meta-script for the apt-get ecosystem)

In note form …

Add the following text to /etc/logwatch/scripts/services/apt

#!/bin/bash
/usr/bin/apt list --upgradable

Add the following text to /etc/logwatch/conf/services/apt.conf

# The title shown in the report.
Title = "Packages to upgrade"

# The name of the log file group (file name). 
# e.g for /etc/logwatch/conf/logfiles/apt.conf, we'd have Logfile = apt
LogFile = NONE

As we have NONE there, we don’t need to create /etc/logwatch/conf/logfiles/apt.conf.

mysql root password reset … for systemd

There are a lot of posts around telling you how to update mysql root password. “Simple!,” they cry, “just start mysqld_safe, and use mysqladmin …” But wait, what’s that? You don’t HAVE mysqld_safe? Well the chances are,  you’ve got one of these new fangled systemd systems, where everything is ass backwards.

Then you went and tried to run mysqld as root didn’t you? That didn’t work either. Read on …

Read more