Archive

Posts Tagged ‘Linux’

Home phone by Asterisk

September 1st, 2009 1 comment

Last week I’ve spend some time doing an Asterisk PBX setup at home. Because I like the technique and my girlfriend likes to use the phone I decided to build my own PBX (Private Branch Exchange). In other words a telephone exchange. So doing some research I figured out what the requirements where and came up with the following components:
- a SIP provider
- a SIP compliant phone
- Asterisk PBX software
- an Internet connected Linux server running 24/7

As for the SIP provider I chose the Budgetphone company because they support Asterisk and you get a local area number on which you can be called.

On my search for a suitable phone selected the Siemens Gigaset A580 IP. The main reasons I chose this phone where:
- it’s a hybrid phone so you can use POTS and or VOIP
- it’s energy efficient by using multiple energy-saving technologies
- it’s in a affordable price range

The installation of Asterisk was a piece of cake. Being a very happy user of Debian Linux, I installed the pre-compiled package from the Debian repository by executing the following command:

# apt-get install asterisk asterisk-sounds-main

In my case the Asterisk server has a public ip-address, and the phone base station is located in private ip space behind a NAT router.

Below you’ll find the Asterisk configuration. This configuration is known to work on Asterisk version 1.4.21.2~dfsg-3. In my case all configuration files reside in ‘/etc/asterisk/’.

sip.conf:

[general]
context=default
subscribemwi=yes
allowoverlap=no
bindport=5060
bindaddr=0.0.0.0
srvlookup=yes
disallow=all           
allow=alaw             
allow=ulaw             
allow=g726
allow=ilbc
allow=gsm
language=us
dtmfmode = auto

register => 31123456789@sip1.budgetphone.nl:***:31123456789@sip1.budgetphone.nl/101

[31123456789]
type=friend
context=from-budgetphone
host=sip1.budgetphone.nl
fromuser=31123456789
fromdomain=sip1.budgetphone.nl
username=31123456789
insecure=very
secret=***
qualify=yes
port=5060

[phone]
type=friend
context=internal
host=dynamic
nat=yes
callerid="Home phone"
canreinvite=no
qualify=yes
secret=password
mailbox=1001

extensions.conf:

[general]
static=yes
writeprotect=no
clearglobalvars=no

[globals]
INT1=SIP/phone
OUTBOUNDTRUNK=SIP/31123456789

[from-budgetphone]
exten => 101,1,Dial(${INT1},28)
exten => 101,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy:unavail)
exten => 101,n(unavail),VoiceMail(1001@default,u)
exten => 101,n,Hangup()
exten => 101,n(busy),VoiceMail(1001@default,b)
exten => 101,n,Hangup()

[internal]
; internal number
exten => 1001,1,Dail(${INT1})
; voicemail number
exten => 700,1,VoiceMailMain()
; external numbers
exten => _XXXX.,1,Set(CALLERID(all)=31123456789)
exten => _XXXX.,2,Dial(${OUTBOUNDTRUNK}/${EXTEN})
exten => _XXXX.,3,Hangup()

voicemail.conf

[general]
format=wav49|gsm|wav
serveremail=asterisk
attach=yes
skipms=3000
maxsilence=10
silencethreshold=128
maxlogins=3
emaildateformat=%A, %B %d, %Y at %r
sendvoicemail=yes

[zonemessages]
eastern=America/New_York|’vm-received’ Q ‘digits/at’ IMp
central=America/Chicago|’vm-received’ Q ‘digits/at’ IMp
central24=America/Chicago|’vm-received’ q ‘digits/at’ H N ‘hours’
military=Zulu|’vm-received’ q ‘digits/at’ H N ‘hours’ ‘phonetic/z_p’
european=Europe/Copenhagen|’vm-received’ a d b ‘digits/at’ HM

[default]
1001 => 1234,Your name,user@domain.net,,tz=european

When done editing those files, you need to connect to the Asterisk CLI (Command Line Interface) by using the following command:

# asterisk -r

Set the verbosity level to 10:

*CLI> core set verbose 10

To reload the new configuration issue:

