'Gasy geek

malagasy geek miblaogy …

Gns3 + patched qemu 0.15.0 + debian wheezy/sid

leave a comment »

Qemu 0.15.0 is in unstable now and I have to patch it to emulate normally Cisco ASA 8.0(X) with Gns3, you have to do it also if you want emulate Juniper routers. This patch is necessary for UDP tunnels and multicast. I wrote this post to help debian users to achieve it.

Update your sources.list by adding a deb-src repository, for example here is my /etc/apt/sources.list:

deb http://mirror.malagasy.com/debian/ sid main contrib non-free  
deb http://mg.debian.net/debian/ sid main contrib non-free
deb-src ftp://mg.debian.net/debian/ sid main contrib non-free  

Run as superuser:

aptitude update

Fetch the qemu package source:

cd /tmp/
apt-get source qemu
wget http://code.gns3.net/qemu-patches/archive/8eb98a728e4f.tar.bz2
tar jxvf 8eb98a728e4f.tar.bz2
cd qemu-patches-8eb98a728e4f/
cat *.patch > ../qemu-0.15.0+dfsg/debian/patches/gns3.patch
echo "gns3.patch" >> ../qemu-0.15.0+dfsg/debian/patches/series 
cd ../qemu-0.15.0+dfsg/
apt-get install build-essential devscripts
apt-get build-dep qemu
debuild -us -uc
dpkg -i ../qemu*.deb

You can prevent an upgrade by pinning qemu:

aptitude hold qemu

Vita tompoko!!

Some useful links for you ;-)

- http://code.gns3.net/qemu-patches/
- http://forum.gns3.net/topic2784.html
- http://blog.gns3.net/2009/12/how-to-emulate-cisco-asa/
- http://blog.gns3.net/2009/10/olive-juniper/2/
- http://www.mediafire.com/?p1izkcij9rkbp87

Written by thierry

2011/11/06 at 7:59 pm

Posted in cisco, debian

Tagged with , , ,

convertir ma partition /home ext3 en ext4

leave a comment »

Comme je suis impatient et que j’en ai marre d’attendre le fsck de ma partition /home qui fait ~90GB une ou deux fois par semaine. Oui, oui, je sais, je peux changer cela avec tune2fs pour que ça arrive moins souvent mais ext4 m’a tenté ce soir. Enfin j’ai déjà monté ma partition ext3 en ext4 depuis 2 ou 3 mois.

La longue explication est ici. En résumé les principaux avantages par rapport à ext3 sont :

  • ext4 peut supporter un système de fichier très grand (1 EiB ou 260 octets) que ext3 (16TiB)
  • ext4 peut supporter un fichier très volumineux (16TiB ou 16To) que ext3 (16GiB)
  • ext4 est très rapide lors d’un fsck

Donc pour les impatients, ceci est les manips que j’ai sur une partition non-racine / ou /boot .

df -h

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/vg0-home 89G 80G 4,7G 95% /home

umount /dev/mapper/vg0-home
fsck.ext3 -pf /dev/mapper/vg0-home
tune2fs -O extents,uninit_bg,dir_index /dev/mapper/vg0-home
fsck.ext4 -yfD /dev/mapper/vg0-home
emacs /etc/fstab
mount -a

N’oubliez pas de modifier et de tester votre fstab

Written by thierry

2011/10/20 at 9:23 pm

Posted in debian, tips

Tagged with ,

mod_fcgid: read data timeout in 40 seconds

leave a comment »

Today, I get this error :

[Sun Oct 16 22:46:18 2011] [warn] [client 127.0.0.1] mod_fcgid: read data timeout in 40 seconds
[Sun Oct 16 22:46:18 2011] [error] [client 127.0.0.1] Premature end of script headers: index.php

Just increase your “Communication timeout to FastCGI server” in your vhost by adding this line :

FcgidIOTimeout 300

Written by thierry

2011/10/16 at 11:23 pm

Posted in Uncategorized

Tagged with ,

vpnc-connect: hash comparison failed: (ISAKMP_N_AUTHENTICATION_FAILED)(24) check group password!

leave a comment »

If you get this error! please check your config first for example :
cat -A /etc/vpnc/office.conf

IPSec secret 123456.789 $

Here I have a SPACE!! the result must be :


IPSec secret 123456.789$

Hope this will help.

Written by thierry

2011/09/29 at 10:42 pm

Posted in cisco, tips

Tagged with

Play! framework + GAE

with 3 comments

Je voulais faire un plugin nagios qui check notre ip public périodiquement car j’ai utilisé ip sla pour basculer automatiquement entre nos deux FAI. Il y a d’autre moyen de vérifier si je suis sur l’un ou l’autre …

