JSON Parsing Nagios Script

Reading Time: 2 minutes

Parsing JSON in Bash is never usually the best idea but sometimes it may be necessary or preferred. Here’s a nice easy script which uses the ‘jq’ command to perform JSON parsing in Bash.

imgres

Let’s imagine you have the following JSON which is outputted by a stats gathering process:

{"web_rate":1,"db_rate":2,"php_rate":2}

Parsing that in Bash by writing some regex’s etc is perfecting possible but there’s an infinitely easier way. Welcome to ‘jq’. Let’s see it in action.

Read More »

Useful to know Bash parameters

Reading Time: 3 minutes

Even having written many hundreds of Bash scripts over the years I sometimes forget the basic special parameters which are available. For that reason I’ve made this post which is a copy of the page from gnu.org.

bash-logo-web

Read More »

Prevent apcupsd shutting down the OS

Reading Time: 1

If you have an APC UPS you may not, for whatever reason, want the OS to trigger a shutdown. The ‘apcupsd’ package will call shutdown whenever the battery capacity is reported too low. To prevent this, just edit the following file.

8c516a38-5056-ae36-fe9e72b8749700c8_pr

Read More »

How to download iplayer content on Linux

Reading Time: 16 minutes

Here is a very simple way to download iPlayer content using a Linux command line tool. This literally downloads the stream and saves it to a file. The best part is, because they’re not DRM protected, you can keep it forever.

bbc-iplayer-logo

Continue reading

How to resize a VirtualBox disk

Reading Time: 1

Very quick post on how to resize a VirtualBox virtual disk.

virtualbox

 

When using QCOW based disks with Virtual Box there’s no automagic method for resizing the disks. Because of that you first have to convert it. Here’s the commands you need…

Read More »

That’s not a server, THIS is a server!

Reading Time: 11 minutes

I thought a wee article on what a server is and why they are expensive compared to your average PC might be interesting. When you hear someone say they have built a server for the house what they usually mean to say is they’ve built a PC and have it running various applications which serves ‘stuff’. A real server is a different beast all together.

bullion26_profi_reduced607x350

So what makes a server a server? It boils down to the hardware feature set. Sure, you can get low-end servers which are nothing more than a PC in a fancy rack mount chassis, but lets take a look at higher end goodness.

Read More »

How To Create a Tor Exit Node

Reading Time: 8 minutes

This will be a quick tutorial on how to configure an Exit Node for the Tor Network. Doing this comes with some inherent risks for the operator but exit nodes are essential for bridging Tor with the ‘clear net’. Without exit nodes, anyone suffering from ISP filtering or those not wishing to have their Internet activity logged (BBC Article) couldn’t utilise Tor to access the Internet.

tor-exit

Unlike bridges, exit nodes (and normal relays) are publicly known devices, for which their IP address and configuration is available for anyone to see. They effectively make the final connection to the destination on behalf of the originating (anonymous) client. The Tor network is drastically short of exit nodes, but for good reason. Because they are the final hop in the chain, they will be making hundreds of outbound connections to whatever website or service Tor users request. It is therefore easy for the powers who be to blame an exit node operator for ‘doing bad things’ when in fact their node is merely participating in a network, much like a traditional router would in any network. Anyway, assuming you have balls of steel and willing to run an exit node I’ll take a look at how to do this with least hassle as possible.

Read More »

How To Configure Tor On Your Network

Reading Time: 11 minutes

Tor (‘The Onion Router’) is by far the most popular solution for anonymous browsing, with over 6000 relays and 2.5 million active users.  I’m going to look at how to configure Tor on your network, in a variety of ways. The so called ‘Dark Web’ seems to get a bad press, maybe because of illegal sites like Silkroad, but it’s actually an invaluable resource for citizens or visitors to countries who have severe Internet censorship (including the UK!). Even Facebook has a .onion address, as does the DuckDuckGo search engine and Aphex Twin’s ‘Syro’ album.

tor-logo

By far the simplest and most secure way of using Tor is to install the Tor Browser. It’s dead simple and takes literally a few minutes. However, depending on your goal, there are other ways to use Tor. I’m going to look at a few ways to deploy Tor, including the pros and cons of each. These are:

  • Using the Tor Browser Bundle
  • Configuring a Tor SOCKS proxy
  • Creating a transparent Tor network

Read More »

How To: FreePBX on Raspbian

Reading Time: 4 minutes

FreePBX is an opensource front-end for the Asterisk VoIP solution. It can be installed on a Raspberry Pi via a prebuilt image but what if you want to use it directly on Raspbian (or other distros)? Well, it is possible with a few minor tweaks.

FreePBX

Because FreePBX and Asterisk are tightly bound it is a permissions nightmare to get the web interface to work with any other user than ‘asterisk’. If you already have Apache running for other purposes then this is obviously not ideal. For this reason we need to get second Apache process running as the ‘asterisk’ user, while at the same time allowing the main Apache process to run as is. Here’s how you do that.

Read More »

How To: Rebuild Linux RAID (Simples!)

Reading Time: 5 minutes

There are many tutorials on rebuilding Linux Software RAID but most are unnecessarily overly complicated. It’s fairly straight forward – here’s how.

Raid1

Unlike hardware RAID, software RAID is all handled by the operating system itself. This means the process of replication, rebuilding and control is performed by the filesystem with various kernel and userspace software.

Read More »