DDNS (Dynamic DNS) on Cloudflare (using your own domain name)

There are a number of dynamic DNS services available to set up in your home router, its easier to remember a domain name than a dynamically changing IP address.
Often you will create a hostname based on the DDNS providers domain name.

If you have your own domain name and a raspberry pi at home then this may be for you.

Amongst the many services offered by Cloudflare their DNS hosting is of interest to me.
For personal web sites they offer a BASIC plan for free.
By using their API I can change a DNS records using a script on the raspberry pi in my home office.

I obtained the following script from here,
https://gist.github.com/benkulbertis/fff10759c2391b6618dd

#!/bin/bash

# CHANGE THESE
auth_email="[email protected]"
auth_key="c2547eb745079dac9320b638f5e225cf483cc5cfdda41" # found in cloudflare account settings
zone_name="example.com"
record_name="www.example.com"

# MAYBE CHANGE THESE
ip=$(curl -s http://ipv4.icanhazip.com)
ip_file="/path/to/ip.txt"
id_file="/path/to/cloudflare.ids"
log_file="/path/to/cloudflare.log"

# LOGGER
log() {
    if [ "$1" ]; then
        echo -e "[$(date)] - $1" >> $log_file
    fi
}

# SCRIPT START
log "Check Initiated"

if [ -f $ip_file ]; then
    old_ip=$(cat $ip_file)
    if [ $ip == $old_ip ]; then
        echo "IP has not changed."
        exit 0
    fi
fi

if [ -f $id_file ] && [ $(wc -l $id_file | cut -d " " -f 1) == 2 ]; then
    zone_identifier=$(head -1 $id_file)
    record_identifier=$(tail -1 $id_file)
else
    zone_identifier=$(curl -s -X GET "https://api.cloudflare.com/client/v4/zones?name=$zone_name" -H "X-Auth-Email: $auth_email" -H "X-Auth-Key: $auth_key" -H "Content-Type: application/json" | grep -Po '(?<="id":")[^"]*' | head -1 )
    record_identifier=$(curl -s -X GET "https://api.cloudflare.com/client/v4/zones/$zone_identifier/dns_records?name=$record_name" -H "X-Auth-Email: $auth_email" -H "X-Auth-Key: $auth_key" -H "Content-Type: application/json"  | grep -Po '(?<="id":")[^"]*')
    echo "$zone_identifier" > $id_file
    echo "$record_identifier" >> $id_file
fi

update=$(curl -s -X PUT "https://api.cloudflare.com/client/v4/zones/$zone_identifier/dns_records/$record_identifier" -H "X-Auth-Email: $auth_email" -H "X-Auth-Key: $auth_key" -H "Content-Type: application/json" --data "{\"id\":\"$zone_identifier\",\"type\":\"A\",\"name\":\"$record_name\",\"content\":\"$ip\"}")

if [[ $update == *"\"success\":false"* ]]; then
    message="API UPDATE FAILED. DUMPING RESULTS:\n$update"
    log "$message"
    echo -e "$message"
    exit 1 
else
    message="IP changed to: $ip"
    echo "$ip" > $ip_file
    log "$message"
    echo "$message"
fi

Locate the file in
/usr/local/bin/

Create a cron entry
*/2 * * * * /usr/local/bin/cf-ddns.sh >/dev/null 2>&1

This will run the script every 2 minutes.

Outlook (Protected View) has stopped working

When I try to open a Microsoft Office email attachment from within Microsoft Outlook 2016 on Windows 10 on my Microsoft Surfacebook.

I receive the following error dialog:

(Protected View) has stopped working

followed shortly after by this:

this file is corupt-crop

and the file fails to open.

This appears to be related to a bug introduced recently, I haven’t been able to identify exactly when.

The solution for now is to Disable hardware graphics acceleration in Outlook 2016

  • Go to Outlook
  • Click the File tab, then Options and then Advanced
  • Scroll down to “Display” and check the “Disable hardware graphics acceleration” option

Outlook 2016 Option Dissable Hardware Graphics AccelerationNot a great fix I know, but it lets you carry on working without disabling the protected view setting.

 

 

 

SCO Openserver 5.05 add a default route

I needed to add a default route to my SCO Openserver 5.05 box. I used the following command
route add default 192.168.4.3 (192.168.4.3 is the main router on my network)

To make this persistent I then edited /etc/tcp, searched for the word “ifconfig” and added the line after the ifconfig statements.

/etc/route add default 192.168.4.3

This will not however, survive an upgrade. (This is an old box, so I don’t expect I will be upgrading)

There is an article here that gives a much more detailed description and further options.

http://aplawrence.com/SCOFAQ/FAQ_scotec4defaultroute.html

Airbus A380 Business Class Bar

This is the passenger bar at the back of business class at the upper deck of the Emirates Airbus A380. Its amazing, as well as the usual selection of drinks cocktails nibbles they have a hot snacks menu, as my son said, its a pub at the back of the plane.

The stewardess  suggested she  take my photo.

This really is an excellent aircraft, and the staff are always great.