Mon but dans ce post est d’avoir une page web qui retourne l’adresse IP que j’utilise, c’est très facile en PHP.

<?php echo $_SERVER['REMOTE_ADDR']; ?>

Vous mettez ça quelque part sur un serveur apache2 + php et c’est bon. Je voulais m’amuser avec Play! que je trouve accessible pour moi qui ne connais pas grand chose en Java et companie, j’étais plutôt dans CodeIgniter, Kohana, depuis quelques années… Je n’ai pas aussi un serveur sous la main pour mettre le script et j’ai pensé à Google Application Engine (GAE).

Read the rest of this entry »

Written by thierry

2011/09/27 at 8:57 pm

Posted in debian

Tagged with , ,

NetBackup Status Code 23 (socket read failed)

leave a comment »

Un matin j’ai eu ce message lors du backup d’un de nos contrôleurs de domaine. La liaison entre le master server et le serveur en question marche très bien, les ports ouverts vers le serveur master sont :

  • tcp/1521 pour le backup Oracle
  • tcp/1556 pour le java admin client
  • tcp/udp 13720,13722,13724,13782,13783

La résolution de nom sur les 2 serveurs marche aussi !!

L’erreur que j’ai :

8/31/2011 9:47:41 AM - Error bpbrm(pid=8060) bpcd on winsrv-ifrX exited with status 23: socket read failed
8/31/2011 9:47:46 AM - Error bpbrm(pid=8060) cannot send mail because BPCD on winsrv-ifrX exited with status 23: socket read failed
8/31/2011 9:47:49 AM - end writing
socket read failed(23)

D’après la doc de symantec il faut forcer la résolution du nom ( vraiment bizarre ), donc il faut éditer votre fichiers hosts comme ici :

http://www.symantec.com/business/support/index?page=content&id=TECH54563

Written by thierry

2011/08/31 at 10:23 am

Posted in tips

Tagged with

my nagios check_ftp plugin

leave a comment »

I use a modified version of a simple perl plugin check_ftp.pl from nagios exchange.
Here is my version:

#!/usr/bin/perl -w 
#
# Version 0.0.3
# # modified by Thierry Randrianiriana
# # used /dev/null
# # added missing exit
# # typos
# Version 0.0.2
# # fixed some bugs when using strict
# Version 0.0.1
# # initial version

use Net::FTP;
use Getopt::Long qw(:config no_ignore_case);

my $hostname = 'localhost';
my $username = 'anonymous';
my $password = 'username@domain.com';
my $port = '21';
my $directory = '/';
my $file = '';
my $verbose = '0';
my $passive = '0';
my $timeout = "30";
my $version = "0.0.2";

sub help ();

my $options_okay = GetOptions (
  'hostname|H=s'	=> \$hostname,
  'username|u=s'	=> \$username,
  'password|p=s'	=> \$password,
  'port|P=s'		=> \$port,
  'directory=s'		=> \$directory,
  'file=s'		=> \$file,
  'verbose=i'		=> \$verbose,
  'version'		=> \$version,
  'help|h'		=> sub {help}
);

# creating connection
my $ftp = Net::FTP->new("$hostname", Debug => $verbose, Port => $port, Timeout => $timeout, Passive => $passive );
my $err = $@;

if (! defined $ftp) {
    print "ERROR: ", $err;
    exit 2;
}

if (!$ftp->login("$username","$password")) { 
  print "ERROR: server says: ", $ftp->message;
  exit 2;
}

if ($file eq "") {
  if (!$ftp->ls("$directory")) { 
    print "WARNING: server says: " , $ftp->message;
    exit 1;
  } else  {
    print $ftp->message;
    exit 0;
  }
} else {
  if (!$ftp->ls("$file")) { 
    print "WARNING: server says: " , $ftp->message;
    exit 1;
  } else {
    if (!$ftp->get("$file","/dev/null")) {
      print "WARNING: server says: " , $ftp->message;
      exit 1;
    } else {
      my @message = $ftp->message;
      chomp @message;
      print "OK: ", "$message[0] $message[1]\n";
      exit 0;
    }
  }
}
$ftp->quit;

sub help () {
        print "Copyright (c) 2005 Joost Veldkamp, nagios at darth dot xs4all dot nl
This plugin checks a ftp server, logins supported. The check downloads a file and returns
OK when the download succeeded.

-H, --hostname=HOST
   Name or IP address of host to check
-u, --username=username
   FTP username
-p --password=password
   FTP Password
-P --port=INTEGER
   TCP port of the FTP server (default 21)
-d --directory=PATH
   Directory on the remote FTP server
-f --file=FILENAME
   Filename of the file on the remote FTP server
-v --verbose=INT
   Print verbose stuff when performing the check, default 0, other for debugging.
-h --help
   Print this message.
-v --version
   Print version number.
";
exit 0;
}