*CLI> reload

To see if the SIP services have registered succesfully issue:

*CLI> sip show peers

I needed to configure the next fields in the base station configuration to get the phone registered with Asterisk. Go to ’settings’ -> ‘telephony’ -> ‘connections’ -> ‘edit’ -> ’show advanced settings’.
- Authentication Name: phone
- Authentication password: *******
- Username: phone

- Domain: local
- Proxy server address: Asterisk server ip
- Registrar server: Asterisk server ip

To make the MWI (Message Wait Indicator) work on the handset you need to follow the next steps:
Web browse to the Siemens phone web interface, go to ’settings’ -> ‘telephony’ -> ‘Network Mailbox’. For the connection you want MWI with, enter the voicemail access number into the ‘Call Number’ box, in my case 1001 and tick the ‘Active’ box. This will make the Siemens phone subscribe to the mailbox status.

Have fun!

Categories: Linux Tags: ,

eToken, Personal certificate and the Mozilla suite

August 26th, 2009 No comments

Recently I have a personal certificate also known as a Digital ID on a smart card (Aladdin eToken) to access a secure web service. While installing the certificate I noticed it is also possible to use it to digitally sign and encrypt email with the same certificate, so I fired up Thunderbird and added the PCKS#11 security device to configure signing using S/MIME. See the steps below.

“PKCS#11 is one of the family of standards called Public-Key Cryptography Standards (PKCS), published by RSA Laboratories. It defines a platform-independent API to cryptographic tokens, such as Hardware Security Modules (HSM) and smart cards.” (Source: http://en.wikipedia.org/wiki/PKCS11)

I assume you already have installed the eToken software. In case you haven’t, take a look at this article I wrote earlier.

Open Thunderbird and go to Preferences -> Advanced -> Encryption -> Security Devices

Click on “Load” and enter a Module name or choose the default like I did, which is “New PKCS#11 Module” and browse for the ‘libeTPkcs11.so’ library. This file probably sits in ‘/usr/lib’ or ‘/usr/lib64′. Be sure to pick the right one, because you need the 64bit version if you’re using 64bit Firefox.

Open Account Settings -> Security

Select the certificate on your smart card you like to use.

