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.

 

 

 

Spring Project – Garage Alteration

We need to create a little extra space at home and the garage is a just somewhere to unnecessarily hoard the things I cant make the final decision to dispose of. In addition the garage flat roof now needs replacing

Changing the garage into a comfortable room we can use as a home office / spare bedroom (with sofa bed) is both convenient and relatively inexpensive.

To do this we intend to bring forward the front of the garage (by approx 3.30m) to create a sheltered alcove over the front door by extending the roof-line down.

As the existing pebble dashing is pretty poor around the existing front door and although we would love to replace all the pebble dashing, for now, We want to keep the cost down. If we select a nice brick for the garage extension we can also replace the facing brick around the font door and adjacent window to match.

Parking

I think we need to maintain at least two off-road parking spaces under the local planning guidelines, bringing the garage forward impacts on the current parking arrangements. Widening the existing gateposts and extending the driveway into the existing lawn area will achieve this ( i don’t enjoy cutting the grass anyway)

Garage Roof

If we where to form a normal roof pitch against the west elevation of the house the top of the new roof would cover the windows on this elevation. to avoid this, if we only pitch the roof to a point beneath the large landing window we maintain the natural light from these. This will leave us with a very shallow roof pitch.

To ensure the south elevation looks pleasing, I have extended the existing roof pitch down over the front door and across the front of th e extension, therefore the garage roof looks like an extension of the front porch area.

I have put our ideas down using Google Sketchup, they are not exactly to scale, but very close.
If you have Google Sketchup installed on your computer you can download my original drawings here for the existing and the proposed

Existing - ISO Drawing
Existing - ISO Drawing

 

Existring - South Elevation
Existring - South Elevation

 

Existing - West Elevation
Existing - West Elevation

 

Existing - North Elevation
Existing - North Elevation

 

Existing - Plan Drawing
Existing - Plan Drawing
Proposed  - ISO Drawing
Proposed - ISO Drawing

 

Proposed  - South Elevation
Proposed - South Elevation

 

Proposed  - West Elevation
Proposed - West Elevation

 

Proposed  - North Elevation
Proposed - North Elevation

 

Proposed  - Plan Drawing
Proposed - Plan Drawing