Written by thierry

2011/08/30 at 11:05 am

Posted in tips

Tagged with ,

RTA dance style 2011

leave a comment »

Le serveur de RTA ne supporte pas la charge, il faut faire un petit tunning du serveur web …


Written by thierry

2011/08/06 at 8:35 pm

Posted in Uncategorized

Tagged with

Upgrade Cisco IOS sur un 2811 pour détecter une HWIC 1Fe

leave a comment »

Nous avons eu un problème lors d’ajout d’une carte HWIC 1Fe sur un routeur, d’après les infos, il faut un iso 12.4(15) et supérieur pour qu’il puisse la détecter alors que le notre est à 12.4(11) donc nous sommes obligé de faire une mise à jour.

La procédure est simple :

  • sauvegarder l’ios existant sur le flash sur un serveur tftp (debian + tftpd)
  • supprimer l’ios sur le flash
  • télécharger le nouveau ios depuis un serveur tftp

Si vous n’avez pas encore un serveur tftp et que vous etes sur debian, ceci va vous aider sinon vous pouvez utiliser un serveur tftp comme celui de solarwinds.

aptitude install tftpd openbsd-inetd

J’ai modifié mon fichier /etc/inetd.conf comme :

grep tftp /etc/inetd.conf
tftp        dgram    udp    wait    nobody    /usr/sbin/tcpd    /usr/sbin/in.tftpd -s /srv/tftp

Relancer inetd :

killall inetd ; inetd &

Sauvegarder l’ios present sur le routeur au cas où.

Router#copy flash tftp
Source filename []? c2800nm-advipservicesk9-mz.124-11.T2.bin
Address or name of remote host []? 10.0.0.2
Destination filename [c2800nm-advipservicesk9-mz.124-11.T2.bin]?
…..
%Error opening tftp://10.0.0.2/c2800nm-advipservicesk9-mz.124-11.T2.bin (Timed out)

Mon serveur tftp est 10.0.0.2, assurez-vous que le routeur peut y accéder. Pour y écrire, j’ai eu un peu souci, il faut d’abord créer le fichier à transférer sur le serveur:

# touch /srv/tftp/c2800nm-advipservicesk9-mz.124-11.T2.bin
# chmod 777 /srv/tftp/c2800nm-advipservicesk9-mz.124-11.T2.bin

Recommencer :

Router#copy flash tftp                         
Source filename [c2800nm-advipservicesk9-mz.124-11.T2.bin]?
Address or name of remote host []? 10.0.0.2       
Destination filename [c2800nm-advipservicesk9-mz.124-11.T2.bin]?
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
39835176 bytes copied in 141.324 secs (281871 bytes/sec)

Récupérer le nouveau ios :

Router#copy tftp flash
Address or name of remote host []? 10.0.0.2
Source filename []? c2800nm-advipservicesk9-mz.124-24.T.bin
Destination filename [c2800nm-advipservicesk9-mz.124-24.T.bin]?
Accessing tftp://10.0.0.2/c2800nm-advipservicesk9-mz.124-24.T.bin…
Loading c2800nm-advipservicesk9-mz.124-24.T.bin from 10.0.0.2 (via FastEthernet0/0): !
%Error copying tftp://10.0.0.2/c2800nm-advipservicesk9-mz.124-24.T.bin (Not enough space on device)

Il me dit qu’il manque de place donc je vais supprimer l’ancien ios :

Router#delete flash:c2800nm-advipservicesk9-mz.124-11.T2.bin
Delete filename [c2800nm-advipservicesk9-mz.124-11.T2.bin]?
Delete flash:c2800nm-advipservicesk9-mz.124-11.T2.bin? [confirm]

On recommence :

Router#copy tftp flash                                      
Address or name of remote host [10.0.0.2]?
Source filename [c2800nm-advipservicesk9-mz.124-24.T.bin]?
Destination filename [c2800nm-advipservicesk9-mz.124-24.T.bin]?
Accessing tftp://10.0.0.2/c2800nm-advipservicesk9-mz.124-24.T.bin…
Loading c2800nm-advipservicesk9-mz.124-24.T.bin from 10.0.0.2 (via FastEthernet0/0): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[OK - 57637932 bytes]
57637932 bytes copied in 334.712 secs (172202 bytes/sec)

On verifie :

Router#show flash:
-#- –length– —–date/time—— path
1         2748 Jun 26 2009 13:57:58 +00:00 sdmconfig-2811.cfg
2       931840 Jun 26 2009 13:58:18 +00:00 es.tar
3      1505280 Jun 26 2009 13:58:36 +00:00 common.tar
4         1038 Jun 26 2009 13:58:50 +00:00 home.shtml
5       112640 Jun 26 2009 13:59:04 +00:00 home.tar
6      1697952 Jun 26 2009 13:59:30 +00:00 securedesktop-ios-3.1.1.45-k9.pkg
7       415956 Jun 26 2009 13:59:50 +00:00 sslclient-win-1.1.4.176.pkg
8     57637932 Aug 4 2011 05:45:22 +00:00 c2800nm-advipservicesk9-mz.124-24.T.bin

