2019-01-07 22:48:42 +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>
|
|
|
|
|
2019-02-09 09:23:05 +00:00
|
|
|
table ip nat {
|
2019-04-29 22:12:26 +00:00
|
|
|
|
|
|
|
set radius_federez {
|
|
|
|
type ipv4_addr
|
2019-11-13 20:37:34 +00:00
|
|
|
elements = { 195.154.165.76, 185.230.78.47 }
|
2019-04-29 22:12:26 +00:00
|
|
|
}
|
|
|
|
|
2022-09-03 18:05:45 +00:00
|
|
|
chain fwd_aurelian_pinet{
|
|
|
|
# +-----------------------------------------------------+
|
|
|
|
# + asyncnomi port forwarding table +
|
|
|
|
# +------------+------+-----------+-------------+-------+
|
|
|
|
# | Service | Port | Protocole | IP | Fwd |
|
|
|
|
# +------------+------+-----------+-------------+-------|
|
|
|
|
# | EDT 1 | 8000 | Both | 10.69.9.231 | 52000 |
|
|
|
|
# | EDT 2 | 8001 | Both | 10.69.9.231 | 52001 |
|
|
|
|
# | PLYST | 8002 | Both | 10.69.9.231 | 52002 |
|
|
|
|
# | SSH | 22 | Both | 10.69.9.231 | 52003 |
|
|
|
|
# | BF | 80 | Both | 10.69.9.231 | 52004 |
|
|
|
|
# | MediaVault | 2000 | Both | 10.69.9.231 | 52005 |
|
|
|
|
# | E2EE 1 | 6000 | TCP | 10.69.9.231 | 52006 |
|
|
|
|
# | E2EE 2 | 6001 | TCP | 10.69.9.231 | 52007 |
|
|
|
|
# | E2EE 3 | 6002 | TCP | 10.69.9.231 | 52008 |
|
|
|
|
# | Spare 1 | 2001 | Both | 10.69.9.231 | 52009 |
|
|
|
|
# | Spare 2 | 2002 | Both | 10.69.9.231 | 52010 |
|
|
|
|
# | SSH | 22 | Both | 10.69.9.232 | 52011 |
|
|
|
|
# | E2EE 1 | 6000 | TCP | 10.69.9.232 | 52012 |
|
|
|
|
# | E2EE 2 | 6001 | TCP | 10.69.9.232 | 52013 |
|
|
|
|
# | E2EE 3 | 6002 | TCP | 10.69.9.232 | 52014 |
|
|
|
|
# | Spare 1 | 2001 | Both | 10.69.9.232 | 52015 |
|
|
|
|
# | Spare 2 | 2002 | Both | 10.69.9.232 | 52016 |
|
|
|
|
# +------------+------+-----------+-------------+-------+
|
|
|
|
tcp dport 52000 dnat to 10.69.9.231:8000 # EDT 1 tcp
|
|
|
|
udp dport 52000 dnat to 10.69.9.231:8000 # EDT 1 udp
|
|
|
|
tcp dport 52001 dnat to 10.69.9.231:8001 # EDT 2 tcp
|
|
|
|
udp dport 52001 dnat to 10.69.9.231:8001 # EDT 2 tcp
|
|
|
|
tcp dport 52002 dnat to 10.69.9.231:8002 # PLYST tcp
|
|
|
|
udp dport 52002 dnat to 10.69.9.231:8002 # PLYST udp
|
|
|
|
tcp dport 52003 dnat to 10.69.9.231:22 # SSH tcp
|
|
|
|
udp dport 52003 dnat to 10.69.9.231:22 # SSH udp
|
|
|
|
tcp dport 52004 dnat to 10.69.9.231:80 # BF tcp
|
|
|
|
udp dport 52004 dnat to 10.69.9.231:80 # BF udp
|
|
|
|
tcp dport 52005 dnat to 10.69.9.231:2000 # MediaVault tcp
|
|
|
|
udp dport 52005 dnat to 10.69.9.231:2000 # MediaVault udp
|
|
|
|
tcp dport 52006 dnat to 10.69.9.231:6000 # E2EE 1
|
|
|
|
tcp dport 52007 dnat to 10.69.9.231:6001 # E2EE 1
|
|
|
|
tcp dport 52008 dnat to 10.69.9.231:6002 # E2EE 1
|
|
|
|
tcp dport 52009 dnat to 10.69.9.231:2001 # Spare 1 tcp
|
|
|
|
udp dport 52009 dnat to 10.69.9.231:2001 # Spare 1 udp
|
|
|
|
tcp dport 52010 dnat to 10.69.9.231:2002 # Spare 2 tcp
|
|
|
|
udp dport 52010 dnat to 10.69.9.231:2002 # Spare 2 udp
|
|
|
|
|
|
|
|
tcp dport 52011 dnat to 10.69.9.232:22 # SSH tcp
|
|
|
|
udp dport 52011 dnat to 10.69.9.232:22 # SSH udp
|
|
|
|
tcp dport 52012 dnat to 10.69.9.232:6000 # E2EE 1
|
|
|
|
tcp dport 52013 dnat to 10.69.9.232:6001 # E2EE 1
|
|
|
|
tcp dport 52014 dnat to 10.69.9.232:6002 # E2EE 1
|
|
|
|
tcp dport 52015 dnat to 10.69.9.232:2001 # Spare 1 tcp
|
|
|
|
udp dport 52015 dnat to 10.69.9.232:2001 # Spare 1 udp
|
|
|
|
tcp dport 52016 dnat to 10.69.9.232:2002 # Spare 2 tcp
|
|
|
|
udp dport 52016 dnat to 10.69.9.232:2002 # Spare 2 udp
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-01-07 22:48:42 +00:00
|
|
|
chain prerouting {
|
|
|
|
type nat hook prerouting priority 0;
|
2019-04-29 22:12:26 +00:00
|
|
|
ip saddr $range_prerezotage ip daddr != { $intranet, $comnpay, $website } tcp dport {http,https} dnat $bounce_server;
|
2022-08-02 20:33:36 +00:00
|
|
|
|
|
|
|
# Serveur de Mohammed Ziani
|
|
|
|
meta iif $if_supelec ip daddr $ip_self_public tcp dport 51000 counter dnat to 10.69.3.116:22
|
|
|
|
meta iif $if_supelec ip daddr $ip_self_public tcp dport 51001 counter dnat to 10.69.3.116:80
|
|
|
|
meta iif $if_supelec ip daddr $ip_self_public tcp dport 51002 counter dnat to 10.69.3.116:443
|
|
|
|
|
2022-09-03 18:05:45 +00:00
|
|
|
# Serveur de Aurélian Pinet
|
|
|
|
meta iif $if_supelec ip daddr $ip_self_public tcp dport 52000-52016 jump fwd_aurelian_pinet
|
|
|
|
meta iif $if_supelec ip daddr $ip_self_public udp dport 52000-52016 jump fwd_aurelian_pinet
|
|
|
|
|
2020-09-14 18:26:26 +00:00
|
|
|
#ip saddr @radius_federez ip daddr $ip_self_public tcp dport { 636, 389 } dnat $ip_radius;
|
|
|
|
#ip saddr @radius_federez ip daddr $ip_self_public udp dport { 636, 1812 } dnat $ip_radius;
|
2019-01-07 22:48:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
chain postrouting {
|
|
|
|
type nat hook postrouting priority 100
|
2019-02-09 09:23:05 +00:00
|
|
|
|
2019-05-12 09:58:09 +00:00
|
|
|
meta oifname != $if_supelec return
|
2019-03-26 21:02:43 +00:00
|
|
|
|
2020-09-14 18:26:26 +00:00
|
|
|
#ip saddr $ip_radius ip daddr @radius_federez tcp dport { 636, 389} snat to $ip_self_public
|
|
|
|
#ip saddr $ip_radius ip daddr @radius_federez udp dport { 636, 1812 } snat to $ip_self_public
|
2019-05-20 08:56:31 +00:00
|
|
|
|
2019-04-29 22:12:26 +00:00
|
|
|
ip daddr != {10.0.0.0/8, $range_public} ip saddr vmap {
|
|
|
|
$range_adherent : goto adherent_nat,
|
|
|
|
$range_admin : goto admin_nat,
|
2022-08-01 10:10:08 +00:00
|
|
|
$range_new_admin : goto admin_nat,
|
2019-04-29 22:12:26 +00:00
|
|
|
$range_federez : goto federez_nat,
|
|
|
|
$range_aloes : goto aloes_nat,
|
|
|
|
$range_prerezotage : goto prerezotage_nat
|
2019-03-26 21:02:43 +00:00
|
|
|
}
|
2019-12-20 18:18:10 +00:00
|
|
|
|
2019-04-29 22:12:26 +00:00
|
|
|
ip daddr != {10.0.0.0/8, $range_public} ip saddr != $range_public snat to $ip_self_public
|
2019-01-07 22:48:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|