Problema Consola Proxmax desde Firefox

Un cop accedeixo remotament al meu Proliant microserver de casa els meus pares, hem trobo que amb el firefox veig la consola de les maquines virtuals en blanc sense contingut.

Tot rebuscant veig que es un problema de java i per sol.lucionar el que faig es intal.lar un script que sol.luciona el problema.

Afegeixo el seguent al sources.list /etc/apt/sources.list

deb http://www.duinsoft.nl/pkg debs all

Importo la gpg key

sudo apt-key adv --keyserver keys.gnupg.net --recv-keys 5CB26B26

sudo apt-get update

sudo apt-get install update-sun-jre

Salut !!

Share

Backup automàtic de mikrotiks dins guifi

Portava temps amb la idea de automatitzar backups de les rb’s que tinc per guifi i per fi ho estic implementant gràcies a les llistes de guifi 😉

Al servidor de casa tinc una maquina virtual amb una Mikrotik 3.20 que fare servir per recollir tots els backups de les rb’s.

Partim de la base que tant aquesta virtual com els clients tenim el SNTP configurat per tenir be el dia i hora a tot el tinglado…

A cada RB que volguem que faci backups automàtics cal introduir un script (on enlloc de xyz, hi posem el nom del node de guifi per exemple)

/system script 
add name=Backup source="/system backup save name=NomNodeGuifi" 

/system scheduler
add name="System Backup" on-event=Backup start-date=jul/03/2008 
start-time=23:15:00 interval=1w

Aqui es on li diem que ho faci un cop per setmana…

I finalment afegim l’script que l’envia i el scheduler setmanal

/system script 
add name=Fetch source="tool fetch address=IPguifiservidor 
user=***** password=****** src-path=nomdelnode.backup 
mode=ftp dst-path=nomdelnode.backup upload=yes"
/system scheduler
add name="Fetch Backup" on-event=Fetch 
start-date=jul/03/2008 start-time=23:30:00 interval=1w

Ja estaria… tansols comentar que amb el temps pot quedarse les memories de les rb’s plenes de backups i caldria anar borrant en local..
Salut !!!

Share

Trunk SIP amb SPA3000, porta el teu telefon fix a centraleta Asterisk via IP

Tret d’uns foro’s, us copio el manualillu:

IP SPA3102: 192.168.0.100
IP Asterisk: 192.168.0.200

INBOUND Trunk

  1. Acceder a la configuración avanzada y administrador, http://192.168.0.100/admin/advanced
  2. Ir a la pestaña PSTN
  3. Ir a la seccióm Proxy and Registration
  4. En proxy poner la IP del asterisk: 192.168.0.200
  5. Bajar el scroll e ir a Subscriber Information
  6. Poner User ID: PSTN
  7. Bajar a Dial Plans
  8. Ponre Dial Plan 2: (S0<:192.168.0.200>)
  9. Bajar a PSTN-To-VoIP Gateway Setup
  10. Poner PSTN CID for VoIP CID: yes (with PSTN Caller ID) / no (without PSTN Caller ID)
  11. Poner PSTN Caller Default DP: 2
  12. Bajar a FXO Timer Values (sec)
  13. Poner PSTN Answer Delay: 3 (with PSTN Caller ID) / 0 (without PSTN Caller ID)
  14. FXO Port Impedance: cambiar de 600 a 220+820||120nF
  15. SIP Remote-Party-ID: cambiar de yes a no
  16. Make Call Without Reg: cambiar a yes
  17. Ans Call Without Reg: cambiar a yes
  18. Register: cambiar a no

En Asterisk:

  1. Acceder a la configuración del FreePBX Setup.
  2. Pinchar en Trunks
  3. Pinchar en Add Trunk
  4. Pinchar en Add SIP Trunk
  5. Bajar a Inbound Settings
  6. Poner Trunk Name un nombre para el trunk, por ejemplo: TRUNKSPA3102
  7. Borrar los valores por defecto de Peer Details:, y reempazar por:
    Code:
    canreinvite=no
    context=from-pstn
    host=192.168.0.100
    insecure=very
    nat=no
    port=5061
    qualify=yes
    type=peer
    username=USER1
  8. Bajar a Incoming Settings
  9. Borrar valores por defecto de User Details:, dejarlo en blanco.
  10. Bajar scroll a la parte de abajo y pinchar en Submit Changes
  11. Pinchar en Click the You have made changes – when finished, click here to APPLY them at the top of the page.

Comprobar que nos acepta llamadas entrantes con la configuración, configurar las Inbound Routes en el interface del FreePBX, si no ponemos rutas de entrada, si no, no funcionará.

