Drop static NAT support
Unused and never properly tested.
This commit is contained in:
parent
2c7e20bb75
commit
331adbd5e4
2 changed files with 0 additions and 13 deletions
|
|
@ -119,17 +119,6 @@ def save_config():
|
||||||
f.write(nft_set6.format(name=name, ips=make_set(data.get('ip6', ()))))
|
f.write(nft_set6.format(name=name, ips=make_set(data.get('ip6', ()))))
|
||||||
f.write('\n')
|
f.write('\n')
|
||||||
|
|
||||||
# Print static NAT (1:1) rules.
|
|
||||||
with open(output / 'etc/nftables.d/netmap.nft', 'w', encoding='utf-8') as f:
|
|
||||||
nft_map = 'map {name} {{\n type ipv4_addr : interval ipv4_addr; flags interval; elements = {{\n{ips}\n }}\n}}\n'
|
|
||||||
def make_map(ips, reverse=False):
|
|
||||||
# return "{ from1: to1, from2: to2, … }" with possibly reversed from and to
|
|
||||||
return ',\n'.join(f"{b if reverse else a}: {a if reverse else b}" for a, b in ips)
|
|
||||||
if netmap := db.read('netmap'): # { private range: public range… }
|
|
||||||
f.write(nft_map.format(name='netmap-out', ips=make_map(netmap.items())))
|
|
||||||
f.write('\n')
|
|
||||||
f.write(nft_map.format(name='netmap-in', ips=make_map(netmap.items(), reverse=True)))
|
|
||||||
|
|
||||||
# Print dynamic NAT rules.
|
# Print dynamic NAT rules.
|
||||||
with open(output / 'etc/nftables.d/nat.nft', 'w', encoding='utf-8') as f:
|
with open(output / 'etc/nftables.d/nat.nft', 'w', encoding='utf-8') as f:
|
||||||
no_nat_set = settings.get('no_nat_set')
|
no_nat_set = settings.get('no_nat_set')
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,6 @@
|
||||||
<dd>območja IP, naslovi NAT in skupine za VPN
|
<dd>območja IP, naslovi NAT in skupine za VPN
|
||||||
<dt><a href="{{ url_for('rules.index') }}">Pravila</a>
|
<dt><a href="{{ url_for('rules.index') }}">Pravila</a>
|
||||||
<dd>pravila za posredovanje prometa
|
<dd>pravila za posredovanje prometa
|
||||||
<dt><a href="{{ url_for('config.edit', name='netmap') }}">Netmap</a>
|
|
||||||
<dd>statične 1:1 preslikave naslovov za strežniška omrežja
|
|
||||||
<dt><a href="{{ url_for('vpn.custom') }}">VPN po meri</a>
|
<dt><a href="{{ url_for('vpn.custom') }}">VPN po meri</a>
|
||||||
<dd>urejanje ključev za oddaljeni dostop do posebnih omrežij
|
<dd>urejanje ključev za oddaljeni dostop do posebnih omrežij
|
||||||
<dt><a href="{{ url_for('config.index') }}">Nastavitve</a>
|
<dt><a href="{{ url_for('config.index') }}">Nastavitve</a>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue