Monday, December 10, 2007

Setting Up a Secure Apache 2 Server

http://www.informit.com/articles/article.aspx?p=30115&seqNum=1

Requirements

openssl-0.9.7g-2.12
openssl-devel-0.9.7g-2
httpd-2.0.58

Configuring Apache
#./configure --enable-module=so --enable-ssl --with-ssl=/usr/include/openssl
#make
#make install
#/usr/local/apache2/bin/httpd -l (to list available modules

Creating a Key Pair
#openssl req -new -key www.example.com.key -out www.example.com.csr
#openssl genrsa -des3 -out www.example.com.key 1024

to backup key (optional):
#./usr/local/ssl/bin/openssl rsa -noout -text -in www.example.com.key

Creating a Self-Signed Certificate
#openssl x509 -req -days 30 -in www.example.com.csr -signkey www.example.com.key -out www.example.com.cert

# chmod 400 www.example.com.key

Edit /usr/local/apache2/conf/ssl.conf
Listen 80
Listen 443
ServerName http://www.example.com
SSLEngine on
SSLCertificateFile \
/etc/ssl/certs/www.example.com.cert
SSLCertificateKeyFile \
/etc/ssl/certs/www.example.com.key

Starting the server
#/usr/local/apache2/bin/apachectl startssl

Thursday, December 6, 2007

asterisk + mySQL table = refined

You have two options in /usr/src/asterisk-addons:
1. Add CFLAGS+=-DMYSQL_LOGUNIQUEID to the Makefile.
2. Add a #define MYSQL_LOGUNIQUEID to the top of cdr_addon_mysql.c.

- perform the usual make clean, make, make install.

Table definitions for Asterisk cdr_mysql

Create the database
mysql --user=root --password=password -h dbhost

CREATE DATABASE asterisk;

GRANT INSERT
ON asterisk.*
TO asterisk@localhost
IDENTIFIED BY 'yourpassword';

(Remote MySQL server permissions)
GRANT INSERT
ON asterisk.*
TO asterisk@localhost
IDENTIFIED BY 'yourpassword';

USE asterisk;

CREATE TABLE `cdr` (
`calldate` datetime NOT NULL default '0000-00-00 00:00:00',
`clid` varchar(80) NOT NULL default '',
`src` varchar(80) NOT NULL default '',
`dst` varchar(80) NOT NULL default '',
`dcontext` varchar(80) NOT NULL default '',
`channel` varchar(80) NOT NULL default '',
`dstchannel` varchar(80) NOT NULL default '',
`lastapp` varchar(80) NOT NULL default '',
`lastdata` varchar(80) NOT NULL default '',
`duration` int(11) NOT NULL default '0',
`billsec` int(11) NOT NULL default '0',
`disposition` varchar(45) NOT NULL default '',
`amaflags` int(11) NOT NULL default '0',
`accountcode` varchar(20) NOT NULL default '',
`uniqueid` varchar(32) NOT NULL default '',
`userfield` varchar(255) NOT NULL default ''
);

ALTER TABLE `cdr` ADD INDEX ( `calldate` );
ALTER TABLE `cdr` ADD INDEX ( `dst` );
ALTER TABLE `cdr` ADD INDEX ( `accountcode` );


/etc/asterisk/cdr_mysql.conf
[global]
hostname=192.168.10.5
dbname=asterisk
table=cdr
password=asterisk
user=asterisk
port=3306
sock=/var/lib/mysql/mysql.sock
;userfield=1

/etc/asterisk/modules.conf
load => cdr_addon_mysql.so
[global]

genksyms not found on 64bit kernel

http://folk.uio.no/oeysteio/orinoco-usb/building.html

$ cd /lib/modules/$(uname -r)/
$ rm build
$ ln -s source build
$ cd build/
$ su
(root password)
$ make mrproper
$ make cloneconfig
$ make prepare-all
Important: You must change
make prepare-all
to
make prepare scripts


if you get an error similar to:
/bin/sh: scripts/genksyms/genksyms: No such file or directory


Wednesday, October 17, 2007

Required CPAN Modules for Mon

#perl -MCPAN -e shell
cpan>install Time::Period
cpan>install Time::HiRes
cpan>install Convert::BER
cpan>install Mon::Protocol
cpan>install Mon::SNMP
cpan>install Mon::Client

And, depending upon what you want to monitor, you may also wish to install the following optional modules:
cpan>install Filesys::DiskSpace
cpan>install Net::Telnet
cpan>install Net::LDAPapi
cpan>install Net::DNS
cpan>install SNMP

Friday, September 28, 2007

Creating GSM files with SOX

# sox inputfile.wav -r 8000 -c 1 output.gsm resample -ql

Wednesday, September 26, 2007

Null Modem for High Availability

Null modem cable pin mapping
This is one very common mapping which will work with software that relies on proper assertion of the CD signal.
Signal Name DB-25 Pin DE-9 Pin
DE-9 Pin DB-25 Pin
FG (Frame Ground) 1 - X - 1 FG
TD (Transmit Data) 2 3 - 2 3 RD
RD (Receive Data) 3 2 - 3 2 TD
RTS (Request To Send) 4 7 - 8 5 CTS
CTS (Clear To Send) 5 8 - 7 4 RTS
SG (Signal Ground) 7 5 - 5 7 SG
DSR (Data Set Ready) 6 6 - 4 20 DTR
CD (Carrier Detect) 8 1 - 4 20 DTR
DTR (Data Terminal Ready) 20 4 - 1 8 CD
DTR (Data Terminal Ready) 20 4 - 6 6 DSR

#Use 1-4 & 4-1 for 9 pin HA null modem.

File Descriptors vs Linux Performance

To increase OS system-wide file descriptors limit

http://bloggerdigest.blogspot.com/2006/10/file-descriptors-vs-linux-performance.html

  1. Set both the hard limit and soft limit of file descriptors, to as maximum as possible, to either all (the asterisk in first column) or individual user login account (replace the asterisk in the first column to the user login account)

    • Modify /etc/security/limits.conf by appending or amending these line

    • @root soft nofile 1024
      @root hard nofile 4096
      to
      @root soft nofile 100000
      @root hard nofile 102400

      Refer to the topic of Linux ulimit command