Trixbox, USB Stick, Grub, TDM card, what more could you want?

I stumbled across Trixbox some time ago and thought it was an excellent replacement for Shortel and Switchvox. Trixbox is a PBX system that is built on top of Asterisks. It is much like Switchvox with its web interface and ease of use. The nice thing is that the Community Edition (CE) is completely free, unsupported, but free. For this adventure, I have been working with an Openvox TDM card, Trixbox on a USB Stick, and SATA RAID. The reason I am using a USB stick is that when the RAID is active, you can not hook up a CDRom to the SATA controller. Ok, this seems fine, but when you choose IDE for SATA in BIOS, it breaks the RAID and according to the controller, it must be “Rebuilt.” I was able to get Trixbox to load onto a USB stick thanks to the people at Pendrivelinux.com and their MultibootISO application. This application uses Grub4Dos to emulate a CD-Rom drive from an ISO file. The only issue I had was when Trixbox installed the bootloader (Grub), it installed it to the MBR of the Flash drive. I was able to get Trixbox to boot off of the Hard drive by using the kernel (hd0,0)/[dir to kernel] and initrd (hd0,0)/[dir to initrd]. Once I had it booted up, I was able to modify /etc/grub.conf to remove the Flash drive. After that, I had to edit /boot/grub/menu.1st with the changed HD info. I was able to fix the MBR by using the grub-install command on the SATA Raid device, which was in a strange place. I think it was /dev/mapper/[name of RAID]. Once I referenced that, I was able to get Trixbox booting all by its self.

Now it was time to configure the TDM card and the extensions. I looked in the system config for the TDM card, but I didn’t see it. For some reason, it was not recognized as Zaptel. I am not entirely sure I understand the difference between the 2 device drivers/emulators, but all I knew is that the guide I was working from said I needed zaptel. Openvox has Zaptel drivers on their website, but I didn’t feel like compiling from scratch.

When I was on Openvox’s website, I noticed that the extra power connector on the TDM card was only needed for FXS ports. The reason is that FXS provides voltage across and FXO receives voltage. This helped explain why the all FXO card was being recognized as FXS. Once I rebooted the system, the TDM card was not being recognized by Asterisk. I tried to run the first_run scripts from Trixbox (/var/Trixbox/first_run…), but they couldn’t initialize the card. Modprobe was failing with a FATAL message meaning it can’t find the driver.

I tried to compile the driver from source, but not all of the Linux-Kernel Header files were included when I got the development files. I then tried to uninstall Trixbox with ‘yum remove [trixbox package]‘ but that wasn’t very successful. I tried to re-install Trixbox with Yum using the repository. I had a bunch of issues and dependencies issues, but eventually got Trixbox installed and running again. Now the only issue was that the system still didn’t recognize the TDM card. Now I am going to do a fresh install from USB and then start from there.

Wish me luck.

Mike

Awesome Commands for Linux

I used to have a Wiki that I would keep track of all of the “Cool Commands” that I found or created.  But now that Wiki is down and I haven’t had the time to put it back up.  So, I need to keep track of commands so I don’t forget them.   Alright, starting off, have you ever wanted to change a few lines of text in a bunch of files?  I have.  I found a one line Perl script that will take care of it for you, and leave you a backup file for your trouble.

  • perl -pi -i.bak -e ’s/searchval/replaceval/’ *.html

This command can use regular expressions for the search value and the replace value.

This next command will sync your information and can be used to only keep updated copies of files.   There are lots of options too, this only scratches the surface.

  • rsync -uav --progress /srcdir/ /dstdir/

This command will will look at the srcdir and then determine if the dstdir file is newer, if it is, it won’t copy.  Very useful if you need to merge multiple copies of files, but don’t want duplicates.

This next command will find files for you based on all sorts of criteria:

  • find . -mtime -10

This command will look for files that are -10 days old.

You can combine rsync and find to search for files and then sync those files.

  • find . -mtime -10 -print0 | rsync -av --progress --files-from=- -from0

This command will first compile a list of files that meet the find criteria and then will port them to rsync.  Very helpful.

Ok, that is all the cool commands for today, I will probably find some more tomorrow.

Found more… This command will make a file of any size for you:

  • dd if=/dev/zero of=file.out bs=1MB count=100

This command will create a 100 meg dummy file. Works great.

Mike

More issues with IspCP [PostFix]

At this point I feel very confident with the inner workings of IspCP.  I have modified suexec, postfix, and other core stuff.  In the process I have started to learn Apache2’s inner workings as well.  Today I am going to talk about issues with Postfix.  The issue is that a Ubuntu installs PostFix with a LAMP install, and IspCP has some custom configs to make it work.  YesterdayI thought I was smart enough to make modifications to the master.cf and main.cf.  Wow was I wrong.  After the changes I made, when you would telnet to port 25 (587 too) it would give you a blank screen and would just hang.  When I looked at the logs all i got was:

