Cahier 2016 groupe n°9 : Différence entre versions

De Wiki de Projets IMA
(Réalisations)
(Réalisations)
Ligne 278 : Ligne 278 :
 
  root@Spiderman:~# mdadm --detail /dev/md0
 
  root@Spiderman:~# mdadm --detail /dev/md0
 
  /dev/md0:
 
  /dev/md0:
        Version : 1.2
+
        Version : 1.2
  Creation Time : Wed Nov 30 18:16:47 2016
+
  Creation Time : Wed Nov 30 18:16:47 2016
    Raid Level : raid5
+
      Raid Level : raid5
    Array Size : 2095104 (2046.34 MiB 2145.39 MB)
+
      Array Size : 2095104 (2046.34 MiB 2145.39 MB)
  Used Dev Size : 1047552 (1023.17 MiB 1072.69 MB)
+
  Used Dev Size : 1047552 (1023.17 MiB 1072.69 MB)
  Raid Devices : 3
+
    Raid Devices : 3
  Total Devices : 3
+
  Total Devices : 3
    Persistence : Superblock is persistent
+
    Persistence : Superblock is persistent
 
+
 
    Update Time : Wed Nov 30 18:16:47 2016
+
    Update Time : Wed Nov 30 18:16:47 2016
          State : clean  
+
          State : clean  
Active Devices : 3
+
  Active Devices : 3
Working Devices : 3
+
Working Devices : 3
Failed Devices : 0
+
  Failed Devices : 0
  Spare Devices : 0
+
  Spare Devices : 0
 
+
 
        Layout : left-symmetric
+
          Layout : left-symmetric
    Chunk Size : 512K
+
      Chunk Size : 512K
 
+
 
          Name : Spiderman:0  (local to host Spiderman)
+
            Name : Spiderman:0  (local to host Spiderman)
          UUID : 0affe846:df8a3d12:fa601836:4085ed0d
+
            UUID : 0affe846:df8a3d12:fa601836:4085ed0d
        Events : 0
+
          Events : 0
 
+
    Number  Major  Minor  RaidDevice State
+
    Number  Major  Minor  RaidDevice State
      0    202      48        0      active sync  /dev/xvdd
+
        0    202      48        0      active sync  /dev/xvdd
      1    202      64        1      active sync  /dev/xvde
+
        1    202      64        1      active sync  /dev/xvde
      2    202      80        2      active sync  /dev/xvdf
+
        2    202      80        2      active sync  /dev/xvdf

Version du 30 novembre 2016 à 16:14

cours utilisé : http://vantroys.polytech-lille.net/TIIR/cisco.pdf

WIFI

Présentation

Le but du projet consiste à créer un accès wifi sur un commutateur OVH 6006 afin de permettre aux utilisateurs de se connecter à distance.


Architecture de la promo IMA5 2016/2017 :


[schema.png]

Matériel

Cisco Aironet 1600

Planning

Séance 1

Prise de connaissance du sujet et lecture concernant la configuration de la wifi

Séance 2

Connexion sur la borne wifi cisco 1600 par USB:

#su
#minicom -os

paramètres : /dev/ttyUSB0, 9600 Bauds, no flow control, no parity, 1 bit stop, 8 data bits

Commande sur la borne Wifi :

ap>show ip interface
BVI1 is down, line protocol is down
Internet address is 193.48.65.201/26
Broadcast address is 255.255.255.255
Address determined by configuration file
MTU is 1500 bytes
...
ap> show interfaces

On remarque qu'il y a 4 interfaces sur la borne wifi :

  • BVI1
  • Dot11Radio0
  • Dot11Radio1
  • GigabitEthernet0

En attente de notre configuration sur le commutateur, voici la liste des commandes que nous utiliserons afin de configurer la borne Wifi:

ap> enable
ap# configure terminal
ap(config)# interface "nom_interface"
ap(config-if)# ip address "ip" "masque"
ap(config-if)# description
ap(config-if)# no shutdown
ap(config-if)# exit
ap(config)# exit
ap#


Séance 4

Création de la machine virtuelle

Connexion au serveur cordouan:

ssh root@cordouan.insecserv.deule.net

Création de la VM:

