Outils pour utilisateurs

Outils du site


admin:procedures:installation_serveur_physique

Ceci est une ancienne révision du document !


système

guide suivi pour l'installation initiale (avec serveur en rescue) : https://www.debian.org/releases/stretch/amd64/apds03.html.fr

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 :

  udevadm test-builtin net_id /sys/class/net/eth0 2> /dev/null

Cette commande permet de récupérer le nom de l'interface dans le nouveau format ( https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ )

/!\ ne pas oublier d'installer mdadm + lvm2 avant grub

sur chaque disque, activer le “mode grub”

  # parted /dev/sda
  > set 1 bios_grub on
  > quit
  # grub-install /dev/sda

libvirt

Rappel : virt-manager à besoin de netcat-openbsd (enfin d'un netcat avec -U)

Sur Coon :

  On édite le réseau defautl : 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
  On ajoute enp1s0 dans le bridge : brctl addif enp1s0 virbr0
  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

On utilisera firehol. Pour les détails quant à l'usage, se référer à Un firewall simple pour le chaton.

Ne surtout pas installer le paquet firewall-chaton : il n'est prévu que pour les guests !

On pensera à définir les services pour drbd et icinga :

/etc/firehol/services/icinga.conf
#FHVER: 1:213
# La premiere ligne ci dessus est nécessaire !!
server_icinga_ports="tcp/5665"
client_icinga_ports="default"
/etc/firehol/services/drdb.conf
#FHVER: 1:213
# La premiere ligne ci dessus est nécessaire !!
server_drbd_ports="tcp/7788 tcp/7789"
client_drbd_ports="default"

Script de firewall

On a un script de firewalling destiné à être identique entre maine et coon. La différence se situant au niveau de la configuration.

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.

################################################################################
# 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
    client ipv6neigh accept
    server ipv6neigh accept
    policy return

################################################################################
# DHCP
################################################################################
interface4 virbr0 dhcp
    policy return
    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
# The purpose of this interface is to control the traffic
# on the enp0s31f6 interface destinated to public IP.
################################################################################
interface enp0s31f6 external_trafic dst4 $myPublicIp4 dst6 $myPublicIp6

    # 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 destinated to private IP.
################################################################################
interface "enp1s0 virbr0 virbr1" internal_trafic src4 $clusterPrivateNetwork dst4 "$myPrivateIp" src6 "$clusterV6Network" dst6 $myPublicIp6

    # 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 {enp1s0,virbr0,virbr1} (LAN) accessing servers on enp0s31f6 (Internet).
################################################################################
router me2ext inface "enp1s0 virbr0 virbr1" outface enp0s31f6
    masquerade
    # If you remove it, no REQUEST will pass matching this traffic.
    route all accept

################################################################################
# Clients on {enp1s0,virbr0,virbr1} (LAN) accessing servers on {enp1s0,virbr0,virbr1} (LAN).
################################################################################
router me2me inface "enp1s0 virbr0 virbr1" outface "enp1s0 virbr0 virbr1"
    # If you remove it, no REQUEST will pass matching this traffic.
    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

Configuration sur coon

/etc/firehol/firehol.conf
################################################################################
# Configuration
################################################################################
 
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")'
)

Sur maine

/etc/firehol/firehol.conf
################################################################################
# Configuration
################################################################################
 
myPrivateIp="192.168.1.2 192.168.1.4"
myPublicIp4="94.130.8.2"
myPublicIp6="2a01:4f8:10b:c41::/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")'
)
admin/procedures/installation_serveur_physique.1502299342.txt.gz · Dernière modification : 2017/08/09 17:22 de fpoulain