<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr">
	<id>https://wiki-se.plil.fr/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rmoussao</id>
	<title>wiki-se.plil.fr - Contributions [fr]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki-se.plil.fr/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rmoussao"/>
	<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php/Sp%C3%A9cial:Contributions/Rmoussao"/>
	<updated>2026-05-16T21:58:33Z</updated>
	<subtitle>Contributions</subtitle>
	<generator>MediaWiki 1.39.1</generator>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=3056</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=3056"/>
		<updated>2023-11-24T11:17:02Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 24/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
==== '''Configuration DNS (bind9:''' Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; ====&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
&lt;br /&gt;
* Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
* Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]&lt;br /&gt;
&lt;br /&gt;
* Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]&lt;br /&gt;
&lt;br /&gt;
==== '''HTTPS (apache2):''' ====&lt;br /&gt;
* Création d'une clée privée, et génération d'une demande de csr &amp;lt;code&amp;gt; openssl req -nodes -newkey rsa:2048 -sha256 -keyout tokyo.key -out tokyo.csr -utf8 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Sécurisation de l'accès au fichier de clés privés:&amp;lt;code&amp;gt; chmod 440 tokyo.key &amp;lt;/code&amp;gt;&lt;br /&gt;
* Sur Gandi on recopie notre clée privée csr pour obtenir un certificat d'autorité&lt;br /&gt;
* &amp;lt;br /&amp;gt; Création du Virtual Host pour redirection sur le port *:443 : &amp;lt;code&amp;gt; vim  /etc/apache2/sites-available/vhost-https.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Frgre.png|centré|vignette|494x494px|vhost-https.conf]]&lt;br /&gt;
&lt;br /&gt;
=== '''23/11:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Ajout de deux DNS records dans le fichier &amp;lt;code&amp;gt;/etc/bind9/db.tokyoray.lol&amp;lt;/code&amp;gt;[[Fichier:Tokyo.png|centré|vignette|547x547px]]&lt;br /&gt;
&lt;br /&gt;
* Puis &amp;lt;code&amp;gt;service bind9 restart&amp;lt;/code&amp;gt; (Ne pas oublier l'incrémentation du serial number)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Ajout DNS secondaire : &amp;lt;code&amp;gt;host ns6.gandi.net&amp;lt;/code&amp;gt;&lt;br /&gt;
* Puis ajout des adresses IPV4 et IPV6 dans le fichier &amp;quot;config.name.local&amp;quot;  &amp;lt;code&amp;gt;allow-transfer {192.168.13.10;217.70.177.42;2001:4b98:d:1::4b;};&amp;lt;/code&amp;gt;&lt;br /&gt;
* Dans db.tokyoray.lol  ajout de : &amp;lt;code&amp;gt;tokyoray.lol.    IN      NS      ns6.gandi.net&amp;lt;/code&amp;gt; puis &amp;lt;code&amp;gt;service bind9 restart&amp;lt;/code&amp;gt;&lt;br /&gt;
* Sur Gandi ajout du DNS secondaire:&lt;br /&gt;
&lt;br /&gt;
[[Fichier:Gandi.png|centré|vignette|511x511px]]&lt;br /&gt;
&lt;br /&gt;
* Une fois la certification validée sur gandi, je télécharge et déplace le fichier tokyoray.lol.crt vers la machine mandataire: &amp;lt;code&amp;gt;scp /home/pifou/Downloads/tokyoray.lol.crt  root@193.48.57.164:/etc/ssl/certs/&amp;lt;/code&amp;gt;&lt;br /&gt;
* Puis depuis la machine mandataire vers la machine de service : &amp;lt;code&amp;gt;scp /etc/ssl/certs/tokyoray.lol.crt root@192.168.13.12:/etc/ssl/certs/&amp;lt;/code&amp;gt;&lt;br /&gt;
* Je copie la clé tokyo.key sur la machine mandataire : &amp;lt;code&amp;gt;scp /etc/ssl/private/tokyo.key root@193.48.57.164:/etc/ssl/private/&amp;lt;/code&amp;gt;&lt;br /&gt;
* Dans la mandataire &amp;lt;code&amp;gt;/etc/apache2/sites-available/vhost-https.conf :&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Sccreeen333.png|centré|vignette|446x446px|vhost-https.conf (dans la mandataire)]]&lt;br /&gt;
&lt;br /&gt;
* Dans la machine de service &amp;lt;code&amp;gt;/etc/apache2/sites-available/vhost-https.conf :&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Sccreeenn444.png|centré|vignette|466x466px|vhost-https.conf (dans la machine de service)]]&lt;br /&gt;
&lt;br /&gt;
* Activation du SSL pour apache : &amp;lt;code&amp;gt;a2enmod ssl&amp;lt;/code&amp;gt;&lt;br /&gt;
* Activation du proxy :&amp;lt;code&amp;gt;a2enmod proxy et a2enmod proxy_http&amp;lt;/code&amp;gt;&lt;br /&gt;
* Activation du virtual host : &amp;lt;code&amp;gt;a2ensite /etc/apache2/sites-available/vhost-https.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* Puis &amp;lt;code&amp;gt;service apache2 restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====  '''Sécurisation du DNS (DNSSEC):''' ====&lt;br /&gt;
&lt;br /&gt;
* Modification des droits de bind avec la commande: &amp;lt;code&amp;gt;chown -R bind /etc/bind&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Création du répertoire Keys dans bind&lt;br /&gt;
&lt;br /&gt;
* Modification du fichier &amp;lt;code&amp;gt;/etc/bind/named.conf.local :&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:DNSSEC.png|centré|vignette|510x510px|&amp;lt;code&amp;gt;named.conf.local (machine de service)&amp;lt;/code&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
=== '''24/11:''' ===&lt;br /&gt;
&lt;br /&gt;
* Récupération de la clé KSK (Ktokyoray.lol.+013+46428.key) dans le répertoire &amp;lt;code&amp;gt;/etc/bind/keys&amp;lt;/code&amp;gt;et copie de la clée sur le site gandi:&lt;br /&gt;
&lt;br /&gt;
[[Fichier:Ksk.png|centré|vignette|810x810px|KSK key sur gandi]]&lt;br /&gt;
&lt;br /&gt;
* Analyse via DNSViz&lt;br /&gt;
&lt;br /&gt;
[[Fichier:DNSviz.png|centré|vignette|382x382px|DNSViz]]&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Fichier:DNSviz.png&amp;diff=3055</id>
		<title>Fichier:DNSviz.png</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Fichier:DNSviz.png&amp;diff=3055"/>
		<updated>2023-11-24T11:16:33Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;dfhsfj&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=3049</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=3049"/>
		<updated>2023-11-24T11:09:19Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* Sécurisation du DNS (DNSSEC): */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
==== '''Configuration DNS (bind9:''' Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; ====&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
&lt;br /&gt;
* Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
* Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]&lt;br /&gt;
&lt;br /&gt;
* Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]&lt;br /&gt;
&lt;br /&gt;
==== '''HTTPS (apache2):''' ====&lt;br /&gt;
* Création d'une clée privée, et génération d'une demande de csr &amp;lt;code&amp;gt; openssl req -nodes -newkey rsa:2048 -sha256 -keyout tokyo.key -out tokyo.csr -utf8 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Sécurisation de l'accès au fichier de clés privés:&amp;lt;code&amp;gt; chmod 440 tokyo.key &amp;lt;/code&amp;gt;&lt;br /&gt;
* Sur Gandi on recopie notre clée privée csr pour obtenir un certificat d'autorité&lt;br /&gt;
* &amp;lt;br /&amp;gt; Création du Virtual Host pour redirection sur le port *:443 : &amp;lt;code&amp;gt; vim  /etc/apache2/sites-available/vhost-https.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Frgre.png|centré|vignette|494x494px|vhost-https.conf]]&lt;br /&gt;
&lt;br /&gt;
=== '''23/11:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Ajout de deux DNS records dans le fichier &amp;lt;code&amp;gt;/etc/bind9/db.tokyoray.lol&amp;lt;/code&amp;gt;[[Fichier:Tokyo.png|centré|vignette|547x547px]]&lt;br /&gt;
&lt;br /&gt;
* Puis &amp;lt;code&amp;gt;service bind9 restart&amp;lt;/code&amp;gt; (Ne pas oublier l'incrémentation du serial number)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Ajout DNS secondaire : &amp;lt;code&amp;gt;host ns6.gandi.net&amp;lt;/code&amp;gt;&lt;br /&gt;
* Puis ajout des adresses IPV4 et IPV6 dans le fichier &amp;quot;config.name.local&amp;quot;  &amp;lt;code&amp;gt;allow-transfer {192.168.13.10;217.70.177.42;2001:4b98:d:1::4b;};&amp;lt;/code&amp;gt;&lt;br /&gt;
* Dans db.tokyoray.lol  ajout de : &amp;lt;code&amp;gt;tokyoray.lol.    IN      NS      ns6.gandi.net&amp;lt;/code&amp;gt; puis &amp;lt;code&amp;gt;service bind9 restart&amp;lt;/code&amp;gt;&lt;br /&gt;
* Sur Gandi ajout du DNS secondaire:&lt;br /&gt;
&lt;br /&gt;
[[Fichier:Gandi.png|centré|vignette|511x511px]]&lt;br /&gt;
&lt;br /&gt;
* Une fois la certification validée sur gandi, je télécharge et déplace le fichier tokyoray.lol.crt vers la machine mandataire: &amp;lt;code&amp;gt;scp /home/pifou/Downloads/tokyoray.lol.crt  root@193.48.57.164:/etc/ssl/certs/&amp;lt;/code&amp;gt;&lt;br /&gt;
* Puis depuis la machine mandataire vers la machine de service : &amp;lt;code&amp;gt;scp /etc/ssl/certs/tokyoray.lol.crt root@192.168.13.12:/etc/ssl/certs/&amp;lt;/code&amp;gt;&lt;br /&gt;
* Je copie la clé tokyo.key sur la machine mandataire : &amp;lt;code&amp;gt;scp /etc/ssl/private/tokyo.key root@193.48.57.164:/etc/ssl/private/&amp;lt;/code&amp;gt;&lt;br /&gt;
* Dans la mandataire &amp;lt;code&amp;gt;/etc/apache2/sites-available/vhost-https.conf :&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Sccreeen333.png|centré|vignette|446x446px|vhost-https.conf (dans la mandataire)]]&lt;br /&gt;
&lt;br /&gt;
* Dans la machine de service &amp;lt;code&amp;gt;/etc/apache2/sites-available/vhost-https.conf :&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Sccreeenn444.png|centré|vignette|466x466px|vhost-https.conf (dans la machine de service)]]&lt;br /&gt;
&lt;br /&gt;
* Activation du SSL pour apache : &amp;lt;code&amp;gt;a2enmod ssl&amp;lt;/code&amp;gt;&lt;br /&gt;
* Activation du proxy :&amp;lt;code&amp;gt;a2enmod proxy et a2enmod proxy_http&amp;lt;/code&amp;gt;&lt;br /&gt;
* Activation du virtual host : &amp;lt;code&amp;gt;a2ensite /etc/apache2/sites-available/vhost-https.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* Puis &amp;lt;code&amp;gt;service apache2 restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====  '''Sécurisation du DNS (DNSSEC):''' ====&lt;br /&gt;
&lt;br /&gt;
* Modification des droits de bind avec la commande: &amp;lt;code&amp;gt;chown -R bind /etc/bind&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Création du répertoire Keys dans bind&lt;br /&gt;
&lt;br /&gt;
* Modification du fichier &amp;lt;code&amp;gt;/etc/bind/named.conf.local :&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:DNSSEC.png|centré|vignette|510x510px|&amp;lt;code&amp;gt;named.conf.local (machine de service)&amp;lt;/code&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
=== '''24/11:''' ===&lt;br /&gt;
&lt;br /&gt;
* Récupération de la clé KSK (Ktokyoray.lol.+013+46428.key) dans le répertoire &amp;lt;code&amp;gt;/etc/bind/keys&amp;lt;/code&amp;gt;et copie de la clée sur le site gandi: [[Fichier:Ksk.png|centré|vignette|810x810px|KSK key sur gandi]]&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=3048</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=3048"/>
		<updated>2023-11-24T11:05:28Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