xen-create-image --hostname=Spiderman --ip=193.48.57.169 --netmask=255.255.255.240 --gateway=193.48.57.172
  --dir=/usr/local/xen --mirror=http://debian.polytech-lille.fr/debian/ --dist=jessie

demarrer la vm:

  xl create /etc/xen/Spiderman.cfg

lancer la vm :

xl console Spiderman

Création des partitions logiques pour la machine virtuelle:

lvextend -L 10G/dev/virtual/ima5-Spiderman-var

on démarre la console :

xl etc/xen/console Spiderman
lvcreate -L 10G -n /dev/virtual/ima5-Spiderman-n

Ajouts des partitions à la configuration de la machine virtuelle en ajoutant la commande suivante dans etc/xen/Spiderman.cfg:

'phy:/dev/virtual/ima5-Spiderman-home,xvdb,w',


Configuration de la wifi:

show cdp neigbors detail
show run int BVI1

Wep :

dans : /documents/test_crack# :

inconfig
airmon-ng check kill
airmon-ng check
airmon-ng start wlan1
airodump-ng-encrypt wep mon0
airodump-ng -w out -c 13 .... bssid ... mon0

Séance 5

Installation de bind9 sur la VM xen.

Modification du fichier /etc/bind/named.conf.local :


zone "l-epee-d-ophile-net" { 
type master;
file "/etc/bind/db.l-epee-d-ophile.net";
allow-transfer { 217.70.177.40; };
};
zone "57.48.193.in-addr.arpa" {
type master;
notify no;
file "/etc/bind/db.193";
};


Créez le fichier de zone /etc/bind/db.l-epee-d-ophile.net

$TTL	10800
@	IN	SOA	www.l-epee-d-ophile.net. root.l-epee-d-ophile.net. (
1		; Serial
10800		; Refresh
86400		; Retry
2419200		; Expire
604800 )	; Negative Cache TTL
;
@	IN	NS	www.l-epee-d-ophile.net.
@	IN	A	193.48.57.169


Redémarrer bind

/etc/init.d/bind9 restart

Installation d'apache et php5:

apt-get install apache2
apt-get install php5

Création d'un glue record de notre domaine Gandi :

nom de serveur : ns.l-epee-d-ophile.net adresse IP : 193.48.57.169

Changez la configuration des serveurs du domaine Gandi

DNS1: ns1.l-epee-d-ophile.net DNS2: ns6.gandi.net

Commande:

root@Spiderman:/etc/bind# nslookup l-epee-d-ophile.net
Server:		193.48.57.34
Address:	193.48.57.34#53

Non-authoritative answer:
Name:	l-epee-d-ophile.net
Address: 217.70.184.38


Séance 6

Génération des clefs :

root@Spiderman:/etc/bind/l-epee-d-ophile.net.dnssec#dnssec-keygen -a RSASHA1 -b 2048 -r /dev/urandom -f KSK -n ZONE l-epee-d-ophile.net
root@Spiderman:/etc/bind/l-epee-d-ophile.net.dnssec#dnssec-keygen -a RSASHA1 -b 1024 -r /dev/urandom -n ZONE l-epee-d-ophile.net



Signature de la zone :

root@Spiderman:/etc/bind/l-epee-d-ophile.net.dnssec# dnssec-signzone -o l-epee-d-ophile.net -k l-epee-d-ophile.net-ksk ../db.l-epee-d-ophile.net l-epee-d-ophile.net-zsk
Verifying the zone using the following algorithms: RSASHA1.
Zone fully signed:
Algorithm: RSASHA1: KSKs: 1 active, 0 stand-by, 0 revoked
                    ZSKs: 1 active, 0 stand-by, 0 revoked
../db.l-epee-d-ophile.net.signed


dnssec :


root@Spiderman:/etc/bind# dig DNSKEY l-epee-d-ophile.net @localhost

; <<>> DiG 9.9.5-9+deb8u8-Debian <<>> DNSKEY l-epee-d-ophile.net @localhost
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 50084
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
   
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;l-epee-d-ophile.net.		IN	DNSKEY

