Outils pour utilisateurs

Outils du site


admin:procedures:installation_serveur_physique

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
admin:procedures:installation_serveur_physique [2017/07/05 07:00] fpoulainadmin:procedures:installation_serveur_physique [2023/11/11 19:02] (Version actuelle) – dokuwiki formatting pitchum
Ligne 6: Ligne 6:
 Ne pas hésiter à lire https://www.debian.org/releases/stretch/amd64/release-notes/ pour les notes de versions. Ne pas hésiter à lire https://www.debian.org/releases/stretch/amd64/release-notes/ pour les notes de versions.
 En particulier, pour la configuration réseau, attention au nom des interfaces réseaux : En particulier, pour la configuration réseau, attention au nom des interfaces réseaux :
-    udevadm test-builtin net_id /sys/class/net/eth0 2> /dev/null+ 
 +<code>udevadm test-builtin net_id /sys/class/net/eth0 2> /dev/null</code> 
 Cette commande permet de récupérer le nom de l'interface dans le nouveau format ( https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ ) Cette commande permet de récupérer le nom de l'interface dans le nouveau format ( https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ )
  
Ligne 12: Ligne 14:
  
 sur chaque disque, activer le "mode grub" sur chaque disque, activer le "mode grub"
-    # parted /dev/sda +<code> 
-    > set 1 bios_grub on +# parted /dev/sda 
-    > quit +> set 1 bios_grub on 
-    # grub-install /dev/sda+> quit 
 +# grub-install /dev/sda 
 +</code>
  
 ====== libvirt ====== ====== libvirt ======
  
-Rappel : virt-manager à besoin de  netcat-openbsd (enfin d'un netcat avec -U)+Rappel : ''virt-manager'' à besoin de  ''netcat-openbsd'' (enfin d'un netcat avec -U)
  
 Sur Coon : Sur Coon :
  
-    On édite le réseau defautl : virsh net-edit default ; virsh net-destroy default ; virsh net-start default +  * On édite le réseau défaut ''virsh net-edit default ; virsh net-destroy default ; virsh net-start default'' 
- +  Le bridge est à ''192.168.1.4'' sur coon et le range dhcp est de ''192.168.1.10-99'' 
-    Le bridge est à 192.168.1.4 sur coon et le range dhcp est de 192.168.1.10-99 +  On ajoute ''enp1s0'' dans le bridge : ''brctl addif enp1s0 virbr0'' 
- +  On relance l'interface enp1s0 : ''ifup enp1s0'' 
-    On ajoute enp1s0 dans le bridge : brctl addif enp1s0 virbr0 +  * ''systemctl disable libvirt-guests'', pour éviter que les machines démarrent toutes seules sans action explicite d'un admin (ce qui ne devrait pas être possible, car le point de montage de la partition des qcow ne peut pas être monté automatiquement.
- +
-    On relance l'interface enp1s0 : ifup enp1s0 +
- +
- +
-systemctl disable libvirt-guests pour éviter que les machines démarrent toutes seules sans action explicite +
-d'un admin (ce qui ne devrait pas être possible, car le point de montage de la partition des qcow ne peut +
-pas être monté automatiquement+
  
 ====== Firewall ====== ====== Firewall ======
  
-On utilisera firehol. Pour les détails quant à l'usage, se référer à [[admin:procedures:configuration-firewall-guest|Un firewall simple pour le chaton]].+On utilisera ''firehol''. Pour les détails quant à l'usage, se référer à [[admin:procedures:configuration-firewall-guest|Un firewall simple pour le Chapril]].
  
 <note warning>Ne surtout pas installer le paquet firewall-chaton : il n'est prévu que pour les guests !</note> <note warning>Ne surtout pas installer le paquet firewall-chaton : il n'est prévu que pour les guests !</note>
  
-On pensera à définir les services pour drbd et icinga :+On pensera à définir les services pour ''drbd'' et ''icinga'' :
 <code bash /etc/firehol/services/icinga.conf> <code bash /etc/firehol/services/icinga.conf>
 #FHVER: 1:213 #FHVER: 1:213