Thunderbird and Firefox are not bundled with the needed CA’s to support GlobalSign PersonalSign Class 2 out-of-the-box. You have to Import the GlobalSign Primary Class 2 CA (http://secure.globalsign.net/cacert/PrimClass2.crt) and GlobalSign PersonalSign Class 2 CA (http://secure.globalsign.net/cacert/PersonalSignClass2.crt) to make it work in Thunderbird, otherwise you’ll notice you’re not able to send digitally signed email.

Categories: Blog Tags: , , ,

eToken and Linux

July 22nd, 2009 1 comment

To make the eToken PKI 5.0 client work on my 64bit Fedora 11 workstation with the 32bit version of the Aladdin eToken middle ware I had to install the following packages: hal-libs.i586, libusb.i586, openct.i586, pcsc-lite-openct.i586, pcsc-lite-libs.i586, pcsc-lite.i586 and dependencies.

# rpm -ivh pkiclient-5.00.28-0.i386.rpm
Preparing…                ########################################### [100%]
   1:pkiclient              ########################################### [100%]
Adding eToken security provider….done.
Starting PC/SC smart card daemon (pcscd): [  OK  ]
PKI Client installation completed.
#

If you don’t install the 32bit version of the packages, the installation of the pkiclient software will result in a error. The pkiclient software does need one of the following bundle dirs ‘/usr/lib/readers’ or ‘/usr/lib/pcsc/drivers’, or else it will exit with the error message below.

# rpm -ivh pkiclient-5.00.28-0.i386.rpm
Preparing…                ########################################### [100%]
Error: cannot find pcsc-lite bundles directory.
error: %pre(pkiclient-5.00.28-0.i386) scriptlet failed, exit status 11
error:   install: %pre scriptlet failed (2), skipping pkiclient-5.00.28-0
#

Do not try to add the eToken as a security device in Firefox or Thunderbird as you’re probably running the 64bit version of the applications. The 64bit applications refuse to load the 32bit ‘libeTPkcs11.so’, you’ll be prompted with a message “Unable to add module”.
I have requested the 64bit version of the middle ware, which should make things easier.

Categories: Linux Tags: ,

Wireless fix on Amilo running Ubuntu

June 11th, 2009 9 comments

Recently I had to use a laptop for a course I was doing. This Fujisu Siemens Amilo Li 2727 laptop came with Windows Vista pre-installed. Since the installed OS didn’t matter for the course I installed the latest Ubuntu which is 9.04 (Jaunty). All worked well except for the wireless card (Atheros Communications Inc. AR242x 802.11abg Wireless PCI Express Adapter (rev 04)). The network applet says “Wireless is disabled”. The ath5k driver for the wireless card is being correctly initialised, as you can see:

[   12.170260] ath5k_pci 0000:08:00.0: PCI INT A -> GSI 18 (level, low) -> IRQ 18
[   12.170274] ath5k_pci 0000:08:00.0: setting latency timer to 64
[   12.170439] ath5k_pci 0000:08:00.0: registered as ‘phy0′
[   12.355693] ath5k phy0: Atheros AR2425 chip found (MAC: 0xe2, PHY: 0×70)
[  264.864848] ath5k phy0: noise floor calibration timeout (2442MHz)

You can also use the following command to see if the device is blocked (not tuned on!):

$ sudo rfkill list
0: acer-wireless: Wireless LAN
        Soft blocked: no
        Hard blocked: no
1: phy0: Wireless LAN
        Soft blocked: no
        Hard blocked: yes

It appears that the wireless card is enabled but not activated, so you’ll need to turn it on. Using Windows you use the Fn-F1 key combination to activate the wireless card, but this doesn’t work with Linux. The easiest way to get wireless going is by activating a kernel module called acer_wmi. As soon as you execute the following line you’ll notice the wireless led will light up. There are other ways, but this is by far the most easy and elegant way to do it.

$ sudo modprobe acer_wmi

The wireless card is now active! Wait a moment and you’ll see wireless networks appear in the NetworkManager if you’re in range. Just for the record I am using Ubuntu kernel 2.6.28-11-generic at the moment of writing.

To make this solution last on a reboot, you’ll have to add the module name ‘acer_wmi’ to ‘/etc/modules’.

$ echo "acer_wmi" | sudo tee /etc/modules

30 Apr 2010: I can confirm this work-around also works for Ubuntu 10.04 LTS (Lucid).

Categories: Linux Tags: , ,

Gallery2 and Lenny

May 5th, 2009 3 comments

During the upgrade from Etch to Lenny I was surprised that the Gallery2 package was not available for the current stable release of Debian. At first it was no problem, but the Gallery2 package of old stable Etch is to old for the most recent WPG2 plug-in for Wordpress, so I had to upgrade Gallery2 using a upstream version as one of the package maintainers made clear:

“Gallery2 is not available in Lenny due to the large amount of differences between the previous version and 2.3-1 from unstable. The release team decided not to include Gallery2 in stable due to this disruptive change late in the release process. The gallery2 package from sid can be installed via pinning.”

I’ve documented the steps I took for upgrading Gallery2.

1. Create to following file if it not exists:

vi /etc/apt/preferences

2. Add the following lines:

Package: *
Pin: release a=stable
Pin-Priority: 600

Package: gallery2
Pin: release a=testing
Pin-Priority: 800

* If you are using testing Debian make sure testing is the bigger number.
* This file will install only from the highest pin but it will show you if the packages is available in testing or unstable.

3. Edit /etc/apt/sources.list and add the following lines:

# Testing (squeeze) for gallery2
deb http://ftp.us.debian.org/debian/ squeeze main contrib non-free
deb-src http://ftp.us.debian.org/debian/ squeeze main contrib non-free

4. Update the apt database and upgrade the gallery2 package:

# apt-get update
# apt-get upgrade -s

You’ll notice that the package will be kept back. Issue a dist-upgrade to install the upstream package.

# apt-get dist-upgrade

Restart apache and as soon as you visit the gallery2 site you’ll be asked to start the upgrade process, which went very smoothly.

Categories: Linux Tags: , ,

Setup Firefly to serve iTunes

May 4th, 2009 4 comments

FireFly LogoThis guide will help you setup Firefly Media Server to serve iTunes. This server based program, previously known as “mt-daapd” shares your media collection to iTunes. DAAP stands for Digital Audio Access Protocol and is developed by Apple to share media across a local network.

I have done the installation on Debian Lenny, but Firefly (still called mt-daapd on the Debian repository!) is even available on Windows. In order to publish the firefly shared library on the network I have used Avahi, which is a free implementation of Zeroconf including mDNS/DNS-SD.

1. Install the needed packages including dependencies

# apt-get install mt-daapd avahi-daemon

2. Setup Avahi by creating /etc/avahi/services/mt-daapd.service

<?xml version="1.0" standalone=’no’?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h</name>
<service>
<type>_daap._tcp</type>
<port>3689</port>
<txt-record>txtvers=1</txt-record>
<txt-record>iTSh Version=131073</txt-record>
<txt-record>Version=196610</txt-record>
</service>
</service-group>

3. Restart the Avahi daemon

# /etc/init.d/avahi-daemon restart

4. Edit /etc/mt-daapd.conf. The following variables where important to me:

# $Id: mt-daapd.conf.templ 1660 2007-09-12 13:08:04Z rpedde $
#
# This is the mt-daapd config file.

<…>

#
# admin_pw (required)
#
# This is the password to the administrative pages
#

admin_pw = mt-daapd

<…>

#
# mp3_dir (required)
#
# Location of the mp3 files to share.  Note that because the
# files are stored in the database by inode, these must be
# in the same physical filesystem.
#

mp3_dir = /path/to/music

#
# servername (required)
#
# This is both the name of the server as advertised
# via rendezvous, and the name of the database
# exported via DAAP.  Also know as "What shows up in iTunes".
#

servername = Firefly %v on %h

<…>

5. Restart mt-daapd

# /etc/init.d/mt-daapd restart

The first time you start mt-daapd it will do a full scan to update the mt-daapd database. Watch the /var/log/daemon.log file to see when it’s ready.

May  4 09:54:25 sinners mt-daapd[16843]: Firefly Version svn-1696: Starting with debuglevel 2
May  4 09:54:25 sinners mt-daapd[16843]: Plugin loaded: daap/svn-1696
May  4 09:54:25 sinners mt-daapd[16843]: Plugin loaded: ssc-ffmpeg/svn-1696
May  4 09:54:25 sinners mt-daapd[16843]: Plugin loaded: rsp/svn-1696
May  4 09:54:25 sinners mt-daapd[16843]: Starting rendezvous daemon
May  4 09:54:25 sinners mt-daapd[16843]: Client running
May  4 09:54:25 sinners mt-daapd[16843]: Starting signal handler
May  4 09:54:25 sinners mt-daapd[16845]: Initializing database
May  4 09:54:25 sinners mt-daapd[16845]: Full reload…
May  4 09:54:25 sinners mt-daapd[16845]: Starting mp3 scan
May  4 09:54:27 sinners mt-daapd[16845]: Starting playlist scan
May  4 09:54:27 sinners mt-daapd[16845]: Updating playlists
May  4 09:54:27 sinners mt-daapd[16845]: Scanned 10 songs in 1 seconds
May  4 09:54:27 sinners mt-daapd[16845]: Starting web server from /usr/share/mt-daapd/admin-root on port 3689
May  4 09:54:27 sinners mt-daapd[16845]: Registering rendezvous names
May  4 09:54:27 sinners mt-daapd[16845]: Serving 10 songs.  Startup complete in 2 seconds

Now you should be able to connect to the mt-daapd admin webinterface at http://yourservername:3689.

6. You’re done!
Fire up iTunes and you’ll see the just created Firefly library become available under Shared. You can also use this service with Rhythmbox Music Player, XMMS with the DAAP plugin, or any other DAAP compatible music player.

Categories: Blog Tags: , , , ,

Persistent route in Fedora

March 16th, 2009 No comments

Today I had to add a static-route on a Fedora 10 workstation to gain access to a web application. Because it needs to be persistent, survive reboots, I wanted to configure the static-route the way Fedora (Red Hat) likes it.

The script ‘/etc/sysconfig/network-scripts/ifup-routes’ is responsible for setting the route. You have to create a ‘route-eth1′ file depending on the interface the static route has to be configured on.

# touch /etc/sysconfig/network-scripts/route-eth1
# echo "to 130.37.136.220 via 192.168.129.15" > /etc/sysconfig/network-scripts/route-eth1

You can check if it works by calling the script followed by the interface name.

# /etc/sysconfig/network-scripts/ifup-routes eth1

Use the route command to see if the new route has been added to the route table.

Categories: Linux Tags: , ,

Enlarging the size of a striped LV

December 8th, 2008 No comments

Since there were not enough free PPs available within the VG to extend our fast growing LV we had to increase disk space and extend this LV, but this was a little different from the usual manner because of this LV was a striped one. At first we thought we had to rebuild the entire LV to expand to the new capacity, but… since AIX 5L version 5.3 it is possible to enlarge the size of striped LVs online thanks to the concept of striped columns for LVs. The only thing is that you can raise the upper bound with a multiple of the stripe width. Our SAN team was so happy to supply the necessary LUNs.

This is what it looked like:

# lslv fslv17
LOGICAL VOLUME:     fslv17                 VOLUME GROUP:   oradatavg3
LV IDENTIFIER:      00c1e99000004c000000011b8d014031.2 PERMISSION:     read/write
VG STATE:           active/complete        LV STATE:       opened/syncd
TYPE:               jfs2                   WRITE VERIFY:   off
MAX LPs:            6144                   PP SIZE:        64 megabyte(s)
COPIES:             1                      SCHED POLICY:   striped
LPs:                5580                   PPs:            5580
STALE PPs:          0                      BB POLICY:      relocatable
INTER-POLICY:       maximum                RELOCATABLE:    no
INTRA-POLICY:       middle                 UPPER BOUND:    6
MOUNT POINT:        /oracle/data/P30       LABEL:          /mnt
MIRROR WRITE CONSISTENCY: on/ACTIVE
EACH LP COPY ON A SEPARATE PV ?: yes (superstrict)
Serialize IO ?:     NO
STRIPE WIDTH:       6
STRIPE SIZE:        128K
#

Use the -u option to extend the upper bound. This can only be a multiple of the stripe width, which is 12 in my case.

# chlv -u 12 fslv17
# lslv fslv17
LOGICAL VOLUME:     fslv17                 VOLUME GROUP:   oradatavg3
LV IDENTIFIER:      00c1e99000004c000000011b8d014031.2 PERMISSION:     read/write
VG STATE:           active/complete        LV STATE:       opened/syncd
TYPE:               jfs2                   WRITE VERIFY:   off
MAX LPs:            5120                   PP SIZE:        64 megabyte(s)
COPIES:             1                      SCHED POLICY:   striped
LPs:                4776                   PPs:            4776
STALE PPs:          0                      BB POLICY:      relocatable
INTER-POLICY:       maximum                RELOCATABLE:    no
INTRA-POLICY:       middle                 UPPER BOUND:    12
MOUNT POINT:        /oracle/data/P30       LABEL:          /mnt
MIRROR WRITE CONSISTENCY: on/ACTIVE
EACH LP COPY ON A SEPARATE PV ?: yes (superstrict)
Serialize IO ?:     NO
STRIPE WIDTH:       6
STRIPE SIZE:        128K
#

After that we had to extend the Maximum LPs for this LV.

# chfs -a size=+40G /oracle/data/SID
0516-787 extendlv: Maximum allocation for logical volume fslv17
is 5120.
# chlv -x 6144 fslv17
# chfs -a size=+40G /oracle/data/SID
Filesystem size changed to 731381760
#
Categories: Linux Tags: ,