firewall/checkmac.nft

39 lines
1.3 KiB
Text
Raw Normal View History

2019-12-20 18:18:10 +00:00
# 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>
2018-10-14 16:49:38 +00:00
# Table checkmac, à bas le spoof d'ips.
2019-03-12 21:06:21 +00:00
table inet firewall {
2018-10-14 16:49:38 +00:00
set ip_mac {
type ipv4_addr . ether_addr
}
2019-03-12 21:06:21 +00:00
chain checkmac {
meta iifname $if_adherent ip saddr . ether saddr != @ip_mac drop
meta iifname $if_aloes ip saddr . ether saddr != @ip_mac drop
}
2018-10-14 16:49:38 +00:00
}
# 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 :)