24 octobre 2006

conversion ext2 vers ext3

Converting the / directory
First, think long and hard before deciding to convert the root directory. Ext3's primary purpose is shorter recovery from disaster rather than data loss prevention. Converting the root directory from Ext2 to Ext3 isn't difficult, but converting it back from Ext3 to Ext2 is a treacherous process fraught with problems. But, if you really must perform the Ext2 to Ext3 conversion on the root directory, here's how, assuming /dev/hda2 is mounted as the root directory and /dev/hda1 is mounted as /boot:

* Log in as root
* Edit /etc/fstab and change ext2 to ext3 on the line referencing the root directory.
* tune2fs -j /dev/hda2
* cd /boot
* mv initrd-2.4.18-26.8.0.img initrd-2.4.18-26.8.0.img.ext2
* mkinitrd initrd-2.4.18-26.8.0.img 2.4.18-26.8.0
* reboot

In the preceding, you MUST perform all the steps, including the mkinitrd, before rebooting. Failing to perform all the steps before rebooting produces a "buried shovel" where if only you could boot the machine, you could run the mkinitrd command, and if only you could run the mkinitrd command, you could boot the machine.

23 octobre 2006

changer la configuration du clavier

Changement non persistant à la volée:

terminal: loadkeys be-latin1|us|uk|...

serveur X: setxkbmap

Persistant distribution spécifique:

RHEL : system-config-keyboard
Debian: dpkg-reconfigure console-data

20 octobre 2006

Wine basics

Wine Quickstart Guide

This Quickstart Guide will help you to get Wine running. Make sure you have Wine installed. If you don't check this page on installing Wine: http://winehq.org/site/docs/wineusr-guide/getting-wine

Installing an application

In this guide I will show you how to install MS Office 97.
In order to install an application you must know the name of the file to run and the location of the file.
In this example I must run setup.exe which is loacted in /media/cdrom.
To install Office I must run the following command:

$ wine /media/cdrom/setup.exe

The application will now be installed.




Running an application

The application will be installed in a directory called .wine in your HOME directory. If your file manager doesn't show this directory make sure that it shows hidden files/directories (.wine is a hidden directory).

Office is installed in ~/.wine/drive_c/Program Files/Microsoft Office/Office
If I want to run Word I must type the following lines:

$ cd ~/.wine/drive_c/Program Files/Microsoft\ Office/Office
$ wine winword.exe




It might be a good idea to create a file that launches Word. It could look like this:

#/bin/sh
cd ~/.wine/drive_c/Program Files/Microsoft\ Office/Office
wine winword.exe

Save this as word.sh in ~/bin and make it executable by typing chmod +x word.sh
You can now start Word by typing word.sh

04 octobre 2006

wpa supplicant

Authentification wi-fi sécurisée en Linux
- apt-get install wpasupplicant et wpagui

- créer fichier de config : par exemple : /etc/wpa_supplicant.conf
(voir plus bas en fonction de la méthode utilisée)

