net/wireguard: add gateway support for PBR via PF (#1443)

This commit is contained in:
Michael
2019-08-11 10:12:45 +03:00
committed by Franco Fichtner
parent 63d397f725
commit 488263b335
5 changed files with 37 additions and 1 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
PLUGIN_NAME= wireguard
PLUGIN_VERSION= 1.0
PLUGIN_VERSION= 1.1
PLUGIN_COMMENT= WireGuard VPN service
PLUGIN_DEPENDS= wireguard
PLUGIN_MAINTAINER= m.muenz@gmail.com
+13
View File
@@ -12,3 +12,16 @@ most secure, easiest to use, and simplest VPN solution in
the industry.
WWW: https://www.wireguard.com/
Changelog
---------
1.1
* Allow adding interface route for PBR
1.0
* Support for most features like S2S, Roadwarror
* DNS, MTU, PSK
* Allow to disable setting routes for PBR
@@ -71,4 +71,11 @@
<type>checkbox</type>
<help>This will prevent installing routes. Usually you only enable this to do own routing decisions via a local gateway and gateway rules.</help>
</field>
<field>
<id>server.gateway</id>
<label>Gateway</label>
<type>text</type>
<advanced>true</advanced>
<help>Set the gateway IP here when using Disable Routes feature. You also have to add this as a gateway in OPNsense.</help>
</field>
</form>
@@ -50,7 +50,19 @@
<disableroutes type="BooleanField">
<default>0</default>
<Required>Y</Required>
<Constraints>
<check001>
<ValidationMessage>You have to enable Disable Routes option.</ValidationMessage>
<type>DependConstraint</type>
<addFields>
<field1>gateway</field1>
</addFields>
</check001>
</Constraints>
</disableroutes>
<gateway type="NetworkField">
<Required>N</Required>
</gateway>
<peers type="ModelRelationField">
<Model>
<template>
@@ -17,6 +17,10 @@ PrivateKey = {{ server_list.privkey }}
{% if server_list.disableroutes == '1' %}
Table = off
{% endif %}
{% if server_list.disableroutes == '1' and server_list.gateway|default('') != '' %}
PostUp = route add {{ server_list.gateway }} -iface %i
PostDown = route del {{ server_list.gateway }} -iface %i
{% endif %}
{% if server_list.peers|default('') != '' %}
{% for peerlist in server_list.peers.split(",") %}
{% set peerlist2_data = helpers.getUUID(peerlist) %}