30 lines
No EOL
983 B
Bash
30 lines
No EOL
983 B
Bash
#!/bin/bash
|
|
|
|
. ./lib/metadata.sh
|
|
|
|
function config_kvm {
|
|
sysctl -w net.ipv4.ip_forward=1
|
|
iptables -A OUTPUT -p icmp --icmp-type time-exceeded -j DROP
|
|
|
|
# Créer une nouvelle chaîne nommée "ACCEPT_BOGON"
|
|
iptables -N ACCEPT_BOGON
|
|
|
|
# Y mettre toutes les règles liées aux IPs bogon
|
|
iptables -A ACCEPT_BOGON -s 10.0.0.0/8 -j ACCEPT
|
|
iptables -A ACCEPT_BOGON -s 192.168.0.0/16 -j ACCEPT
|
|
iptables -A ACCEPT_BOGON -s 192.168.15.0/24 -j DROP
|
|
iptables -A ACCEPT_BOGON -s 172.16.0.0/12 -j ACCEPT
|
|
iptables -A ACCEPT_BOGON -s 127.0.0.0/8 -j ACCEPT
|
|
iptables -A ACCEPT_BOGON -s 169.254.0.0/16 -j ACCEPT
|
|
iptables -A ACCEPT_BOGON -s 0.0.0.0/8 -j ACCEPT
|
|
iptables -A ACCEPT_BOGON -s 240.0.0.0/4 -j ACCEPT
|
|
iptables -A ACCEPT_BOGON -s 224.0.0.0/4 -j ACCEPT
|
|
iptables -A ACCEPT_BOGON -j DROP
|
|
|
|
# Puis dans la chaîne INPUT, tu appelles cette chaîne :
|
|
iptables -A INPUT -j ACCEPT_BOGON
|
|
|
|
|
|
metadata_service
|
|
systemctl daemon-reload
|
|
} |