#! /sbin/nft -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 table inet firewall { set dns { type ipv4_addr flags interval elements = { 193.48.225.248, 193.48.225.204 } } set www { type ipv4_addr flags interval elements = { 193.48.225.241, 193.48.225.242, 193.48.225.243, 193.48.225.247, 193.48.225.200, 193.48.225.3, 193.48.225.203, 193.48.225.208 } } set irc { type ipv4_addr flags interval elements = {193.48.225.244} } set znc { type ipv4_addr flags interval elements = { 193.48.225.242 } } set smtp { type ipv4_addr flags interval elements = { 193.48.225.249, 193.48.225.245, 193.48.225.200 , 193.48.225.207} } set letsencrypt { type ipv4_addr flags interval elements = {193.48.225.246, 193.48.225.248, 193.48.225.249} } set federez { type ipv4_addr flags interval elements = {193.48.225.201} } set gitlab { type ipv4_addr flags interval elements = { 193.48.225.243 } } set video { type ipv4_addr flags interval elements = { 193.48.225.240 } } set ldap { type ipv4_addr flags interval elements = { 193.48.225.246, 193.48.225.248 } } set ldap_clients { type ipv4_addr flags interval elements = { 10.7.0.0/24, 10.69.0.0/20, 185.230.78.37, 51.15.178.125, 193.48.225.0/24 } } set mysql { type ipv4_addr flags interval elements = {10.7.0.243} } set minecraft { type ipv4_addr flags interval elements = {193.48.225.202} } set latoilescoute { type ipv4_addr flags interval elements = {193.48.225.203} } set dns_rennais { type ipv4_addr flags interval elements = {193.48.225.205} } chain to_dmz { ip saddr 10.7.0.0/16 accept ip daddr @smtp tcp dport { 22, 25, 80, 443, 143, 993, 587} accept ip daddr @dns tcp dport { 22, 53 } accept ip daddr @dns udp dport { 53 } accept ip daddr @dns_rennais tcp dport { 22, 53 } accept ip daddr @dns_rennais udp dport { 53 } accept ip daddr @www tcp dport { 21, 22, 80, 443, 3000 } accept ip daddr @federez tcp dport { 22, 53, 80, 443, 389 } accept ip daddr @federez udp dport { 53, 636 } accept ip daddr @znc tcp dport { 6667 } accept ip daddr @letsencrypt tcp dport { 80, 443 } accept ip daddr @irc tcp dport { 22, 6667, 6697, 6767, 7000, 9090 } accept ip daddr @video tcp dport { 37700, 6754 } accept ip daddr @video udp dport { 37800 } accept ip daddr @video tcp dport { 5678 } accept ip saddr $monitoring udp dport { 161 } accept ip daddr @minecraft tcp dport { 22, 25565 } accept ip daddr @minecraft udp dport { 22, 25565 } accept ip daddr @latoilescoute udp dport { 22, 161, 16384-32768 } accept ip daddr @latoilescoute tcp dport { 22 } accept ip saddr @ldap_clients ip daddr @ldap tcp dport { 389, 636 } accept ip saddr @ldap_clients ip daddr @ldap udp dport { 636 } accept drop } chain from_dmz { ip daddr 10.0.0.0/8 accept ip daddr @mysql ip saddr != @www tcp dport 3306 drop ip daddr @mysql ip saddr != @smtp tcp dport 3306 drop } }