OUTBOUND Trunk

Esta es la segunda tarea, ahora que tenemos el SPA3102 con las llamadas PSTN entrantes a asterisk, ahora hay que permitir que el asterisk rute llamadas salientes hacia el SPA3102.

In reality, at this point any SIP device can send calls to the SPA-3000 and it will route them out the PSTN. Not the most secure setup, is it? After paying for someone else’s international and 900 calls that they conveniently routed through your SPA-3000 PSTN connection, you might want to consider restricting just who can use it. Here’s how:

En el SPA-3102:

  1. Acceder a Sipura SPA-3102, avanzado/administrador en http://192.168.0.100/admin/advanced
  2. Pinchar en PSTN Line tab
  3. Bajar a VoIP-To-PSTN Gateway Setup
  4. Poner VoIP Caller Auth Method: HTTP Digest
  5. Bajar a VoIP Users and Passwords (HTTP Authentication)
  6. Poner VoIP User 1 Auth ID: PSTN

En el Asterisk:

No hace falta cambios, con lo que hemos hecho en la tarea anterior es suficiente:

En Asterisk:

  1. Acceder a la configuración del FreePBX Setup.
  2. Pinchar en Trunks
  3. Pinchar en Add Trunk
  4. Pinchar en Add SIP Trunk
  5. Bajar a Outgoing Settings
  6. Poner Trunk Name un nombre para el trunk, por ejemplo: TRUNKSPA3102
  7. Borrar los valores por defecto de Peer Details:, y reempazar por:

 

Code:
canreinvite=no
context=from-pstn
host=192.168.0.100
insecure=very
nat=no
port=5061
qualify=yes
type=peer
username=USER1

No olvidar la configuración de la Outbound Route dentre del interfaz FreePBX, si no ponemos una routa de salida, asterisk no sabrá enviar una llamada hacia el SPA3102.

Share

Com instalar Ubiquiti UniFi en una debian

Primer ens cal tenir mongoDB 1.6.1 o superior, per instalar-ho….

sudo apt-key adv –keyserver keyserver.ubuntu.com –recv 7F0CEB10

deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen   (ubuntu)

deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen    (debian)

sudo apt-get update

sudo apt-get install mongodb-10gen

Ara anem per afegir el repositori…

editem /etc/apt/sources.list i afegim:

## Ubuntu Maverick (10.10):
deb http://www.ubnt.com/downloads/unifi/distros/deb/maverick maverick ubiquiti
## Ubuntu Lucid (10.4):
deb http://www.ubnt.com/downloads/unifi/distros/deb/lucid lucid ubiquiti
## Ubuntu Karmic (9.10):
deb http://www.ubnt.com/downloads/unifi/distros/deb/karmic karmic ubiquiti
## Ubuntu Jaunty (9.4):
deb http://www.ubnt.com/downloads/unifi/distros/deb/jaunty jaunty ubiquiti
## Debian Lenny (5.0):
deb http://www.ubnt.com/downloads/unifi/distros/deb/lenny lenny ubiquiti
## Debian Squeeze (6.0):
deb http://www.ubnt.com/downloads/unifi/distros/deb/squeeze squeeze ubiquiti

Guardem i a fegim GPG Key

sudo apt-key adv –keyserver keyserver.ubuntu.com –recv C0A52C50

i somhi…

apt-get update
apt-get install unifi
apt-get upgrade

Per accedir-hi:     https://<unifi_ip>:8443/

Salut !!!

Share

Desabilitar IPV6 a Ubuntu server

El IPV6 es pot desabilitar sense necessitat de reiniciar el pc de la seguent manera….

Agreguem al seguent arxiu /etc/sysctl.conf

#disable ipv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

Guardem i executem:

sysctl -p

Podem comprovar que ha quedat desabilitat de la següent manera

Amb IPV6 Actiu

lo        Link encap:Bucle local
Direc. inet:127.0.0.1  Másc:255.0.0.0
Dirección inet6: ::1/128 Alcance:Anfitrión
ACTIVO BUCLE FUNCIONANDO  MTU:16436  Métrica:1

Amb IPV6 INACTIU:

lo        Link encap:Bucle local
Direc. inet:127.0.0.1  Másc:255.0.0.0
ACTIVO BUCLE FUNCIONANDO  MTU:16436  Métrica:1

Salut !!!

Share

Icinga el germanet del Nagios completament Open Source

Estic provant un soft per monitorar xarxes que pinta molt i molt bé, demoment us passo un script d’instal.lació per ubuntu….

#!/bin/bash

# Icinga Ubuntu Server Post-install Script
# Ezra Bowden
# blog.kyodium.net
# Sept 5, 2011
# Updated: Jan 04, 2012

