puras babosadas de un freak

Sunday, October 19, 2008

Howto para instalar FreePBX en Ubuntu 8.04

Fuente: http://colt45.chemlab.org/?p=55





Install Ubuntu 8.04 Server w/ LAMP server & SSHd

*THIS HOW-TO IS CURRENTLY A WORK IN PROGRESS*

Get the system all up to date
#aptitude upgrade

After that is finish with no errors reboot your system

Note: I would not recommend installing zaptel or asterisk from apt. It will just cause problems.

Install Required Packages

# sudo aptitude install cvs build-essential automake autoconf bison flex libtool libncurses5-dev libssl-dev php5 php5-cli php5-curl php5-gd php5-mysql mysql-server php-pear php-db curl sox apache2 subversion libssl-dev libmysqlclient15-dev

Compile & Installing Zaptel Modules

Next we want to prepare to build the zaptel modules to do we will need the following packages:

# uname -a

# sudo aptitude install linux-headers-2.6.24-19-server
# sudo ln -s /usr/src/linux-headers-2.6.8.1-5-686-smp /usr/src/linux-2.6

# cd /usr/src/
# sudo wget http://downloads.digium.com/pub/zaptel/zaptel-1.4-current.tar.gz
# sudo tar -zxvf zaptel-1.4-current.tar.gz
# cd zaptel-1.4.12.1
# ./configure
# make clean
# make
# sudo make install
# sudo make config

I am not going to go in depth into Zaptel module configuration since there is a ton of great sites out there.
Edit the following config files to your needs: configure /etc/zaptel.conf and /etc/asterisk/zapata.conf
voip-info zaptel config

# sudo /etc/init.d/zaptel start
# sudo update-rc.d zaptel defaults 20 80

Ways to test your Zaptel
# lspci

should have something like this: 02:0a.0 Ethernet controller: Digium, Inc. Unknown device 8005 (rev 11)

# cat /proc/zaptel/*
output similar to:

Span 1: WCTDM/0 “Wildcard TDM410P Board 1″ (MASTER)
IRQ misses: 1

1 WCTDM/0/0 FXSKS (In use)
2 WCTDM/0/1 FXSKS (In use)
3 WCTDM/0/2 FXSKS (In use)
4 WCTDM/0/3 FXSKS (In use)

Testing once Asterisk IS INSTALLED

Access Asterisk CLI
# sudo asterisk -r

In asterisk command line enter : zap show channels
xxx*CLI> zap show channels

output similar to:

Chan Extension Context Language MOH Interpret
pseudo from-pstn default
1 from-pstn default
2 from-pstn default
3 from-pstn default
4 from-pstn default

In asterisk command line enter : zap show status
xxx*CLI> zap show status

output similar to:

Description Alarms IRQ bpviol CRC4
Wildcard TDM410P Board 1 OK 1 0 0

If you have stuff like this showing up your card should be working

Setting Up & Compile Asterisk

# sudo groupadd asterisk
# sudo useradd -c “asterisk PBX” -d /var/lib/asterisk -g asterisk asterisk
# sudo mkdir /var/run/asterisk
# sudo chown asterisk:asterisk /var/run/asterisk/
# cd /usr/src/
# sudo wget http://downloads.digium.com/pub/asterisk/releases/asterisk-1.4.22.tar.gz
# sudo tar -zxvf asterisk-1.4.22.tar.gz
# cd asterisk-1.4.22
# make clean
# ./configure
# make
# sudo make install
# sudo make samples

Download Astrisk Add-ons
# cd ..
# sudo wget http://downloads.digium.com/pub/asterisk/asterisk-addons-1.4.7.tar.gz
# sudo tar -zxvf asterisk-addons-1.4.7.tar.gz
# cd asterisk-addons-1.4.7
# sudo perl -p -i.bak -e ’s/CFLAGS.*D_GNU_SOURCE/CFLAGS+=-D_GNU_SOURCE\nCFLAGS+=-DMYSQL_LOGUNIQUEID/’ Makefile
# ./configure
# make clean
# make
# sudo make install

Download Astrisk Sounds
# cd ..
# sudo mkdir asterisk-sounds
# cd asterisk-sounds
# sudo wget http://downloads.digium.com/pub/telephony/sounds/asterisk-core-sounds-en-wav-current.tar.gz
# sudo wget http://downloads.digium.com/pub/telephony/sounds/asterisk-extra-sounds-en-wav-current.tar.gz
# sudo wget http://downloads.digium.com/pub/telephony/sounds/asterisk-moh-freeplay-wav.tar.gz

# sudo tar -zxvf asterisk-core-sounds-en-wav-current.tar.gz
# sudo tar -zxvf asterisk-extra-sounds-en-wav-current.tar.gz
# sudo tar -zxvf asterisk-moh-freeplay-wav.tar.gz

copy all sounds to the asterisk directory
# sudo cp -rf * /var/lib/asterisk/sounds/

