Colourful Norwich skyline illustration

Michael Sage

IT, Digital & Culture

Flic HTTP request with Authentication

When you are wanting to use the HTTP request within Flic it doesn’t work using the standard user:pass@host. So you have to do a little more work…

  • Add your URL which for me was http://xxx.xxx.xxx.xxx/relay/0?turn=toggle to turn a light on or off in the garage.

  • stick with GET http method (or which ever suites)

  • under the HTTP headers, set up basic authentication i.e. type “Authorization” in the Key field of the app

  • encode your “user:password” string using base64 (I used base64encode.org for online base64 encoding)

  • Prefix the encoded string with “Basic ” including a trailing space

  • “Basic YWRtaW46YWRtaW4NCg==” is encoded “admin:admin” as an example. Key or paste all of this into the Value field in the FLIC app

  • Press the save button.

  • Press DONE to ensure all saved away

OPNsense + NextCloud Backup – Windows Client Issue

OPNsense backups contain a special character, in this case “:”. Which while most operating systems tolerate it causes an issue with the Windows NextCloud client and it is unable to sync. The developer has a very good point in that this isn’t a OPNsense issue, but a NextCloud / Windows one for not respecting, or being able to deal with special characters. However, all is not lost, there is a tiny modification you can make to one file on the OPNsense server to make everything OK!

First log into the shell on the OPNsense box (option 8 on the console GUI)

If you don’t have an editor installed you can use vi, or you can install nano

pkg install nano

Open the file

nano /usr/local/opnsense/mvc/app/library/OPNsense/Backup/Nextcloud.php 
Change line 132 from
$configname = 'config-' . $hostname . '-' .  date("Y-m-d_h:m:s") . '.xml';
to
$configname = 'config-' . $hostname . '-' .  date("Y-m-d_H-i-s") . '.xml';
This changes the “:” to a “-“, but you could change this to anything you like. Save the file, job done!

Remember it is likely this will get overwritten with updates to OPNsense so I recommend you check the file after every update!

Public Sector Podcast

Public Sector Podcast

In last May I was invited to speak on “The Public Sector Pod”, a podcast that focuses on digital transformation in the public sector.

I really enjoyed having the chance to talk about a subject that I feel very passionately about, digital transformation in the public sector. I was allowed to chat about the successes and failings we had experienced at Chelmsford as well as the future. 

You can find the podcast here!

June 2020 Update

June 2020 Update

The year is now 2020 and things have changed in the smart home. After a lot of soul searching I decided it was time to remove lightwave from the setup, the product hasn’t really moved with the times from it’s promising start, it felt old, expensive and stagnant. I replaced all my remaining lightwave switches and plugs with products from sonoff, some of them are running the custom tasmota firmware others are still running the default sonoff firmware, I am likely to start buying Shelly stuff as it becomes available in the UK because of its flexibility. 

I am also really interested in Broadlinks new offering especially the zero app series that is likely to arrive in the UK in the next few months. I have added a couple of NEOS cameras to watch Hollie while I am at work these integrate nicely with Alexa and I now have a Show 8 and Show 5 to make use of video based skills. 

My hue install has grown and now covers the garden as well as the house, an additional govee ambilight has been added to the TV, and although it integrates with Alexa, it mainly stands alone.

Alexa has expanded to include my car using the Echo Auto and the control outside of the house is a nice feature, with geolocation it could become almost as game changing as the original echo.

I have migrated from the Unifi USG to OPNsense. With the promise of BT FTTP coming in the next couple of months and continuing issues with the USG (it just isn’t powerful enough to do everything it says it can). I decided to move back to OPNsense (I moved from pfSense to OPNsense about 5 years ago when I didn’t like the way pfSense licensing was heading).

Duo ByPass

To bypass duo 2fa for a script or secure login etc on Linux you simply need to add the following to your SSHD PAM config (/etc/pam.d/sshd)

auth    [success=2 default=ignore]      pam_access.so accessfile=/etc/security/access-local.conf

You will then need to create the access file and put your rules in for example

+ : ALL : 192.168.1.0/24
- : ALL : ALL

For information on the access file, see here

Nagios Core Upgrade

Ubuntu

Stop Service / Daemon

This command stops Nagios Core.

===== Ubuntu 14.x =====

sudo service nagios stop

 

===== Ubuntu 15.x / 16.x / 17.x / 18.x =====

sudo systemctl stop nagios.service

 

Downloading the Source

