31 may 2009

HOW-TO: Convierte tu webcam en un sistema de vigilancia | Linux Zone

HOW-TO: Convierte tu webcam en un sistema de vigilancia | Linux Zone

Convierte tu webcam en un sistema de vigilancia desde Ubuntu
Si bien el espíritu libertario que subyace bajo cualquier distribución de linux siempre es motivo de elogios, la misma naturaleza de su arquitectura también permite usarla para operaciones de vigilacia orweliana.Un ejemplo claro lo podemos observar en la instalación de Ubuntu como sistema de vigilancia.Requerimientos:* Una computadora extra que se utilizará como servidor
* Una distro de linux que se instalará en la computadora que utilizaremos como servidor (se recomienda Ubuntu).
* USB Webcam con sus respectivos controladores para Linux.
* IP estático para el servidor.
* Conocimientos generales sobre Linux.
* Mucho tiempo libre.Paso 1Comencemos por descargar los drivers para tu webcam. En este sitio puedes encontrar un driver que es compatible con 244 webcams distintas. Descárgalo en el escritorio de tu servidor.Si no funciona puedes preguntarle al oráculo de Google, tal vez él pueda ayudarte.Paso 2Una vez descargado el driver puedes comenzar a compilarlo. Pero antes de ello asegúrate que tienes instalada la paquetería de build-essential. De no ser así ejecuta en la consola

sudo apt-get install build-essential

Ahora sí comienza a compilar el código fuente del driver descargado. Descomprime el archivo y posicionate en el sitio donde se encuentre la carpeta descomprimida del driver:

cd ~/Desktop/gspcav1-20070508/

despues ejecuta:

./configure

Esta operación puede tardar algunos minutos. Una vez finalizada teclea:

make

y después

sudo make install

Paso 3

Instala Motion, un software que funcionará para detectar movimiento de cualquier persona u objeto. Para instalarlo teclea en una terminal

sudo apt-get install motion

Paso 4

Ahora toca el turno de configurar Motion. Puedes descargar los archivos de configuración del autor de este artículo aquí. Puedes ajustar la configuración según tus necesidades. Coloca los archivos de Motion Config.zip file en el folder /etc/motion/ de tu servidor. Primero extrae los archivos en tu escritorio, ahora teclea en una terminal

sudo mv ~/Desktop/Motion Config.zip_FILES /etc/motion/

Importante. Si tienes más una webcam necesitarás un thread.conf por cada webcam extra, por ejemplo thread0.conf, thread1.conf, thread2.conf. También necesitarás crear los enlaces a estos archivos al final de motion.conf.

Paso 5

Si toda ha trancurrido en orden deberías poder abrir la interfaz de Motion tecleando desde el servidor mismo

localhost:8000

ó desde otra computadora.

XXX.XXX.X.XXX:8000

Para visualizar el live stream de tu webcam teclea

localhost:8001

desde tu servidor ó desde el navegador de otra computadora.

XXX.XXX.X.XXX:8001


29 may 2009

Asterisk Func_odbc.conf - ODBC y Base de datos | VozToVoice

Asterisk Func_odbc.conf - ODBC y Base de datos | VozToVoice: "Asterisk Func_odbc.conf - ODBC y Base de datos"

Estoy firmemente convencido que seguir las guías que publican los “tipos” de “Nerd Vittles” es siempre un buen ejercicio para aprender cosas nuevas. En este caso veremos, siguiendo unas de las guías recientemente publicadas, como usar el conector ODBC y el archivo de configuración de asterisk func_odbc.conf para hacer consultas en una base de datos MySQL y restituir los resultados, todo a través de unas cuantas líneas del Diaplan. La guía de Nerd Vittles es pensada para asterisk 1.4.X, para que funcionara en asterisk 1.6.X tuve que hacerle unas cuantas modificaciones.

Antes que nada para el soporte de ODBC en Asterisk tenemos que descargar unos archivos y volver a compilar las fuentes:

si no tenemos instalado MySQL escribimos:

yum install mysql mysql-devel mysql-server

seguimos con ODBC:

yum install unixODBC unixODBC-devel libdbi-dbd-mysql mysql-connector-odbc

Compilamos asterisk:

cd /usr/src/asterisk.1.6.0.9

./configure

make

make install

Ahora continuamos con la configuración del driver ODBC:

nano /etc/odbcinst.ini