1695744 bytes available (62320640 bytes used)

On reload :

Router#reload
Proceed with reload? [confirm]

J’ai remarqué que le démarrage est devenu lent avec cet nouveau ios …

Yes! il a détecté la nouvelle carte HWIC 1Fe :

[...]
SETUP: new interface FastEthernet0/0/0 placed in “shutdown” state
[...]

Router#sh version
Cisco IOS Software, 2800 Software (C2800NM-ADVIPSERVICESK9-M), Version 12.4(24)T, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2009 by Cisco Systems, Inc.
Compiled Wed 25-Feb-09 17:55 by prod_rel_team

ROM: System Bootstrap, Version 12.4(13r)T11, RELEASE SOFTWARE (fc1)

Router uptime is 1 minute
System returned to ROM by power-on
System image file is “flash:c2800nm-advipservicesk9-mz.124-24.T.bin”
[...]
Cisco 2811 (revision 53.50) with 247808K/14336K bytes of memory.
Processor board ID FCZ132671T2
3 FastEthernet interfaces
1 Virtual Private Network (VPN) Module
DRAM configuration is 64 bits wide with parity enabled.
239K bytes of non-volatile configuration memory.
62720K bytes of ATA CompactFlash (Read/Write)

Vita tompoko!

Written by thierry

2011/08/04 at 7:49 pm

Posted in cisco

Tagged with , ,

Envoyer des sms sur debian gnu/linux

leave a comment »

Un petit tuto pour envoyer des sms en console sous linux, j’en ai besoin pour combiner avec mon serveur de monitoring Nagios. Le logiciel utilisé est Gammu, c’est très simple!
J’utilise un nokia e71, vous pouvez voir ici si le votre est supporté http://wammu.eu/phones/

aptitude install gammu

Connecter le téléphone sur votre ordinateur, ici j’utilise un cable usb type CA-101D .
Choisir “PC Suite” lors de la connexion.
dmesg donne :

...
[22811.664979] usb 4-1.3: USB disconnect, device number 4
[22814.163152] usb 4-1.3: new full speed USB device number 5 using ehci_hcd
[22814.257804] usb 4-1.3: New USB device found, idVendor=0421, idProduct=00ab
[22814.257810] usb 4-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[22814.257815] usb 4-1.3: Product: Nokia E71
[22814.257819] usb 4-1.3: Manufacturer: Nokia
[22814.355752] cdc_acm 4-1.3:1.10: ttyACM0: USB ACM device
[22814.356452] cdc_acm 4-1.3:1.12: ttyACM1: USB ACM device
[22814.356997] usbcore: registered new interface driver cdc_acm
[22814.356999] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[22814.366980] NET: Registered protocol family 35
[22814.410200] usbcore: registered new interface driver cdc_phonet
[22814.418027] usbcore: registered new interface driver cdc_ether
[22814.419599] usbcore: registered new interface driver rndis_host
[22814.457592] usbcore: registered new interface driver rndis_wlan

lsusb donne :

root@tux:/etc# lsusb
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 004 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 003: ID 138a:0007 Validity Sensors, Inc. VFS451 Fingeprint Reader
Bus 003 Device 004: ID 04f2:b15e Chicony Electronics Co., Ltd
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 046d:c018 Logitech, Inc. Optical Wheel Mouse
Bus 004 Device 003: ID 05ac:1292 Apple, Inc. iPhone 3G
Bus 004 Device 005: ID 0421:00ab Nokia Mobile Phones E71 (PC Suite mode)

Créer le fichier de conf /etc/gammurc :

[gammu]
port = /dev/ttyACM0
connection = at115200

Tester :

# gammu identify
Device               : /dev/ttyACM0
Manufacturer         : Nokia
Model                : unknown (Nokia E71)
Firmware             : V ICPR71_09w47.10,20-01-11
IMEI                 : 352710043176476
SIM IMSI             : 646020100145051

Envoyer le sms :

# echo "hello world" | /usr/bin/gammu --sendsms TEXT 0320533254
If you want break, press Ctrl+C...
Sending SMS 1/1....waiting for network answer..OK, message reference=193

Si vous voulez une interface graphique, vous pouvez installer wammu .

Written by thierry

2011/07/26 at 3:02 pm

Posted in debian, tips

Tagged with , ,

Follow

Get every new post delivered to your Inbox.