==== '''Configuration DNS (bind9:''' Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; ====&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
&lt;br /&gt;
* Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
* Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]&lt;br /&gt;
&lt;br /&gt;
* Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]&lt;br /&gt;
&lt;br /&gt;
==== '''HTTPS (apache2):''' ====&lt;br /&gt;
* Création d'une clée privée, et génération d'une demande de csr &amp;lt;code&amp;gt; openssl req -nodes -newkey rsa:2048 -sha256 -keyout tokyo.key -out tokyo.csr -utf8 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Sécurisation de l'accès au fichier de clés privés:&amp;lt;code&amp;gt; chmod 440 tokyo.key &amp;lt;/code&amp;gt;&lt;br /&gt;
* Sur Gandi on recopie notre clée privée csr pour obtenir un certificat d'autorité&lt;br /&gt;
* &amp;lt;br /&amp;gt; Création du Virtual Host pour redirection sur le port *:443 : &amp;lt;code&amp;gt; vim  /etc/apache2/sites-available/vhost-https.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Frgre.png|centré|vignette|494x494px|vhost-https.conf]]&lt;br /&gt;
&lt;br /&gt;
=== '''23/11:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Ajout de deux DNS records dans le fichier &amp;lt;code&amp;gt;/etc/bind9/db.tokyoray.lol&amp;lt;/code&amp;gt;[[Fichier:Tokyo.png|centré|vignette|547x547px]]&lt;br /&gt;
&lt;br /&gt;
* Puis &amp;lt;code&amp;gt;service bind9 restart&amp;lt;/code&amp;gt; (Ne pas oublier l'incrémentation du serial number)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Ajout DNS secondaire : &amp;lt;code&amp;gt;host ns6.gandi.net&amp;lt;/code&amp;gt;&lt;br /&gt;
* Puis ajout des adresses IPV4 et IPV6 dans le fichier &amp;quot;config.name.local&amp;quot;  &amp;lt;code&amp;gt;allow-transfer {192.168.13.10;217.70.177.42;2001:4b98:d:1::4b;};&amp;lt;/code&amp;gt;&lt;br /&gt;
* Dans db.tokyoray.lol  ajout de : &amp;lt;code&amp;gt;tokyoray.lol.    IN      NS      ns6.gandi.net&amp;lt;/code&amp;gt; puis &amp;lt;code&amp;gt;service bind9 restart&amp;lt;/code&amp;gt;&lt;br /&gt;
* Sur Gandi ajout du DNS secondaire:&lt;br /&gt;
&lt;br /&gt;
[[Fichier:Gandi.png|centré|vignette|511x511px]]&lt;br /&gt;
&lt;br /&gt;
* Une fois la certification validée sur gandi, je télécharge et déplace le fichier tokyoray.lol.crt vers la machine mandataire: &amp;lt;code&amp;gt;scp /home/pifou/Downloads/tokyoray.lol.crt  root@193.48.57.164:/etc/ssl/certs/&amp;lt;/code&amp;gt;&lt;br /&gt;
* Puis depuis la machine mandataire vers la machine de service : &amp;lt;code&amp;gt;scp /etc/ssl/certs/tokyoray.lol.crt root@192.168.13.12:/etc/ssl/certs/&amp;lt;/code&amp;gt;&lt;br /&gt;
* Je copie la clé tokyo.key sur la machine mandataire : &amp;lt;code&amp;gt;scp /etc/ssl/private/tokyo.key root@193.48.57.164:/etc/ssl/private/&amp;lt;/code&amp;gt;&lt;br /&gt;
* Dans la mandataire &amp;lt;code&amp;gt;/etc/apache2/sites-available/vhost-https.conf :&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Sccreeen333.png|centré|vignette|446x446px|vhost-https.conf (dans la mandataire)]]&lt;br /&gt;
&lt;br /&gt;
* Dans la machine de service &amp;lt;code&amp;gt;/etc/apache2/sites-available/vhost-https.conf :&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Sccreeenn444.png|centré|vignette|466x466px|vhost-https.conf (dans la machine de service)]]&lt;br /&gt;
&lt;br /&gt;
* Activation du SSL pour apache : &amp;lt;code&amp;gt;a2enmod ssl&amp;lt;/code&amp;gt;&lt;br /&gt;
* Activation du proxy :&amp;lt;code&amp;gt;a2enmod proxy et a2enmod proxy_http&amp;lt;/code&amp;gt;&lt;br /&gt;
* Activation du virtual host : &amp;lt;code&amp;gt;a2ensite /etc/apache2/sites-available/vhost-https.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* Puis &amp;lt;code&amp;gt;service apache2 restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====  '''Sécurisation du DNS (DNSSEC):''' ====&lt;br /&gt;
* Création du répertoire Keys dans bind&lt;br /&gt;
&lt;br /&gt;
* Modification du fichier &amp;lt;code&amp;gt;/etc/bind/named.conf.local :&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:DNSSEC.png|centré|vignette|510x510px|&amp;lt;code&amp;gt;named.conf.local (machine de service)&amp;lt;/code&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
=== '''24/11:''' ===&lt;br /&gt;
&lt;br /&gt;
* Récupération de la clé KSK (Ktokyoray.lol.+013+46428.key) dans le répertoire &amp;lt;code&amp;gt;/etc/bind/keys&amp;lt;/code&amp;gt;et copie de la clée sur le site gandi: [[Fichier:Ksk.png|centré|vignette|810x810px|KSK key sur gandi]]&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=3028</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=3028"/>
		<updated>2023-11-24T10:40:45Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 23/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
* '''DNS (bind9:''' Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
&lt;br /&gt;
* Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
* Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]&lt;br /&gt;
&lt;br /&gt;
* Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]'''HTTPS (apache2):'''&lt;br /&gt;
&lt;br /&gt;
* Création d'une clée privée, et génération d'une demande de csr &amp;lt;code&amp;gt; openssl req -nodes -newkey rsa:2048 -sha256 -keyout tokyo.key -out tokyo.csr -utf8 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Sécurisation de l'accès au fichier de clés privés:&amp;lt;code&amp;gt; chmod 440 tokyo.key &amp;lt;/code&amp;gt;&lt;br /&gt;
* Sur Gandi on recopie notre clée privée csr pour obtenir un certificat d'autorité&lt;br /&gt;
* &amp;lt;br /&amp;gt; Création du Virtual Host pour redirection sur le port *:443 : &amp;lt;code&amp;gt; vim  /etc/apache2/sites-available/vhost-https.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Frgre.png|centré|vignette|494x494px|vhost-https.conf]]&lt;br /&gt;
&lt;br /&gt;
=== '''23/11:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Ajout de deux DNS records dans le fichier &amp;lt;code&amp;gt;/etc/bind9/db.tokyoray.lol&amp;lt;/code&amp;gt;[[Fichier:Tokyo.png|centré|vignette|547x547px]]&lt;br /&gt;
&lt;br /&gt;
* Puis &amp;lt;code&amp;gt;service bind9 restart&amp;lt;/code&amp;gt; (Ne pas oublier l'incrémentation du serial number)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Ajout DNS secondaire : &amp;lt;code&amp;gt;host ns6.gandi.net&amp;lt;/code&amp;gt;&lt;br /&gt;
* Puis ajout des adresses IPV4 et IPV6 dans le fichier &amp;quot;config.name.local&amp;quot;  &amp;lt;code&amp;gt;allow-transfer {192.168.13.10;217.70.177.42;2001:4b98:d:1::4b;};&amp;lt;/code&amp;gt;&lt;br /&gt;
* Dans db.tokyoray.lol  ajout de : &amp;lt;code&amp;gt;tokyoray.lol.    IN      NS      ns6.gandi.net&amp;lt;/code&amp;gt; puis &amp;lt;code&amp;gt;service bind9 restart&amp;lt;/code&amp;gt;&lt;br /&gt;
* Sur Gandi ajout du DNS secondaire:&lt;br /&gt;
&lt;br /&gt;
[[Fichier:Gandi.png|centré|vignette|511x511px]]&lt;br /&gt;
&lt;br /&gt;
* Une fois la certification validée sur gandi, je télécharge et déplace le fichier tokyoray.lol.crt vers la machine mandataire: &amp;lt;code&amp;gt;scp /home/pifou/Downloads/tokyoray.lol.crt  root@193.48.57.164:/etc/ssl/certs/&amp;lt;/code&amp;gt;&lt;br /&gt;
* Puis depuis la machine mandataire vers la machine de service : &amp;lt;code&amp;gt;scp /etc/ssl/certs/tokyoray.lol.crt root@192.168.13.12:/etc/ssl/certs/&amp;lt;/code&amp;gt;&lt;br /&gt;
* Je copie la clé tokyo.key sur la machine mandataire : &amp;lt;code&amp;gt;scp /etc/ssl/private/tokyo.key root@193.48.57.164:/etc/ssl/private/&amp;lt;/code&amp;gt;&lt;br /&gt;
* Dans la mandataire &amp;lt;code&amp;gt;/etc/apache2/sites-available/vhost-https.conf :&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Sccreeen333.png|centré|vignette|446x446px|vhost-https.conf (dans la mandataire)]]&lt;br /&gt;
&lt;br /&gt;
* Dans la machine de service &amp;lt;code&amp;gt;/etc/apache2/sites-available/vhost-https.conf :&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Sccreeenn444.png|centré|vignette|466x466px|vhost-https.conf (dans la machine de service)]]&lt;br /&gt;
&lt;br /&gt;
* Activation du SSL pour apache : &amp;lt;code&amp;gt;a2enmod ssl&amp;lt;/code&amp;gt;&lt;br /&gt;
* Activation du proxy :&amp;lt;code&amp;gt;a2enmod proxy et a2enmod proxy_http&amp;lt;/code&amp;gt;&lt;br /&gt;
* Activation du virtual host : &amp;lt;code&amp;gt;a2ensite /etc/apache2/sites-available/vhost-https.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* Puis &amp;lt;code&amp;gt;service apache2 restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Sécurisation du DNS (DNSSEC):'''&lt;br /&gt;
&lt;br /&gt;
* Création du répertoire Keys dans bind&lt;br /&gt;
&lt;br /&gt;
* Modification du fichier &amp;lt;code&amp;gt;/etc/bind/named.conf.local :&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:DNSSEC.png|centré|vignette|510x510px|&amp;lt;code&amp;gt;named.conf.local (machine de service)&amp;lt;/code&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
=== '''24/11:''' ===&lt;br /&gt;
&lt;br /&gt;
* Récupération de la clé KSK (Ktokyoray.lol.+013+46428.key) dans le répertoire &amp;lt;code&amp;gt;/etc/bind/keys&amp;lt;/code&amp;gt;et copie de la clée sur le site gandi: [[Fichier:Ksk.png|centré|vignette|810x810px|KSK key sur gandi]]&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Fichier:Ksk.png&amp;diff=3026</id>
		<title>Fichier:Ksk.png</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Fichier:Ksk.png&amp;diff=3026"/>
		<updated>2023-11-24T10:40:03Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;sgqe&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2917</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2917"/>
		<updated>2023-11-23T16:58:33Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 23/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
'''DNS (bind9:'''&lt;br /&gt;
Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]'''HTTPS (apache2):'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une clée privée, et génération d'une demande de csr &amp;lt;code&amp;gt; openssl req -nodes -newkey rsa:2048 -sha256 -keyout tokyo.key -out tokyo.csr -utf8 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sécurisation de l'accès au fichier de clés privés:&amp;lt;code&amp;gt; chmod 440 tokyo.key &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sur Gandi on recopie notre clée privée csr pour obtenir un certificat d'autorité&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création du Virtual Host pour redirection sur le port *:443 : &amp;lt;code&amp;gt; vim  /etc/apache2/sites-available/vhost-https.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Frgre.png|centré|vignette|494x494px|vhost-https.conf]]&lt;br /&gt;
&lt;br /&gt;
=== '''23/11:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ajout de deux DNS records dans le fichier &amp;lt;code&amp;gt;/etc/bind9/db.tokyoray.lol&amp;lt;/code&amp;gt;[[Fichier:Tokyo.png|centré|vignette|547x547px]]&lt;br /&gt;
&lt;br /&gt;
Puis &amp;lt;code&amp;gt;service bind9 restart&amp;lt;/code&amp;gt; (Ne pas oublier l'incrémentation du serial number)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ajout DNS secondaire : &amp;lt;code&amp;gt;host ns6.gandi.net&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Puis ajout des adresses IPV4 et IPV6 dans le fichier &amp;quot;config.name.local&amp;quot;  &amp;lt;code&amp;gt;allow-transfer {192.168.13.10;217.70.177.42;2001:4b98:d:1::4b;};&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dans db.tokyoray.lol  ajout de : &amp;lt;code&amp;gt;tokyoray.lol.    IN      NS      ns6.gandi.net&amp;lt;/code&amp;gt; puis &amp;lt;code&amp;gt;service bind9 restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sur Gandi ajout du DNS secondaire:&lt;br /&gt;
[[Fichier:Gandi.png|centré|vignette|511x511px]]Une fois la certification validée sur gandi, je télécharge et déplace le fichier tokyoray.lol.crt vers la machine mandataire: &amp;lt;code&amp;gt;scp /home/pifou/Downloads/tokyoray.lol.crt  root@193.48.57.164:/etc/ssl/certs/&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Puis depuis la machine mandataire vers la machine de service : &amp;lt;code&amp;gt;scp /etc/ssl/certs/tokyoray.lol.crt root@192.168.13.12:/etc/ssl/certs/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Je copie la clé tokyo.key sur la machine mandataire : &amp;lt;code&amp;gt;scp /etc/ssl/private/tokyo.key root@193.48.57.164:/etc/ssl/private/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dans la mandataire &amp;lt;code&amp;gt;/etc/apache2/sites-available/vhost-https.conf :&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Sccreeen333.png|centré|vignette|446x446px|vhost-https.conf (dans la mandataire)]]&lt;br /&gt;
Dans la machine de service &amp;lt;code&amp;gt;/etc/apache2/sites-available/vhost-https.conf :&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Sccreeenn444.png|centré|vignette|466x466px|vhost-https.conf (dans la machine de service)]]&lt;br /&gt;
Activation du SSL pour apache : &amp;lt;code&amp;gt;a2enmod ssl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Activation du proxy :&amp;lt;code&amp;gt;a2enmod proxy et a2enmod proxy_http&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Activation du virtual host : &amp;lt;code&amp;gt;a2ensite /etc/apache2/sites-available/vhost-https.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Puis &amp;lt;code&amp;gt;service apache2 restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Sécurisation du DNS (DNSSEC):'''&lt;br /&gt;
&lt;br /&gt;
Modification du fichier &amp;lt;code&amp;gt;/etc/bind/named.conf.local :&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:DNSSEC.png|centré|vignette|510x510px|&amp;lt;code&amp;gt;named.conf.local (machine de service)&amp;lt;/code&amp;gt;]]&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Fichier:DNSSEC.png&amp;diff=2915</id>
		<title>Fichier:DNSSEC.png</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Fichier:DNSSEC.png&amp;diff=2915"/>
		<updated>2023-11-23T16:56:09Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;dhsfj&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2898</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2898"/>
		<updated>2023-11-23T16:31:31Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 23/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