# Starts with a base server installation, no packages/groups added during OS installation.

# Running this script as root (sudo sh <scriptname>) against a base server install should
# have you up and running without any additional fiddling around. Let me know if you see a better way
# to do this, or any glaring errors.

# Tested versions:
# Ubuntu Server: 10.10/11.04/11.10
# Icinga: 1.5.0/1.5.1/1.6.0/1.6.1

# VARIABLES
PARAMETERS=”[-d|–debug] [–help] [-v|–version <version>] [–plugin-version <version>] [–enable-ssl] [–email <email address>] [–db-address <database ip address>]”
DEBUG=0
SSL=0
DB_ADDRESS=127.0.0.1  # Default is localhost, change this if database is hosted on a separate machine.
APTCMD=”apt-get install -y”
ICINGA_VER=”1.5.0″
PLUGIN_VER=”1.4.15″

# NOTE: If installing ssl then verify the additional ssl packages (under INSTALLING PACKAGES heading).
PACKAGES=”apache2 build-essential libgd2-xpm-dev libjpeg62 libjpeg62-dev libpng12-0 libpng12-dev”

# PARAMETER CHECK
while [ $# -gt 0 ]; do    # Until you run out of parameters …
case “$1” in
-d|–debug)
# “-d” or “–debug” parameter?
DEBUG=1
APTCMD=`echo “$APTCMD” | sed ‘/.*/ s/[ ]-y//’`
;;
–enable-ssl)
SSL=1
;;
–email)
shift
EMAIL=”$1″
;;
–db-address)
shift
DB_ADDRESS=”$1″
;;
-v|–version)
shift
ICINGA_VER=”$1″
;;
–plugin-version)
shift
PLUGIN_VER=”$1″
;;
*)
echo “\n”
echo “Usage: `basename $0` $PARAMETERS”
echo “\n”
echo “Running this script as root \(sudo sh `basename $0`\) against a base 10.10 server install should”
echo “have you up and running without any additional fiddling around. Let me know if you see a better way”
echo “to do this, or any glaring errors.”
echo “\n”
exit 0
;;
esac
shift       # Check next set of parameters.
done

# VARIABLES
# Set variables that might be changed by calling parameters
# Tarball download URLs
ICINGA_URL=”https://downloads.sourceforge.net/project/icinga/icinga/$ICINGA_VER/icinga-$ICINGA_VER.tar.gz”
PLUGINS_URL=”https://downloads.sourceforge.net/project/nagiosplug/nagiosplug/$PLUGIN_VER/nagios-plugins-$PLUGIN_VER.tar.gz”

# Icinga directory name
ICINGA_DIR=`echo “$ICINGA_URL” | sed ‘s/^\(.*\)\/\(.*\)\(\.tar\.gz\)/\2/’`

# VERIFY DOWNLOAD URLS
if [ “$DEBUG” = 1 ]; then read -p “[Press Enter to continue]” null; fi
echo “\n\n”
echo “——— VERIFYING DOWNLOAD URLS ———”

verifyURL ()
{
# Verify URLs
wget –spider -S $1

if [ $? -ne 0 ]; then
echo “URL verification failed:”
echo “$1”
echo “”
echo “There was a problem verifying the file download URL.”
echo “Please check that the URL above is correct in the script and try again.”
echo “”
echo “Installation Aborted.”
exit
else
echo “URL verification succeeded:”
echo “$1”
fi
echo “\n\n”
}

verifyURL $ICINGA_URL
verifyURL $PLUGINS_URL

if [ “$DEBUG” = 1 ]; then read -p “[Press Enter to continue]” null; fi
echo “\n\n”
echo “——— INSTALLING PACKAGES ———”

# Install ssl if specified.
if [ $SSL = 1 ]; then
PACKAGES=”$PACKAGES openssl libssl-dev”
fi

$APTCMD $PACKAGES

if [ “$DEBUG” = 1 ]; then read -p “[Press Enter to continue]” null; fi
echo “\n\n”
echo “——— INSTALLING MYSQL ———”
RELEASE=`lsb_release -rs`
if [ “$RELEASE” \< “11.10” ]; then
# pre 11.10 packages
PACKAGES=”mysql-server mysql-client libdbi0 libdbi0-dev libdbd-mysql”
else
# post 11.10 packages
PACKAGES=”mysql-server mysql-client libdbi1 libdbi-dev libdbd-mysql”
fi
$APTCMD $PACKAGES

