Вы находитесь на странице: 1из 6

********************************************************************************

********
********************************************************************************
********
********************************************************************************
********
********************************************************************************
********
Estos son algunos pasos opcionales si quieres tener tu RedHat(CentOS) para traba
jar comodamente,
paquetes que puedes encontrar en la web o en la carpeta "Paquetes" de tu ultimo
servidor
configurado.
yum --nogpgcheck localinstall bash-completion-20060301-1.el5.rf.noarch.rpm
yum --nogpgcheck localinstall fail2ban-0.8.4-23.el5.noarch.rpm shorewall-3.2.7-1
.0.el5.noarch.rpm
vi /etc/fail2ban/jail.conf
chkconfig fail2ban on
service fail2ban start
vi .bashrc
* agregar "alias vi='vim'"
********************************************************************************
********
* Para empezar, necesitamos alguna herramientas para descomprimir paquetes y com
pilar.
yum -y install gcc glibc-devel ncurses-devel kernel-devel libtermcap-devel gcc-c
++ openssl-devel newt-devel zlib-devel make unixODBC-devel libtool-devel rpm-bui
ld
yum -y install libtool-devel kernel-headers
yum -y install flex bison
yum -y install mysql mysql-server mysql-devel libtiff-devel net-snmp-devel
********************************************************************************
********
* Preparar la carpeta para la descargar de los sources
cd /usr/src/
mkdir asterisk && cd asterisk/
wget -c http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-1.8-curren
t.tar.gz
wget -c http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-l
inux-complete-current.tar.gz
wget -c http://downloads.asterisk.org/pub/telephony/libpri/libpri-1.4-current.ta
r.gz
********************************************************************************
********
* Compilando libpri
cd /usr/src/asterisk
tar -zxf libpri-1.4-current.tar.gz

cd libpri-1.4.11.5/
make clean
make
make install
********************************************************************************
********
* Compilando dahdi, tenemos tarjetas SANGOMA, por lo tanto no detectara las tarj
etas.
cd /usr/src/asterisk
tar -zxf dahdi-linux-complete-current.tar.gz
cd dahdi-linux-complete-*
make all
make install
make config
********************************************************************************
********
* Como las tarjetas que estamos utilizando son SANGOMA, necesitamos instalar los
drivers
* de esas tarjetas, para que el dahdi las detecte. Comprobamos los ultimos drive
s del
* sitio http://wiki.sangoma.com/wanpipe-linux-drivers
cd /usr/src/asterisk
wget -c ftp://ftp.sangoma.com/linux/current_wanpipe/wanpipe-3.5.20.tgz
tar xvfz wanpipe-3.5.20.tgz
cd wanpipe-3.5.20/
--------------------------------------------------------------------------------------------------* Ejecutamos el siguiente comando pero no instalamos, solo llegamos hasta el
* proceso de verificacin de dependencias.
./Setup install
--------------------------------------------------------------------------------------------------* Ejecutamos el proceso de instalacin con el siguiente comando
./Setup dahdi
--------------------------------------------------------------------------------------------------* En el proceso, es posible que no encuentre la carpeta de asterisk creada, por
lo que podemos
* decirle que no realize el asistente de configuracion del chan_dahdi.conf.
* Despues de tener la carpeta /etc/asterisk creada, podemos ejecutar el siguient
e comando:
wancfg_dahdi
--------------------------------------------------------------------------------------------------* Verificamos la creacin de los archivos en la carpeta del DAHDI y realizamos cop
ia del
* archivo generado.
cd /etc/dahdi/

vi system.conf
cd /etc/asterisk/
cp chan_dahdi.conf chan_dahdi.conf.001
--------------------------------------------------------------------------------------------------* Instalacin de scripts de inicio rc.d
./Setup install_init
********************************************************************************
********
* OPENR2
* Si estamos configurando una Tarjeta E1, la sealizacin en Latinoamerica es R2
* Por lo que tenemos que instalar las librerias para que asterisk reconozca la
* sealizacin MFC/R2
* sitio http://code.google.com/p/openr2/
cd /usr/src/asterisk
wget http://openr2.googlecode.com/files/openr2-1.3.1.tar.gz
tar zxvf openr2-1.3.1.tar.gz
cd openr2-1.3.1
* Por defecto instala en /usr/local/ Para evitar problemas de ubicacin.
./configure --prefix=/usr
make
make install
* Se hace necesario cambiar las configuraciones en /etc/dahdi/system.conf para
* que quede de la siguiente manera:
--------------------------------------------------------------------------------------------------#Sangoma A104 port 1 [slot:4 bus:3 span:1] <wanpipe1>
span=1,1,0,cas,hdb3
cas=1-15,17-31:1101
dchan=16
echocanceller=mg2,1-15,17-31
--------------------------------------------------------------------------------------------------* El :1101 es la posicin inicial de los bits CAS (conocidos tambin como los bits A
BCD) que son
* usados por R2 para sealizar el estado de la lnea (contestada, colgada, etc.). La
seal 1101
* significa bloqueado en R2, que significa que cuando el hardware despierta por pr
imera vez no
* podr recibir llamadas (Asterisk o cualquier otro software que use R2 despus camb
iarn los
* bits a 1001, que significan IDLE, o listo para hacer llamadas).
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------* EL otro cambio se hace Necesario en /etc/asterisk/chan_dahdi.conf. Este archi
vo es generado
* automaticamente por wancfg_dahdi. En el debemos comentar y agregar mas lineas