'''DNS (bind9:'''&lt;br /&gt;
Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]'''HTTPS (apache2):'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une clée privée, et génération d'une demande de csr &amp;lt;code&amp;gt; openssl req -nodes -newkey rsa:2048 -sha256 -keyout tokyo.key -out tokyo.csr -utf8 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sécurisation de l'accès au fichier de clés privés:&amp;lt;code&amp;gt; chmod 440 tokyo.key &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sur Gandi on recopie notre clée privée csr pour obtenir un certificat d'autorité&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création du Virtual Host pour redirection sur le port *:443 : &amp;lt;code&amp;gt; vim  /etc/apache2/sites-available/vhost-https.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Frgre.png|centré|vignette|494x494px|vhost-https.conf]]&lt;br /&gt;
&lt;br /&gt;
=== '''23/11:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ajout de deux DNS records dans le fichier &amp;lt;code&amp;gt;/etc/bind9/db.tokyoray.lol&amp;lt;/code&amp;gt;[[Fichier:Tokyo.png|centré|vignette|547x547px]]&lt;br /&gt;
&lt;br /&gt;
Puis &amp;lt;code&amp;gt;service bind9 restart&amp;lt;/code&amp;gt; (Ne pas oublier l'incrémentation du serial number)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ajout DNS secondaire : &amp;lt;code&amp;gt;host ns6.gandi.net&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Puis ajout des adresses IPV4 et IPV6 dans le fichier &amp;quot;config.name.local&amp;quot;  &amp;lt;code&amp;gt;allow-transfer {192.168.13.10;217.70.177.42;2001:4b98:d:1::4b;};&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dans db.tokyoray.lol  ajout de : &amp;lt;code&amp;gt;tokyoray.lol.    IN      NS      ns6.gandi.net&amp;lt;/code&amp;gt; puis &amp;lt;code&amp;gt;service bind9 restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sur Gandi ajout du DNS secondaire:&lt;br /&gt;
[[Fichier:Gandi.png|centré|vignette|511x511px]]Une fois la certification validée sur gandi, je télécharge et déplace le fichier tokyoray.lol.crt vers la machine mandataire: &amp;lt;code&amp;gt;scp /home/pifou/Downloads/tokyoray.lol.crt  root@193.48.57.164:/etc/ssl/certs/&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Puis depuis la machine mandataire vers la machine de service : &amp;lt;code&amp;gt;scp /etc/ssl/certs/tokyoray.lol.crt root@192.168.13.12:/etc/ssl/certs/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Je copie la clé tokyo.key sur la machine mandataire : &amp;lt;code&amp;gt;scp /etc/ssl/private/tokyo.key root@193.48.57.164:/etc/ssl/private/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dans la mandataire &amp;lt;code&amp;gt;/etc/apache2/sites-available/vhost-https.conf :&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Sccreeen333.png|centré|vignette|446x446px|vhost-https.conf (dans la mandataire)]]&lt;br /&gt;
Dans la machine de service &amp;lt;code&amp;gt;/etc/apache2/sites-available/vhost-https.conf :&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Sccreeenn444.png|centré|vignette|466x466px|vhost-https.conf (dans la machine de service)]]&lt;br /&gt;
Activation du SSL pour apache : &amp;lt;code&amp;gt;a2enmod ssl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Activation du proxy :&amp;lt;code&amp;gt;a2enmod proxy et a2enmod proxy_http&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Activation du virtual host : &amp;lt;code&amp;gt;a2ensite /etc/apache2/sites-available/vhost-https.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Puis &amp;lt;code&amp;gt;service apache2 restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Sécurisation du DNS DNSSEC:'''&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2878</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2878"/>
		<updated>2023-11-23T16:05:57Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 23/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
'''DNS (bind9:'''&lt;br /&gt;
Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]'''HTTPS (apache2):'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une clée privée, et génération d'une demande de csr &amp;lt;code&amp;gt; openssl req -nodes -newkey rsa:2048 -sha256 -keyout tokyo.key -out tokyo.csr -utf8 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sécurisation de l'accès au fichier de clés privés:&amp;lt;code&amp;gt; chmod 440 tokyo.key &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sur Gandi on recopie notre clée privée csr pour obtenir un certificat d'autorité&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création du Virtual Host pour redirection sur le port *:443 : &amp;lt;code&amp;gt; vim  /etc/apache2/sites-available/vhost-https.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Frgre.png|centré|vignette|494x494px|vhost-https.conf]]&lt;br /&gt;
&lt;br /&gt;
=== '''23/11:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ajout de deux DNS records dans le fichier &amp;lt;code&amp;gt;/etc/bind9/db.tokyoray.lol&amp;lt;/code&amp;gt;[[Fichier:Tokyo.png|centré|vignette|547x547px]]&lt;br /&gt;
&lt;br /&gt;
Puis &amp;lt;code&amp;gt;service bind9 restart&amp;lt;/code&amp;gt; (Ne pas oublier l'incrémentation du serial number)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ajout DNS secondaire : &amp;lt;code&amp;gt;host ns6.gandi.net&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Puis ajout des adresses IPV4 et IPV6 dans le fichier &amp;quot;config.name.local&amp;quot;  &amp;lt;code&amp;gt;allow-transfer {192.168.13.10;217.70.177.42;2001:4b98:d:1::4b;};&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dans db.tokyoray.lol  ajout de : &amp;lt;code&amp;gt;tokyoray.lol.    IN      NS      ns6.gandi.net&amp;lt;/code&amp;gt; puis &amp;lt;code&amp;gt;service bind9 restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sur Gandi ajout du DNS secondaire:&lt;br /&gt;
[[Fichier:Gandi.png|centré|vignette|511x511px]]Une fois la certification validée sur gandi, je télécharge et déplace le fichier tokyoray.lol.crt vers la machine mandataire: &amp;lt;code&amp;gt;scp /home/pifou/Downloads/tokyoray.lol.crt  root@193.48.57.164:/etc/ssl/certs/&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Puis depuis la machine mandataire vers la machine de service : &amp;lt;code&amp;gt;scp /etc/ssl/certs/tokyoray.lol.crt root@192.168.13.12:/etc/ssl/certs/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Je copie la clé tokyo.key sur la machine mandataire : &amp;lt;code&amp;gt;scp /etc/ssl/private/tokyo.key root@193.48.57.164:/etc/ssl/private/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dans la mandataire &amp;lt;code&amp;gt;/etc/apache2/sites-available/vhost-https.conf :&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Sccreeen333.png|centré|vignette|446x446px|vhost-https.conf (dans la mandataire)]]&lt;br /&gt;
Dans la machine de service &amp;lt;code&amp;gt;/etc/apache2/sites-available/vhost-https.conf :&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Sccreeenn444.png|centré|vignette|466x466px|vhost-https.conf (dans la machine de service)]]&lt;br /&gt;
Activation du SSL pour apache : &amp;lt;code&amp;gt;a2enmod ssl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Puis &amp;lt;code&amp;gt;service apache2 restart&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Fichier:Sccreeenn444.png&amp;diff=2877</id>
		<title>Fichier:Sccreeenn444.png</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Fichier:Sccreeenn444.png&amp;diff=2877"/>
		<updated>2023-11-23T16:03:23Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;hkf&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Fichier:Sccreeen333.png&amp;diff=2874</id>
		<title>Fichier:Sccreeen333.png</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Fichier:Sccreeen333.png&amp;diff=2874"/>
		<updated>2023-11-23T16:01:27Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;hsfh&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2868</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2868"/>
		<updated>2023-11-23T15:49:21Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 23/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
'''DNS (bind9:'''&lt;br /&gt;
Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]'''HTTPS (apache2):'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une clée privée, et génération d'une demande de csr &amp;lt;code&amp;gt; openssl req -nodes -newkey rsa:2048 -sha256 -keyout tokyo.key -out tokyo.csr -utf8 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sécurisation de l'accès au fichier de clés privés:&amp;lt;code&amp;gt; chmod 440 tokyo.key &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sur Gandi on recopie notre clée privée csr pour obtenir un certificat d'autorité&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création du Virtual Host pour redirection sur le port *:443 : &amp;lt;code&amp;gt; vim  /etc/apache2/sites-available/vhost-https.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Frgre.png|centré|vignette|494x494px|vhost-https.conf]]&lt;br /&gt;
&lt;br /&gt;
=== '''23/11:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ajout de deux DNS records dans le fichier &amp;lt;code&amp;gt;/etc/bind9/db.tokyoray.lol&amp;lt;/code&amp;gt;[[Fichier:Tokyo.png|centré|vignette|547x547px]]&lt;br /&gt;
&lt;br /&gt;
Puis &amp;lt;code&amp;gt;service bind9 restart&amp;lt;/code&amp;gt; (Ne pas oublier l'incrémentation du serial number)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ajout DNS secondaire : &amp;lt;code&amp;gt;host ns6.gandi.net&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Puis ajout des adresses IPV4 et IPV6 dans le fichier &amp;quot;config.name.local&amp;quot;  &amp;lt;code&amp;gt;allow-transfer {192.168.13.10;217.70.177.42;2001:4b98:d:1::4b;};&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dans db.tokyoray.lol  ajout de : &amp;lt;code&amp;gt;tokyoray.lol.    IN      NS      ns6.gandi.net&amp;lt;/code&amp;gt; puis &amp;lt;code&amp;gt;service bind9 restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sur Gandi ajout du DNS secondaire:&lt;br /&gt;
[[Fichier:Gandi.png|centré|vignette|511x511px]]Une fois la certification validée sur gandi, je télécharge et déplace le fichier tokyoray.lol.crt vers la machine mandataire: &amp;lt;code&amp;gt;scp /home/pifou/Downloads/tokyoray.lol.crt  root@193.48.57.164:/etc/ssl/certs/&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Puis depuis la machine mandataire vers la machine de service : &amp;lt;code&amp;gt;scp /etc/ssl/certs/tokyoray.lol.crt root@192.168.13.12:/etc/ssl/certs/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dans &amp;lt;code&amp;gt;/etc/apache2/sites-available&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Sccreeenn222.png|centré|vignette|424x424px]]&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Fichier:Sccreeenn222.png&amp;diff=2867</id>
		<title>Fichier:Sccreeenn222.png</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Fichier:Sccreeenn222.png&amp;diff=2867"/>
		<updated>2023-11-23T15:48:56Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;fgsdh&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2857</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2857"/>
		<updated>2023-11-23T14:32:43Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 23/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
'''DNS (bind9:'''&lt;br /&gt;
Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]'''HTTPS (apache2):'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une clée privée, et génération d'une demande de csr &amp;lt;code&amp;gt; openssl req -nodes -newkey rsa:2048 -sha256 -keyout tokyo.key -out tokyo.csr -utf8 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sécurisation de l'accès au fichier de clés privés:&amp;lt;code&amp;gt; chmod 440 tokyo.key &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sur Gandi on recopie notre clée privée csr pour obtenir un certificat d'autorité&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création du Virtual Host pour redirection sur le port *:443 : &amp;lt;code&amp;gt; vim  /etc/apache2/sites-available/vhost-https.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Frgre.png|centré|vignette|494x494px|vhost-https.conf]]&lt;br /&gt;
&lt;br /&gt;
=== '''23/11:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ajout de deux DNS records dans le fichier &amp;lt;code&amp;gt;/etc/bind9/db.tokyoray.lol&amp;lt;/code&amp;gt;[[Fichier:Tokyo.png|centré|vignette|547x547px]]&lt;br /&gt;
&lt;br /&gt;
Puis &amp;lt;code&amp;gt;service bind9 restart&amp;lt;/code&amp;gt; (Ne pas oublier l'incrémentation du serial number)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans &amp;lt;code&amp;gt;/etc/apache2/sites-available&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Sccreeenn.png|centré|vignette|440x440px]]Ajout DNS secondaire : &amp;lt;code&amp;gt;host ns6.gandi.net&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Puis ajout des adresses IPV4 et IPV6 dans le fichier &amp;quot;config.name.local&amp;quot;  &amp;lt;code&amp;gt;allow-transfer {192.168.13.10;217.70.177.42;2001:4b98:d:1::4b;};&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dans db.tokyoray.lol  ajout de : &amp;lt;code&amp;gt;tokyoray.lol.    IN      NS      ns6.gandi.net&amp;lt;/code&amp;gt; puis &amp;lt;code&amp;gt;service bind9 restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sur Gandi ajout du DNS secondaire:&lt;br /&gt;
[[Fichier:Gandi.png|centré|vignette|511x511px]]&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Fichier:Gandi.png&amp;diff=2856</id>
		<title>Fichier:Gandi.png</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Fichier:Gandi.png&amp;diff=2856"/>
		<updated>2023-11-23T14:31:00Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;fsdqgq&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2854</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2854"/>
		<updated>2023-11-23T14:29:01Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 23/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
'''DNS (bind9:'''&lt;br /&gt;
Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]'''HTTPS (apache2):'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une clée privée, et génération d'une demande de csr &amp;lt;code&amp;gt; openssl req -nodes -newkey rsa:2048 -sha256 -keyout tokyo.key -out tokyo.csr -utf8 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sécurisation de l'accès au fichier de clés privés:&amp;lt;code&amp;gt; chmod 440 tokyo.key &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sur Gandi on recopie notre clée privée csr pour obtenir un certificat d'autorité&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création du Virtual Host pour redirection sur le port *:443 : &amp;lt;code&amp;gt; vim  /etc/apache2/sites-available/vhost-https.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Frgre.png|centré|vignette|494x494px|vhost-https.conf]]&lt;br /&gt;
&lt;br /&gt;
=== '''23/11:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ajout de deux DNS records dans le fichier &amp;lt;code&amp;gt;/etc/bind9/db.tokyoray.lol&amp;lt;/code&amp;gt;[[Fichier:Tokyo.png|centré|vignette|547x547px]]&lt;br /&gt;
&lt;br /&gt;
Puis &amp;lt;code&amp;gt;service bind9 restart&amp;lt;/code&amp;gt; (Ne pas oublier l'incrémentation du serial number)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans &amp;lt;code&amp;gt;/etc/apache2/sites-available&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Sccreeenn.png|centré|vignette|440x440px]]Ajout DNS secondaire : &amp;lt;code&amp;gt;host ns6.gandi.net&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Puis ajout des adresses IPV4 et IPV6 dans le fichier &amp;quot;config.name.local&amp;quot;  &amp;lt;code&amp;gt;allow-transfer {192.168.13.10;217.70.177.42;2001:4b98:d:1::4b;};&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dans db.tokyoray.lol  ajout de : &amp;lt;code&amp;gt;tokyoray.lol.    IN      NS      ns6.gandi.net&amp;lt;/code&amp;gt; puis &amp;lt;code&amp;gt;service bind9 restart&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2823</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2823"/>
		<updated>2023-11-23T13:33:26Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 10/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
'''DNS (bind9:'''&lt;br /&gt;
Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]'''HTTPS (apache2):'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une clée privée, et génération d'une demande de csr &amp;lt;code&amp;gt; openssl req -nodes -newkey rsa:2048 -sha256 -keyout tokyo.key -out tokyo.csr -utf8 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sécurisation de l'accès au fichier de clés privés:&amp;lt;code&amp;gt; chmod 440 tokyo.key &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sur Gandi on recopie notre clée privée csr pour obtenir un certificat d'autorité&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création du Virtual Host pour redirection sur le port *:443 : &amp;lt;code&amp;gt; vim  /etc/apache2/sites-available/vhost-https.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Frgre.png|centré|vignette|494x494px|vhost-https.conf]]&lt;br /&gt;
&lt;br /&gt;
=== '''23/11:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ajout de deux DNS records dans le fichier &amp;lt;code&amp;gt;/etc/bind9/db.tokyoray.lol&amp;lt;/code&amp;gt;[[Fichier:Tokyo.png|centré|vignette|547x547px]]&lt;br /&gt;
&lt;br /&gt;
Puis &amp;lt;code&amp;gt;service bind9 restart&amp;lt;/code&amp;gt; (Ne pas oublier l'incrémentation du serial number)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans &amp;lt;code&amp;gt;/etc/apache2/sites-available&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Sccreeenn.png|centré|vignette|440x440px]]&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2821</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2821"/>
		<updated>2023-11-23T13:29:05Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 23/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
'''DNS (bind9:'''&lt;br /&gt;
Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]'''HTTPS (apache2):'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une clée privée, et génération d'une demande de csr &amp;lt;code&amp;gt; openssl req -nodes -newkey rsa:2048 -sha256 -keyout tokyo.key -out tokyo.csr -utf8 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sécurisation de l'accès au fichier de clés privés:&amp;lt;code&amp;gt; chmod 440 tokyo.key &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sur Gandi on recopie notre clée privée csr pour obtenir un certificat d'autorité&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création du Virtual Host: &amp;lt;code&amp;gt; vim  /etc/apache2/sites-available/vhost-https.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Frgre.png|centré|vignette|494x494px|vhost-https.conf]]&lt;br /&gt;
&lt;br /&gt;
=== '''23/11:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ajout de deux DNS records dans le fichier &amp;lt;code&amp;gt;/etc/bind9/db.tokyoray.lol&amp;lt;/code&amp;gt;[[Fichier:Tokyo.png|centré|vignette|547x547px]]&lt;br /&gt;
&lt;br /&gt;
Puis &amp;lt;code&amp;gt;service bind9 restart&amp;lt;/code&amp;gt; (Ne pas oublier l'incrémentation du serial number)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans &amp;lt;code&amp;gt;/etc/apache2/sites-available&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Sccreeenn.png|centré|vignette|440x440px]]&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Fichier:Sccreeenn.png&amp;diff=2820</id>
		<title>Fichier:Sccreeenn.png</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Fichier:Sccreeenn.png&amp;diff=2820"/>
		<updated>2023-11-23T13:28:02Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;rgsdg&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2817</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2817"/>
		<updated>2023-11-23T13:13:08Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 23/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
'''DNS (bind9:'''&lt;br /&gt;
Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]'''HTTPS (apache2):'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une clée privée, et génération d'une demande de csr &amp;lt;code&amp;gt; openssl req -nodes -newkey rsa:2048 -sha256 -keyout tokyo.key -out tokyo.csr -utf8 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sécurisation de l'accès au fichier de clés privés:&amp;lt;code&amp;gt; chmod 440 tokyo.key &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sur Gandi on recopie notre clée privée csr pour obtenir un certificat d'autorité&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création du Virtual Host: &amp;lt;code&amp;gt; vim  /etc/apache2/sites-available/vhost-https.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Frgre.png|centré|vignette|494x494px|vhost-https.conf]]&lt;br /&gt;
&lt;br /&gt;
=== '''23/11:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ajout de deux DNS records dans le fichier &amp;lt;code&amp;gt;/etc/bind9/db.tokyoray.lol&amp;lt;/code&amp;gt;[[Fichier:Tokyo.png|centré|vignette|547x547px]]&lt;br /&gt;
&lt;br /&gt;
Puis &amp;lt;code&amp;gt;service bind9 restart&amp;lt;/code&amp;gt; (Ne pas oublier l'incrémentation du serial number)&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2815</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2815"/>
		<updated>2023-11-23T13:10:25Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 23/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
'''DNS (bind9:'''&lt;br /&gt;
Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]'''HTTPS (apache2):'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une clée privée, et génération d'une demande de csr &amp;lt;code&amp;gt; openssl req -nodes -newkey rsa:2048 -sha256 -keyout tokyo.key -out tokyo.csr -utf8 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sécurisation de l'accès au fichier de clés privés:&amp;lt;code&amp;gt; chmod 440 tokyo.key &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sur Gandi on recopie notre clée privée csr pour obtenir un certificat d'autorité&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création du Virtual Host: &amp;lt;code&amp;gt; vim  /etc/apache2/sites-available/vhost-https.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Frgre.png|centré|vignette|494x494px|vhost-https.conf]]&lt;br /&gt;
&lt;br /&gt;
=== '''23/11:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ajout de deux DNS records dans le fichier &amp;lt;code&amp;gt;/etc/bind9/db.tokyoray.lol&amp;lt;/code&amp;gt;[[Fichier:Tokyo.png|centré|vignette|547x547px]]&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2814</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2814"/>
		<updated>2023-11-23T13:09:50Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
'''DNS (bind9:'''&lt;br /&gt;
Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]'''HTTPS (apache2):'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une clée privée, et génération d'une demande de csr &amp;lt;code&amp;gt; openssl req -nodes -newkey rsa:2048 -sha256 -keyout tokyo.key -out tokyo.csr -utf8 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sécurisation de l'accès au fichier de clés privés:&amp;lt;code&amp;gt; chmod 440 tokyo.key &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sur Gandi on recopie notre clée privée csr pour obtenir un certificat d'autorité&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création du Virtual Host: &amp;lt;code&amp;gt; vim  /etc/apache2/sites-available/vhost-https.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Frgre.png|centré|vignette|494x494px|vhost-https.conf]]&lt;br /&gt;
&lt;br /&gt;
=== '''23/11:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ajout de deux DNS records dans le fichier /etc/bind9/db.tokyoray.lol[[Fichier:Tokyo.png|centré|vignette|547x547px]]&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2813</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2813"/>
		<updated>2023-11-23T13:06:58Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
'''DNS (bind9:'''&lt;br /&gt;
Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]'''HTTPS (apache2):'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une clée privée, et génération d'une demande de csr &amp;lt;code&amp;gt; openssl req -nodes -newkey rsa:2048 -sha256 -keyout tokyo.key -out tokyo.csr -utf8 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sécurisation de l'accès au fichier de clés privés:&amp;lt;code&amp;gt; chmod 440 tokyo.key &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sur Gandi on recopie notre clée privée csr pour obtenir un certificat d'autorité&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création du Virtual Host: &amp;lt;code&amp;gt; vim  /etc/apache2/sites-available/vhost-https.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Frgre.png|centré|vignette|494x494px|vhost-https.conf]]'''23/11:'''&lt;br /&gt;
[[Fichier:Tokyo.png|centré|vignette|547x547px]]&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Fichier:Tokyo.png&amp;diff=2812</id>
		<title>Fichier:Tokyo.png</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Fichier:Tokyo.png&amp;diff=2812"/>
		<updated>2023-11-23T13:06:39Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;dezf&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2530</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2530"/>
		<updated>2023-11-10T14:58:58Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