- mettre les certificats adéquat, par exemple dans : /etc/cert/*.*
client.p12 root.pem client.pem root.der

- lancer la commande :
wpa_supplicant -d -c/etc/wpa_supplicant.conf -ieth1 -Dwext

--> se lance en mode debugg
--> pour lancer en background : -B au lieu de -d
--> -Dwext dépend du driver utilisé faire un man de wpasupplicant

- lancer la commande :
wpa_gui

--> interface pour vérifier état de connexion et donner des paramètres complémentaires


--> il peut être nécessaire de faire un dhclient eth1 pour obtenir une adresse ip

--> il peut être nécessaire de définir l'interface par défaut (eth1 au lieu de eth0)

Exemples de configuration
---------------------------------------------------------
# WPA-PSK

ctrl_interface=/var/run/wpa_supplicant

network={
ssid="MULTITELWIFI"
key_mgmt=WPA-PSK
psk="*****************"
}
---------------------------------------------------------
--> OK
---------------------------------------------------------
# WPA-EAP/TLS

ctrl_interface=/var/run/wpa_supplicant

network={
ssid="MULTITELWIFI"
key_mgmt=WPA-EAP
eap=TLS
ca_cert="/etc/cert/root.pem"
private_key="/etc/cert/client.p12"
private_key_passwd="***************"
}
---------------------------------------------------------
--> promp pour le paramètre identity
sinon, on peut mettre en dur identity="username"
---------------------------------------------------------
# WPA-EAP/TTLS

ctrl_interface=/var/run/wpa_supplicant

network={
ssid="MULTITELWIFI"
key_mgmt=WPA-EAP
eap=TTLS
ca_cert="/etc/cert/root.pem"
}
---------------------------------------------------------
--> prompt pour les paramètre identity et password
sinon, mettre en dur :
---------------------------------------------------------
# WPA-EAP/TTLS avec paramètres dans le fichier pour éviter #prompt

ctrl_interface=/var/run/wpa_supplicant

network={
ssid="MULTITELWIFI"
key_mgmt=WPA-EAP
eap=TTLS
identity="******"
password="***********"
ca_cert="/etc/cert/root.pem"
}
---------------------------------------------------------
--> OK
---------------------------------------------------------
# WPA-EAP/PEAP

ctrl_interface=/var/run/wpa_supplicant

network={
ssid="MULTITELWIFI"
key_mgmt=WPA-EAP
eap=PEAP
ca_cert="/etc/cert/root.pem"
}
---------------------------------------------------------
--> OK
---------------------------------------------------------

29 août 2006

Compression d'une archive .TAR.GZ

Compression d'une archive .TAR.GZ

Syntaxe: tar

Dans les options, on doit mettre c pour créer une archive et non la décompresser, f pour indiquer qu'il s'agit d'un fichier, on peut mettre z pour compresser avec Gzip, et v si on désire avoir la liste des fichiers compressés qui défile.

Exemple: tar cfvz kfilecoder.tar.gz /root/projects/kfilecoder

Dans cet exemple, on crée un fichier kfilecoder.tar.gz compressé avec Gzip, dans lequel on met tous les fichiers contenus dans le dossier /root/projects/kfilecoder

21 août 2006

tftp server sur ubuntu 6.06

apt-get install tftpd-hpa

il faut changer la config par défaut
daemon mis à yes et -c pour permettre l'upload de nouveaux fichiers
les fichiers uploadés le seront dans le répertoire /var/lib/tftpboot


vi /etc/default/tftpd-hpa

#Defaults for tftpd-hpa
RUN_DAEMON="yes"
OPTIONS="-l -c -s /var/lib/tftpboot"

:wq

chmod 755 /var/lib/tftpboot

/etc/init.d/tftpd-hpa start

18 août 2006

OOo debug

Symptôme:

OOo plante à l'ouverture d'un fichier quel qu'il soit
Si on démarre OOo seul OK mais plante à l'ouverture d'un fichier

Si on le démarre en root OK

Solution:

vider le cache des documents récents
soit mv .recently-used .recently-used-2 (dans le home de l'utilisateur)
soit raccourcis > documents récents > vider les documents récents

17 août 2006

plusieurs pages par feuille (linux)

2 feuilles par page en colonne
psnup -2 -c -pa4 -Pa4 entree.ps sortie2.ps

ou petit script (/usr/local/bin/imprime)
#! /bin/bash
gui=`zenity --title="Selectionnez le fichier à imprimer" --file-selection `
cp $gui ~/source.ps
nombre=`zenity --list --radiolist --text "Choisissez le nombre de pages par feuilles à imprimer" --column "nombre" --column "de pages" TRUE 2 False 4 False 8`
format=`zenity --list --radiolist --text "Choisissez le format du papier" --column "Choix" --column "du format" TRUE a4 False a3 False letter`
echo $nombre
echo $format
psnup -$nombre -p"$format" ~/source.ps ~/sortie.ps
rm ~/source.ps
imprimante=`zenity --list --radiolist --text "Choisissez votre imprimante" --column "Choix" --column "nom imprimante" TRUE HL-5050 False LaserJet-1100 False AcuLaser-C4000`
lpr -P "$imprimante" ~/sortie.ps
rm ~/sortie.ps

reste à laisser choisir l'imprimante depuis une liste dynamique lpstat -v
et à gérer les pages "paysage" une option dans psnup à rajouter

14 août 2006

VMware server on Ubuntu 6.06

Avant de suivre ce howto installer les linux-headers, linux-source et linux-kernel-headers relatifs à votre noyau

/usr/src/linux-headers-2.6.15-27-386/include/ sera à indiquer si vous avez ce noyau par exemple en lieu et place de /usr/src/linux/include si votre noyau n'est pas reconnu...

How To Install VMware Server On Ubuntu 6.06 LTS (Dapper Drake)

Version 1.0
Author: Till Brehm
Last edited 07/13/2006

This tutorial provides step-by-step instructions on how to install the free VMware Server (version 1.0) on Ubuntu 6.06 LTS (Dapper Drake).

VMware has just released version 1.0 of its free VMware Server. With VMware Server you can create and run guest operating systems ("virtual machines") such as Linux, Windows, FreeBSD, etc. under a host operating system. This has the benefit that you can run multiple operating systems on the same hardware which saves a lot of money, and you can move virtual machines from one VMware Server to the next one (or to a system that has the VMware Player which is also free). In this article we use Ubuntu 6.06 LTS (Dapper Drake) as the host operating system.

I want to say first that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!

1 Preliminary Note

I assume you have already set up a basic Ubuntu 6.06 system. It doesn't matter if you use Ubuntu's server or desktop version. If you use the server version, you can set up your system as described on the first three pages of this tutorial: The Perfect Setup - Ubuntu 6.06 LTS Server (Dapper Drake).

You should have a working root account (as the following steps have to be run as root) or run

sudo su

to get root priveliges and also a static IP address. In this tutorial I use the IP address 192.168.0.100.

2 Installing Required packages

Now we install the packages required by VMware on our Ubuntu system:

apt-get install linux-kernel-headers libx11-6 libx11-dev libxtst6 xlibs-dev xinetd wget

apt-get install gcc binutils-doc cpp-doc gcc-4.0-locales make manpages-dev autoconf automake1.9 libtool flex bison gdb gcc-doc gcc-4.0-doc libc6-dev-amd64 lib64gcc1

and create the directory /var/vm where we want to install our virtual machines later. The virtual machines require much disk space, make sure you have enough free space on your /var partition for the virtual machines.:

mkdir /var/vm

3 Getting VMware Server

The VMware server can be downloaded for free from the VMware website: http://www.vmware.com/download/server/
To run the VMware Server software you need a (free) serial number, that can be requested by clicking on the "Register now" button on the download page.

4 Downloading The Software

To setup VMWare Server on Ubuntu, we need the following packages from the VMware downloads page:

VMware Server for linux (Binary tar.gz)
Management Interface (Binary tar.gz)

To create new virtual machines, we need VMware server client package either for Windows if you want to create them from your Windows workstation or for Linux if you have a Linux workstation.

For downloading the software to your server, I recommend to use the linux commandline program wget. The wget syntax is as follows:

wget [URL of the file that shall be downloaded]

Unpacking the server tar.gz:

tar xvfz VMware-server-*.tar.gz

Running the installer script:

cd vmware-server-distrib
./vmware-install.pl

The installer asks you a few questions. Most of the time you can accept the default value:

Creating a new installer database using the tar3 format.

Installing the content of the package.

In which directory do you want to install the binary files?
[/usr/bin]
<-- /usr/bin

What is the directory that contains the init directories (rc0.d/ to rc6.d/)?
[/etc]
<-- /etc

What is the directory that contains the init scripts?
[/etc/init.d]
<-- /etc/init.d

In which directory do you want to install the daemon files?
[/usr/sbin]
<-- /usr/sbin

In which directory do you want to install the library files?
[/usr/lib/vmware]
<-- /usr/lib/vmware

The path "/usr/lib/vmware" does not exist currently. This program is going to
create it, including needed parent directories. Is this what you want? [yes]
<-- yes

In which directory do you want to install the manual files?
[/usr/share/man]
<-- /usr/share/man

In which directory do you want to install the documentation files?
[/usr/share/doc/vmware]
<-- /usr/share/doc/vmware

The path "/usr/share/doc/vmware" does not exist currently. This program is going
to create it, including needed parent directories. Is this what you want?
[yes]
<-- yes

The installation of VMware Server 1.0.0 build-28343 for Linux completed
successfully. You can decide to remove this software from your system at any
time by invoking the following command: "/usr/bin/vmware-uninstall.pl".

Before running VMware Server for the first time, you need to configure it by
invoking the following command: "/usr/bin/vmware-config.pl". Do you want this
program to invoke the command for you now? [yes]
<-- yes

Making sure services for VMware Server are stopped.

Stopping VMware services:
Virtual machine monitor done

You must read and accept the End User License Agreement to continue.
Press enter to display it.


..... snip [LICENCE TEXT] ......


Do you accept? (yes/no)
<-- yes
Thank you.

Configuring fallback GTK+ 2.4 libraries.

In which directory do you want to install the mime type icons?
[/usr/share/icons]
<-- /usr/share/icons

The path "/usr/share/icons" does not exist currently. This program is going to
create it, including needed parent directories. Is this what you want? [yes]
<-- yes

What directory contains your desktop menu entry files? These files have a
.desktop file extension. [/usr/share/applications]
<-- /usr/share/applications

The path "/usr/share/applications" does not exist currently. This program is
going to create it, including needed parent directories. Is this what you want?
[yes]
<-- yes

In which directory do you want to install the application's icon?
[/usr/share/pixmaps]
<-- /usr/share/pixmaps

Trying to find a suitable vmmon module for your running kernel.

The module bld-2.6.15-23-i386server-Ubuntu6.06 loads perfectly in the running
kernel.

Do you want networking for your virtual machines? (yes/no/help) [yes] <-- yes

Configuring a bridged network for vmnet0.

The following bridged networks have been defined:

. vmnet0 is bridged to eth0

All your ethernet interfaces are already bridged.

Do you want to be able to use NAT networking in your virtual machines? (yes/no)
[yes]
<-- yes

Configuring a NAT network for vmnet8.

Do you want this program to probe for an unused private subnet? (yes/no/help) <-- yes
Probing for an unused private subnet (this can take some time)...

The subnet 192.168.246.0/255.255.255.0 appears to be unused.

The following NAT networks have been defined:

. vmnet8 is a NAT network on private subnet 192.168.246.0.

Do you wish to configure another NAT network? (yes/no) [no] <-- no

Do you want to be able to use host-only networking in your virtual machines?
[yes]
<-- yes

Configuring a host-only network for vmnet1.

Do you want this program to probe for an unused private subnet? (yes/no/help)
[yes]
<-- yes

Probing for an unused private subnet (this can take some time)...

The subnet 172.16.37.0/255.255.255.0 appears to be unused.

The following host-only networks have been defined:

. vmnet1 is a host-only network on private subnet 172.16.37.0.

Do you wish to configure another host-only network? (yes/no) [no] <-- no

Trying to find a suitable vmnet module for your running kernel.

The module bld-2.6.15-23-i386server-Ubuntu6.06 loads perfectly in the running
kernel.

Please specify a port for remote console connections to use [902] <-- 902

Stopping internet superserver: xinetd.
Starting internet superserver: xinetd.
Configuring the VMware VmPerl Scripting API.

Building the VMware VmPerl Scripting API.

Using compiler "/usr/bin/gcc". Use environment variable CC to override.

Installing the VMware VmPerl Scripting API.

The installation of the VMware VmPerl Scripting API succeeded.

Generating SSL Server Certificate

In which directory do you want to keep your virtual machine files?
[/var/lib/vmware/Virtual Machines]
<-- /var/vm

Please enter your 20-character serial number.

Type XXXXX-XXXXX-XXXXX-XXXXX or 'Enter' to cancel: <-- your VMware Server serial number

Starting VMware services:
Virtual machine monitor done
Virtual ethernet done
Bridged networking on /dev/vmnet0 done
Host-only networking on /dev/vmnet1 (background) done
Host-only networking on /dev/vmnet8 (background) done
NAT service on /dev/vmnet8 done

The configuration of VMware Server 1.0.0 build-28343 for Linux for this running
kernel completed successfully.

5 Installing The VMware Management Interface

The VMware Management Interface is a Web-based management tool that allows you to

  • monitor the state of virtual machines and the VMware Server host on which they are running.
  • control (power on, suspend, resume, reset and power off) the virtual machines on that host.
  • view details about each virtual machine, including system summary, hardware information, any connected users and a log of recent events.

(Please note: it cannot be used to create virtual machines. To do this, you must install the VMWare console (available for Windows and Linux) on a client PC.)

cd /tmp
tar xvfz VMware-mui-*.tar.gz
cd vmware-mui-distrib
./vmware-install.pl

Accept the end user licence:

Do you accept? (yes/no) <-- yes

Thank you.

Installing the content of the package.

In which directory do you want to install the binary files?
[/usr/bin]
<-- /usr/bin

What is the directory that contains the init directories (rc0.d/ to rc6.d/)?
[/etc]
<-- /etc

What is the directory that contains the init scripts?
[/etc/init.d]
<-- /etc/init.d

In which directory do you want to install the VMware Management Interface files?
[/usr/lib/vmware-mui]
<-- /usr/lib/vmware-mui

The path "/usr/lib/vmware-mui" does not exist currently. This program is going
to create it, including needed parent directories. Is this what you want?
[yes]
<-- yes

In which directory would you like to install the documentation files?
[/usr/lib/vmware-mui/doc]
<-- /usr/lib/vmware-mui/doc

The path "/usr/lib/vmware-mui/doc" does not exist currently. This program is
going to create it, including needed parent directories. Is this what you want?
[yes]
<-- yes

Before running VMware Management Interface for the first time, you need to
configure it by invoking the following command:
"/usr/bin/vmware-config-mui.pl". Do you want this program to invoke the command
for you now? [yes]
<-- yes

The installation of VMware Management Interface 1.0.0 build-28343 for Linux
completed successfully. You can decide to remove this software from your system
at any time by invoking the following command:
"/usr/bin/vmware-uninstall-mui.pl".

Before running VMware Management Interface for the first time, you need to
configure it by invoking the following command:
"/usr/bin/vmware-config-mui.pl". Do you want this program to invoke the command
for you now? [yes]
<-- yes

Configuring httpd.conf to run Apache as:
User: www-data and Group: nogroup

Set the number of minutes before a http session times out. (This is the length
of time before someone connecting to VMware Management Interface will be logged
out) [60]
<-- 60

Generating SSL Server Certificate

Starting httpd.vmware: done
The configuration of VMware Management Interface completed successfully.

Create a directory for the VMware httpd:

mkdir /var/run/vmware/httpd
chown www-data:www-data /var/run/vmware/httpd

You will now be able to login the the VMware management interface with the URL:

https://192.168.0.100:8333/

To login use the username root and the password of your root system user.

This interface shows status information of the installed VM instances and you are able to start and stop VM instances:

To create new VM instances, use the VMware console which is availabe as Linux and Windows GUI application.

There are many ready-to-run appliances for the VMware server available, for example the ISPConfig webhosting appliance based on the HowtoForge perfect setup for Debian 3.1:

http://www.vmware.com/vmtn/appliances/directory/342

Many other appliances can be found in the VMWare Appliances directory:

http://www.vmware.com/vmtn/appliances/

6 Creating A Virtual Machine

We use the VMWare Linux or Windows GUI application to create a new virtual machine on our VMware server.

Login to your server with the IP address or hostname, the user root and the root password.

Click on New Virtual Machine and follow the whizard. The wizard asks you to select:

  • Operating system (Linux, Windows, Novell Netware, Solaris or other operating system)
  • Operating system version
  • Location and virtual machine name. The folder /var/vm that we created in the setup is preselected.
  • Networking: If you want the virtual machine to be part of the same network than the server itself, select bridged networking.
    If you want to use a virtual NAT, select Network address translation.
  • Enter the size of your virtual harddisk. I recommend to disable the option that creates the virtual harddisk in full size instantly, the harddisk will then grow with the data that you store inside up to the max. size you selected.
  • After you finished the VM creation wizard, put the boot disk of the operating system you want to install in the CD / DVD drive of your server and start the VM.

All trademarks belong to their respective owners. We thank VMware Inc. for the permission to write this Howto.

7 Links

11 août 2006

Impression de plusieurs pages sur une imprimante

sous Ubuntu Dapper LTS 6.06

sudo apt-get install psutils
psnup -pa4 -4 test.ps test4.ps (depuis le répertoire où se trouve le fichier à imprimer)

-pa4 (on veut du format a4 en sortie)
-4 quatre pages par feuille
fichier en entrée et fichier de sortie

ensuite il suffit d'imprimer à partir d'evince test4.ps

09 août 2006

Cisco VPN client under Ubuntu 6.06 (LTS) Linux


Avec la version vpnclient-linux-4.8.00.0490-k9.tar.gz plus besoin de patcher sur une ubuntu 6.06 (le reste reste valable)

Avec la version vpnclient-linux-4.7.00.0640-k9.tar.gz suivre ce howto:

One of my customers has a VPN which I'd like to access. They provided me with a copy of the Cisco VPN client for Linux, and a "pcf" configuration file for the client. Here's what i had to do to get the Cisco VPN client working in Linux - and it does work just fine.

First we make a directory to put the bits and bobs in

alan@hactar:~$ mkdir cisco
alan@hactar:~$ cd cisco/

I then downloaded the Cisco VPN client from my customers intranet and saved it in the cisco directory I just created. I then unpacked it which makes a directory called vpnclient and unpacks the files into it.

alan@hactar:~/cisco$ tar zxvf vpnclient-linux-4.6.02.0030-k9.tar.gz
vpnclient/
vpnclient/libvpnapi.so
vpnclient/vpnapi.h
vpnclient/cisco_cert_mgr
vpnclient/vpnclient
vpnclient/ipseclog
vpnclient/cvpnd
vpnclient/vpn_install
vpnclient/vpnclient_init
vpnclient/vpn_uninstall
vpnclient/driver_build.sh
vpnclient/sample.pcf
vpnclient/vpnclient.ini
vpnclient/license.txt
vpnclient/license.rtf
vpnclient/interceptor.c
vpnclient/linuxcniapi.c
vpnclient/linuxcniapi.h
vpnclient/vpn_ioctl_linux.h
vpnclient/IPSecDrvOS_linux.c
vpnclient/linux_os.h
vpnclient/frag.h
vpnclient/frag.c
vpnclient/GenDefs.h
vpnclient/mtu.h
vpnclient/IPSecDrvOSFunctions.h
vpnclient/IPSecDrvOS_linux.h
vpnclient/Cniapi.h
vpnclient/unixcniapi.h
vpnclient/config.h
vpnclient/libdriver.so
vpnclient/Makefile

Dive into the directory and check all the files are there

alan@hactar:~/cisco/vpnclient$ ls -l
total 4580
-rwxr-xr-x 1 alan alan 1149812 2005-03-11 22:43 cisco_cert_mgr
-rw-r--r-- 1 alan alan 15974 2005-03-11 22:43 Cniapi.h
-rw-r--r-- 1 alan alan 4474 2005-03-11 22:43 config.h
-rwxr-xr-x 1 alan alan 1943604 2005-03-11 22:43 cvpnd
-rwxr-xr-x 1 alan alan 1430 2005-03-11 22:43 driver_build.sh
-rw-r--r-- 1 alan alan 6301 2005-03-11 22:43 frag.c
-rw-r--r-- 1 alan alan 227 2005-03-11 22:43 frag.h
-rw-r--r-- 1 alan alan 4500 2005-03-11 22:43 GenDefs.h
-rw-r--r-- 1 alan alan 21952 2005-03-11 22:43 interceptor.c
-rw-r--r-- 1 alan alan 2524 2005-03-11 22:43 IPSecDrvOSFunctions.h
-rw-r--r-- 1 alan alan 5138 2005-03-11 22:43 IPSecDrvOS_linux.c
-rw-r--r-- 1 alan alan 1249 2005-03-11 22:43 IPSecDrvOS_linux.h
-rwxr-xr-x 1 alan alan 205464 2005-03-11 22:43 ipseclog
-rwxr-xr-x 1 alan alan 516924 2005-03-11 22:43 libdriver.so
-rwxr-xr-x 1 alan alan 356756 2005-03-11 22:43 libvpnapi.so
-rw-r--r-- 1 alan alan 4449 2005-03-11 22:43 license.rtf
-rw-r--r-- 1 alan alan 4130 2005-03-11 22:43 license.txt
-rw-r--r-- 1 alan alan 16856 2005-03-11 22:43 linuxcniapi.c
-rw-r--r-- 1 alan alan 1291 2005-03-11 22:43 linuxcniapi.h
-rw-r--r-- 1 alan alan 1852 2005-03-11 22:43 linux_os.h
-rw-r--r-- 1 alan alan 908 2005-03-11 22:43 Makefile
-rw-r--r-- 1 alan alan 1926 2005-03-11 22:43 mtu.h
-rw-r--r-- 1 alan alan 349 2005-03-11 22:43 sample.pcf
-rw-r--r-- 1 alan alan 946 2005-03-11 22:43 unixcniapi.h
-rw-r--r-- 1 alan alan 24385 2005-03-11 22:43 vpnapi.h
-rwxr-xr-x 1 alan alan 263264 2005-03-11 22:43 vpnclient
-rw-r--r-- 1 alan alan 172 2005-03-11 22:43 vpnclient.ini
-rwxr-xr-x 1 alan alan 2961 2005-03-11 22:43 vpnclient_init
-rwxr-xr-x 1 alan alan 13826 2005-03-11 22:43 vpn_install
-rw-r--r-- 1 alan alan 1008 2005-03-11 22:43 vpn_ioctl_linux.h
-rwxr-xr-x 1 alan alan 5992 2005-03-11 22:43 vpn_uninstall

To make this you need the kernel headers for your current running kernel version. uname -r tells us the kernel version number:

alan@hactar:~$ uname -r
2.6.15-23-686

Using that information we can (in Ubuntu and other Debian based distributions) easily download the kernel headers with a command like this:

alan@hactar:~$ sudo apt-get install linux-headers-`uname -r`
Reading package lists... Done
Building dependency tree... Done
linux-headers-2.6.15-23-686 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 66 not upgraded.

Looks like I already have it. Lets double check:

alan@hactar:~/cisco/vpnclient$ ls /usr/src/linux-headers-2.6.15-23-686/
arch crypto include kernel mm scripts usr
block drivers init lib Module.symvers security
cluster fs ipc Makefile net sound

That all looks sane. Now we need to patch the client because it won't compile otherwise.
Get the patch from here:

Here is a direct link:

Save it in the vpnclient directory then apply it:

alan@hactar:~/cisco/vpnclient$ patch -p0 <>

Do a quick make to see if it compiles sanely.

alan@hactar:~/cisco/vpnclient$ make
make -C /lib/modules/2.6.15-23-686/build SUBDIRS=/home/alan/cisco/vpnclient modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.15-23-686'
CC [M] /home/alan/cisco/vpnclient/linuxcniapi.o
CC [M] /home/alan/cisco/vpnclient/frag.o
CC [M] /home/alan/cisco/vpnclient/IPSecDrvOS_linux.o
CC [M] /home/alan/cisco/vpnclient/interceptor.o
/home/alan/cisco/vpnclient/interceptor.c: In function ‘handle_vpnup’:
/home/alan/cisco/vpnclient/interceptor.c:312: warning: assignment from incompatible pointer type
/home/alan/cisco/vpnclient/interceptor.c:336: warning: assignment from incompatible pointer type
/home/alan/cisco/vpnclient/interceptor.c:337: warning: assignment from incompatible pointer type
/home/alan/cisco/vpnclient/interceptor.c: In function ‘do_cleanup’:
/home/alan/cisco/vpnclient/interceptor.c:380: warning: assignment from incompatible pointer type
LD [M] /home/alan/cisco/vpnclient/cisco_ipsec.o
Building modules, stage 2.
MODPOST
Warning: could not find /home/alan/cisco/vpnclient/.libdriver.so.cmd for /home/alan/cisco/vpnclient/li bdriver.so
CC /home/alan/cisco/vpnclient/cisco_ipsec.mod.o
LD [M] /home/alan/cisco/vpnclient/cisco_ipsec.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.15-23-686'

That looks good. Now lets do it for real with the vpn_install script supplied by Cisco.

alan@hactar:~/cisco/vpnclient$ sudo ./vpn_install
Cisco Systems VPN Client Version 4.6.02 (0030) Linux Installer
Copyright (C) 1998-2004 Cisco Systems, Inc. All Rights Reserved.

By installing this product you agree that you have read the
license.txt file (The VPN Client license) and will comply with
its terms.


Directory where binaries will be installed [/usr/local/bin]

Automatically start the VPN service at boot time [yes]

In order to build the VPN kernel module, you must have the
kernel headers for the version of the kernel you are running.


Directory containing linux kernel source code [/lib/modules/2.6.15-23-686/build]

* Binaries will be installed in "/usr/local/bin".
* Modules will be installed in "/lib/modules/2.6.15-23-686/CiscoVPN".
* The VPN service will be started AUTOMATICALLY at boot time.
* Kernel source from "/lib/modules/2.6.15-23-686/build" will be used to build the module.

Is the above correct [y]

Making module
make -C /lib/modules/2.6.15-23-686/build SUBDIRS=/home/alan/cisco/vpnclient modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.15-23-686'
Building modules, stage 2.
MODPOST
Warning: could not find /home/alan/cisco/vpnclient/.libdriver.so.cmd for /home/alan/cisco/vpnclient/li bdriver.so
make[1]: Leaving directory `/usr/src/linux-headers-2.6.15-23-686'
Create module directory "/lib/modules/2.6.15-23-686/CiscoVPN".
Copying module to directory "/lib/modules/2.6.15-23-686/CiscoVPN".
Already have group 'bin'

Creating start/stop script "/etc/init.d/vpnclient_init".
/etc/init.d/vpnclient_init
Enabling start/stop script for run level 3,4 and 5.
Creating global config /etc/opt/cisco-vpnclient

Installing license.txt (VPN Client license) in "/opt/cisco-vpnclient/":

Installing bundled user profiles in "/etc/opt/cisco-vpnclient/Profiles/":
* New Profiles : sample

Copying binaries to directory "/opt/cisco-vpnclient/bin".
Adding symlinks to "/usr/local/bin".
/opt/cisco-vpnclient/bin/vpnclient
/opt/cisco-vpnclient/bin/cisco_cert_mgr
/opt/cisco-vpnclient/bin/ipseclog
Copying setuid binaries to directory "/opt/cisco-vpnclient/bin".
/opt/cisco-vpnclient/bin/cvpnd
Copying libraries to directory "/opt/cisco-vpnclient/lib".
/opt/cisco-vpnclient/lib/libvpnapi.so
Copying header files to directory "/opt/cisco-vpnclient/include".
/opt/cisco-vpnclient/include/vpnapi.h

Setting permissions.
/opt/cisco-vpnclient/bin/cvpnd (setuid root)
/opt/cisco-vpnclient (group bin readable)
/etc/opt/cisco-vpnclient (group bin readable)
/etc/opt/cisco-vpnclient/Profiles (group bin readable)
/etc/opt/cisco-vpnclient/Certificates (group bin readable)
* You may wish to change these permissions to restrict access to root.
* You must run "/etc/init.d/vpnclient_init start" before using the client.
* This script will be run AUTOMATICALLY every time you reboot your computer.

Yay! That all looks pretty good. There is a sample profile supplied with the client which lives by default in /etc/opt/cisco-vpnclient/Profiles/, lets see:

alan@hactar:~/cisco/vpnclient$ ls /etc/opt/cisco-vpnclient/Profiles/
sample.pcf

Now I will copy the configuration file supplied by my customer to that location so the software can find it:

alan@hactar:~/cisco/vpnclient$ sudo cp *.pcf /etc/opt/cisco-vpnclient/Profiles/

Lets check they're there.

alan@hactar:~/cisco/vpnclient$ ls /etc/opt/cisco-vpnclient/Profiles/
XXX-XXX_XXX-VPN.pcf YYY-YYY_YYY-VPN.pcf ZZZ-ZZZ-ZZZ-1.pcf sample.pcf

(Note I've changed the names of the files to hide some info.)
The next bit will be started when I reboot, but as I don't want to reboot right now I'll start it myself:

alan@hactar:~/cisco/vpnclient$ sudo /etc/init.d/vpnclient_init start
Starting /opt/cisco-vpnclient/bin/vpnclient: Done

I'll now start the client to see if it starts.

alan@hactar:~/cisco/vpnclient$ ./vpnclient
Cisco Systems VPN Client Version 4.6.02 (0030)
Copyright (C) 1998-2004 Cisco Systems, Inc. All Rights Reserved.
Client Type(s): Linux
Running on: Linux 2.6.15-23-686 #1 SMP PREEMPT Tue May 23 14:03:07 UTC 2006 i686
Config file directory: /etc/opt/cisco-vpnclient

Usage:
vpnclient connect [user ] [eraseuserpwd | pwd ]
[nocertpwd]
vpnclient disconnect
vpnclient stat [reset] [traffic] [tunnel] [route] [repeat]
vpnclient notify
vpnclient verify [autoinitconfig]
vpnclient autoinit

Now we actually start the client and connect. Note that I start the client with the word "connect" and the name of the pcf file (without the pcf extension) as a parameter.

alan@hactar:~/cisco/vpnclient$ sudo vpnclient XXX-XXX_XXX-VPN

Cisco Systems VPN Client Version 4.6.02 (0030)
Copyright (C) 1998-2004 Cisco Systems, Inc. All Rights Reserved.
Client Type(s): Linux
Running on: Linux 2.6.15-23-686 #1 SMP PREEMPT Tue May 23 14:03:07 UTC 2006 i686
Config file directory: /etc/opt/cisco-vpnclient

Initializing the VPN connection.
Contacting the gateway at XXX.X.XX.XXX
User Authentication for XXX-XXX-XXXX-1...

Enter Username and Password.

Username [DOMAIN\username]:
Password []:
Authenticating user.
Negotiating security policies.

I then get my customers standard welcome message and am connected.

lancer une application graphique en root (Ubuntu 6.06)

Ubuntu assigns a random root password to discourage users from logging in as root. This is a safety precaution. When you need to execute a command as root, you’ll need to use the sudo command. For instance, if you want to use vi to edit the /etc/fstab file, you’d type sudo /vi /etc/fstab. Ubuntu will prompt you for a password. Provide the password for the user account you’re currently logged into. If you need to run a graphical application as root, press ALT-F2 and type gksudo and then the application name. Synaptic, for instance, is a graphical tool for installing new software, but you must run it as root. To run Synaptic, press ALT-F2 and type gksudo synaptic. When prompted, provide your user password.

07 août 2006

Flash 8 sous Ubuntu 6.06

Pour cela, récupérez l'installeur de Mozilla Firefox Windows 1.5.0.4 et effectuez les opérations suivantes :
$ sudo apt-get install wine
$ wine Firefox\ Setup\ 1.5.0.4.exe

Ceci fait, installez le player Flash 8 :

$ wget http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player.exe
$ wine install_flash_player.exe

Si l'installeur vous demande de spécifier le répertoire d'installation du plugin pour Firefox, précisez c:\Program files\Mozilla Firefox\plugins.

Lancez votre Firefox pour Windows fraîchement installé (un raccourci a été créé sur votre bureau).

16 juin 2006

Configuration du client OCS-ng sous fenêtre brevetée

Quand on lance ocslogon (dont on aura remplacé le nom par l'adresse ip du serveur ou mis une entrée pour ocslogon dans le DNS), un répertoire C:\ocs-ng est créé. Si on veut changer le tag on doit effacer le répertoire pour qu'il le redemande.

05 avril 2006

Installation de Nessus sur Ubuntu PPC 5.10

Un coup de synaptic pour installer nessus (client) et nessusd (serveur)
répondre aux questions pour créer certificats du serveur

ensuite nessus-adduser et répondre aux questions pour créer un utilisateur

ensuite http://www.nessus.org/register/

et on reçoit par mail un code pour pouvoir mettre à jour les plugins:

rentrer la commande suivante:
/usr/bin/nessus-fetch --register 9DA0-8F51-F3FF-XXXX-XXXX


lancer le serveur :

sudo nessusd -D

mettre à jour les plugins:

sudo nessus-update-plugins -v
(long à démarrer)


lancer un client:

nessus

et le vrai boulot peut commencer...

Configuration NVIDIA sous Red Hat ES 4

Pour installer les drivers propriétaires NVIDIA il faut installer le paquetage kernel-devel
puis arrêter le serveur X: init 3
lancer le script récupéré chez NVIDIA
quand c'est fait
system-config-display
S'il ne prend pas la résolution souhaitée on peut avoir besoin de la commande:
xrandr -s 0 (ou un autre nombre relatif à une autre résolution)
man xrandr si nécessaire
Vieux dicton: si l'interface graphique fait aisément et joliment ce qu'elle veut, la ligne de commande exécutera ta commande et rien d'autre.

11 mars 2006

SSH avec authentification par clef privée/publique

Je veux me connecter à un serveur SSH (debian ip=10.0.0.7) appelé debianvdr à partir d'un powerbook macosx appelé PBJH et ce sans entrer de mot de passe. Il y a un compte hanoteau sur les deux machines.
Prérequis la connexion ssh avec mot de passe fonctionne.
Sur le client (PBJH) il faut entrer les commandes suivantes:

PBJH:~ hanoteau$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/Users/hanoteau/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/hanoteau/.ssh/id_dsa.
Your public key has been saved in /Users/hanoteau/.ssh/id_dsa.pub.
The key fingerprint is:
XX:XX:XX................................. hanoteau@PBJH.local
PBJH:~ hanoteau$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/hanoteau/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/hanoteau/.ssh/id_rsa.
Your public key has been saved in /Users/hanoteau/.ssh/id_rsa.pub.
The key fingerprint is:
XX:XX:XX:................................. hanoteau@PBJH.local
PBJH:~ hanoteau$ cd .ssh
PBJH:~/.ssh hanoteau$ ls
id_dsa id_dsa.pub id_rsa id_rsa.pub known_hosts
PBJH:~/.ssh hanoteau$ scp *.pub 10.0.0.7:/home/hanoteau
Password:
id_dsa.pub 100% 609 459.6KB/s 00:00
id_rsa.pub 100% 229 213.5KB/s 00:00
PBJH:~/.ssh hanoteau$

Ensuite sur le serveur (ip 10.0.0.7):

hanoteau@debianvdr:~$ cd /home/hanoteau
hanoteau@debianvdr:~$ mkdir .ssh
hanoteau@debianvdr:~$ cp *.pub .ssh/
hanoteau@debianvdr:~$ cd .ssh
hanoteau@debianvdr:~/.ssh$ ls
id_dsa.pub id_rsa.pub
hanoteau@debianvdr:~/.ssh$ cat id_dsa.pub >> authorized_keys
hanoteau@debianvdr:~/.ssh$ cat id_rsa.pub >> authorized_keys

Désormais on se connecte sans mot de passe depuis le compte hanoteau de PBJH sur le compte hanoteau de debianvdr avec ssh:

PBJH:~ hanoteau$ ssh 10.0.0.7
Linux debianvdr 2.6.15-1-686 #2 Thu Feb 23 05:41:01 CET 2006 i686 GNU/Linux

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
You have new mail.

Last login: Sat Mar 11 17:11:00 2006 from pbjh.lan
hanoteau@debianvdr:~$