:
; Configuracion para senalizacion R2
mfcr2_variant=ar
mfcr2_max_ani=10
mfcr2_max_dnis=3
mfcr2_category=national_subscriber
mfcr2_logging=all
;Sangoma A104 port 1 [slot:4 bus:3 span:1] <wanpipe1>
;switchtype=euroisdn
context=entrada
group=1
echocancel=yes
signalling=mfcr2
channel =>1-15,17-31
*-------- Despues de compilado asterisk, puedes comprobar que el chan_dahdi vien
e incluido
*-------- con la libreria de OpenR2
ldd channels/chan_dahdi.so
* ( o luego de estar corriendo asterisk: module unload chan_dahdi.so, module loa
d chan_dahdi.so )
********************************************************************************
********
* COMPILANDO ASTERISK
cd /usr/src/asterisk/
tar zxvf asterisk-1.8-current.tar.gz
cd asterisk-1.8.4.3/
--------------------------------------------------------------------------------------------------* Para soporte MP3, ejecutamos el siguiente comando
contrib/scripts/get_mp3_source.sh
--------------------------------------------------------------------------------------------------* En el make menuselect, quitamos el soporte para pbx_ael, agregamos SOUNDS en E
S/EN(GSM,ULAW,ALAW)
* MOH (GSM,ULAW,ALAW), Addons(MySQL,mp3)
make clean
./configure
make menuselect
--------------------------------------------------------------------------------------------------make
make install
---------------------------------------------------------------------------------------------------

* Ejecutar si no tenemos nada configurado ya.


make samples
--------------------------------------------------------------------------------------------------* los progdocs son la documentacion de todas las aplicaciones.
make progdocs
make config
********************************************************************************
********
* Configurando system-config-securitylevel
system-config-securitylevel
--------------------------------------------------------------------------------------------------* Por lo general contamos con 1 o 2 tarjeta de Red. Si necesitamos permitir acc
eso desde
* la red Publica, estas serian los datos a configurar:
Trusted Devices:
[ ] eth0 [*] eth1
[*] SSH
Other ports 5060:udp 5061:udp 10000-20000:udp 161:udp
--------------------------------------------------------------------------------------------------********************************************************************************
********
* Configurando FAIL2BAN para ASTERISK.
Tomado de http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asteri
sk
cd /etc/fail2ban/filter.d/
vi asterisk.conf
--------------------------------------------------------------------------------------------------# Fail2Ban configuration file
#
#
# $Revision: 250 $
#
[INCLUDES]
# Read common prefixes. If any customizations available -- read them from
# common.local
#before = common.conf
[Definition]
#_daemon = asterisk
# Option: failregex
# Notes.: regex to match the password failures messages in the logfile. The
#
host must be matched by a group named "host". The tag "<HOST>" can
#
be used for standard IP/hostname matching and is only an alias for
#
(?:::f{4,6}:)?(?P<host>\S+)

# Values: TEXT
#
failregex = NOTICE.* .*: Registration from '.*' failed for '<HOST>(:[0-9]{1,5})?
' - Wrong password
NOTICE.* .*: Registration from '.*' failed for '<HOST>(:[0-9]{1,5})?
' - No matching peer found
NOTICE.* .*: Registration from '.*' failed for '<HOST>(:[0-9]{1,5})?
' - Username/auth name mismatch
NOTICE.* .*: Registration from '.*' failed for '<HOST>(:[0-9]{1,5})?
' - Device does not match ACL
NOTICE.* .*: Registration from '.*' failed for '<HOST>(:[0-9]{1,5})?
' - Peer is not supposed to register
NOTICE.* .*: Registration from '.*' failed for '<HOST>' - ACL error
(permit/deny)
NOTICE.* <HOST> failed to authenticate as '.*'$
NOTICE.* .*: No registration for peer '.*' \(from <HOST>\)
NOTICE.* .*: Host <HOST> failed MD5 authentication for '.*' (.*)
NOTICE.* .*: Failed to authenticate user .*@<HOST>.*
NOTICE.* .*: Registration from '\".*\".*' failed for '<HOST>' - No m
atching peer found
# Option: ignoreregex
# Notes.: regex to ignore. If this regex matches, the line is ignored.
# Values: TEXT
#
ignoreregex =
--------------------------------------------------------------------------------------------------vi /etc/fail2ban/jail.conf
--------------------------------------------------------------------------------------------------# Para bloqueo de intentos del asterisk
[asterisk-iptables]
enabled = true
filter = asterisk
action = iptables-allports[name=ASTERISK, protocol=all]
sendmail-whois[name=ASTERISK, dest=root, sender=you@mail.com]
logpath = /var/log/asterisk/messages
maxretry = 5
bantime = 259200
--------------------------------------------------------------------------------------------------service fail2ban restart
********************************************************************************
********

Вам также может понравиться