'''DNS (bind9:'''&lt;br /&gt;
Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]'''HTTPS (apache2):'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une clée privée, et génération d'une demande de csr &amp;lt;code&amp;gt; openssl req -nodes -newkey rsa:2048 -sha256 -keyout tokyo.key -out tokyo.csr -utf8 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sécurisation de l'accès au fichier de clés privés:&amp;lt;code&amp;gt; chmod 440 tokyo.key &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sur Gandi on recopie notre clée privée csr pour obtenir un certificat d'autorité&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création du Virtual Host: &amp;lt;code&amp;gt; vim  /etc/apache2/sites-available/vhost-https.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Frgre.png|centré|vignette|494x494px|vhost-https.conf]]&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2528</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2528"/>
		<updated>2023-11-10T14:52:04Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 10/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
'''DNS (bind9:'''&lt;br /&gt;
Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]'''HTTPS (apache2):'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une clée privée, et génération d'une demande de csr &amp;lt;code&amp;gt; openssl req -nodes -newkey rsa:2048 -sha256 -keyout tokyo.key -out tokyo.csr -utf8 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sécurisation de l'accès au fichier de clés privés:&amp;lt;code&amp;gt; chmod 440 tokyo.csr &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sur Gandi on recopie notre clée privée csr pour obtenir un certificat d'autorité&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création du Virtual Host: &amp;lt;code&amp;gt; vim  /etc/apache2/sites-available/vhost-https.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
[[Fichier:Frgre.png|centré|vignette|494x494px|vhost-https.conf]]&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Fichier:Frgre.png&amp;diff=2527</id>
		<title>Fichier:Frgre.png</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Fichier:Frgre.png&amp;diff=2527"/>
		<updated>2023-11-10T14:51:36Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;fdgdf&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2526</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2526"/>
		<updated>2023-11-10T14:49:46Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 10/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
'''DNS (bind9:'''&lt;br /&gt;
Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]'''HTTPS (apache2):'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une clée privée, et génération d'une demande de csr &amp;lt;code&amp;gt; openssl req -nodes -newkey rsa:2048 -sha256 -keyout tokyo.key -out tokyo.csr -utf8 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sécurisation de l'accès au fichier de clés privés:&amp;lt;code&amp;gt; chmod 440 tokyo.csr &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sur Gandi on recopie notre clée privée csr pour obtenir un certificat d'autorité&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création du Virtual Host: &amp;lt;code&amp;gt; vim  /etc/apache2/sites-available/vhost-https.conf &amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2525</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2525"/>
		<updated>2023-11-10T14:49:26Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 10/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
'''DNS (bind9:'''&lt;br /&gt;
Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]'''HTTPS (apache2):'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une clée privée, et génération d'une demande de csr &amp;lt;code&amp;gt; openssl req -nodes -newkey rsa:2048 -sha256 -keyout tokyo.key -out tokyo.csr -utf8 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sécurisation de l'accès au fichier de clés privés:&amp;lt;code&amp;gt; chmod 440 tokyo.csr &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sur Gandi on recopie notre clée privée csr pour obtenir un certificat d'autorité&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création du Virtual Host: vim  /etc/apache2/sites-available/vhost-https.conf&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2524</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2524"/>
		<updated>2023-11-10T14:45:44Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 10/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
'''DNS (bind9:'''&lt;br /&gt;
Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]'''HTTPS (apache2):'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une clée privée, et génération d'une demande de csr &amp;lt;code&amp;gt; openssl req -nodes -newkey rsa:2048 -sha256 -keyout tokyo.key -out tokyo.csr -utf8 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sécurisation de l'accès au fichier de clés privés:&amp;lt;code&amp;gt; chmod 440 tokyo.csr &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Création du Virtual Host&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2523</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2523"/>
		<updated>2023-11-10T14:43:31Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 10/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
'''DNS (bind9:'''&lt;br /&gt;
Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]'''HTTPS (apache2):'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une clée privée, et génération d'une demande de csr &amp;lt;code&amp;gt; openssl req -nodes -newkey rsa:2048 -sha256 -keyout tokyo.key -out tokyo.csr -utf8 &amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2522</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2522"/>
		<updated>2023-11-10T14:42:36Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 10/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
'''DNS (bind9:'''&lt;br /&gt;
Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]'''HTTPS (apache2):'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une clée privée csr&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2517</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2517"/>
		<updated>2023-11-10T14:23:18Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 10/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
'''DNS (bind9:'''&lt;br /&gt;
Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]'''HTTPS (apache2):'''&lt;br /&gt;
&lt;br /&gt;
Genreration de clée privée : &amp;lt;code&amp;gt;openssl req -new -x509 -days 365 -nodes -out /etc/ssl/certs/tokyo.crt -keyout /etc/ssl/private/tokyo.key&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;chmod 440 /etc/ssl/private/tokyo.key&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2516</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2516"/>
		<updated>2023-11-10T14:22:30Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 10/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
'''DNS (bind9:'''&lt;br /&gt;
Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]'''HTTPS (apache2):'''&lt;br /&gt;
&lt;br /&gt;
Genreration de clée privée : &amp;lt;code&amp;gt;openssl req -new -x509 -days 365 -nodes -out /etc/ssl/certs/tokyo.crt -keyout /etc/ssl/private/tokyo.key&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;chmod 440 /etc/ssl/private/tokyo.key&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2515</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2515"/>
		<updated>2023-11-10T14:21:08Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 10/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
'''DNS (bind9:'''&lt;br /&gt;
Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]'''HTTPS (apache2):'''&lt;br /&gt;
&lt;br /&gt;
Genreration de clée privée : &amp;lt;code&amp;gt;openssl req -new -x509 -days 365 -nodes -out /etc/ssl/certs/tokyo.crt -keyout /etc/ssl/private/tokyo.key&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2514</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2514"/>
		<updated>2023-11-10T14:19:48Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 10/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
'''DNS (bind9:'''&lt;br /&gt;
Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]'''HTTPS (apache2):'''&lt;br /&gt;
&lt;br /&gt;
Genreration de clée privée :&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2505</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2505"/>
		<updated>2023-11-10T13:48:21Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 10/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; (DNS secondaire) :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2501</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2501"/>
		<updated>2023-11-10T13:43:02Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 10/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;code&amp;gt; vim /etc/bind/db.tokyoray.lol&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2499</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2499"/>
		<updated>2023-11-10T13:38:31Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 10/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/bind/db.tokyoray.lol &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;après chaque modification, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2485</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2485"/>
		<updated>2023-11-10T13:12:35Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 10/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Configuration du serveur DNS sur la machine de service Tokyo: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/bind/db.tokyoray.lol &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2473</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2473"/>
		<updated>2023-11-10T11:15:54Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 10/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sur la machine de service Tokyo: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/bind/db.tokyoray.lol &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|named.conf.local]]Du coté de la machine mandataire &amp;quot;muaythai&amp;quot; :&lt;br /&gt;
&lt;br /&gt;
-création de 2 fichiers vides &amp;quot;db.tokyoray.lol&amp;quot; &amp;amp; &amp;quot;db.bogota.lol&amp;quot; dans /etc/bind &lt;br /&gt;
&lt;br /&gt;
-modification du fichier named.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.muaythai.png|centré|vignette|493x493px|named.conf.local (muaythai)]]&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Fichier:Name.conf.local.muaythai.png&amp;diff=2472</id>
		<title>Fichier:Name.conf.local.muaythai.png</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Fichier:Name.conf.local.muaythai.png&amp;diff=2472"/>
		<updated>2023-11-10T11:15:12Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;km&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2466</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2466"/>
		<updated>2023-11-10T10:57:05Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 10/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sur la machine de service Tokyo: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/bind/db.tokyoray.lol &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;, (incrémenter le numéro Serial à chaque restart)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ajout d'une zone de resolution de domaine tokyoray.lol dans le fichier name.conf.local:&lt;br /&gt;
[[Fichier:Name.conf.local.png|centré|vignette|503x503px|name.conf.local]]&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Fichier:Name.conf.local.png&amp;diff=2465</id>
		<title>Fichier:Name.conf.local.png</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Fichier:Name.conf.local.png&amp;diff=2465"/>
		<updated>2023-11-10T10:56:20Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;df&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2461</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2461"/>
		<updated>2023-11-10T10:35:40Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 10/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sur la machine de service Tokyo: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/bind/db.tokyoray.lol &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;, (incrémenter le numéro Serial à chaque restart)&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2460</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2460"/>
		<updated>2023-11-10T10:35:11Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* 10/11: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sur la machine de service Tokyo: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/bind/db.tokyoray.lol &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis service bind9 restart, (incrémenter le numéro Serial à chaque restart)&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2459</id>
		<title>Atelier SysRes SE2a5 2023/2024 E6</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Atelier_SysRes_SE2a5_2023/2024_E6&amp;diff=2459"/>
		<updated>2023-11-10T10:34:39Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== '''13/09: Création de la VM''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Génération du fichier de configuration:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=Tokyo --ip=172.26.145.105 --netmask=255.255.255.0 --gateway 172.26.145.254 --bridge=bridgeStudents --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Lancement de la VM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen console Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
xen console Tokyo&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Modication de l'interface eth0 dans /etc/network/interfaces: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
address 172.26.145.105/24&lt;br /&gt;
gateway 172.26.145.254 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration ssh, modifications dans /etc/ssh/sshd_config:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
PermitRootLogin yes&lt;br /&gt;
service ssh restart&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''14/09: Création d'un conteneur à la main''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création d'une partition de 10GB: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
dd if=/dev/zero of=toto bs=1024k count=10240&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On formate l'espace mémoire toto créé, pour cela on passe en root:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
su -&lt;br /&gt;
cd ~pifou&lt;br /&gt;
mkfs toto&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte ensuite la partition:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /tmp/mnt&lt;br /&gt;
mount -o loop toto /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On y ajoute l'image du conteneur: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
debootstrap stable /tmp/mnt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Préparation du montage du pseudo système de fichier /proc:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;proc /proc proc defaults 0 0&amp;quot; &amp;gt;&amp;gt; /tmp/mnt/etc/fstab&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Isolation du processus:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
unshare -p -f -m chroot /tmp/mnt /bin/sh -c &amp;quot;mount /proc ; /bin/bash&amp;quot; ;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''02/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Installation des paquetages pour le serveur web et dns: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install apache2&lt;br /&gt;
apt install bind9&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Creation LVM: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvcreate -L10G -nTokyo-home virtual&lt;br /&gt;
lvcreate -L10G -nTokyo-var virtual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Visualisation des LVM:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lvs&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''05/10:''' ===&lt;br /&gt;
Dans la VM, vérification de la création des partitions:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
lsblk&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Screenshot 2023-10-05 16-28-17.png|centré|vignette|375x375px]]&lt;br /&gt;
Formatage des partitions de disque:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkfs /dev/xvdb1&lt;br /&gt;
mkfs /dev/xvdb2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Créations des répertoires new_home et new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /new_var&lt;br /&gt;
mkdir /new_home&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On monte les disques:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mount /dev/xvbd1 /new_home&lt;br /&gt;
mount /dev/xvdb2 /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On déplace tout ce qu'il y'a dans var vers new_var:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mv /var/* /new_var&lt;br /&gt;
umount /new_home&lt;br /&gt;
umount /new_var&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Modification de /etc/fstab:&lt;br /&gt;
[[Fichier:Fstab add.png|centré|vignette|298x298px]]&lt;br /&gt;
Nous avons maintenant 10GB dans /home et /var&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Création de la machine mandataire '''muaythai''' en collaboration avec Simon MAROLLEAU:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen-create-image --hostname=muaythai --ip=193.48.57.164 --netmask=255.255.255.240 --gateway=193.48.57.161 --bridge=SE2a5 --dir=/usr/local/xen --password=glopglop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''06/10:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans capbreton ajout du bridge dans Tokyo.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/Tokyo.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'mac=00:16:3E:45:AF:1E, bridge=muaythai' , 'mac=00:16:3D:46:AB:1D,bridge=SE2a5']&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Configuration de l'interface eth1 sur la machine mandataire pour communiquer avec nos machine de service (Tokyo et bogota):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/network/interfaces&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[Fichier:Network-interfaces tokyo.png|vignette|centré|interfaces Tokyo]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dans muaythai.cfg:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/xen/muaythai.cfg&lt;br /&gt;
&lt;br /&gt;
#Networking&lt;br /&gt;
&lt;br /&gt;
vif = [ 'ip=193.48.57.164 , mac=00:16:3E:CD:47:4D,bridge=SE2a5', 'bridge=muaythai' ]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Dans le network/interfaces de Tokyo:&lt;br /&gt;
[[Fichier:Screenshot 2023-10-06 15-54-52.png|centré|vignette|Interfaces muaythai]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Redémarrage de la VM Tokyo:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
xen shut Tokyo&lt;br /&gt;
xen create /etc/xen/Tokyo.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Avant d'entamer la mascarade on installe sur la machine mandataire: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
apt install iptables-persistent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Puis on effectue la commande suivante:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.13.0/24&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il est maintenant possible de ping de l'IPV4 et IPV6 avec les machines de services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pour permettre la connexion aux machines de services en passant par la mandataire sans mot de passe, on créer un répertoire .ssh  dans les machines de services , où l'on viens mettre une clée publique générée sur la machine mandataire (dans le fichier authorized_keys):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh-keygen&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /root/ .ssh&lt;br /&gt;
cd /root/.ssh&lt;br /&gt;
vim authorized_keys&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Il n'est plus demandé d'entrer un mdp lors d'un connexion ssh de muaythai vers Tokyo ou bogota&lt;br /&gt;
&lt;br /&gt;
Redirection de port:&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sysct1 net.ipv4.ip_forward=sysct1&lt;br /&gt;
service networking restart&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2202 -j DNAT --to-destination 192.168.13.12:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2201 -j DNAT --to-destination 192.168.13.11:22&lt;br /&gt;
iptables-save &amp;gt; /etc/iptables/rules.v4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;On peut maintenant se connecter à la machine de service via la redirection de port avec la commande suivante (exemple Tokyo):&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
ssh -p2202 root@193.48.57.164&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Création du serveur DNS sur Gandi:&lt;br /&gt;
[[Fichier:Capture d’écran 2023-10-06 153127.png|centré|vignette]]&lt;br /&gt;
&lt;br /&gt;
=== '''10/11:''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sur la machine de service Tokyo: &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vim /etc/bind/db.tokyoray.lol &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Fichier:Db.tokyoray.lol.png|centré|vignette|535x535px|db.tokyoray.lol]]&lt;br /&gt;
Puis &amp;lt;nowiki&amp;gt;&amp;lt;code&amp;gt; service bind9 restart &amp;lt;/code&amp;gt;&amp;lt;/nowiki&amp;gt;, (incrémenter le numéro Serial à chaque restart)&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=Fichier:Db.tokyoray.lol.png&amp;diff=2457</id>
		<title>Fichier:Db.tokyoray.lol.png</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=Fichier:Db.tokyoray.lol.png&amp;diff=2457"/>
		<updated>2023-11-10T10:30:22Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;gdsges&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
	<entry>
		<id>https://wiki-se.plil.fr/mediawiki/index.php?title=SE5_syst%C3%A8me/r%C3%A9seau_2023/2024&amp;diff=1925</id>
		<title>SE5 système/réseau 2023/2024</title>
		<link rel="alternate" type="text/html" href="https://wiki-se.plil.fr/mediawiki/index.php?title=SE5_syst%C3%A8me/r%C3%A9seau_2023/2024&amp;diff=1925"/>
		<updated>2023-10-06T14:17:41Z</updated>

		<summary type="html">&lt;p&gt;Rmoussao : /* PRA SE5 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= PRA SE5 =&lt;br /&gt;
&lt;br /&gt;
== Menu de la première séance ==&lt;br /&gt;
&lt;br /&gt;
Pour la  première séance du 06/10/2023 il vous est demandé d'effectuer individuellement les opérations listées ci-dessous.&lt;br /&gt;
* création d'une machine virtuelle sur le serveur &amp;lt;code&amp;gt;capbreton&amp;lt;/code&amp;gt; ;&lt;br /&gt;
* création d'un conteneur &amp;quot;à la main&amp;quot; sur votre station de travail &amp;lt;code&amp;gt;zabeth&amp;lt;/code&amp;gt; :&lt;br /&gt;
** créez un conteneur isolé au maximum (sauf pour les utilisateur) avec la méthode décrite en cours,&lt;br /&gt;
** création d'un commutateur virtuel privé sur la &amp;lt;code&amp;gt;zabeth&amp;lt;/code&amp;gt; dans le réseau IPv4 &amp;lt;code&amp;gt;192.168.68.0/24&amp;lt;/code&amp;gt;, l'adresse &amp;lt;code&amp;gt;192.168.68.1&amp;lt;/code&amp;gt; est affectée au commutateur lui-même,&lt;br /&gt;
** création d'une interface Ethernet virtuelle, une extrémité doit être envoyée dans le conteneur, l'autre dans le commutateur virtuel privé,&lt;br /&gt;
** mise en place d'une mascarade sur la &amp;lt;code&amp;gt;zabeth&amp;lt;/code&amp;gt;, vérifiez que le conteneur a accès aux mêmes machines que la  &amp;lt;code&amp;gt;zabeth&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Par binôme vous devez créer une machine virtuelle mandataire connectée sur le commutateur virtuel SE5 et sur le commutateur virtuel privé des machines virtuelles de services concernées (voir deuxième section du sujet).&lt;br /&gt;
&lt;br /&gt;
Globalement vous devez configurer le routeur principal de la promotion (voir la troisième section du sujet). Pour votre promotion il s'agit du Catalyst 9200 situé en E304. Il faut le connecter en fibre vers le serveur &amp;lt;code&amp;gt;capbreton&amp;lt;/code&amp;gt; de la E306 dans le commutateur virtuel SE5 et aussi en fibre vers le local technique SR52 sur un port dans le VLAN 531. Vous pouvez configurer le commutateur via l'utilitaire &amp;lt;code&amp;gt;minicom&amp;lt;/code&amp;gt; à partir de la machine &amp;lt;code&amp;gt;zabeth09&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Répartition des élèves pour la première séance :&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Station de travail !! Elève&lt;br /&gt;
|-&lt;br /&gt;
| zabeth02 || Elias SIMON&lt;br /&gt;
|-&lt;br /&gt;
| zabeth03 || Mathis RIFFAUT&lt;br /&gt;
|-&lt;br /&gt;
| zabeth04 || Dann RODENBURG&lt;br /&gt;
|-&lt;br /&gt;
| zabeth05 || Benjamin NGUYEN&lt;br /&gt;
|-&lt;br /&gt;
| zabeth06 || Halaoui mohammed&lt;br /&gt;
|-&lt;br /&gt;
| zabeth07 || Blgrim Haitam&lt;br /&gt;
|-&lt;br /&gt;
| zabeth08 || Florian Vallée&lt;br /&gt;
|-&lt;br /&gt;
| zabeth09 (routeur) || Julien Charleux&lt;br /&gt;
|-&lt;br /&gt;
| zabeth10 || Amine SELLALI&lt;br /&gt;
|-&lt;br /&gt;
| zabeth11 || Paul Amoros&lt;br /&gt;
|-&lt;br /&gt;
| zabeth12 || Maël Delaby&lt;br /&gt;
|-&lt;br /&gt;
| zabeth13 || Black Baptiste&lt;br /&gt;
|-&lt;br /&gt;
| zabeth14 || Timothé Brenier&lt;br /&gt;
|-&lt;br /&gt;
| zabeth15 || Jeanne Delcourt&lt;br /&gt;
|-&lt;br /&gt;
| zabeth16 || Estelle Godard&lt;br /&gt;
|-&lt;br /&gt;
| zabeth17 || Jason DELANNOY&lt;br /&gt;
|-&lt;br /&gt;
| zabeth18 || Chloé Lemaire&lt;br /&gt;
|-&lt;br /&gt;
| zabeth19 || Gabriel THOMAS&lt;br /&gt;
|-&lt;br /&gt;
| zabeth20 || Albin MOUTON&lt;br /&gt;
|-&lt;br /&gt;
| zabeth21 || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
| zabeth22 || Maxime Balbastre&lt;br /&gt;
|-&lt;br /&gt;
| zabeth26 || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
| zabeth27 || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
| zabeth28 || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
| zabeth30 || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Répartition des binômes ==&lt;br /&gt;
&lt;br /&gt;
Concertez-vous pour trouver des noms de machines de services et de machines mandataires dans deux thèmes.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Cahier !! Nom machine services &lt;br /&gt;
!IP machine services !! Nom de domaine !! Nom machine mandataire &lt;br /&gt;
!IP machine mandataires!! Elève &lt;br /&gt;
|-&lt;br /&gt;
| [[Atelier SysRes SE5 2023/2024 E1 | Cahier n°1]]&lt;br /&gt;
| || || || || || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
| [[Atelier SysRes SE5 2023/2024 E2 | Cahier n°2]]&lt;br /&gt;
| || || || || || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
| [[Atelier SysRes SE5 2023/2024 E3 | Cahier n°3]]&lt;br /&gt;
| || || || || || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
| [[Atelier SysRes SE5 2023/2024 E4 | Cahier n°4]]&lt;br /&gt;
| || || || || || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
| [[Atelier SysRes SE5 2023/2024 E5 | Cahier n°5]]&lt;br /&gt;
| || || || || || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
| [[Atelier SysRes SE5 2023/2024 E6 | Cahier n°6]]&lt;br /&gt;
| || || || || || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
| [[Atelier SysRes SE5 2023/2024 E7 | Cahier n°7]]&lt;br /&gt;
| || || || || || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
| [[Atelier SysRes SE5 2023/2024 E8 | Cahier n°8]]&lt;br /&gt;
| || || || || || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
| [[Atelier SysRes SE5 2023/2024 E9 | Cahier n°9]]&lt;br /&gt;
| || || || || || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
| [[Atelier SysRes SE5 2023/2024 E10 | Cahier n°10]]&lt;br /&gt;
| || || || || || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
| [[Atelier SysRes SE5 2023/2024 E11 | Cahier n°11]]&lt;br /&gt;
| || || || || || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
| [[Atelier SysRes SE5 2023/2024 E12 | Cahier n°12]]&lt;br /&gt;
| || || || || || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
| [[Atelier SysRes SE5 2023/2024 E13 | Cahier n°13]]&lt;br /&gt;
| || || || || || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
| [[Atelier SysRes SE5 2023/2024 E14 | Cahier n°14]]&lt;br /&gt;
| || || || || || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
| [[Atelier SysRes SE5 2023/2024 E15 | Cahier n°15]]&lt;br /&gt;
| || || || || || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
| [[Atelier SysRes SE5 2023/2024 E16 | Cahier n°16]]&lt;br /&gt;
| || || || || || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
| [[Atelier SysRes SE5 2023/2024 E17 | Cahier n°17]]&lt;br /&gt;
| || || || || || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
| [[Atelier SysRes SE5 2023/2024 E18 | Cahier n°18]]&lt;br /&gt;
| || || || || || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
| [[Atelier SysRes SE5 2023/2024 E19 | Cahier n°19]]&lt;br /&gt;
| || || || || || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
| [[Atelier SysRes SE5 2023/2024 E20 | Cahier n°20]]&lt;br /&gt;
| || || || || || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
| [[Atelier SysRes SE5 2023/2024 E21 | Cahier n°21]]&lt;br /&gt;
| || || || || || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
| [[Atelier SysRes SE5 2023/2024 E22 | Cahier n°22]]&lt;br /&gt;
| || || || || || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
| [[Atelier SysRes SE5 2023/2024 E23 | Cahier n°23]]&lt;br /&gt;
| || || || || || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
| [[Atelier SysRes SE5 2023/2024 E24 | Cahier n°24]]&lt;br /&gt;
| || || || || || Prénom Nom&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Contrôle continu ==&lt;/div&gt;</summary>
		<author><name>Rmoussao</name></author>
	</entry>
</feed>