bundles/pppd: allow dynamic configuration of nftables rules
All checks were successful
kunsi/bundlewrap/pipeline/head This commit looks good
All checks were successful
kunsi/bundlewrap/pipeline/head This commit looks good
This commit is contained in:
parent
20bbb3eb8e
commit
2b06c77439
3 changed files with 11 additions and 2 deletions
|
@ -3,6 +3,9 @@
|
||||||
INTERFACE=$1
|
INTERFACE=$1
|
||||||
|
|
||||||
echo "add rule nat postrouting oif $INTERFACE masquerade" > /etc/nftables-rules.d/90-pppd
|
echo "add rule nat postrouting oif $INTERFACE masquerade" > /etc/nftables-rules.d/90-pppd
|
||||||
|
% for rule in sorted(nftables):
|
||||||
|
echo "add rule ${rule}" >> /etc/nftables-rules.d/90-pppd
|
||||||
|
% endfor
|
||||||
echo "net.ipv6.conf.$INTERFACE.accept_ra=2" > /etc/sysctl.d/90-pppd.conf
|
echo "net.ipv6.conf.$INTERFACE.accept_ra=2" > /etc/sysctl.d/90-pppd.conf
|
||||||
|
|
||||||
if systemctl is-active nftables;
|
if systemctl is-active nftables;
|
||||||
|
|
|
@ -59,6 +59,10 @@ files = {
|
||||||
},
|
},
|
||||||
'/etc/ppp/ip-up.d/nftables': {
|
'/etc/ppp/ip-up.d/nftables': {
|
||||||
'source': 'ip-up',
|
'source': 'ip-up',
|
||||||
|
'content_type': 'mako',
|
||||||
|
'context': {
|
||||||
|
'nftables': node.metadata.get('pppd/nftables-rules.d', set()),
|
||||||
|
},
|
||||||
'mode': '0755',
|
'mode': '0755',
|
||||||
},
|
},
|
||||||
'/etc/ppp/peers/provider': {
|
'/etc/ppp/peers/provider': {
|
||||||
|
|
|
@ -105,8 +105,6 @@ nodes['home.router'] = {
|
||||||
'50-router': [
|
'50-router': [
|
||||||
# This is a router. Allow forwarding traffic for internal networks.
|
# This is a router. Allow forwarding traffic for internal networks.
|
||||||
'inet filter forward ct state { related, established } accept',
|
'inet filter forward ct state { related, established } accept',
|
||||||
'inet filter forward iif enp1s0.23 oif ppp0 accept',
|
|
||||||
'inet filter forward iif enp1s0.42 accept',
|
|
||||||
|
|
||||||
# yaaaaay, IPv6! No NAT!
|
# yaaaaay, IPv6! No NAT!
|
||||||
'inet filter forward ip6 nexthdr ipv6-icmp accept',
|
'inet filter forward ip6 nexthdr ipv6-icmp accept',
|
||||||
|
@ -148,6 +146,10 @@ nodes['home.router'] = {
|
||||||
'username': vault.decrypt('encrypt$gAAAAABfr8DLAJhmUIhdxLq83I8MnRRvkRgDZcO8Brvw1KpvplC3K8ZGj0jIIWD3Us33vIP6t0ybd_mgD8slpRUk78Kqd3BMoQ=='),
|
'username': vault.decrypt('encrypt$gAAAAABfr8DLAJhmUIhdxLq83I8MnRRvkRgDZcO8Brvw1KpvplC3K8ZGj0jIIWD3Us33vIP6t0ybd_mgD8slpRUk78Kqd3BMoQ=='),
|
||||||
'password': vault.decrypt('encrypt$gAAAAABfr8Cq5M1hweeJTQAl0dLhFntdlw-QnkIYUQpY-_ycODVWOpyeAwjwOgWLSdsdXIUvqcoiXPZPV-BE12p5C42NGnj9r7sKYpoGz8xfuGIk6haMa2g='),
|
'password': vault.decrypt('encrypt$gAAAAABfr8Cq5M1hweeJTQAl0dLhFntdlw-QnkIYUQpY-_ycODVWOpyeAwjwOgWLSdsdXIUvqcoiXPZPV-BE12p5C42NGnj9r7sKYpoGz8xfuGIk6haMa2g='),
|
||||||
},
|
},
|
||||||
|
'nftables-rules.d': {
|
||||||
|
'inet filter forward iif enp1s0.23 oif $INTERFACE accept',
|
||||||
|
'inet filter forward iif enp1s0.42 accept',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
'unbound': {
|
'unbound': {
|
||||||
'restrict-to': {
|
'restrict-to': {
|
||||||
|
|
Loading…
Reference in a new issue