pegamos las siguientes líneas (para Centos 32bit)

[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/libmyodbc3.so
Setup = /usr/lib/libodbcmyS.so
FileUsage = 1

Ahora creamos una base de datos de prueba en MySQL:

wget http://pbxinaflash.net/source/odbc/timeclock.sql

mysql –u root –p <>

si miramos la base de datos viene con dos records insertados

mysql –u root –p

mysql> SELECT * FROM users;
+----+--------+----------+----------+------------+
| id | empnum | lastin | lastout | comments |
+----+--------+----------+----------+------------+
| 1 | 12345 | 00:00:00 | 00:00:00 | Uncle Ward |
| 2 | 23456 | 00:00:00 | 00:00:00 | Miss Mary |
+----+--------+----------+----------+------------+
2 rows in set (0.00 sec)

mysql> quit

Ahora tenemos que modificar algunos archivos de asterisk para que todo funcione:

nano /etc/asterisk/res_odbc.conf

añadimos las siguientes líneas

[timeclock]
enable=yes
dns=timeclock
username=root
password=clave
loguniqueid=yes
pre-connect=yes

en el campo password ponemos la contraseña configurada en MySQL para el usuario root (normalmente definida al momento de instalar mysql-server)

nano /etc/asterisk/func_odbc.conf

añadimos las líneas:

[TIMECLOCK]
dsn=timeclock
readsql=SELECT comments FROM users WHERE empnum='${SQL_ESC(${ARG1})}'
writesql=UPDATE users SET empnum='${SQL_ESC(${VAL1})}' WHERE empnum='${SQL_ESC(${ARG1})}'

seguimos con:

nano /etc/odbc.ini

[timeclock]
Description = MySQL ODBC TIMECLOCK
Driver = MySQL
Server = localhost
User = root
Password = clave
Database = timeclock
Port = 3306
Option = 3

En clave volvemos a poner la contraseña configurada en MySQL para el usuario root

Ahora solo nos falta la parte del dialplan que usaremos para hacer consultas en la base de datos:

nano /etc/asterisk/extensions.conf

exten => 222,1,Answer
exten => 222,n,Wait(2)
exten => 222,n,Flite("Please enter the 5 digit employee number.")
exten => 222,n,Read(EMPNUM,beep,5)
exten => 222,n,NoOp(EMPNUM: ${EMPNUM})
exten => 222,n,Set(EMPNAME=${ODBC_TIMECLOCK(${EMPNUM})})
exten => 222,n,GotoIf($["${EMPNAME}foo" = "foo"]?notfound)
exten => 222,n,Flite("The employee name is ${EMPNAME}. Good bye.")
exten => 222,n,NoOp(Employee: ${EMPNAME})
exten => 222,n,Hangup
exten => 222,n(notfound),Flite("No such employee on file. Good bye.")
exten => 222,n,Hangup

Volvemos a arrancar Asterisk

/etc/init.d/asterisk reload

o

/etc/init.d/asterisk restart

Como pueden ver, se contesta la llamada, se usa un programa de síntesis de voz (podrías ser también festival o cepstral), en este caso Flite (festival-lite). Se espera que el llamante digite una serie de 5 números(aplicacion Read); se consulta la base de datos para ver si ese numero existe. Si no existe el dialplan sigue desde la etiqueta (notfound) sino desde la línea que sigue donde escucharemos la frase con el nombre del empleado asociado a los 5 dígitos que hemos enviados.

Hagan sus pruebas y luego me cuentan


28 may 2009

Alerta-Antivirus.es: Seguridad Informática

Alerta-Antivirus.es: Seguridad Informática: "El archivo HOSTS"

El archivo HOSTS

Qué es el archivo Hosts.

El archivo Hosts tanto en Windows como otros sistemas operativos es un archivo de texto que se utiliza para resolver nombres de dominio en direcciones IP de forma local, es decir, una libreta de direcciones. Es bastante arcaico pues fue concebido en tiempos en que sólo había unos pocos dominios que se enviaban en una lista (archivo hosts) todos ellos con sus respectivas Ips y para resolver nombres de dominio en redes locales (LAN).

Cómo funciona la Resolución nombres de dominio, DNS.

Cuando desde cualquier aplicación basada en el protocolo IP (navegador, línea de comandos, gestor de correo…) escribimos un nombre de dominio se formula una consulta de resolución de nombres al servidor DNS que tengamos configurado. Este responderá con la dirección IP correspondiente y en el caso del navegador finalmente se accederá al servidor web para cargar la página. Este proceso de traducción se conoce como resolución de nombres (en ingles DNS, Domain Name Server).

Veamos un ejemplo y quedara más claro, el nombre de dominio para “alerta-antivirus” es www.alerta-antivirus.red.es, y su dirección IP es 194.69.254.61. Si escribimos en la barra de direcciones del navegador la IP 194.69.254.61 también aparecerá el sitio “alerta-antivirus” como si hubieramos escrito www.alerta-antivirus.red.es. Esto es debido a que todos los ordenadores que están conectados a internet están identificados por su dirección IP. Además de ser más fácil de recordar, el nombre es más fiable ya que la dirección numérica podría cambiar por muchas razones sin que por ello tenga que cambiar el nombre.

El archivo HOSTS simplemente acelera el proceso guardando los dominios y su equivalente dirección IP de manera que su navegador (o cualquier aplicación basada en el protocolo IP) pueda omitir la petición de la dirección IP actual al servidor DNS.

Para entender mejor la funcionalidad del archivo hosts veremos los mecanismos básicos de resolución de nombres de dominio que se aplican en el siguiente orden:

  1. Comprueba si el dominio solicitado se encuentra en el propio host. Si se encuentra se utiliza la IP indicada.
  2. Si no se cumple 1º mira si se pidió hace poco tiempo y lo tiene guardado en la caché.
  3. Si no se cumple 1º ni 2º se formula una consulta al servidor DNS el cual devolverá la IP correspondiente, que será guardada en la caché para futuras consultas. Esta caché se vacía al poco tiempo, al reiniciar el equipo, etc. En cambio los datos del archivo Hosts son permanentes.

Ubicación del archivo hosts.

En los sistemas operativos windows puede haber varios archivos hosts. Esta es la ubicación por defecto de los que nos interesan:

  • Windows 95/98/Me c:/windows/hosts
  • Windows NT/2000/XP Pro c:/winnt/system32/drivers/etc/hosts
  • Windows XP Home c:/windows/system32/drivers/etc/hosts

Estrucutura del archivo hosts.

Lo podemos visualizar con herramientas especificas para ello o con cualquier editor de texto (ej: notepad) y veremos que su contenido típico es algo como:

#Host list for localhost generated by browserc.dll
127.0.0.1 localhost

La primera línea empieza con el carácter 'almohadilla' y es simplemente un comentario. La segunda que es la importante indica que hay un ordenador llamado localhost cuya IP es 127.0.0.1.

Algunos comentarios sobre el archivo hosts:

  • Se pueden asignar varios nombres de dominio a una misma dirección IP.
  • El archivo se lee de arriba a abajo por lo que se deben colocar al principio los nombres utilizados más a menudo.
  • Un nombre de dominio puede tener hasta 255 caracteres. En sistemas Windows no se distingue entre mayúsculas y minúsculas.
  • No funciona con comodines, tales como: *.banners.com.

Funcionalidad del archivo hosts.

A continuación veremos las principales aplicaciones de uso que se deducen de todo lo anterior.

Uso fraudulento del archivo hosts.
Algunos malwares (virus, gusanos, troyanos ó spyware) han sabido utilizar este orden de aplicación (archivo hosts antes que el servidor DNS) para sus propios intereses. En la variante más común de lo que se conoce como Pharming modifican el archivo hosts con diferentes fines:

    - Evitar que un usuario pueda ingresar a determinados sitios, generalmente para impedir la actualización de antivirus u otro software de seguridad. Esto lo consiguen modificando el archivo hosts, escribiendo las direcciones web de los servidores legítimos dirigidas a la IP local 127.0.0.1 (u otra IP), por lo que el ordenador no contactara con esos servidores de publicidad ya que buscara la información en nuestra propia maquina.

    - Redirigir al usuario a sitios falsos suplantando la identidad del original con el fin de conseguir información confidencial (Phishing).
    Esto lo consiguen modificando el archivo hosts, escribiendo las direcciones web de los servidores legítimos dirigidas a la IP falsa.

    - Redirigir al usuario a sitios web desde donde se puede descargar software malicioso sin el conocimiento/consentimiento del usuario. Mismo procedimiento que el caso anterior.

En la sección de Fraude en Internet se puede encontrar más información sobre este fraude así como herramientas para combatirlo con diferentes funcionalidades como:

    -Bloquear la modificación del archivo hosts haciéndolo de sólo lectura (no es infalible, la familia de spyware CoolWebSearch consiguen saltarse esta protección).
    -Monitorizar y editar el archivo hosts para mantener su eficiencia.
    -Mostrar avisos de intentos de modificación del archivo hosts.
    -Realizar copias de seguridad del archivo hosts para poder restaurarlo en caso de necesidad.
    -Añadir una lista de servidores no confiables al archivo hosts, en su mayoría sitios que instalan software espía o monitorizan la navegación del usuario.
    -Comprobar la respuesta DNS para evitar redirecciones engañosas.

Bloqueando publicidad y otros sitios.
Muchos sitios web tienen enlaces a otros sitios web que les proveen de banners, scripts, imágenes GIF, JPG de publicidad que pueden resultar molestos ya que intentan captar nuestra atención, demoran la carga de la página e intentan obtener un perfil de nuestra navegación ó de lo que hacemos en ese sitio web. Si en el archivo hosts escribimos las direcciones web de servidores de publicidad dirigidas a nuestra IP local 127.0.0.1, el ordenador no contactara con esos servidores de publicidad ya que buscara la información en nuestra propia maquina.

Veamos un ejemplo, si visitamos www.ya.com, encontraremos banner con publicidad, la cual se encuentra alojada en el servidor "ad.es.doubleclick.net" y no en www.ya.com, así que, si agregamos al archivo hosts la cadena:

127.0.0.1 ad.es.doubleclick.net

Guardamos los cambios al archivo hosts, reiniciamos el navegador y al entrar nuevamente en www.ya.com en lugar del banner que salía antes aparecerá un mensaje con el texto "Not Found. The requested URL ******* was not found on this server.", y el resto de la página permanecerá igual.

Hay que tener en cuenta que no funciona con publicidad que esté alojada en el mismo sitio web que visitamos, el archivo hosts no bloquea subdirectorios ó rutas, sólo el sitio completo. Por lo que deberemos recurrir a otros métodos como por ejemplo el cortafuegos Outpost de Agnitum ó la extensión Adblock del Mozilla Firefox.

De la misma manera podremos bloquear servidores que contienen parásitos (adwares ó spywares), con el valor añadido de que también funcionara en el sentido inverso. Es decir, si algún parásito ha conseguido alojarse en nuestro sistema e intenta contactar con alguno de estos servidores (ya sea para suministrar información ó para descargar código) no podrá mientras esa IP este bloqueada en nuestro archivo hosts.

Y también podremos usarlo para filtrar páginas con contenidos para adultos.

Tal y como decíamos antes algunas utilidades (Spybot Search and Destroy por ejemplo), agregan al hosts direcciones de conocidos sitios que descargan adwares o spywares, para que no podamos acceder a sus páginas.
Hay dispares opiniones en cuanto a las ventajas de bloquear servidores mediante el archivo hosts, ya que tiene ciertos inconvenientes.
Archivos hosts extensos (más de 135kb) pueden provocar que el sistema se ralentice (ver resolución de problemas más abajo), y hay tener en cuenta que si por cualquier razón cambia la dirección IP de esos dominios seremos direccionados a una IP obsoleta. Tendremos que vigilar esto en caso de tener problemas al cargar alguna página.

Considerando lo anterior puede resultar útil conseguir una lista de sitios bloqueados por servir publicidad ó contenido indeseado. En el web www.mvps.org actualizan periódicamente un archivo hosts con IP bloqueadas y que podemos descargar comprimido en ZIP desde el siguiente enlace,

http://www.mvps.org/winhelp2002/hosts2.htm

ó en formato texto desde,

http://www.mvps.org/winhelp2002/hosts.txt

Una búsqueda en Google! también es útil para conseguir archivos hosts con IP de servidores bloqueadas.

Acelerar la carga de las páginas mas visitadas.
Si añadimos al archivo hosts las direcciones IP de las páginas que visitamos más frecuentemente, en especial la de la página de inicio del navegador, conseguiremos cargarla más rápidamente. Podemos conseguir la IP asociada a un nombre de dominio con el comando PING desde línea de comandos (Inicio-Ejecutar, escribimos “cmd” sin comillas).
Por ejemplo, "ping www.alerta-antivirus.red.es" devolverá en la salida la IP 172.16.250.110 que podremos incluir en el archivo hosts:

# Ejemplo de archivo HOSTS
127.0.0.1 localhost
194.69.254.61 www.alerta-antivirus.red.es

Hay que recordar que si la IP cambia tendremos que actualizarla.

Utilizar abreviaturas para nombres de servidores.
Algo que puede resultar útil e incluso cómico es que podemos asignar abreviaturas ó nombres distintos a servidores web. Estos servidores tienen que ser dedicados (asignados a una IP) y no virtuales (varios servidores con la misma IP). Con un archivo hosts como el siguiente conseguiremos que al escribir "cata" en nuestro navegador, seamos direccionados a “www.alerta-antivirus.red.es”, y que cuando escribamos “Tobias” (un supuesto amigo) seamos dirigidos a su página “www.paginadetobias.tk”.

# Ejemplo de archivo hosts
194.69.254.61 cata
129.43.19.32 Tobias
192.168.0.1 router


Posibles errores y Restauración del archivo hosts.

Si se ralentiza el sistema:
En sistemas Windows 2000 y XP se ha detectado que para archivos hosts mayores de 135kb la maquina tiende a ralentizarse, no ocurre para Windows 98 y Me. Para evitar este problema recomiendan configurar el Cliente DNS de automático a manual:
• Abrir el editor de servicios, Inicio->Ejecutar, teclear “services.msc” (sin comillas) y pulsar Aceptar.
• Seleccionar “Cliente DNS” en la columna nombre, hacer clic con el botón derecho y seleccionar Propiedades.
• Señalar “Tipo de Inicio” y seleccionar “Manual”, hacer clic en Aceptar y reiniciar.

Puedes comprobar si el servicio anterior es necesario abriendo el Editor de Servicios de nuevo después de un periodo de navegación. Para este servicio la columna de estado debería estar en blanco, si este servicio ha sido necesario la columna mostrara “Iniciado”.

Si usas un Proxy Server:
Si estas conectado a Internet usando AOL (un dialer proporcionado por tu ISP), a través de una conexión LAN (Red de Área Local) ó un servidor proxy remoto las recomendaciones sobre el archivo hosts no serán efectivas. Ya que consultará antes al servidor DNS que al archivo hosts.

Para solventar este problema en Internet Explorer:
• Vamos a Herramientas->Opciones de Internet->Conexiones.
• Nos aseguramos que la casilla “evita el servidor proxy para direcciones locales” esta marcada.

Si el equipo esta conectado a una red consultaremos previamente la configuración de esta antes de realizar ningún cambio.

Este tipo de problemas con el proxy también pueden ocurrir si cambiamos de ISP y la anterior configuración no fue eliminada correctamente. O si tuvimos un problema previo con Spyware ó Adware, es posible que la infección haya alterado la configuración de sistema. Podemos comprobarlo ejecutando la aplicación HijackThis y viendo si existe alguna de las siguientes entradas (estas son un pequeño ejemplo):

R1 - HKCUSoftwareMicrosoftWindowsCurrentVersionInternet Settings,
ProxyServer=127.0.0.1:8080
R1 - HKCUSoftwareMicrosoftWindowsCurrentVersionInternet Settings,
ProxyOverride =local

Recomendamos consultar siempre el ISP antes de realizar ningún cambio, ó podremos perder la conexión a Internet.

Restaurar el archivo Hosts:
Si tenemos problemas o vemos irregularidades con determinados dominios habría que comprobar nuestro archivo HOSTS. Ya hemos visto que hay parásitos que son capaces de modificarlo con el fin de redirigirnos a otro lugar.
Pero nuestros problemas también pueden ser debidos a una mala configuración del archivo hosts, en cualquier caso puede resultar útil el restaurarlo. Para ello podemos hacerlo utilizando una copia de seguridad que hayamos hecho anteriormente o restaurarlo a su estado por defecto abriendo con el notepad el archivo hosts y borrando todas las líneas que comiencen con un número excepto:

127.0.0.1     localhost

Si el archivo hosts no es el culpable, probablemente sea nuestro servidor DNS el que esté proporcionando una información incorrecta, en ese caso una posible solución sería cambiar de servidor DNS. Si en la configuración TCP/IP (Conexiones de red – Propiedades –TCP/IP – Propiedades…) no establecemos un servidor DNS específico, se usará el servidor DNS que nuestro proveedor de servicios de Internet tenga por defecto.


28/11/2005

Nortel VPN Router Configuration Guide | Michael McNamara

Nortel VPN Router Configuration Guide | Michael McNamara: "anaged to configure the SSL part of the router so HTTPS works, but I can’t get SSH working no matter what I try."

In this post I’ll provide an example of how to configure a Nortel VPN Router. We’ll configure the remote office VPN router for a tunnel with 3DES/SHA1 encryption and DH2 using pre-shared keys, routing all traffic to the main office across the tunnel (no split tunneling). You should start by connecting up to the local console port on the VPN router (the diskless 1100,1050,1010 require a special RJ45 -> DB9 console cable). Log into the VPN router with the default username of “admin” and the default password of “setup” and reset it to factory defaults. You’ll find the option under “R” for “Reset System to Factory Defaults”.
Welcome to the Contivity Secure IP Services Gateway
Copyright (c) 1999-2004 Nortel Networks, Inc.

Version: V05_00.136
Creation date: Aug 20 2004, 15:50:15

Date: 07/23/1980
Unit Serial Number: 11221

Please enter the administrator's user name: admin

Please enter the administrator's password:

Main Menu: System is currently in NORMAL mode.
1) Interfaces
2) Administrator
3) Default Private Route Menu
4) Default Public Route Menu
5) Create A User Control Tunnel(IPsec) Profile
6) Restricted Management Mode FALSE
7) Allow HTTP Management TRUE
8) Firewall Options
9) Shutdown
B) System Boot Options
P) Configure Serial Port
C) Controlled Crash
L) Command Line Interface
R) Reset System to Factory Defaults
E) Exit, Save and Invoke Changes

