JSON Parsing Nagios Script

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 »

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

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

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

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

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!)

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 »