#! /usr/sbin/nft -I /usr/local/firewall -f # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Copyright © 2018-2019 Hugo Levy-Falk # Remise à zéro des règles du pare-feu flush ruleset # Inclusion des dépendances include "archi.nft" include "global_policy.nft" include "checkmac.nft" include "zones/adherent.nft" include "zones/aloes.nft" include "zones/federez.nft" include "zones/supelec.nft" include "zones/admin.nft" include "zones/dmz.nft" include "zones/prerezotage.nft" include "nat.nft" include "roulette.nft" # Table principale table inet firewall { chain dispatch { # Définition de la chaîne. On s'occupe du forward. type filter hook forward priority 0; # Politique par défaut : tout jeter. policy accept # La roulette pour les n1as jump roulette # Applique la politique globale jump global # Passage par le checkmac pour les concernés # jump checkmac # Filtre sur les interfaces entrantes, ne pas accepter # directement dans la chaine, mais retourner. # Par convention pour le routage, on vérifie dans la chaîne to_ que # le passage d'un vlan à l'autre est autorisé. # # On utilise des jumps pour revenir ici une fois la chaîne évaluée. meta iif vmap { $if_adherent : jump from_adherent, $if_admin : jump from_admin, $if_new_admin : jump from_admin, $if_federez : jump from_federez, $if_supelec : jump from_supelec, $if_aloes : jump from_aloes, $if_prerezotage : jump from_prerezotage, $if_dmz: jump from_dmz } # Filtre sur les interfaces sortantes, ne pas retourner : drop ou # accept # On utilise des goto pour ne pas revenir ici une fois la chaîne # évaluée. meta oif vmap { $if_adherent : goto to_adherent, $if_admin : goto to_admin, $if_new_admin : goto to_admin, $if_federez : goto to_federez, $if_supelec : goto to_supelec, $if_aloes : goto to_aloes, $if_prerezotage : goto to_prerezotage, $if_dmz: goto to_dmz } # Un compteur qui doit être à 0 si on a bien fait notre travail. counter } chain input { type filter hook input priority 0; policy accept; } chain output { type filter hook output priority 0; policy accept; } }