Please select a menu choice (1 - 9,B,P,C,L,R,E):

The first step will be to configure the IP addressing for the private LAN and public WAN interfaces. Using the serial console select “L) Command Line Interface” from the menu options.

CES>

Upon entering the CLI environment the prompt will be changed to “CES>”. You must now enter privileged mode using the “enable” command entering the default admin password of “setup”.

CES>enable
Password: *********

Let’s take care of the easy stuff first. I’m currently working in the Eastern time zone;

CES#clock timezone est
CES#clock set 15:22:30 12 JANUARY 2005

You can discern from the syntax above that #clock set
Now you must enter configuration mode using the commands listed below. We’ll reset the admin password before anything else.

CES#configure terminal
Enter configuration commands, one per line. End with Ctrl/z.
CES(config)#
CES(config)#adminname admin password

We’ll configure the private LAN IP Address. In the example below I’m using 10.2.203.1 as the LAN address of the branch office VPN router.

CES(config)#interface FastEthernet 0/1
CES(config-if)#ip address 10.2.203.1 255.255.255.0
CES(config-if)#exit

Next we’ll configure the MANAGEMENT IP Address. The LAN address and management IP address must be on the same subnet.

CES(config)#ip address 10.2.203.10
Management address set to 10.2.203.10 successfully !
Next, make sure Mgt addr and private LAN addr are on same subnet
CES(config)#

