diff options
author | Christian Pointner <equinox@spreadspace.org> | 2021-01-23 22:17:02 +0100 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2021-01-23 22:17:02 +0100 |
commit | aefa7a4f57f91ed62ca166ecf5fdfc2eacc04f6a (patch) | |
tree | f7bb813720bc5198cbd2c172ae6136f2927eab3e /roles/wireguard/gateway/templates | |
parent | add etherwake and wakeonlan to ch-equinox-(ws|t450s) (diff) |
move wireguard to network sub-dir
Diffstat (limited to 'roles/wireguard/gateway/templates')
4 files changed, 0 insertions, 100 deletions
diff --git a/roles/wireguard/gateway/templates/systemd-fix-default-gw.service.j2 b/roles/wireguard/gateway/templates/systemd-fix-default-gw.service.j2 deleted file mode 100644 index d2d8a470..00000000 --- a/roles/wireguard/gateway/templates/systemd-fix-default-gw.service.j2 +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Wants=network-online.target -After=network-online.target - -[Service] -Type=oneshot -ExecStart=/sbin/ip route add {{ item.value.default_gateway.outer }} via {{ ansible_default_ipv4.gateway }} -ExecStop=/sbin/ip route del {{ item.value.default_gateway.outer }} via {{ ansible_default_ipv4.gateway }} -RemainAfterExit=yes - -[Install] -WantedBy=multi-user.target diff --git a/roles/wireguard/gateway/templates/systemd-iptables.service.j2 b/roles/wireguard/gateway/templates/systemd-iptables.service.j2 deleted file mode 100644 index 11cf4b8a..00000000 --- a/roles/wireguard/gateway/templates/systemd-iptables.service.j2 +++ /dev/null @@ -1,42 +0,0 @@ -[Unit] -Wants=network-online.target -After=network-online.target - - -[Service] -Type=oneshot - -{% if 'ip_snat' in item.value %} -ExecStart=/usr/sbin/sysctl net.ipv4.ip_forward=1 -{% for addr in item.value.addresses %} -ExecStart=/sbin/iptables -t nat -A POSTROUTING -s {{ addr | ipaddr('network/prefix') }} -o {{ item.value.ip_snat.interface }} -j SNAT --to {{ item.value.ip_snat.to }} -{% endfor %} -{% endif %} -{% for forward in item.value.port_forwardings | default([]) %} -{% for port in forward.tcp_ports | default([]) %} -ExecStart=/sbin/iptables -t nat -A PREROUTING -d {{ forward.dest }} -p tcp --dport {{ port }} -j DNAT --to {{ forward.tcp_ports[port] }} -{% endfor %} -{% for port in forward.udp_ports | default([]) %} -ExecStart=/sbin/iptables -t nat -A PREROUTING -d {{ forward.dest }} -p udp --dport {{ port }} -j DNAT --to {{ forward.udp_ports[port] }} -{% endfor %} -{% endfor %} - -{% if 'ip_snat' in item.value %} -{% for addr in item.value.addresses %} -ExecStop=/sbin/iptables -t nat -D POSTROUTING -s {{ addr | ipaddr('network/prefix') }} -o {{ item.value.ip_snat.interface }} -j SNAT --to {{ item.value.ip_snat.to }} -{% endfor %} -{% endif %} -{% for forward in item.value.port_forwardings | default([]) %} -{% for port in forward.tcp_ports | default([]) %} -ExecStop=/sbin/iptables -t nat -D PREROUTING -d {{ forward.dest }} -p tcp --dport {{ port }} -j DNAT --to {{ forward.tcp_ports[port] }} -{% endfor %} -{% for port in forward.udp_ports | default([]) %} -ExecStop=/sbin/iptables -t nat -D PREROUTING -d {{ forward.dest }} -p udp --dport {{ port }} -j DNAT --to {{ forward.udp_ports[port] }} -{% endfor %} -{% endfor %} - -RemainAfterExit=yes - - -[Install] -WantedBy=multi-user.target diff --git a/roles/wireguard/gateway/templates/systemd.netdev.j2 b/roles/wireguard/gateway/templates/systemd.netdev.j2 deleted file mode 100644 index 96399b52..00000000 --- a/roles/wireguard/gateway/templates/systemd.netdev.j2 +++ /dev/null @@ -1,26 +0,0 @@ -[NetDev] -Name={{ item.key }} -Kind=wireguard -{% if 'description' in item.value %} -Description={{ item.value.description }} -{% endif %} - - -[WireGuard] -PrivateKey={{ item.value.priv_key }} -ListenPort={{ item.value.listen_port | default(51820) }} - -{% for peer in item.value.peers %} - -[WireGuardPeer] -PublicKey={{ peer.pub_key }} -{% for ip in peer.allowed_ips %} -AllowedIPs={{ ip }} -{% endfor %} -{% if 'endpoint' in peer %} -Endpoint={{ peer.endpoint.host }}:{{ peer.endpoint.port | default(51820) }} -{% endif %} -{% if 'keepalive_interval' in peer %} -PersistentKeepalive={{ peer.keepalive_interval }} -{% endif %} -{% endfor %} diff --git a/roles/wireguard/gateway/templates/systemd.network.j2 b/roles/wireguard/gateway/templates/systemd.network.j2 deleted file mode 100644 index 6847aa6a..00000000 --- a/roles/wireguard/gateway/templates/systemd.network.j2 +++ /dev/null @@ -1,20 +0,0 @@ -[Match] -Name={{ item.key }} - -[Network] -{% for addr in item.value.addresses %} -Address={{ addr }} -{% endfor %} -{% if 'ip_masq' in item.value and item.value.ip_masq %} -IPMasquerade=yes -{% endif %} -{% if 'default_gateway' in item.value %} - -[Route] -Destination=0.0.0.0/1 -Gateway={{ item.value.default_gateway.inner }} - -[Route] -Destination=128.0.0.0/1 -Gateway={{ item.value.default_gateway.inner }} -{% endif %} |