OpenVPN for Mikrotik client

From this setup for OpenVPN Server on Ubuntu 16.04..

We need to unbolt some of the security features of the server config for Mikrotik compatibility.

I guess this isn’t explained in bright colours on their wiki examples cos they’re not proud of not being up with latest crypto. Which is more annoying cos it took a day, where as getting the server online took 20 minutes on a digital ocean instructional.

Continue reading “OpenVPN for Mikrotik client”

OpenVPN Server on Ubuntu 16.04

Following this guide.

NOTE 1: In the part where they edit /etc/openvpn/server.conf

I edited the server directive to read:

then my UFW rules are

# NAT table rules
# Allow traffic from OpenVPN client to ens3 (change to the interface you discovered!)
Continue reading “OpenVPN Server on Ubuntu 16.04”

Monitoring RPi Temp and CPU with Thingspeak

I made the following python script to update CPU Temperature and 5 minute average CPU load of my RPi to Thingspeak:

#!/usr/bin/env python
import subprocess
import httplib, urllib

GetTempCommand = "cat /sys/class/thermal/thermal_zone0/temp"
GetCPUCommand = "cat /proc/loadavg"

GetTempProcess = subprocess.Popen(GetTempCommand.split(), stdout=subprocess.PIPE)
GetTempOutput = GetTempProcess.communicate()[0]
Temp = float(GetTempOutput) / 1000
#print Temp
GetCPUProcess = subprocess.Popen(GetCPUCommand.split(), stdout=subprocess.PIPE)
GetCPUOutput = GetCPUProcess.communicate()[0]
CPU = GetCPUOutput.split()
#print CPU[1]

params = urllib.urlencode({'field1': CPU[1],'field2': Temp, 'key':'######'})     # use your API key generated in the thingspeak channels for the value of 'key'
# temp is the data you will be sending to the thingspeak channel for plotting the graph. You can add more than one channel and plot more graphs
headers = {"Content-typZZe": "application/x-www-form-urlencoded","Accept": "text/plain"}
conn = httplib.HTTPConnection("")                
    conn.request("POST", "/update", params, headers)
    response = conn.getresponse()
    data =
    print "connection failed"

The script is run every 5 mins using cron ($ crontab -e):

*/5 * * * * python "/home/ubuntu/logging/"

I borrowed some script from here and here.

Raspbian on RPi3 for NAS

Note: I have swapped the RPi3 for a RPi2 due to Ubuntu compatibility. Even the supported RPi2 with Ubuntu is proving problematic, I want to move to something more reliable.

Using a Western Digital PiDrive Cable to power the setup.
  • Raspbian comes with default user:pass = pi:raspbian so this needs to be changed
  • I confirmed SSH was installed and working.
  • Following these instructions;
    • I installed ufw
      sudo apt-get install ufw
      sudo ufw allow ssh
    • I confirmed NTP configuration.
  • Installed autoupdates, similar to this with different config.
  • Installed postfix, kind of like this.
  • the rest of the steps are basically the same that I used for Ubuntu – except that there isn’t a proper Ubuntu release for RPI3 yet.

RPi GPIO: Adding switches and lights


Create a pair of LED’s and push buttons on my RPi which can run scripts. ?One will shut down the Pi (updated here), the other will rsync a directory to a USB. Also I will read the status of a UPS. This may/will become more complicated since the UPS doesn’t have any useful interface (requiring an Arduino to:

  • Watch the UPS battery voltage and tell the RPi to power down.
  • Monitor whether mains power is applied.
  • Once mains is re-powered, restart the RPi after a UPS shut down using the hardware reset pins on the Pi.)
  1. As in these RPi ubuntu instructions I installed python.. I removed sudo from the last command to make the command output happy
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python-pip
pip install RPi.GPIO
  1. Initially I set up a breadboard as in this youtube video (using the linked files)
    from time import sleep
    import RPi.GPIO as GPIO
    GPIO.setup(12, GPIO.OUT)
    while 1:
     GPIO.output(12, False)
     GPIO.output(12, True)

    Continue reading “RPi GPIO: Adding switches and lights”

VPN Server on RPi Ubuntu

I installed OpenVPN on my RPi 2 running ubuntu 14.04 using these instructions. Initially it failed, the problem being that I hadn’t allowed UDP port forwarding on my WAN router…