Atelier SysRes SE2a5 2023/2024 E2

De wiki-se.plil.fr
Aller à la navigation Aller à la recherche

Informations :

IP : 172.26.145.112

Nom du domaine: berlin2.lol

Machine de service: berlin

Machine mandataire: judo

13/09/2023 :

Création de la VM

xen-create-image --hostname=berlin --ip=172.26.145.112 --dir=/usr/local/xen --dhcp
  • Lancer la VM
xen console berlin
  • vi /etc/network/interfaces : remplacer DHCP par static
  • Mise en place de l'adressage IP pour ssh :
address 172.26.145.112/24
gateway 172.26.145.254
  • Activation du PermitRootPassword dans /etc/ssh/sshd_config
    PermitRootLogin yes
    

14/09/2023 :

Configuration

Configuration de l'interface eth0:

nano /etc/network/interfaces

Modifications:

auto eth0
iface eth0 inet static
address 172.26.145.109/24
gateway 172.26.145.254

Création d’un conteneur à la main

Sous machine Zabeth:

dd if=/dev/zero of=toto bs=1024k count=10240

mkfs /home/pifou/toto

mkdir tmp/mnt

mount -oloop /home/pifou/toto /tmp/mnt

apt install debootstrap

debootstrap stable /tmp/mnt

echo "proc /proc proc defaults 0 0" >> /tmp/mnt/etc/fstab

unshare -p -f -m chroot /tmp/mnt  /bin/sh -c "mount /proc ; /bin/bash"

Docker

docker run -i -t debian /bin/bash

02/10/2023

  • Configuration du ssh : /etc/ssh/sshd_config
    PermitRootLogin yes
    
  • Installer apache2 et bind9
  • lvcreate -L10G -nberlin-var virtual
  • lvcreate -L10G -nberlin-home virtual
  • tasksel (xfce)

05/10/2023

  • mkfs /dev/xvdb1
  • mkfs /dev/xvdb2
  • mkdir new-var
  • mkdir new-home
  • mount /dev/xvdb1 /new-home
  • mount /dev/xvdb2 /new-var
  • mv /var/* /new-var/
  • lsblk
xvda1 202:1    0  512M  0 disk [SWAP]
xvda2 202:2    0   10G  0 disk /
xvdb1 202:17   0   10G  0 disk /root/new-home
xvdb2 202:18   0   10G  0 disk /root/new-var
  • nano /etc/fstab
/dev/xvdb1 /home ext2 defaults 0 2
/dev/xvdb2 /var  ext4 defaults 0 2
  • umount /root/new-var
  • umount /root/new-home
  • mount -a
  • lsblk
xvda1 202:1    0  512M  0 disk [SWAP]
xvda2 202:2    0   10G  0 disk /
xvdb1 202:17   0   10G  0 disk /home
xvdb2 202:18   0   10G  0 disk /var

ajout des interfaces sur la machine de service berlin :

auto eth1
iface eth1 inet static
        address 192.168.165.3/24
        gateway 192.168.165.1
        post-up ethtool -K eth1 tx off

Séance du 10/11:

  • Modification: nano /etc/bind/db.berlin2.lol
$TTL 1H
berlin2.lol.    IN      SOA     ns1.berlin2.lol. berlin222@mail.com. (
                                        2011041902 ; Serial
                                        1H ; Refresh
                                        15M ; Retry
                                        2W ; Expire
                                        3M ; Minimum TTL
                                        )
berlin.lol.      IN NS   ns1.berlin2.lol.
berlin.lol.      IN A    193.48.57.165
ns1.berlin2.lol. IN A    193.48.57.165 
ns1.berlin2.lol. IN AAAA  2001:660:4401:60a0:216:3eff:fe9b:446d
www.berlin2.lol. IN CNAME ns1.berlin2.lol.
  • Ajout de la zone dans le fichier named.conf.local :
    zone "berlin2.lol" {
        type master;
        file "/etc/bind/db.berlin2.lol";
        allow-transfer { 192.168.165.1; };
    };
    
Machine mandataire :

modification du fichier de config named.config.local, nous avons ajouté les deux zones de nos machines de service:

zone "paris13.lol" {
        type slave;
        file "/etc/bind/db.paris13.lol";
        masters {192.168.165.2;};
};

zone "berlin2.lol" {
        type slave;
        file "/etc/bind/db.berlin2.lol";
        masters {192.168.165.3;};
};