You should use the IP addressing that’s been assigned to the equipment your configuring in place of the IP addressing used above. Next we’ll assign the public WAN IP Address provided by the Internet Service Provider (ISP) which in this case happens to be Verizon DSL;

CES(config)#interface FastEthernet 1/1
CES(config-if)#ip address 70.256.1.10 255.255.255.0
%Warning: The IP address type is changed from DHCP dynamic to static
CES(config-if)#exit
CES(config)#ip default-network 70.256.1.1 public
CES(config)#ip name-server 151.197.0.38 151.197.0.39 199.45.32.43

NOTE: FastEthernet 0/1 is the PRIVATE LAN while FastEthernet 1/1 is the PUBLIC WAN
Let’s disable those services we won’t be using and enable those we will be using;

CES(config)#no tunnel protocol pptp public
CES(config)#no tunnel protocol pptp private
CES(config)#no tunnel protocol l2tp public
CES(config)#no tunnel protocol l2tp private
CES(config)#ipsec encryption 3des-sha1
CES(config)#ipsec encryption aes256-sha1
CES(config)#no ipsec encryption aes128-sha1
CES(config)#no ipsec encryption des40-md5
CES(config)#no ipsec encryption des40-sha1
CES(config)#no ipsec encryption des56-md5
CES(config)#no ipsec encryption des56-sha1
CES(config)#no ipsec encryption hmac-md5
CES(config)#no ipsec encryption hmac-sha1

