firewall/checkmac.nft
Hugo Levy-Falk 9512cd35ac License
2019-12-20 19:18:10 +01:00

38 lines
1.3 KiB
Text

# 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 <http://www.gnu.org/licenses/>.
# Copyright © 2018-2019 Hugo Levy-Falk <hugo@klafyvel.me>
# Table checkmac, à bas le spoof d'ips.
table inet firewall {
set ip_mac {
type ipv4_addr . ether_addr
}
chain checkmac {
meta iifname $if_adherent ip saddr . ether saddr != @ip_mac drop
meta iifname $if_aloes ip saddr . ether saddr != @ip_mac drop
}
}
# Note :
# - On pourra afficher le set checkmac comme ceci :
# nft list set firewall ip_mac
#
# - On pourra ajouter des éléments comme ceci :
# nft add element firewall ip_mac { 10.69.6.91 . aa:bb:cc:dd:ee:ff }
#
# - En retirer :
# nft delete element firewall ip_mac { 10.69.6.91 . aa:bb:cc:dd:ee:ff }
#
# Le tout à la volée :)