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
Dernière révisionLes deux révisions suivantes
admin:procedures:installation_serveur_physique [2017/06/29 15:49] – [Sur coon] fpoulainadmin:procedures:installation_serveur_physique [2022/04/15 20:40] – s/drdb/drbd/ pilou
Ligne 42: Ligne 42:
 <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>
  
-===== Sur coon =====+On pensera à définir les services pour drbd et icinga : 
 +<code bash /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" 
 +</code> 
 +<code bash /etc/firehol/services/drbd.conf > 
 +#FHVER: 1:213 
 +# La premiere ligne ci dessus est nécessaire !! 
 +server_drbd_ports="tcp/7788 tcp/7789" 
 +client_drbd_ports="default" 
 +</code>
  
-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 53: Ligne 123:
     policy return     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 # 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. 
- policy drop+    policy drop
  
- # Protection anti flood +    # Protection anti flood 
- protection strong+    protection strong
  
- # Services acceptés +    # Services acceptés 
- server ICMP accept +    server ssh accept 
- server ssh accept+    server ICMP accept 
 +    server ICMPV6 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 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" 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 
- # The default policy is REJECT. +    # The default policy is REJECT. 
- policy reject+    policy reject
  
- # Here are the services listening on enp1s0. +    # Here are the services listening on enp1s0. 
- server ICMP accept +    server ICMP accept 
- server dns accept +    server ICMPV6 accept 
- server ssh 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. +    # The following means that this machine can REQUEST anything via enp1s0. 
- client all accept+    client all accept
  
-# Clients on enp0s31f6 (Internet) accessing servers on {enp1s0,virbr0} (LAN). +################################################################################ 
-router ext2me inface enp0s31f6 outface "enp1s0 virbr0" +# Clients on enp0s31f6 (Internet) accessing servers on {enp1s0,virbr0,virbr1} (LAN). 
- protection strong+################################################################################ 
 +router ext2me inface enp0s31f6 outface "enp1s0 virbr0 virbr1
 +    protection strong
  
-# Clients on {enp1s0,virbr0} (LAN) accessing servers on enp0s31f6 (Internet). +################################################################################ 
-router me2ext inface "enp1s0 virbr0" outface enp0s31f6 +# Clients on {enp1s0,virbr0,virbr1} (LAN) accessing servers on enp0s31f6 (Internet). 
- masquerade +################################################################################ 
- # If you remove it, no REQUEST will pass matching this traffic. +router me2ext inface "enp1s0 virbr0 virbr1" outface enp0s31f6 
- route all accept+    masquerade 
 +    # If you remove it, no REQUEST will pass matching this traffic. 
 +    route all accept
  
-# Clients on {enp1s0,virbr0} (LAN) accessing servers on {enp1s0,virbr0} (LAN). +################################################################################ 
-router me2me inface "enp1s0 virbr0" outface "enp1s0 virbr0" +# Clients on {enp1s0,virbr0,virbr1} (LAN) accessing servers on {enp1s0,virbr0,virbr1} (LAN). 
- # If you remove it, no REQUEST will pass matching this traffic.+################################################################################ 
 +router me2me inface "enp1s0 virbr0 virbr1" outface "enp1s0 virbr0 virbr1
 +    # 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 =====
  
 +<code bash /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")'
 +)
 +
 +</code>
 +
 +===== Configuration sur maine =====
 +
 +<code bash /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")'
 +)
 +</code>
admin/procedures/installation_serveur_physique.txt · Dernière modification : 2023/11/11 19:02 de pitchum