Let’s configure the “Base” default Branch Office Group with the standard settings.

CES(config)#bo-group ipsec /Base
CES(config-bo_group/ipsec)#encryption 3des-sha1
CES(config-bo_group/ipsec)#encryption ike 3des-group2
CES(config-bo_group/ipsec)#antireplay enable
CES(config-bo_group/ipsec)#no compress
CES(config-bo_group/ipsec)#initial-contact enable
CES(config-bo_group/ipsec)#exit

Let’s add a designator for the local network (to be used later – replace with your IP network)

CES(config)#network add LocalNetwork ip 10.2.203.0 mask 255.255.255.0

Let’s add a sub group for our IPsec tunnel configuration;

CES(config)#bo-group add /Base/AcmeHealth
CES(config)#bo-conn add Acme-1 /Base/AcmeHealth
CES(config)#bo-conn Acme-1 /Base/AcmeHealth
CES(config/bo_conn)#conn-type peer2peer
CES(config/bo_conn)#local-endpoint 70.256.1.10
CES(config/bo_conn)#remote-endpoint 192.1.1.124
CES(config/bo_conn)#tunnel-type ipsec
CES(config/bo_conn)#ipsec authentication text-pre-shared-key password987
CES(config/bo_conn)#routing type static
CES(config/bo_conn)#state enable
CES(config/bo_conn)#routing static
CES(config/bo_conn/routing_static)#local-network LocalNetwork
CES(config/bo_conn/routing_static)#remote-network 0.0.0.0 mask 0.0.0.0 state enable cost 1
CES(config/bo_conn/routing_static)#exit