create sim link for MOH (Music on Hold) directory for FreePBX
# sudo ln -s /var/lib/asterisk/moh /var/lib/asterisk/mohmp3

Fix asterisk dir permissions
# chown asterisk:asterisk /etc/asterisk -R
# chown asterisk:asterisk /var/lib/asterisk -R
# chown asterisk:asterisk /var/log/asterisk -R
# chown asterisk:asterisk /var/spool/asterisk/ -R

# nano /etc/asterisk/asterisk.conf
Change astrundir to: /var/run/asterisk

Setting up FreePBX

# cd /usr/src/
# sudo wget http://mirror.freepbx.org/freepbx-2.5.0.tar.gz
# sudo tar -zxvf freepbx-2.5.0.tar.gz
# cd freepbx-2.5.0
# sudo mysql_install_db
# mysqladmin u root password ‘
# mysqladmin create asteriskcdrdb -p
# mysql –user=root –password= asterisk < ./SQL/newinstall.sql

Enter Mysql command prompt

# mysql –user root -p
# GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY ‘amp109′;

# GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY ‘amp109′;

# quit

Configure Apache for FreePBX

# sudo nano /etc/apache/envvars
change : export APACHE_RUN_USER=www-data & export APACHE_RUN_GROUP=www-data
to: export APACHE_RUN_USER=asterisk & export APACHE_RUN_GROUP=asterisk

# sudo nano /etc/apache2/sites-enabled/000-default
change: AllowOveride None to AllowOverid All under both instances of /var/www

Configure PHP for FreePBX
# sudo nano /etc/php5/apache2/php.ini
change: upload_max_filesize to upload_max_filesize = 20M

# sudo nano /etc/php5/cli/php.ini
change: upload_max_filesize to upload_max_filesize = 20M

Set the php lib directory to be owned by asterisk so that it can make changes to the php.ini
# sudo chown asterisk:asterisk /var/lib/php5 -R

Set ownership of the /var/www directory to asterisk so it can write to files
# sudo chown asterisk:asterisk /var/www -R

Restart Apache
# sudo /etc/init.d/apache2 restart

In a web browser test http:/// if all is well you should get a page and your apache is installed and working properly

FreePBX install

# cd /usr/src/freepbx-2.5.0
bash fix for asterisk start script
# sudo ln -sf /bin/bash /bin/sh
# sudo
./start_asterisk start
# sudo ./install_amp
accept defaults on all questions except on:
Enter the path to use for your AMP web root: /var/www
IP address:

No point a web browser at http:///admin/ and click on the orange reload config banner at the top of the page

Astrisk Init Script

# sudo nano /etc/init.d/asterisk

paste the following

set -e

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

DESC="Asterisk"
NAME=amportal
DAEMON=/usr/local/sbin/$NAME
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

test -x $DAEMON || exit 0

d_start() {

amportal start

}

d_stop() {

amportal stop

}

d_reload() {

amportal restart

}

case "$1" in

start)

echo -n "Starting $DESC: $NAME"
d_start
echo "."
;;

stop)

echo -n "Stopping $DESC: $NAME"
d_stop
echo "."
;;

restart|force-reload)

echo -n "Restarting $DESC: $NAME"
d_stop
sleep 10
d_start
echo "."
;;

*)

echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;

esac

exit 0


# sudo chmod 755 /etc/init.d/asterisk
# sudo update-rc.d asterisk defaults 90 10

Activate FOP (Flash Operator Panel)
# sudo nano /etc/amportal.conf
change: FOPRUN=false to FOPRUN=true
*must restart asterisk to take effect in FreePBX

remove old astrisk configs
# sudo rm /etc/asterisk/*.0

Reboot your system and you should have a working Asterisk/FreePBX system up and running

Installing Other Goodies

TFTP server for phone updates and auto configurations

# sudo aptitude install tftpd-hpa tftp-hpa
# sudo nano /etc/default/tftpd-hpa
change: RUN_DAEMON to RUN_DAEMON=”yes”

I make a link to /tftpboot just to make it a little more accessible
# sudo ln -s /var/lib/tftpboot /tftpboot
# sudo /etc/init.d/tftpd-hpa start
# sudo update-rc.d tftpd-hpa defaults

Now put all your firmware updates, phone configs in the /tfptboot directory. Also if your phones use DHCP don’t forget to set the TFTP server address to this server ip so the phones get it automatically assigned.

Changing Mysql Asterisk Username or Password

If you change any of the mysql login cridentials you must update these two files with the new asterisk username and/or password

/etc/asterisk/cdr_mysql.conf
/etc/amportal.conf

Howto de instalacion de Xenserver Express

http://www.howtoforge.com/virtualization-with-xenserver-express-5.0.0

Un muy buen sistema de Firewall opensource

Vale la pena echarle una revisada, ah evolucionado muchisimo a lo largo de los anios.