cd /tmp
sudo rm -rf nagioscore*
wget -O nagioscore.tar.gz https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.4.1.tar.gz
tar xzf nagioscore.tar.gz

 

Compile

cd /tmp/nagioscore-nagios-4.4.1/
sudo ./configure --with-httpd-conf=/etc/apache2/sites-enabled
sudo make all

 

Install Binaries

This step installs the binary files, CGIs, and HTML files.

sudo make install

 

Install Service / Daemon

This installs the service or daemon files. While these will already exist they do get updated occasionally and hence need replacing.

sudo make install-daemoninit

 

Update nagios.cfg

If you are upgrading from Nagios Core 4.3.2 and earlier you will need to update the nagios.cfg file to point to /var/run/nagios.lock using the following command:

sudo sh -c "sed -i 's/^lock_file=.*/lock_file=\/var\/run\/nagios.lock/g' /usr/local/nagios/etc/nagios.cfg"

More information about this is detailed in the following KB article:

Nagios Core – nagios.lock Changes In 4.3.3 Onwards

 

Start Service / Daemon

This command starts Nagios Core.

===== Ubuntu 14.x =====

sudo service nagios start

 

===== Ubuntu 15.x / 16.x / 17.x / 18.x =====

sudo systemctl start nagios.service

 

Confirm Nagios Is Running

You can confirm that the nagios service is now running with the following command:

===== Ubuntu 14.x =====

sudo service nagios status

 

===== Ubuntu 15.x / 16.x / 17.x / 18.x =====

sudo systemctl status nagios.service

 

Confirm Nagios Version

You can confirm the nagios version being used with the following command:

sudo /usr/local/nagios/bin/nagios -V

 

This will output something like:

Nagios Core 4.4.1

December 2018 Initial Post

My Smarthome Adventure

I have been thinking about writing a blog post about the smarthome things I have been doing for a while. When I sat down to write it I realised it was more than a single post. I have tried and tested all the technologies below. These form the basis of my own smarthome.

I have done a few installs for friends and family (and a couple of customers). So… here we go!

Where to start?! I will be looking at this chronologically, this isn’t the way I would do it now!

This journey properly started about 10 years ago when I started to install lightwaverf bulbs on my hall and landing with sensors that automatically turned the bulbs on. This was to stop having to leave the landing room light on all night. I built the lightwave solution up to include sockets and other lights. This was way before Alexa! I was using TP-Link switches and a pfSense firewall. These are great solutions for starting out on.

I then added the Logitech Harmony hub to consolidate all my various remotes. At this point there was no central management just a collection of mobile apps that all worked on their own and were really good point solutions.

Then the world changed… Alexa was born, by this point the company I work with had moved to ubiquiti, I migrated my home network to unifi switches and access points. 

I was given an Echo dot and it immediately changed the game, lightwave and logitech had Alexa skills. I could control the two together, build routines that included the TV, Xbox, DVD player and the lights / plugs.

I upgraded my smart heating to a Wiser product that had an Alexa skill. Replacing a Salus system, that was smart but no skills for Alexa.

Then in early 2018 I purchased a hue hub and a couple of bulbs, since then I have migrated all my lights to hue. The Philips solution is expensive but there is nothing quite as integrated or sophisticated.

Late 2018 saw the addition of a Broadlink mini IR blaster to control TVs elsewhere in the house.  Nowhere near as comprehensive as the logitech, but a lot cheaper.

In 2018 I also began “hacking” the systems to make them work the way I wanted. This included IFTTT to set routines, ESP boards to make custom solutions, AWS including their IoT button to build services around ESP custom actions. Finally I added some NFC stickers to trigger certain routines, such as turning off all the lights or joining our guest wifi network. 

Local Gov Strategy Forum​

Local Gov Strategy Forum

Like many of these events I felt a certain amount of resignation as the date approached. These events seem like a good idea when you book yourself on them. Then as they get close you realise you are still in local government and you are still considered a force for change and modernisation over 10 years since you started in the industry.

Well… I was really surprised when for the first time the people I met and spoke to were all excited by change in the sector, in part this has been forced upon a number of authorities due to budget cuts, but once they start looking they see the real benefit of cultural and technology transformation for their residents and staff. 

Of course this event was sponsored, and there were a few of the normal suspects peddling their frankly b/s wears to an already jaded public sector, but for the first time ever, I took two business cards and didn’t file them in the round file! I even have two post even meetings booked in.

Here’s to local government and them finally getting it… guess I better start looking at a career change.