if [ “$DEBUG” = 1 ]; then read -p “[Press Enter to continue]” null; fi
echo “\n\n”
echo “——— ADDING USER/GROUPS ———”
useradd -m icinga
echo “\a\a”
echo “!!!!!!!!!!     The next password prompt is for the system icinga user.     !!!!!!!!!!”
echo “\n”
passwd icinga
groupadd icinga-cmd
usermod -a -G icinga-cmd icinga
usermod -a -G icinga-cmd www-data

if [ “$DEBUG” = 1 ]; then read -p “[Press Enter to continue]” null; fi
echo  “\n\n”
echo “——— DOWNLOADING ICINGA ———”
cd /usr/src
FILE=`echo “$ICINGA_URL” | sed ‘s/^\(.*\)\/\(.*\)\(\.tar\.gz\)/\2\3/’`
if [ -e $FILE ]; then
echo “Local copy of $FILE exists, Skipping download.”
else
wget “$ICINGA_URL”
fi

echo “Extracting $FILE…”
tar -xzvf $FILE
#cd `echo “$FILE” | sed ‘s/^\(.*\)\(\.tar\.gz\)/\1/’`
cd $ICINGA_DIR

if [ “$DEBUG” = 1 ]; then read -p “[Press Enter to continue]” null; fi
echo  “\n\n”
echo “——— INSTALLING ICINGA ———”

CONF=”./configure –with-command-group=icinga-cmd –enable-idoutils”
if [ $SSL = 1 ]; then
CONF=”$CONF –enable-ssl”
fi

$CONF
make all
make fullinstall
make install-config

if [ “$DEBUG” = 1 ]; then read -p “[Press Enter to continue]” null; fi
echo “\n\n”
echo “——— CONFIGURING ICINGA ———”
#Change email to the address you’d like to receive alerts.

while [ -z “$EMAIL” ]; do
echo “\n\n”
echo “\a\a”
read -p “Enter the email address you want to receive icinga alerts: ” EMAIL
done

sed -i ‘s/\(.*\)icinga@localhost\(.*;\).*/\1’$EMAIL’\2/’ /usr/local/icinga/etc/objects/contacts.cfg # replace email address with $EMAIL

cd /usr/local/icinga/etc/
mv idomod.cfg-sample idomod.cfg
mv ido2db.cfg-sample ido2db.cfg
mv modules/idoutils.cfg-sample modules/idoutils.cfg

if [ $SSL = 1 ]; then
# Make changes to idoutils config files:

#   idomod.cfg
#    use_ssl=1
#    output_type=tcpsocket
#    output=127.0.0.1 (your database address if not on localhost)

sed -i ‘/^use_ssl=0/ s/0/1/’ idomod.cfg   # set use_ssl=1
sed -i ‘/output_type=tcpsocket/ s/^#//’ idomod.cfg # uncomment output_type=tcpsocket
sed -i ‘/^output_type=unixsocket/ s//#&/’ idomod.cfg # comment output_type=unixsocket
sed -i ‘/^output=.*ido.sock/ s//#&/’ idomod.cfg  # comment output=/usr/local/icinga/var/ido.sock
sed -i ‘/output=127.0.0.1/ s/^#//’ idomod.cfg  # uncomment this line
sed -i ‘s/\(^output\=\).*/\1’$DB_ADDRESS’/’ idomod.cfg # replace localhost address with $DB_ADDRESS

#   ido2db.cfg
#    use_ssl=1
#    socket_type=tcp

sed -i ‘/^use_ssl=0/ s/0/1/’ ido2db.cfg   # set use_ssl=1
sed -i ‘/socket_type=tcp/ s/^#//’ ido2db.cfg  # uncomment socket_type=tcp
sed -i ‘/^socket_type=unix/ s//#&/’ ido2db.cfg  # comment socket_type=unix
sed -i ‘s/\(^db_host\=\).*/\1’$DB_ADDRESS’/’ idomod.cfg # replace localhost address with $DB_ADDRESS
fi

if [ “$DEBUG” = 1 ]; then read -p “[Press Enter to continue]” null; fi
echo “\n\n”
echo “——— CONFIGURING MYSQL ———”
# MySQL icinga DB and user. Create idoutils tables.
echo “\a\a”
echo “!!!!!!!!!!     The next two password prompts are for the MySQL root password you set previously.     !!!!!!!!!!”
echo “\n”
start mysql
mysql -u root -p <<HERE
CREATE DATABASE icinga;
GRANT USAGE ON *.* TO ‘icinga’@’localhost’ IDENTIFIED BY ‘icinga’ WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0;
GRANT SELECT , INSERT , UPDATE , DELETE ON icinga.* TO ‘icinga’@’localhost’;
FLUSH PRIVILEGES;
quit
HERE
#mysql -u root -p icinga < /usr/src/icinga-1.5.0/module/idoutils/db/mysql/mysql.sql
mysql -u root -p icinga < /usr/src/$ICINGA_DIR/module/idoutils/db/mysql/mysql.sql