Let’s setup the DHCP relay agent forwarding our DHCP/BOOTP requests to 10.2.16.40;

CES(config)#no service dhcp enable
CES(config)#ip default-network 70.20.130.1 public
CES(config)#ip dhcp-relay 10.2.203.1
CES(config)#ip dhcp-relay 10.2.203.1 enable
CES(config)#ip helper-address 10.2.203.1 server 1 10.2.16.40
CES(config)#ip forward-protocol dhcp-relay

Since we’re routing everything over the IPSec tunnel (the remote-network was 0.0.0.0 with a mask of 0.0.0.0) we need to change the default route preference.

CES(config)#ip default-route-preference private private

That’s the short approach to using the CLI interface to configure the Nortel VPN Router. There is a somewhat old and slow web interface that you can also use to configure the VPN router. You only need to point a web browser to the mangement IP address.

Cheers!

Update: Wednesday December 10, 2008
Here’s the pinout for the special RJ45 to DB9 serial cable used to access the diskless VPN routers;

Cheers!

27 may 2009

Analyzing a SIP call

Analyzing a SIP call: "Analyzing a SIP call

This document describes how a SIP call is established in 3CX Phone System, and what events will be written to the ‘Server Status’ page in the 3CX Management console. Using this call flow description, and by analyzing the events, you will be able to better understand what’s going on and troubleshoot potential problems. Note that the call flow below is identical for both incoming and outgoing calls."