;; ANSWER SECTION:
l-epee-d-ophile.net.	10800	IN	DNSKEY	256 3 5 AwEAAezQNszlMCkzdf6kJCrsqDuq+mL3J1P1/6C7hoA4GLpS4yqkbjs8 kk0gIq992Aq33DosjRtxnhnLuhmhq8asYut/ImoNSKJiAg0dyKx2dzgH wtbQ6L/+y/3f+8qzfA3CbZspivVYpt984hE7BucgFYGhO4NvDLPrlDv5 X/MpCBBf
l-epee-d-ophile.net.	10800	IN	DNSKEY	257 3 5 AwEAAfQXibMSzmfb8EbpamHRkClOYPGUgxnPo+cOXPhnxkza5ETWjrJs eNG+jfOnKHmKkYQylH9a3dLmPUdEOKP2JBWVNU8H/HwmpaQQUhQw3i7C k8p1CeVCT77XTvfGEocjKKbBvbvoZpOt6SWTC/yrWWamlnXIcoK4wqby XVPAc4L25iNnRdFWD72TLB2rJmfGnO6Zv+BVTYFauALtoVA+rNRtf7gl 2M9eUBacnlkHbAWZF9g7tuEAfef7Ct4gHwmiOn1zsHcncA7hfpNiESs2 hn30qkqC+sMb1VsavslNjXfkGzIyh4zpkIY11wMQBx9Z01E894YDHfgw vEagKTUxXVs=

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Nov 28 17:06:51 CET 2016
;; MSG SIZE  rcvd: 472


Réalisations

Sécurisation des données :

lvcreate -L 1G -n /dev/virtual/Spiderman-1 -v
lvcreate -L 1G -n /dev/virtual/Spiderman-2 -v
lvcreate -L 1G -n /dev/virtual/Spiderman-3 -v

Modification du fichier Spiderman.cfg afin d'ajouter les nouvelles partitions :

...
disk        = [
                  'file:/usr/local/xen/domains/Spiderman/disk.img,xvda2,w',
                  'file:/usr/local/xen/domains/Spiderman/swap.img,xvda1,w',
'phy:/dev/virtual/ima5-Spiderman-home,xvdb,w',
'phy:/dev/virtual/ima5-Spiderman-var,xvdc,w',
'phy:/dev/virtual/Spiderman-1,xvdd,w',
'phy:/dev/virtual/Spiderman-2,xvde,w',
'phy:/dev/virtual/Spiderman-3,xvdf,w',
              ]
...


Maintenant il faut installer mdadm afin de mettre en place notre RAID logiciel.

apt-get install mdadm


On vérifie si il son bien présent avec un fdisk -l :

Disk /dev/xvdd: 1 GiB, 1073741824 bytes, 2097152 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/xvde: 1 GiB, 1073741824 bytes, 2097152 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/xvdf: 1 GiB, 1073741824 bytes, 2097152 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Après plusieurs message d'erreur de la commande :

root@Spiderman:~# mdadm --create /dev/md0 --level=5 --assume-clean --raid-devices=3 /dev/xvdd /dev/xvde /dev/xvdf
mdadm: unexpected failure opening /dev/md0

Il fallait installer :

apt-get install linux-image-3.16.0-4-amd64

On vérifie si tout est bon :

root@Spiderman:~# mdadm --detail /dev/md0
/dev/md0:
        Version : 1.2
  Creation Time : Wed Nov 30 18:16:47 2016
     Raid Level : raid5
     Array Size : 2095104 (2046.34 MiB 2145.39 MB)
  Used Dev Size : 1047552 (1023.17 MiB 1072.69 MB)
   Raid Devices : 3
  Total Devices : 3
    Persistence : Superblock is persistent
 
    Update Time : Wed Nov 30 18:16:47 2016
          State : clean 
 Active Devices : 3
Working Devices : 3
 Failed Devices : 0
  Spare Devices : 0
 
         Layout : left-symmetric
     Chunk Size : 512K
 
           Name : Spiderman:0  (local to host Spiderman)
           UUID : 0affe846:df8a3d12:fa601836:4085ed0d
         Events : 0

    Number   Major   Minor   RaidDevice State
       0     202       48        0      active sync   /dev/xvdd
       1     202       64        1      active sync   /dev/xvde
       2     202       80        2      active sync   /dev/xvdf