if [ “$DEBUG” = 1 ]; then read -p “[Press Enter to continue]” null; fi
echo “\n\n”
echo “——— INSTALLING CLASSIC INTERFACE ———”
cd /usr/src/$ICINGA_DIR
make cgis
make install-cgis
make install-html

# Install classic web config in apache conf.d directory:
make install-webconf

# Create icingaadmin account for logging into the classic web interface.
echo “\a\a”
echo “!!!!!!!!!!     The password prompt below is to set the web UI icingaadmin password.     !!!!!!!!!!”
echo “\n”
htpasswd -c /usr/local/icinga/etc/htpasswd.users icingaadmin

# Restart apache to apply new settings:
sudo service apache2 restart

if [ “$DEBUG” = 1 ]; then read -p “[Press Enter to continue]” null; fi
echo “\n\n”
echo “——— INSTALLING NAGIOS PLUGINS ———”
cd /usr/src
FILE=`echo “$PLUGINS_URL” | sed ‘s/^\(.*\)\/\(.*\)\(\.tar\.gz\)/\2\3/’`
if [ -e $FILE ]; then
echo “Local copy of $FILE exists, Skipping download.”
else
wget “$PLUGINS_URL”
fi
echo “Extracting…”
tar -xzvf “$FILE”
cd `echo “$FILE” | sed ‘s/^\(.*\)\(\.tar\.gz\)/\1/’`

./configure –prefix=/usr/local/icinga –with-cgiurl=/icinga/cgi-bin –with-htmurl=/icinga –with-nagios-user=icinga –with-nagios-group=icinga
make
make install

if [ “$DEBUG” = 1 ]; then read -p “[Press Enter to continue]” null; fi
echo “\n\n”
echo “——— STARTING SERVICES ———”
# Verify config file:
/usr/local/icinga/bin/icinga -v /usr/local/icinga/etc/icinga.cfg
service ido2db start
service icinga start

if [ “$DEBUG” = 1 ]; then read -p “[Press Enter to continue]” null; fi
echo “\n\n”
echo “——— CONFIGURING SERVICE STARTUP ———”
update-rc.d ido2db defaults
update-rc.d icinga defaults

echo “\n\n”
echo “——— INSTALLATION COMPLETE ———”
echo “\a\a”
echo “go to http://`ifconfig  | grep ‘inet addr:’| grep -v ‘127.0.0.1’ | cut -d: -f2 | awk ‘{ print $1}’`/icinga”
echo “and verify that Icinga is working. Use the login details below.”
echo “login: icingaadmin”
echo “password: <the password you set during installation>”
echo “\n”
read -p “[Press Enter to continue]” null
echo “\n\n”

Share

Seguim amb Ubiquiti… ara les Aircam

No fa gaire aquesta coneguda marca americana ha tret al mercat unes càmeres ip megapixel a un preu revolucionari per les prestacions que donen… el software es gratuït i compatible amb Linux.

Hi ha el software que es diu Airvision i el Airvision-nvr, aquest ultim transforma el pc amb un gravador. Per instal·lar-ho es senzill gràcies als repositoris d’ubiquiti.

Afegim el repositori:

nano /etc/apt/sources.list

## Ubiquiti AirVision and AirVision NVR
deb http://www.ubnt.com/downloads/airvision/apt oneiric ubiquiti 

 

Canviar <release> per:

oneiric for 11.10
natty for 11.04
maverick for 10.10
squeeze for Debian 6.0.x

Ens baixem la key

wget -O - http://www.ubnt.com/downloads/airvision/apt/airvision.gpg.key | sudo apt-key add -

sudo apt-get update

sudo apt-get upgrade

Instalem Java i flash

sudo apt-get install openjdk-6-jre
sudo apt-get install flashplugin-installer

sudo apt-get install airvision  (soft cams)

sudo apt-get install airvision-nvr (soft grabacio)

– Install Java 6 and Adobe Flash:

sudo apt-get install openjdk-6-jre
sudo apt-get install flashplugin-installer

Ja hi podem accedir amb la ip del server:7443

Una bona cosa a afegir es automatitzar que cada 10 dies per exemple a les 5 de la matinada esborri les imatges guardades, d’aquesta manera evitem que es quedi el disc ple…

sudo crontab -e
0 5 * * * find /var/cache/airvision-nvr/images/* -mtime +10 -exec rm {} \;

Salut   !!!!

Share