http://www.redwall-firewall.com/

Nueva version estable de Dansguardian

El equipo de desarrollo de Dansguardian despues de varis anios por fin publican una nueva version estable. Aqui sus features:


Daniel Barron and Philip Allison release DansGuardian 2.10 - the first new stable-tagged version since August 2005. It is the first version to be tagged stable from the 2.9 development branch which has been in development for over three and a half years.

DansGuardian 2.10 has had a plethora of features added since 2.8 and these are some of the highlights:

  • Built-in content scanner plugin system which includes AV scanning.
  • NTLM and persistent connection support.
  • Header analysis and manipulation so you can manipulate cookies
  • Large file (2GB+) download & scanning support
  • Autotools build system
  • URL regular expression replacement so you can force safe search in Google
  • Deep URL scanning to spot URLs in URLs to for example block images in Google images
  • Advanced advert blocking
  • Many performance improvements
  • Updates to handle all current web technology trends
  • Blanket SSL blocking so you can block SSL anonymous proxies and allow access to legitimate SSL sites such as banking by whitelisting

http://dansguardian.org

Software para balanceo

http://www.inlab.de/balanceng/description.html



What is BalanceNG® ?

BalanceNG (Balance Next Generation) is a Software IP Load Balancing Solution utilising its own network stacks and functionality. It runs on Linux-x86 (2.4 and 2.6 kernels distribution independent) and Solaris (9/10).

General Features

  • Layer 2 (Ethernet) "switching engine" based software load balancer.
  • Running under Linux (Using the PF_PACKET socket API) and Solaris (STREAMS/DLPI API).
  • Backup targets (hosts) specifiable in case of failure of all primary targets.
  • "Alert" and "Upalert" notification script interface.
  • Direct Server Return (DSR) operation support.
  • Unchanged client addresses on IP-level.
  • Small, very fast and reliable.
  • Simple to implement and administer.
  • Simple "init script style" arguments like "start", "stop" and "status" (and "control" for interactive configuration and control).
  • Interactive communications mode with command line editing.
  • Pcap packet dumping with automated dumpfile rotation (e.g. to implement a "transparent forensic logging bridge").
  • Multi-Node High Availability capability using standard VRRP (Virtual Router Redundancy Protocol).
  • "All service load balancing" based on client IP address allows generic load balancing independent of specific ports.
  • SNMP support integrating into Net-SNMP with the BalanceNG MIB.
  • Up to 128 parallel instances (fully independent BalanceNG load balancers) on the same host machine.
  • Up to 1024 load balancing target servers (hard limit) per instance.
  • Up to 512 virtual servers (hard limit) per instance.
  • NAT state replication between master and backup node.
  • VRRP tracking supported to allow automatic resource tracking and failover.
  • NEW: Location-based server load-balacing utilizing a very fast in-memory IP-to-location database (IPDB/LGRP).
  • NEW: DNS-based GSLB (Global Server Load-Balancing).

Session Table Features

  • Session table capable to hold 10 million sessions per 512MByte of main memory.
  • Support of session table state replication / session synchronization between VRRP master and backup.
  • Session persistence based on client address and optional source port.

Available Load Balancing Methods

  • agent: based on bngagent returned value (system load or user supplied script return). Bngagent supplied as open source and precompiled binaries.
  • bw: based on overall bandwidth
  • bwin: based on incoming bandwidth
  • bwout: based on outgoing bandwidth
  • hash: based on hash function called with source IP address
  • plugin: based on user supplied plugin script or program
  • random: based on pseudo randomness (optionally weighted)
  • rndagent: based on agent returned value, but randomized
  • rr: based on simple round robin
  • session: based on the least number of current sessions

Available Health Check Methods

  • agent: Target server side user supplied script or program functionality
  • ping: ICMP echo request/reply health check
  • script: user supplied health check script or program (Mon monitoring daemon scripts and other tools like "wget" are supported for many common protocols like HTTP, SNMP, LDAP, POP3, IMAP, FTP, DNS and many more).
  • tcpopen: TCP open health check

Need more Information ?

Friday, October 10, 2008

Solucionando problema con CACTI que deja de mostrar graficas

De la nada... tu CACTI deja de funcionar, que haces?
Revisas el log y encuentras un monton de lineas con algo muy parecido a esto:

CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'145', SQL:"insert into poller_output (local_data_id, rrd_name, time, output) values (618, 'traffic_out', '2008-10-10 12:45:47', '3873250625')'

Al parecer esto se debe a que la base de datos se corrompe... para repararlo necesitas hacer estas dos cosas:


1.- mysqlcheck --auto-repair --databases cacti -p
(esto como root y cuando te pida tu password de root de mysql se lo pones)

2.- En el cacti te vas a: System Utilities> y das click en Rebuild Poller Cache


Listo! Bonitas graficas de nuevo.