Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Tuesday, 12 January 2016

Linux Directory Copy

07:53 Posted by Jurgens Krause , , , , No comments
Easy to use, easy to forget

Copy directory and subdirectories
The -R flag is to signal a recursive copy

cp -R source-dir dst-dir

Note that this will place source-dir/* in dst-dir. If you want to place source-dir/* in dst-dir/source-dir/* you must use the following command:

mkdir /dst-dir/source-dir
cp -R source-dir dst-dir/source-dir

If you want to move all directories to sub-directory, in case you used the wrong command above, use the following:

mv !(subdir) subdir


Tuesday, 1 September 2015

Ubuntu 14.04 LTS/ FreeRadius / Postgresql Step-by-step

16:27 Posted by Jurgens Krause , , , , No comments

Step by step instructions for installing
FreeRadius with Postgresql on
Ubuntu 14.04 LTS

Why 14.04, well it is the current LTS release, and for production environments, I tend to stick to the latest LTS.

I am not going to be going into detail into how to install Ubuntu 14.04 Server, there are enough tutorials on that elsewhere. I need you to get to the point where you have a clean server, with SSH access, and a root prompt.

Installing software

First, let us update the apt-get info:
apt-get update

Now we need to install the basic components, these include:
Freeradius, Postgresql and it's utilities as well as the postgresql module for freeradius:
apt-get install freeradius freeradius-postgresql postgresql postgresql-contrib

This will install all the necessary components, it is normal for the DH Parameter generation to take a couple of minutes.

Configure Postgres

The Postgres installation automatically creates a user called postgres, in order to configure Postgres, you need to log into that account.

sudo -i -u postgres

Now we create the radius user and database, when creating the user, you will be prompted to create a password, make it nice and secure, and make a note for later use:

createuser radius --no-superuser --no-createdb --no-createrole -P
createdb radius --owner=radius exit

Change the database authentication from peer to md5 to allow login from the console:

vim /etc/postgresql/9.3/main/pg_hba.conf

Find the line that matches:
local    all    postgres    peer

and change it to:
local    all    postgres    md5

also find:
local    all          peer

and change it to:
local    all          md5

Reload postgresql
service postgresql restart

Import the database schema using the command below:
cd /etc/freeradius/sql/postgresql
psql -U radius radius < schema.sql

Configure FreeRadius to use Postgres

Change the sql configuration as follows:
cd /etc/freeradius
vim sql.conf

change the following lines to suit your setup:
database = "postgresql"
password = "yourpassword"


You will also need to change the login name to leave out the realm when logging in:

Change the sql configuration as follows:
vim radiusd.conf

change the following line:
sql_user_name = "%{User-Name}"
To:
sql_user_name = "%{Stripped-User-Name}"
Also uncomment the line that reads:
$INCLUDE sql.conf

Now uncomment the line that reads "sql" under the authorize{} section, on my default config it is line 177,
also uncomment the "sql" line under the accounting{} section,
also uncomment the "sql" line under the post-auth{} section
cd /etc/freeradius/sites-available vim default

Also uncomment the line that reads "sql" under the authorize{} section of /etc/freeradius/sites-available/inner-tunnel, on my default config it is line 131
vim inner-tunnel


Restart the FreeRadius server to load the new config, and you should be good to go.
service freeradius restart

Monday, 29 June 2015

Friday, 8 May 2015

Asterisk Dialplan Show and Tell 1

14:57 Posted by Jurgens Krause , , , , , , No comments

NEW FEATURE ALERT!!

I hope to make this a regular feature on my blog. If you have an awesome dialplan that you would like to share, please let me know and I will analyze and feature it here!


My first share is the dialplan that I use for clients who need added features beyond basic calling. This includes call diverts as well as voicemail.

Thursday, 7 May 2015

Wednesday, 31 December 2014

Ultimate Seedbox Tutorial (Step-By-Step)

14:05 Posted by Jurgens Krause , , , , , , 1 comment

Setting up your own seedbox from scratch, step by step tutorial.

While Ubuntu may not be the most lightweight Linux distro available, ti does make things very easy. I will be using Ubuntu 14.04 Server. I developed this tutorial using VirtualBox, but if you have a spare laptop or old pc, that will work just as well.

I will show you how to install Ubuntu 14.04 server, install the latest version of Deluge, including the daemon and web interface, as well as set up a basic FTP server and Samba share to access your downloads.


Thursday, 3 April 2014

Raspbian on Windows with Installer (VirtualBerry)

08:13 Posted by Jurgens Krause , , 2 comments

Getting Raspbian running on a virtual machine can be very useful if you do development, or just want to play around. Easy to use solutions like VirtualBox unfortunately cannot emulate anything other than x64 or i386 CPUs, while the Raspberry runs on an ARM chip.

Enter Qemu, an open source virtualization host that can run on Windows, Mac or Linux and emulate a wide variety of CPUs, inlcuding the ARM chip that the Raspberry Pi is based on.

I have created an installer for Qemu that is preconfigured with the latest Raspbian image (Jan 2014) at the time of writing this, but still there are a couple of steps required to get it working 100%

 Dropbox Link

 http://jurgens.wipronet.co.za/VirtualBerry-1.0.exe

File MD5: e323adcc7738b1948460b0e5fcb87a03

Thursday, 27 March 2014

Mikrotik The Dude on Ubuntu 12.04 LTS Server (Step-By-Step)

11:12 Posted by Jurgens Krause , , , , 11 comments

On my network I have a single, low power server, running on my single highsite. This server runs Ubuntu 12.04.2 LTS, and it does not have the oomph to virtualize windows for the sake of dude. To this end I have deployed The Dude running under Wine.

Dude is a network monitoring application by Mikrotik that is excellent for monitoring Mikrotik and other SNMP enabled devices.

We will not be compiling anything, opting rather for the easier apt-get installs where possible.

This tutorial is based off the instructions from the Mikrotik Wiki, but adapted for Ubuntu 12.04 and The Dude Version 4.0 Beta 3

Friday, 20 December 2013

Headless Ubuntu 12.04 Server

13:48 Posted by Jurgens Krause , No comments
I deploy headless Ubuntu 12.04 server configurations on a regular basis. One of the things that I often forget to do is modifying Grub to try to boot every time regardless of whether or not previous boots were successful.
If you forget to do this, the server might get stuck at the Grub boot screen, forcing you to connect a keyboard and screen to get it going again.

Thankfully Grub 2 has made this a bit easier:

Log in to your server as root or use sudo,

$vim /etc/default/grub

Add the line:
GRUB_RECORDFAIL_TIMEOUT=10

Update the grub configuration:

$update-grub2

The timeout value is in seconds, I use 10 seconds since that gives me ample time to enter recovery mode should it be necessary.


Thursday, 19 December 2013

Raspberry PI based FreeRadius Server with GUI

09:49 Posted by Jurgens Krause , , 41 comments
I run a small wireless network for a non-profit organization in my home town, it consists of a single high site with internet connectivity, with nine client sites connecting via wireless. The network is built with Ubiquiti hardware, with a Mikrotik 750 handling the routing. I also use this network for experimentation and learning. One of the things that I have been keen on doing is managing it as though it is a commercial network in terms of the network architecture. To this end I have decided to deploy a Raspberrry Pi based Radius server for PPPoE Authentication. The Mikrotik will serve as the PPPoE server, and the Raspberry Pi Radius server will be managed with DaloRADIUS. The instructions below should be easy to use on any Debian based distro.

Tuesday, 11 September 2012

Asterisk Call Groups

18:31 Posted by Jurgens Krause , , 1 comment
A large part of my work centers around managing Asterisk based Virtual PBXes. Now, I know very little of Asterisk, so as I learn I will share what I learn in the home of helping out other people who struggle.

Intercepting Calls on Asterisk (or CallGroups) as the clever people call it.

Say that your client has a switchboard, and six extensions in the office. Someone calls the office, knows the extension they want to reach and by the magics of Asterisk IVRs they manage to connect themselves directly to Joe. Now, Joe is at the water cooler chatting with a colleague and is thus unable to hear his phone ring. Martha at the switchboard however does hear it ringing, and feels the urge to answer it. How would you set up the Asterisk server to allow this?

Well, it is really quite simple:

What you need to do is assign a callgroup and a pickupgroup as shown below. But first, what is a:
callgroup:
A callgroup is simply a way of grouping extensions that share some common function, ie. all the extension in the "Sales" department

pickupgroup:
The pickupgroup directive, when assigned to an extension, shows which callgroups' calls can be intercepted or picked up by the relevant extension

Practical:

Open up sip.conf (usually it can be found in /etc/asterisk/sip.conf)

Here you will find many sections, called "Contexts"

Find the context matching your Switchboard extension ie. [100]. It might look something like this:
-------
[100]
type=peer
host=dynamic
context=international
disallow=all
allow=g729
qualify=yes
secret=superawesomepassword
nat=yes
canreinvite=no
canredirect=no
----------

To the bottom of this add the pickupgroup directive:
pickupgroup=1

This tells Asterisk that extension 100 can intercept any call ringing on any phone in callgroup 1

Now, no extensions have yet been assigned to callgroup 1 so to remedy that, find  the context matching the extension that you want to place in the callgroup and simply add the callgroup directive, like so:
[101]
type=peer
.
.
.
callgroup=1

The switchboard (ext 100) will now be able to pick up a call ringing on extension 101 simply by pressing *2# on their handset (sometimes just *2)



And there you go, Asterisk callgroups in a nutshell. Of course there is much more you can do with callgroups, and we will take a look at that in the future.