Ligne 49: Ligne 46:
 client_icinga_ports="default" client_icinga_ports="default"
 </code> </code>
-<code bash /etc/firehol/services/drdb.conf >+<code bash /etc/firehol/services/drbd.conf >
 #FHVER: 1:213 #FHVER: 1:213
 # La premiere ligne ci dessus est nécessaire !! # La premiere ligne ci dessus est nécessaire !!
Ligne 55: Ligne 52:
 client_drbd_ports="default" client_drbd_ports="default"
 </code> </code>
-===== Sur coon ===== 
  
-On reste permissif : même si les routes ne sont pas censées être celles là, on n'empêche pas de sortir du cluster via enp0s31f6.+===== Script de firewall =====
  
-<code bash /etc/firehol/firehol.conf > +On a un script de firewalling destiné à être identique entre maine et coon. La différence se situant au niveau de la configuration. 
-## IPv6+ 
 +Dans le principe on reste permissif : même si les routes ne sont pas censées être celles là, on n'empêche pas de sortir du cluster via enp0s31f6. 
 + 
 +Il faut par ailleurs gérer le dnat sur l'IP de FIP. On le fait en premier car c'est une contrainte de la conf de firehol. Ensuite il faut penser dans les routeurs comme si la destination était changée. Le bon goût de cette conséquence est que la gestion ipv6 est assez bien intégrée. Enfin on contrôle l'IP de sortie du cluster avec une règle de SNAT. 
 + 
 +<code bash /etc/firehol/firehol.conf> 
 +################################################################################ 
 +# Configuration 
 +################################################################################ 
 + 
 +myPrivateIp="192.168.1.x 192.168.1.x" 
 +myPublicIp4="94.130.8.x" 
 +myPublicIp6="2a01:4f8:10b:c4x::/64" 
 + 
 +clusterPrivateNetwork="192.168.1.0/24" 
 +clusterV6Network="2a01:4f8:10b:c41::/64 2a01:4f8:10b:c42::/64"  
 + 
 +# Si vous décommentez la ligne qui suit, le firewall considérera que fip 
 +# pointe sur cette machine avec l'adresse déclarée. 
 + 
 +# fip="88.99.233.240" 
 + 
 +declare -A dispatching=( 
 +     ["dns"]=' "53" "tcp udp" "192.168.1.53"  "2a01:4f8:10b:c42:5054:ff:fe08:3282")' 
 +    ["http"]=' "80" "tcp"     "192.168.1.93"  "2a01:4f8:10b:c41:5054:ff:fe08:48ff")' 
 +   ["https"]='( "443" "tcp"     "192.168.1.93"  "2a01:4f8:10b:c41:5054:ff:fe08:48ff")' 
 +  ["icinga"]='("5665" "tcp"     "192.168.1.70"  "2a01:4f8:10b:c41:5054:ff:fe9b:6f27")' 
 +    ["smtp"]=' "25" "tcp"     "192.168.1.57"  "2a01:4f8:10b:c42:5054:ff:fec3:b9c7")' 
 +     ["ssh"]=' "22" "tcp"     "192.168.1.93"  "2a01:4f8:10b:c41:5054:ff:fe08:48ff")' 
 +
 + 
 +################################################################################ 
 +# /Configuration 
 +################################################################################ 
 + 
 +################################################################################ 
 +# NAT pour ipv4 
 +################################################################################ 
 +if test -n "$fip" 
 +then 
 +    for service in "${!dispatching[@]}" 
 +    do 
 +        eval "srv=${dispatching[$service]}" 
 +        dport="${srv[0]}" 
 +        protos="${srv[1]}" 
 +        ipv4="${srv[2]}" 
 +        for proto in $protos 
 +        do 
 +            ipv4 dnat to $ipv4 inface enp0s31f6 dst $fip proto $proto dport $dport 
 +        done 
 +    done 
 + 
 +    # Contrôle de l'IP de sortie 
 +    ipv4 snat to $fip outface enp0s31f6 
 +fi 
 + 
 +################################################################################ 
 +# IPv6 
 +################################################################################
 ipv6 interface any v6interop proto icmpv6 ipv6 interface any v6interop proto icmpv6
     client ipv6neigh accept     client ipv6neigh accept
Ligne 66: Ligne 120:
     policy return     policy return
  
 +################################################################################
 # DHCP # DHCP
 +################################################################################
 interface4 virbr0 dhcp interface4 virbr0 dhcp
     policy return     policy return
     server dhcp accept     server dhcp accept
  
 +################################################################################
 +# FIP -> ME
 +# The purpose of this interface is to control the traffic
 +# on the enp0s31f6 interface destinated to fip IP.
 +################################################################################
 +if test -n "$fip"
 +then
 +    interface enp0s31f6 fip_trafic dst4 $fip dst6 $myPublicIp6
 +
 +        # The default policy is DROP.
 +        policy drop
 +
 +        # Protection anti flood
 +        protection strong
 +
 +        # Services acceptés
 +        server ICMP    accept
 +        server ICMPV6  accept
 +
 +        # The following means that this machine can REQUEST anything via enp0s31f6.
 +        client all accept
 +fi
 +
 +################################################################################
 # EXT->ME # EXT->ME
 # The purpose of this interface is to control the traffic # The purpose of this interface is to control the traffic
-# on the enp0s31f6 interface with IP 94.130.8.3+# on the enp0s31f6 interface destinated to public IP. 
-interface enp0s31f6 external_trafic dst4 94.130.8.3 dst6 2a01:4f8:10b:c42::/64+################################################################################ 
 +interface enp0s31f6 external_trafic dst4 $myPublicIp4 dst6 $myPublicIp6
  
     # The default policy is DROP.     # The default policy is DROP.
Ligne 83: Ligne 164:
  
     # Services acceptés     # Services acceptés
 +    server ssh accept
     server ICMP accept     server ICMP accept
     server ICMPV6 accept     server ICMPV6 accept
-    server ssh accept 
  
     # The following means that this machine can REQUEST anything via enp0s31f6.     # The following means that this machine can REQUEST anything via enp0s31f6.
     client all accept     client all accept
  
 +################################################################################
 # LAN->ME # LAN->ME
 # The purpose of this interface is to control the traffic # The purpose of this interface is to control the traffic
-# on the {enp1s0,virbr0,virbr1} interface with IP 192.168.1.{3,5} (net: "192.168.1.0/24 ")+# on the {enp1s0,virbr0,virbr1} interface destinated to private IP. 
-interface "enp1s0 virbr0 virbr1" internal_trafic src4 "192.168.1.0/24" dst4 "192.168.1.3 192.168.1.5" src6 "2a01:4f8:10b:c41::/64 2a01:4f8:10b:c42::/64" dst6 2a01:4f8:10b:c42::/64+################################################################################ 
 +interface "enp1s0 virbr0 virbr1" internal_trafic src4 $clusterPrivateNetwork dst4 "$myPrivateIp" src6 "$clusterV6Network" dst6 $myPublicIp6
  
     # On est entre amis     # On est entre amis
Ligne 112: Ligne 195:
     client all accept     client all accept
  
 +################################################################################
 # Clients on enp0s31f6 (Internet) accessing servers on {enp1s0,virbr0,virbr1} (LAN). # Clients on enp0s31f6 (Internet) accessing servers on {enp1s0,virbr0,virbr1} (LAN).
 +################################################################################
 router ext2me inface enp0s31f6 outface "enp1s0 virbr0 virbr1" router ext2me inface enp0s31f6 outface "enp1s0 virbr0 virbr1"
     protection strong     protection strong
  
 +################################################################################
 # Clients on {enp1s0,virbr0,virbr1} (LAN) accessing servers on enp0s31f6 (Internet). # Clients on {enp1s0,virbr0,virbr1} (LAN) accessing servers on enp0s31f6 (Internet).
 +################################################################################
 router me2ext inface "enp1s0 virbr0 virbr1" outface enp0s31f6 router me2ext inface "enp1s0 virbr0 virbr1" outface enp0s31f6
     masquerade     masquerade
Ligne 122: Ligne 209:
     route all accept     route all accept
  
 +################################################################################
 # Clients on {enp1s0,virbr0,virbr1} (LAN) accessing servers on {enp1s0,virbr0,virbr1} (LAN). # Clients on {enp1s0,virbr0,virbr1} (LAN) accessing servers on {enp1s0,virbr0,virbr1} (LAN).
 +################################################################################
 router me2me inface "enp1s0 virbr0 virbr1" outface "enp1s0 virbr0 virbr1" router me2me inface "enp1s0 virbr0 virbr1" outface "enp1s0 virbr0 virbr1"
     # If you remove it, no REQUEST will pass matching this traffic.     # If you remove it, no REQUEST will pass matching this traffic.
     route all accept     route all accept
 +
 +################################################################################
 +# Clients on enp0s31f6 (Internet) accessing cluster's servers.
 +################################################################################
 +if test -n "$fip"
 +then
 +    for service in "${!dispatching[@]}"
 +    do
 +        eval "srv=${dispatching[$service]}"
 +        dport="${srv[0]}"
 +        protos="${srv[1]}"
 +        ipv4="${srv[2]}"
 +        ipv6="${srv[3]}"
 +        for proto in $protos
 +        do
 +            router "$service"_"$dport"_"$proto" inface enp0s31f6 outface "virbr0 virbr1" dst4 $ipv4 dst6 $ipv6
 +            protection strong
 +            server $service accept
 +        done
 +    done
 +fi
 </code> </code>
  
-===== Sur maine =====+===== Configuration sur coon =====
  
-Sur maine on met le même firewall que sur coon, //mutatis mutandis//.+<code bash /etc/firehol/firehol.conf > 
 +################################################################################ 
 +# Configuration 
 +################################################################################
  
-Il faut par ailleurs ajouter le dnat sur l'ip de FIPOn le fait en premier car c'est une contrainte de la conf de fireholEnsuite il faut penser dans les routeurs comme si la dst était changée, ce qui implique de faire des routeurs fip2bastion, fip2mail, etcLe bon goût de cette conséquence est que la gestion ipv6 est assez bien intégréeOn contrôle l'IP de sortie du cluster avec une règle de SNAT.+myPrivateIp="192.168.1.3 192.168.1.5" 
 +myPublicIp4="94.130.8.3" 
 +myPublicIp6="2a01:4f8:10b:c42::/64" 
 + 
 +clusterPrivateNetwork="192.168.1.0/24" 
 +clusterV6Network="2a01:4f8:10b:c41::/64 2a01:4f8:10b:c42::/64"  
 + 
 +# Si vous décommentez la ligne qui suit, le firewall considérera que fip 
 +# pointe sur cette machine avec l'adresse déclarée. 
 + 
 +# fip="88.99.233.240" 
 + 
 +declare -A dispatching=( 
 +     ["dns"]='(  "53" "tcp udp" "192.168.1.53"  "2a01:4f8:10b:c42:5054:ff:fe08:3282")' 
 +    ["http"]=' "80" "tcp"     "192.168.1.93"  "2a01:4f8:10b:c41:5054:ff:fe08:48ff")' 
 +   ["https"]='( "443" "tcp"     "192.168.1.93"  "2a01:4f8:10b:c41:5054:ff:fe08:48ff")' 
 +  ["icinga"]='("5665" "tcp"     "192.168.1.70"  "2a01:4f8:10b:c41:5054:ff:fe9b:6f27")' 
 +    ["smtp"]=' "25" "tcp"     "192.168.1.57"  "2a01:4f8:10b:c42:5054:ff:fec3:b9c7")' 
 +     ["ssh"]=' "22" "tcp"     "192.168.1.93"  "2a01:4f8:10b:c41:5054:ff:fe08:48ff")' 
 +
 + 
 +</code> 
 + 
 +===== Configuration sur maine =====
  
 <code bash /etc/firehol/firehol.conf > <code bash /etc/firehol/firehol.conf >
-NAT +################################################################################ 
-NB: en plus du NAT il faut ouvrir les filtres. +Configuration 
-    cf les router4 fip2bastion, fip2mail, etc. +################################################################################
-ipv4 dnat to 192.168.1.93 inface enp0s31f6 dst 88.99.233.240 proto tcp dport 22 +
-ipv4 dnat to 192.168.1.57 inface enp0s31f6 dst 88.99.233.240 proto tcp dport 25 +
-ipv4 dnat to 192.168.1.53 inface enp0s31f6 dst 88.99.233.240 proto tcp dport 53 +
-ipv4 dnat to 192.168.1.53 inface enp0s31f6 dst 88.99.233.240 proto udp dport 53 +
-ipv4 dnat to 192.168.1.93 inface enp0s31f6 dst 88.99.233.240 proto tcp dport 80 +
-ipv4 dnat to 192.168.1.93 inface enp0s31f6 dst 88.99.233.240 proto tcp dport 443 +
-ipv4 dnat to 192.168.1.70 inface enp0s31f6 dst 88.99.233.240 proto tcp dport 5663 +
-Contrôle de l'IP de sortie +
-ipv4 snat to 88.99.233.240 outface enp0s31f6+
  
-# IPv6 +myPrivateIp="192.168.1.2 192.168.1.4" 
-ipv6 interface any v6interop proto icmpv6 +myPublicIp4="94.130.8.2" 
-    client ipv6neigh accept +myPublicIp6="2a01:4f8:10b:c41::/64"
-    server ipv6neigh accept +
-    policy return +
-  +
-# DHCP +
-interface4 virbr0 dhcp +
-    policy return +
-    server dhcp accept+
  
-# FIP -> ME +clusterPrivateNetwork="192.168.1.0/24" 
-# The purpose of this interface is to control the traffic +clusterV6Network="2a01:4f8:10b:c41::/64 2a01:4f8:10b:c42::/64" 
-# on the enp0s31f6 interface with IP 88.99.233.240. +
-interface enp0s31f6 fip_trafic dst4 88.99.233.240 dst6 2a01:4f8:10b:c41::/64 +
-  +
-    # The default policy is DROP. +
-    policy drop +
-  +
-    # Protection anti flood +
-    protection strong +
-  +
-    # Services acceptés +
-    server ICMP    accept +
-    server ICMPV6  accept +
-  +
-    # The following means that this machine can REQUEST anything via enp0s31f6. +
-    client all accept +
-  +
-# EXT->ME +
-# The purpose of this interface is to control the traffic +
-# on the enp0s31f6 interface with IP 94.130.8.2. +
-interface enp0s31f6 external_trafic dst4 94.130.8.2 dst6 2a01:4f8:10b:c41::/64 +
-  +
-    # The default policy is DROP. +
-    policy drop +
-  +
-    # Protection anti flood +
-    protection strong +
-  +
-    # Services acceptés +
-    server ssh accept +
-    server ICMP accept +
-    server ICMPV6 accept +
-  +
-    # The following means that this machine can REQUEST anything via enp0s31f6. +
-    client all accept +
-  +
-# LAN->ME +
-# The purpose of this interface is to control the traffic +
-# on the {enp1s0,virbr0,virbr1} interface with IP 192.168.1.{3,5} (net: "192.168.1.0/24 "). +
-interface "enp1s0 virbr0 virbr1" internal_trafic src4 "192.168.1.0/24" dst4 "192.168.1.2 192.168.1.4" src6 "2a01:4f8:10b:c41::/64 2a01:4f8:10b:c42::/64" dst6 2a01:4f8:10b:c41::/64 +
-  +
-    # On est entre amis +
-    # The default policy is REJECT. +
-    policy reject +
-  +
-    # Here are the services listening on enp1s0. +
-    server ICMP accept +
-    server ICMPV6 accept +
-    server dns accept +
-    server ssh accept +
-    server dhcp accept +
-    server dhcpv6 accept +
-    server icinga accept +
-    server drbd accept +
-  +
-    # The following means that this machine can REQUEST anything via enp1s0. +
-    client all accept +
-  +
-# Clients on enp0s31f6 (Internet) accessing servers on {enp1s0,virbr0,virbr1} (LAN). +
-router ext2me inface enp0s31f6 outface "enp1s0 virbr0 virbr1" +
-    protection strong+
  
-Clients on enp0s31f6 (Internet) accessing servers on bastion. +Si vous décommentez la ligne qui suit, le firewall considérera que fip 
-router fip2bastion inface enp0s31f6 outface "virbr0 virbr1" dst4 192.168.1.93 dst6 2a01:4f8:10b:c41:5054:ff:fe08:48ff +pointe sur cette machine avec l'adresse déclarée.
-    protection strong +
-    server http accept +
-    server https accept +
-    server ssh accept +
-  +
-Clients on enp0s31f6 (Internet) accessing servers on mail. +
-router fip2mail inface enp0s31f6 outface "virbr0 virbr1" dst4 192.168.1.57 dst6 2a01:4f8:10b:c42:5054:ff:fec3:b9c7 +
-    protection strong +
-    server smtp accept +
-  +
-# Clients on enp0s31f6 (Internet) accessing servers on dns. +
-router fip2dns inface enp0s31f6 outface "virbr0 virbr1" dst4 192.168.1.53 dst6 2a01:4f8:10b:c42:5054:ff:fe08:3282 +
-    protection strong +
-    server dns accept+
  
-# Clients on enp0s31f6 (Internet) accessing servers on admin+fip="88.99.233.240" 
-router fip2admin inface enp0s31f6 outface "virbr0 virbr1dst4 192.168.1.70 dst6 2a01:4f8:10b:c41:5054:ff:fe9b:6f27 + 
-    protection strong +declare -A dispatching=( 
-    server icinga accept +     ["dns"]=' "53" "tcp udp" "192.168.1.53"  "2a01:4f8:10b:c42:5054:ff:fe08:3282")' 
-  +    ["http"]=' "80" "tcp"     "192.168.1.93"  "2a01:4f8:10b:c41:5054:ff:fe08:48ff")
-# Clients on {enp1s0,virbr0,virbr1} (LANaccessing servers on enp0s31f6 (Internet). +   ["https"]='"443" "tcp"     "192.168.1.93 "2a01:4f8:10b:c41:5054:ff:fe08:48ff")' 
-router me2ext inface "enp1s0 virbr0 virbr1outface enp0s31f6 +  ["icinga"]='("5665" "tcp"     "192.168.1.70"  "2a01:4f8:10b:c41:5054:ff:fe9b:6f27")' 
-    masquerade +    ["smtp"]=' "25" "tcp"     "192.168.1.57"  "2a01:4f8:10b:c42:5054:ff:fec3:b9c7")' 
-    # If you remove it, no REQUEST will pass matching this traffic+     ["ssh"]='(  "22"tcp"     "192.168.1.93"  "2a01:4f8:10b:c41:5054:ff:fe08:48ff")' 
-    route all accept +)
-  +
-# Clients on {enp1s0,virbr0,virbr1} (LAN) accessing servers on {enp1s0,virbr0,virbr1} (LAN)+
-router me2me inface "enp1s0 virbr0 virbr1outface "enp1s0 virbr0 virbr1" +
-    # If you remove it, no REQUEST will pass matching this traffic+
-    route all accept+
 </code> </code>
admin/procedures/installation_serveur_physique.1499238017.txt.gz · Dernière modification : 2017/07/05 07:00 de fpoulain