Saturday, 28 September 2013

PPPT VPN


Please bear in mind that PPTP vpn is less secure than openvpn. If you want to know why please ask Goolgle.
If you don't mind and you think PPPT is secure enough for you go ahead and run the following commands and you'll be ready in less than five.
# sudo apt-get update
# sudo apt-get upgrade
# sudo modprobe ppp-compress-18 - this command should return no errors used for mppe support
# sudo apt-get install pptpd
sudo pico /etc/pptpd.conf
Uncomment the following lines
localip 192.168.1.10
remoteip 192.168.0.25-27,192.168.0.30

"localip" - the IP is the device that is going to be running the VPN 
"remoteip" - is the t
he IP addresses that will be handed out to the clients connecting to you VPN.
Cntrl+o Cntrl+x
# sudo pico /etc/ppp/pptpd-options
Add the follow text on the bottom
ms-dns 192.168.1.1
noipxmtu 1490
mru 1490
Where the IP used for the ms-dns directive is the DNS server for the local network 

Cntrl+o Cntrl+x

# sudo pico /etc/ppp/chap-secrets
myusername[TAB]*[TAB]mypa55w0rd[TAB]*

Cntrl+o Cntrl+x
# sudo service pptpd restart
[ENTER]
To enable forwarding if you wish to have access to your entire home network while away. Edit the ‘sysctl’ file.
# sudo pico  /etc/sysctl.confFind “net.ipv4.ip_forward=1” and uncomment it (or change =0 to =1) 

Cntrl+o Cntrl+x.
# sudo sysctl -p
Last step: Adding iptables rule:
# sudo pico /etc/rc.local

Add this line just above “exit 0”

sudo iptables -t nat -A POSTROUTING -s 192.168.0.25/24 -o eth0 -j SNAT --to 192.168.1.10
Cntrl+o Cntrl+x

Now forward port 1723 in your router/modem 


Done

Saturday, 29 June 2013

My Raspbx

Pre-requisites:

-Connectivity to your Raspbx. Im connecting to the box over SSH

-A couple of soft phones (I'm using SFLphone and Ekiga) for testing and calling internally and externally.
All configuration information for the raspbx is located in /etc/asterisk.
All information for SIP users is stored in sip.conf Numbers are read from extensions.conf. Voicemails are stored in voicemail.conf etc.


To place a call through Asterisk, registration to Asterisk is not required. However, you do need a username and password which will allow you to call someone who is registered.

To receive a call, you must be a registered user and have an extension.

To Register SIP Users:

First of all all users must be registered in sip.conf and have a valid extension  declared in extensions.conf

Follow these steps for:


-Lets first register some users in sip.conf


1. Go to the /etc/asterisk directory on your Asterisk server. Open sip.conf and register the following test user.

Note that ALL lines beginning with ‘;’ (semi-colomn) are interpreted by Asterisk as a comment. 



[1000]

This means we are registering user '1000'

type=friend

This means the user can place or receive calls. For INBOUND calls only, use ‘peer’ as type. For outbound calls only use ‘user’ as type.

username=1000

This declares that our user will be named '1000'

secret=S3cretPa55w0rd

This creates the password for the user to login/authenticate on Asterisk

host=dynamic

This sets dynamic IP for the host. You may also define this as a static IP

context=test

This defines the dial context for the user which in this case is testing. In Asterisk, outgoing numbers are divided in groups called contexts in order to separate/define different needs for different user types. For example, a context for local calls, local area, international calls etc.


This completes the user registration process on Asterisk. Now let us register an extension for the users we created earlier.


-Registering a number in extensions.conf


2. Go to /etc/asterisk and open extensions.conf


[tutorial]

This registers the context ‘tutorial’

exten => 1000,1,Dial(SIP/1000)

when dialing number 1000, Asterisk will first Dial the user SFLphone through SIP protocol. The command is : exten => number, priority, Dial(protocol/user). The priority determines the sequence in which the extensions will be executed.
exten => 2000,1,Dial(SIP/2000)

when dialing number 2000, Asterisk will first Dial the user with SFLphone through SIP protocol. The command is : exten => number, priority, Dial(protocol/user). The priority determines the sequence in which the extensions will be executed.


We now have a registered SIP user and extension on Asterisk. Follow this same process to register another SIP user and extension in order to place test calls.

Start by registering the second user in the same way in /etc/asterisk/sip.conf



Register the extension(1000) in /etc/asterisk/extensions.conf in the same context = test.



Now when user '1000' or any other user from the test context dials 1000, the user '1000' will be called.

3. The final step is to register the user to a compatible softphones. However, softphones will be reviewed later. For now, just make sure you have registered the users and extensions