Step 1: Identifying the source of the caller

A call is initiated by a caller by picking up the phone and sending a SIP INVITE. When 3CX Phone System receives a SIP INVITE from a caller, a Call History event ‘Incoming’ is written to the server status log:

12:03:20.734| Log(2): | Incoming | c1 | "232" | | Incoming call (before routing)

The entry "232" is the SIP address of the caller. The address can be interpreted as follows:

  1. “232” is the ‘display name’ of caller;
  2. 232 (after
  3. <>IP address or domain name is the host or domain where it is registered.

The entry is the SIP address of the destination of the call.

Note that the event is called incoming, even though it could be both an inbound or an outbound call. Incoming refers to the fact that the PBX server is receiving a request from a caller – which could be an incoming or an outbound call.

Step 2: Verifying the source of the caller

3CX Phone System will now try resolve the source of the caller:

  1. If the call originates from a line configured on the 3CX Phone System (i.e the call is being received from a PSTN or VOIP Provider line), the following event will be logged:

    12:03:20.734| Log (2): | Call is incoming from line [#1234578 @Dlink]

    If the source’s host/IP matches one of the known gateways, but the given line number is not found among lines defined for the gateway, the call will be rejected and the following warning message will appear:

    12:03:20.734| Warning( 1): | Incoming call appears to be from gateway DLink, but line number #12345678 is unknown to phone system

    VOIP provider and VOIP Gateway lines do not need to be registered. To allow for wider support of gateways and providers (which work differently sometimes), 3CX Phone System will place or receive the call, even if the source is not registered.

  2. Now, 3CX Phone System will check if the call is made from an extension registered with 3CX Phone System. If it is found, the following event is written to the log:

    12:03:20.734| Log (2): | Registrar resolved as as

    If the extension is not found or is not registered the following message appears:

    12:03:20.734| Log (2): | Registrar can not resolve

  3. If the source of the caller can not be resolved, the Call History event ‘Rejected’ is generated:

    12:03:20.781| Log(2): | Rejected | c1 | "232" | | Attempt to call from an extension/line that is not registered/known to the phone system

    In this case the call initiator gets a SIP response ‘403 Forbidden’. This will be displayed on his/her SIP phone. At this point the call is terminated and a corresponding Call History event is generated:

    12:03:20.781| Log (2): | Terminated | c1 | "232" | | Call ended

Step 3: Finding the destination of the call

If the source of the call has been determined, the next step is to find the destination for the call.

  1. If the caller is from a PSTN or VOIP provider line, the associated inbound rule is used to find the extension number to forward the call to. The system checks whether the extension is registered with the system. If the extension is known and is registered, the following event is logged:

    ……… Found destination for caller

    Now the phone system checks if the call is from an extension for an outbound number. It does this by applying outbound rules to the dialled number. If a rule matches the number it is an outbound call (for example it finds a prefix 0)

    If no outbound rule can been matched it is assumed that the destination is an internal number (extension, ring group, IVR, etc.) and the system will try to find it in systems database. If it is an extension, but this extension is not registered, the following warning is written to the log:

    Destination has been found for , but it hasn't been registered! Unable to complete call.

  2. If the number is not found in the systems database it may be a Ring Group, Queue* or Conference* call. If it is, we proceed to the next point.

  3. If the dialed number is completely unknown to the phone system, the call is rejected and the following event is written to the server status log.

    14:21:58.840| Warn (1): | Dialed number 79306288 is not known to the phone system

After both source and destination have been resolved, the following Call History event is issued:

14:20:42.762| Log (2): | Routed | c2 | "103" | | From: Ext:103; To: [#25405292 @phoneline.com.mt]

Step 4: 3CX Phone System returns the invite

Now that both source and destination are known, 3CX Phone System returns the invite:

  1. 3CX Phone System sends an INVITE to the resolved destination address and writes the following Call History event to the server status log:

    14:20:49.575| Log(2): | Calling | c2 | "103" | | Send INVITE to [#25405292 @phoneline.com.mt]

  2. If a response does not arrive within 30 seconds, the call fails and the following Call history event is written to the log:

    14:21:29.903| Log (2): | Failed | c2 | "103" | | Call failed, reason: Request Timeout

  3. If a response is received the following Call History event is logged:

    14:19:46.403| Log(2): | Got response from | ;tag=b6edc8bfc47cda77 on invite from ;tag=766caf3f. Response line: SIP/2.0 180 Ringing

  4. Now the call will be either established – callee picks up the phone - , or terminated – caller hangs up the phone before answering. If the call is terminated, the terminated event in the Call History is as follows:

    14:19:52.059| Log (2): | Terminated | c1 | "103" | | Call ended

  5. If the call is established the following Call History event is written to the log:

    15:55:39.371| Log(2): | Established | c6 | "103" | | Call is established

  6. When the call is terminated – i.e caller or callee hangs up his phone – another Call History event is issued.

6 may 2009

Daniel's Intuit Blog - pulse of Asterisk & Nagios - Category: NAGIOS

Daniel's Intuit Blog - pulse of Asterisk & Nagios - Category: NAGIOS: "Enable SNMP on Asterisk and monitior with Nagios

Hi!

Last night i was playing with SNMP on one of our Asterisk server. Works actually well after a couple of hours 'testing' and sweating...

After i found out how to use / enable SNMP on a Asterisk machine i integrated it into our Nagios based monitoring solution. Sweet.... smile.

Download this tutorial with step by step instructions. Hope it well help some of you guys!

Cheers and enjoy the day!
Daniel"