firewall/zones/dmz.nft

161 lines
3.8 KiB
Text
Raw Normal View History

2018-10-14 16:49:38 +00:00
#! /sbin/nft -f
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 inet firewall {
2019-03-30 13:36:03 +00:00
set dns {
type ipv4_addr
flags interval
2023-01-06 10:11:20 +00:00
elements = { 193.48.225.204, 193.48.225.29 }
2019-03-30 13:36:03 +00:00
}
set www {
type ipv4_addr
flags interval
2023-01-06 10:11:20 +00:00
elements = { 193.48.225.241, 193.48.225.242, 193.48.225.34, 193.48.225.25, 193.48.225.36, 193.48.225.42, 193.48.225.60, 193.48.225.61, 193.48.225.62, 193.48.225.20, 193.48.225.101}
2019-03-30 13:36:03 +00:00
}
set irc {
type ipv4_addr
flags interval
2023-01-06 10:11:20 +00:00
elements = {}
2019-03-30 13:36:03 +00:00
}
set znc {
type ipv4_addr
flags interval
elements = { 193.48.225.242 }
}
set smtp {
type ipv4_addr
flags interval
2022-08-01 10:10:08 +00:00
elements = { 193.48.225.207, 193.48.225.37 }
2019-03-30 13:36:03 +00:00
}
set letsencrypt {
type ipv4_addr
flags interval
2022-08-01 10:10:08 +00:00
elements = {193.48.225.246, 193.48.225.248, 193.48.225.249, 193.48.225.20}
2019-03-30 13:36:03 +00:00
}
set federez {
type ipv4_addr
flags interval
elements = {193.48.225.201}
}
2018-10-14 16:49:38 +00:00
2019-03-30 13:36:03 +00:00
set gitlab {
2019-02-09 09:23:05 +00:00
type ipv4_addr
2018-10-14 16:49:38 +00:00
flags interval
2019-03-30 13:36:03 +00:00
elements = { 193.48.225.243 }
2018-10-14 16:49:38 +00:00
}
2019-03-30 13:36:03 +00:00
set video {
type ipv4_addr
flags interval
2023-01-06 10:11:20 +00:00
elements = { }
2019-01-09 23:04:58 +00:00
}
2019-03-30 13:36:03 +00:00
set ldap {
type ipv4_addr
flags interval
2023-01-06 10:11:20 +00:00
elements = { 193.48.225.246}
2019-01-09 23:04:58 +00:00
}
2019-03-30 13:36:03 +00:00
set ldap_clients {
type ipv4_addr
flags interval
2020-11-11 15:28:15 +00:00
elements = { 10.7.0.0/24, 10.69.0.0/20, 185.230.78.37, 51.15.178.125, 193.48.225.0/24, 193.54.193.103 }
2019-01-09 23:04:58 +00:00
}
2019-03-30 13:36:03 +00:00
set mysql {
type ipv4_addr
flags interval
2023-01-06 10:11:20 +00:00
elements = {}
2019-01-09 23:04:58 +00:00
}
2019-12-03 16:34:34 +00:00
set minecraft {
type ipv4_addr
flags interval
2023-01-06 10:11:20 +00:00
elements = {}
2019-12-03 16:34:34 +00:00
}
2020-04-30 23:40:39 +00:00
set latoilescoute {
type ipv4_addr
flags interval
2023-01-06 10:11:20 +00:00
elements = {}
2020-04-30 23:40:39 +00:00
}
2022-08-01 10:10:08 +00:00
set wireguard {
type ipv4_addr
flags interval
elements = { 193.48.225.209 }
}
set radius {
type ipv4_addr
flags interval
elements = { 193.48.225.20 }
}
set dns_recursif {
type ipv4_addr
flags interval
elements = { 193.48.225.30 }
}
2018-10-14 16:49:38 +00:00
chain to_dmz {
2022-08-01 10:10:08 +00:00
ip saddr 10.70.0.0/16 accept
2019-04-29 22:12:26 +00:00
2020-10-07 13:43:50 +00:00
ip daddr @smtp tcp dport { 22, 25, 80, 443, 143, 993, 587} accept
2019-03-30 13:36:03 +00:00
ip daddr @dns tcp dport { 22, 53 } accept
ip daddr @dns udp dport { 53 } accept
2020-10-07 13:43:50 +00:00
ip daddr @www tcp dport { 21, 22, 80, 443, 3000 } accept
2019-03-30 13:36:03 +00:00
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
2022-08-01 10:10:08 +00:00
ip daddr @wireguard udp dport { 51820 } accept
2019-09-17 21:24:58 +00:00
ip saddr $monitoring udp dport { 161 } accept
2023-01-06 10:11:20 +00:00
2020-04-30 23:40:39 +00:00
ip daddr @minecraft tcp dport { 22, 25565 } accept
ip daddr @minecraft udp dport { 22, 25565 } accept
2023-01-06 10:11:20 +00:00
ip daddr @latoilescoute udp dport { 22, 161, 16384-32768 } accept
2020-04-30 23:40:39 +00:00
ip daddr @latoilescoute tcp dport { 22 } accept
2019-04-29 22:12:26 +00:00
ip saddr @ldap_clients ip daddr @ldap tcp dport { 389, 636 } accept
ip saddr @ldap_clients ip daddr @ldap udp dport { 636 } accept
2023-01-06 10:11:20 +00:00
2022-08-01 10:10:08 +00:00
ip daddr @radius udp dport { 1812, 1814 } accept
ip daddr @dns_recursif udp dport { 53, 853, 443 } accept
ip daddr @dns_recursif tcp dport { 53, 853, 443 } accept
2019-03-30 13:36:03 +00:00
drop
2018-10-14 16:49:38 +00:00
}
chain from_dmz {
2019-04-29 22:12:26 +00:00
ip daddr 10.0.0.0/8 accept
2019-03-30 13:36:03 +00:00
ip daddr @mysql ip saddr != @www tcp dport 3306 drop
ip daddr @mysql ip saddr != @smtp tcp dport 3306 drop
2018-10-14 16:49:38 +00:00
}
}