Jan 30 06:34:56 [host]postfix/master[28195]: warning: process /usr/lib/postfix/smtpd pid 4838 exit status 1
Jan 30 06:34:56 [host]postfix/master[28195]: warning: /usr/lib/postfix/smtpd: bad command startup — throttling
Jan 30 06:35:56 [host]postfix/smtpd[4876]: fatal: dict_open: unsupported dictionary type: inet:  Is the postfix-inet package installed?

From the error, it would seem that I am missing a package for postfix.  Not the case, in-fact that package doesn’t exist.  Why would they reference a package that doesn’t exist?  I was able to bring the whole thing back up by restoring the master.cf and main.cf from the /etc/ispcp/postfix/working/ directory.  When in doubt, return to the default config file and start over.

Mike

Apache2 + IspCP Omega from Apache1.x = madness

For the issues I have been having with the above formula, I decided to write up my experience in hopes that I can either help someone or at least provide a few little details to make some sense of things.

First off, I just want to say, that if you, as a programmer, choose to use Perl, and then further choose to design a full web application with Perl, PLEASE, PLEASE use the CGI-BIN file so that for future programmers on your project may be able to move your project without an act of congress.  KEEP THINGS SIMPLE!!!

Ok, here is the preface of the situation, A company I have been working with for a few months has a large number of antiquated servers.  They purchased some new ones and then wanted to move everything to the new servers.  This seems like a not too difficult task, the source machines are Fedora.  I opted for the newest release of Ubuntu because of the many new features like integrated cloud control and the fact that it is built on Debian.  Don’t boo me since I am taking the easy road, there is a Sonic wall that will do the filtering and provide a very high level of security and IDS.  Since this is not a post on security I won’t get into the details of my security plan.

Once LAMP and IspCP was all setup, it was time for the copy.  After I had a complete copy of all the files, I began filling out the holes of the new, empty webserver.  For anyone who has messed with IspCP, you will know that it uses /var/www/virtual/[domain name]/htdocs to store the web accessible files.  The cgi-bin folder is stored at the same level as htdocs.

I began populating htdocs with the info from the previous server and everything starting going fine.  Even all of the PHP files worked and executed properly thanks to settings in IspCP.  The issue, Perl was sprinkled throughout much of the web applications.  Many database calls and functions were all written in Perl.  One would think that this isn’t a big deal and that with a few apt-get calls, everything would work out.

The major issue is that it was the intention of the “Elders of The Internet” to store executable files in the cgi-bin.  And from my research (which is many hours at this point), it seems Apache2 with Virtual Hosts is dedicated to following these directives.  After hours of messing with the apache2.conf, ispcp.con, and other config files, I finally have found a work around that is not convenient, but workable.

Inside the virtual host file ispcp.conf (in /etc/apache2/site-enabled/ispcp.conf) under the <VirtualHost> directive, you can place:

AddHandler cgi-script .pl .html
Options +ExecCGI

Inside the same file, inside the <Directory *> directive you can place the same information as above to have it apply only to the specific directory.  However, this only works with directories at the same level or deeper in the tree. (Eg. /here or /here/nowhere).  When I would try to use a directory outside the VirtualHost document root, I would get an Internal Error 500 with the suexec.log file saying that the directory had other write permissions enabled…. Very strange.

The things that don’t work, and guarantee Internal Error 500 are adding the <file ~ .pl> with the file handlers for perl scripts to apache2.conf.  If you try to add an ‘*’ to the directory in the above example, it causes a 500 error.

Finally, I found out the hard way that make changes to the ispcp.conf file don’t stay if someone adds a new website or addon.  Instead you must modify the following file to make it persistent.  /etc/ispcp/apache/working/ispcp.conf

Now back to adding the top directive to the subdirectories.

***UPDATE:  It seems that the previous practice I prescribed earlier has failed.  When I added all of the info to the ispcp.conf, it gave me another Internal Error 500.  This time it was saying a file was writeable by others.  To compound the issue, it looks like Firefox and IE were both reporting Cached pages.  I found a setting in IE to only pull fresh, new copies everytime.  I figured a CTRL+F5 would give me a fresh copy.  It looks like the solution was to add AddHandler cgi-script .pl .html Options +ExecCGI to the .htaccess file.  But now when I add it to a subdomain I am back to the stupid issue with the internal error 500.  I am going to bed.

Good Luck,

Mike

Where are you as a programmer

Thanks to a programming matrix sent to me by my friend Eric, I have decided to take my musings and thoughts to a blog.  Previously I have been putting them into a wiki.  I figured a wiki would be a nice library of information that would be easily accessible.  But as my journey toward a log(n) programmer continues, I must move to a blog and write everything that comes to my brain about code.

Here is the link to the matrix that will allow you to see where you are at and allow you to set your sights for the future:

Complete Programmer’s Matrix <- Click me

As far as programming goes, I have been working on a number of projects recently, but really haven’t had the time to complete anything.  I am in the process of creating a task and project management system.  I hope to take the ideas of management and information logging and make it easy and friendly.  Most project management software I have used is too complex or is missing some core features.  I will add more information about it as it develops.

This is it for my first post, cheers for now.

-Mike