mirror of
https://github.com/DJSundog/wg-portal.git
synced 2024-11-23 15:13:52 -05:00
WIP: support different interface types: many fixes and improvements...
This commit is contained in:
parent
3bfcbe0209
commit
647fe92a03
@ -24,13 +24,13 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-12">
|
<div class="form-group required col-md-12">
|
||||||
<label for="inputEmail">Email Addresses</label>
|
<label for="inputEmail">Email Addresses</label>
|
||||||
<input type="text" name="email" class="form-control" id="inputEmail" value="{{.FormData.Emails}}">
|
<input type="text" name="email" class="form-control" id="inputEmail" value="{{.FormData.Emails}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-12">
|
<div class="form-group required col-md-12">
|
||||||
<label for="inputIdentifier">Client Friendly Name (will be added as suffix to the name of the user)</label>
|
<label for="inputIdentifier">Client Friendly Name (will be added as suffix to the name of the user)</label>
|
||||||
<input type="text" name="identifier" class="form-control" id="inputIdentifier" value="{{.FormData.Identifier}}">
|
<input type="text" name="identifier" class="form-control" id="inputIdentifier" value="{{.FormData.Identifier}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -28,7 +28,8 @@
|
|||||||
<input type="hidden" name="uid" value="{{.Peer.UID}}">
|
<input type="hidden" name="uid" value="{{.Peer.UID}}">
|
||||||
<input type="hidden" name="devicetype" value="{{.Device.Type}}">
|
<input type="hidden" name="devicetype" value="{{.Device.Type}}">
|
||||||
<input type="hidden" name="device" value="{{.Device.DeviceName}}">
|
<input type="hidden" name="device" value="{{.Device.DeviceName}}">
|
||||||
<input type="hidden" name="endpointpubkey" value="{{.Device.PublicKey}}">
|
<input type="hidden" name="endpointpubkey" value="{{.Peer.EndpointPublicKey}}">
|
||||||
|
<input type="hidden" name="endpoint" value="{{.Peer.Endpoint}}">
|
||||||
{{if .EditableKeys}}
|
{{if .EditableKeys}}
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
@ -39,13 +40,13 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-12">
|
<div class="form-group required col-md-12">
|
||||||
<label for="server_PublicKey">Public Key</label>
|
<label for="server_PublicKey">Public Key</label>
|
||||||
<input type="text" name="pubkey" class="form-control" id="server_PublicKey" value="{{.Peer.PublicKey}}">
|
<input type="text" name="pubkey" class="form-control" id="server_PublicKey" value="{{.Peer.PublicKey}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label for="server_PresharedKey">Preshared Key</label>
|
<label for="server_PresharedKey">Preshared Key</label>
|
||||||
<input type="text" name="presharedkey" class="form-control" id="server_PresharedKey" value="{{.Peer.PresharedKey}}">
|
<input type="text" name="presharedkey" class="form-control" id="server_PresharedKey" value="{{.Peer.PresharedKey}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{else}}
|
{{else}}
|
||||||
@ -61,19 +62,19 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-12">
|
<div class="form-group required col-md-12">
|
||||||
<label for="server_Identifier">Client Friendly Name</label>
|
<label for="server_Identifier">Client Friendly Name</label>
|
||||||
<input type="text" name="identifier" class="form-control" id="server_Identifier" value="{{.Peer.Identifier}}">
|
<input type="text" name="identifier" class="form-control" id="server_Identifier" value="{{.Peer.Identifier}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-12">
|
<div class="form-group required col-md-12">
|
||||||
<label for="server_Email">Client Email Address</label>
|
<label for="server_Email">Client Email Address</label>
|
||||||
<input type="email" name="mail" class="form-control" id="server_Email" value="{{.Peer.Email}}">
|
<input type="email" name="mail" class="form-control" id="server_Email" value="{{.Peer.Email}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-12">
|
<div class="form-group required col-md-12">
|
||||||
<label for="server_IP">Client IP Address</label>
|
<label for="server_IP">Client IP Address</label>
|
||||||
<input type="text" name="ip" class="form-control" id="server_IP" value="{{.Peer.IPsStr}}">
|
<input type="text" name="ip" class="form-control" id="server_IP" value="{{.Peer.IPsStr}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
@ -95,7 +96,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="server_MTU">Client MTU</label>
|
<label for="server_MTU">Client MTU</label>
|
||||||
<input type="number" name="mtu" class="form-control" id="server_MTU" placeholder="0" value="{{.Peer.MTU}}">
|
<input type="number" name="mtu" class="form-control" id="server_MTU" placeholder="0" value="{{.Peer.Mtu}}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -108,7 +109,7 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="custom-control custom-switch">
|
<div class="custom-control custom-switch">
|
||||||
<input class="custom-control-input" name="ignoreglobalsettings" type="checkbox" value="true" id="server_IgnoreGlobalSettings" {{if .Peer.IgnorePersistentKeepalive}}checked{{end}}>
|
<input class="custom-control-input" name="ignoreglobalsettings" type="checkbox" value="true" id="server_IgnoreGlobalSettings" {{if .Peer.IgnoreGlobalSettings}}checked{{end}}>
|
||||||
<label class="custom-control-label" for="server_IgnoreGlobalSettings">
|
<label class="custom-control-label" for="server_IgnoreGlobalSettings">
|
||||||
Ignore global settings
|
Ignore global settings
|
||||||
</label>
|
</label>
|
||||||
@ -146,7 +147,7 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-12">
|
<div class="form-group required col-md-12">
|
||||||
<label for="client_PublicKey">Peer Public Key</label>
|
<label for="client_PublicKey">Peer Public Key</label>
|
||||||
<input type="text" name="pubkey" class="form-control" id="client_PublicKey" value="{{.Peer.PublicKey}}">
|
<input type="text" name="pubkey" class="form-control" id="client_PublicKey" value="{{.Peer.PublicKey}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
@ -168,19 +169,19 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-12">
|
<div class="form-group required col-md-12">
|
||||||
<label for="client_Identifier">Endpoint Friendly Name</label>
|
<label for="client_Identifier">Endpoint Friendly Name</label>
|
||||||
<input type="text" name="identifier" class="form-control" id="client_Identifier" value="{{.Peer.Identifier}}">
|
<input type="text" name="identifier" class="form-control" id="client_Identifier" value="{{.Peer.Identifier}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-12">
|
<div class="form-group required col-md-12">
|
||||||
<label for="client_Endpoint">Endpoint Address</label>
|
<label for="client_Endpoint">Endpoint Address</label>
|
||||||
<input type="text" name="endpoint" class="form-control" id="client_Endpoint" value="{{.Peer.Endpoint}}">
|
<input type="text" name="endpoint" class="form-control" id="client_Endpoint" value="{{.Peer.Endpoint}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-12">
|
<div class="form-group required col-md-12">
|
||||||
<label for="client_EndpointPublicKey">Endpoint Public Key</label>
|
<label for="client_EndpointPublicKey">Endpoint Public Key</label>
|
||||||
<input type="text" name="endpointpubkey" class="form-control" id="client_EndpointPublicKey" value="{{.Peer.EndpointPublicKey}}">
|
<input type="text" name="endpointpubkey" class="form-control" id="client_EndpointPublicKey" value="{{.Peer.EndpointPublicKey}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
@ -236,7 +237,7 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-12">
|
<div class="form-group required col-md-12">
|
||||||
<label for="custom_PublicKey">Public Key</label>
|
<label for="custom_PublicKey">Public Key</label>
|
||||||
<input type="text" name="pubkey" class="form-control" id="custom_PublicKey" value="{{.Peer.PublicKey}}">
|
<input type="text" name="pubkey" class="form-control" id="custom_PublicKey" value="{{.Peer.PublicKey}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
@ -258,13 +259,13 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-12">
|
<div class="form-group required col-md-12">
|
||||||
<label for="custom_Identifier">Peer Friendly Name</label>
|
<label for="custom_Identifier">Peer Friendly Name</label>
|
||||||
<input type="text" name="identifier" class="form-control" id="custom_Identifier" value="{{.Peer.Identifier}}">
|
<input type="text" name="identifier" class="form-control" id="custom_Identifier" value="{{.Peer.Identifier}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-12">
|
<div class="form-group required col-md-12">
|
||||||
<label for="custom_Email">Peer Email Address</label>
|
<label for="custom_Email">Peer Email Address</label>
|
||||||
<input type="email" name="mail" class="form-control" id="custom_Email" value="{{.Peer.Email}}">
|
<input type="email" name="mail" class="form-control" id="custom_Email" value="{{.Peer.Email}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
@ -276,7 +277,7 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-12">
|
<div class="form-group required col-md-12">
|
||||||
<label for="custom_EndpointPublicKey">Endpoint Public Key</label>
|
<label for="custom_EndpointPublicKey">Endpoint Public Key</label>
|
||||||
<input type="text" name="endpointpubkey" class="form-control" id="custom_EndpointPublicKey" value="{{.Peer.EndpointPublicKey}}">
|
<input type="text" name="endpointpubkey" class="form-control" id="custom_EndpointPublicKey" value="{{.Peer.EndpointPublicKey}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
@ -304,7 +305,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="custom_MTU">Client MTU</label>
|
<label for="custom_MTU">Client MTU</label>
|
||||||
<input type="number" name="mtu" class="form-control" id="custom_MTU" placeholder="0" value="{{.Peer.MTU}}">
|
<input type="number" name="mtu" class="form-control" id="custom_MTU" placeholder="0" value="{{.Peer.Mtu}}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
<a class="nav-link {{if eq .Device.Type "client"}}active{{end}}" data-toggle="tab" href="#client">Client Mode</a>
|
<a class="nav-link {{if eq .Device.Type "client"}}active{{end}}" data-toggle="tab" href="#client">Client Mode</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link {{if eq .Device.Type "custom"}}active{{end}}" data-toggle="tab" href="#custom">Custom Mode</a>
|
<a class="nav-link {{if eq .Device.Type "custom"}}active{{end}}" data-toggle="tab" href="#custom">Custom Mode (Experimental)</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@ -34,7 +34,7 @@
|
|||||||
<form method="post" enctype="multipart/form-data">
|
<form method="post" enctype="multipart/form-data">
|
||||||
<input type="hidden" name="_csrf" value="{{.Csrf}}">
|
<input type="hidden" name="_csrf" value="{{.Csrf}}">
|
||||||
<input type="hidden" name="device" value="{{.Device.DeviceName}}">
|
<input type="hidden" name="device" value="{{.Device.DeviceName}}">
|
||||||
<input type="hidden" name="type" value="server">
|
<input type="hidden" name="devicetype" value="server">
|
||||||
<h3>Server's interface configuration</h3>
|
<h3>Server's interface configuration</h3>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
@ -46,13 +46,13 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-12">
|
<div class="form-group required col-md-12">
|
||||||
<label for="server_PrivateKey">Private Key</label>
|
<label for="server_PrivateKey">Private Key</label>
|
||||||
<input type="text" name="privkey" class="form-control" id="server_PrivateKey" value="{{.Device.PrivateKey}}">
|
<input type="text" name="privkey" class="form-control" id="server_PrivateKey" value="{{.Device.PrivateKey}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-12">
|
<div class="form-group required col-md-12">
|
||||||
<label for="server_PublicKey">Public Key</label>
|
<label for="server_PublicKey">Public Key</label>
|
||||||
<input type="text" name="pubkey" class="form-control" id="server_PublicKey" value="{{.Device.PublicKey}}">
|
<input type="text" name="pubkey" class="form-control" id="server_PublicKey" value="{{.Device.PublicKey}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{else}}
|
{{else}}
|
||||||
@ -67,18 +67,18 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-6">
|
<div class="form-group required col-md-6">
|
||||||
<label for="server_ListenPort">Listen port</label>
|
<label for="server_ListenPort">Listen port</label>
|
||||||
<input type="number" name="port" class="form-control" id="server_ListenPort" placeholder="51820" value="{{.Device.ListenPort}}">
|
<input type="number" name="port" class="form-control" id="server_ListenPort" placeholder="51820" value="{{.Device.ListenPort}}" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group required col-md-6">
|
<div class="form-group required col-md-6">
|
||||||
<label for="server_IPs">Server IP address</label>
|
<label for="server_IPs">Server IP address</label>
|
||||||
<input type="text" name="ip" class="form-control" id="server_IPs" placeholder="10.6.6.1/24" value="{{.Device.IPsStr}}">
|
<input type="text" name="ip" class="form-control" id="server_IPs" placeholder="10.6.6.1/24" value="{{.Device.IPsStr}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h3>Client's global configuration</h3>
|
<h3>Client's global configuration</h3>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-12">
|
<div class="form-group required col-md-12">
|
||||||
<label for="server_PublicEndpoint">Public Endpoint for Clients</label>
|
<label for="server_PublicEndpoint">Public Endpoint for Clients</label>
|
||||||
<input type="text" name="endpoint" class="form-control" id="server_PublicEndpoint" placeholder="vpn.company.com:51820" value="{{.Device.DefaultEndpoint}}">
|
<input type="text" name="endpoint" class="form-control" id="server_PublicEndpoint" placeholder="vpn.company.com:51820" value="{{.Device.DefaultEndpoint}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
@ -138,7 +138,7 @@
|
|||||||
<form method="post" enctype="multipart/form-data">
|
<form method="post" enctype="multipart/form-data">
|
||||||
<input type="hidden" name="_csrf" value="{{.Csrf}}">
|
<input type="hidden" name="_csrf" value="{{.Csrf}}">
|
||||||
<input type="hidden" name="device" value="{{.Device.DeviceName}}">
|
<input type="hidden" name="device" value="{{.Device.DeviceName}}">
|
||||||
<input type="hidden" name="type" value="client">
|
<input type="hidden" name="devicetype" value="client">
|
||||||
<h3>Client's interface configuration</h3>
|
<h3>Client's interface configuration</h3>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
@ -150,13 +150,13 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-12">
|
<div class="form-group required col-md-12">
|
||||||
<label for="client_PrivateKey">Private Key</label>
|
<label for="client_PrivateKey">Private Key</label>
|
||||||
<input type="text" name="privkey" class="form-control" id="client_PrivateKey" value="{{.Device.PrivateKey}}">
|
<input type="text" name="privkey" class="form-control" id="client_PrivateKey" value="{{.Device.PrivateKey}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-12">
|
<div class="form-group required col-md-12">
|
||||||
<label for="client_PublicKey">Public Key</label>
|
<label for="client_PublicKey">Public Key</label>
|
||||||
<input type="text" name="pubkey" class="form-control" id="client_PublicKey" value="{{.Device.PublicKey}}">
|
<input type="text" name="pubkey" class="form-control" id="client_PublicKey" value="{{.Device.PublicKey}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{else}}
|
{{else}}
|
||||||
@ -171,7 +171,7 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-6">
|
<div class="form-group required col-md-6">
|
||||||
<label for="client_IPs">Client IP address</label>
|
<label for="client_IPs">Client IP address</label>
|
||||||
<input type="text" name="ip" class="form-control" id="client_IPs" placeholder="10.6.6.1/24" value="{{.Device.IPsStr}}">
|
<input type="text" name="ip" class="form-control" id="client_IPs" placeholder="10.6.6.1/24" value="{{.Device.IPsStr}}" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="client_DNS">DNS Servers</label>
|
<label for="client_DNS">DNS Servers</label>
|
||||||
@ -220,7 +220,6 @@
|
|||||||
|
|
||||||
<button type="submit" class="btn btn-primary">Save</button>
|
<button type="submit" class="btn btn-primary">Save</button>
|
||||||
<a href="/admin" class="btn btn-secondary">Cancel</a>
|
<a href="/admin" class="btn btn-secondary">Cancel</a>
|
||||||
<a href="/admin/device/applyglobals" class="btn btn-dark float-right">Apply Global Settings to peers</a>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -229,7 +228,7 @@
|
|||||||
<form method="post" enctype="multipart/form-data">
|
<form method="post" enctype="multipart/form-data">
|
||||||
<input type="hidden" name="_csrf" value="{{.Csrf}}">
|
<input type="hidden" name="_csrf" value="{{.Csrf}}">
|
||||||
<input type="hidden" name="device" value="{{.Device.DeviceName}}">
|
<input type="hidden" name="device" value="{{.Device.DeviceName}}">
|
||||||
<input type="hidden" name="type" value="custom">
|
<input type="hidden" name="devicetype" value="custom">
|
||||||
<h3>Custom interface configuration</h3>
|
<h3>Custom interface configuration</h3>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
@ -241,13 +240,13 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-12">
|
<div class="form-group required col-md-12">
|
||||||
<label for="custom_PrivateKey">Private Key</label>
|
<label for="custom_PrivateKey">Private Key</label>
|
||||||
<input type="text" name="privkey" class="form-control" id="custom_PrivateKey" value="{{.Device.PrivateKey}}">
|
<input type="text" name="privkey" class="form-control" id="custom_PrivateKey" value="{{.Device.PrivateKey}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-12">
|
<div class="form-group required col-md-12">
|
||||||
<label for="custom_PublicKey">Public Key</label>
|
<label for="custom_PublicKey">Public Key</label>
|
||||||
<input type="text" name="pubkey" class="form-control" id="custom_PublicKey" value="{{.Device.PublicKey}}">
|
<input type="text" name="pubkey" class="form-control" id="custom_PublicKey" value="{{.Device.PublicKey}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{else}}
|
{{else}}
|
||||||
@ -266,21 +265,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group required col-md-6">
|
<div class="form-group required col-md-6">
|
||||||
<label for="custom_IPs">Interface IP address</label>
|
<label for="custom_IPs">Interface IP address</label>
|
||||||
<input type="text" name="ip" class="form-control" id="custom_IPs" placeholder="10.6.6.1/24" value="{{.Device.IPsStr}}">
|
<input type="text" name="ip" class="form-control" id="custom_IPs" placeholder="10.6.6.1/24" value="{{.Device.IPsStr}}" required>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
|
||||||
<div class="form-group col-md-6">
|
|
||||||
<label for="custom_MTU">Global MTU</label>
|
|
||||||
<input type="number" name="mtu" class="form-control" id="custom_MTU" placeholder="0" value="{{.Device.Mtu}}">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-6">
|
|
||||||
<div class="custom-control custom-switch">
|
|
||||||
<label class="custom-control-label" for="custom_SaveConfig">
|
|
||||||
Save Configuration (if Interface was edited via WireGuard configuration tool)
|
|
||||||
</label>
|
|
||||||
<input class="custom-control-input" name="saveconfig" type="checkbox" value="true" id="custom_SaveConfig" {{if .Peer.SaveConfig}}checked{{end}}>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
@ -293,6 +278,16 @@
|
|||||||
<input type="text" name="routingtable" class="form-control" id="custom_RoutingTable" placeholder="0" value="{{.Device.RoutingTable}}">
|
<input type="text" name="routingtable" class="form-control" id="custom_RoutingTable" placeholder="0" value="{{.Device.RoutingTable}}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-group col-md-12">
|
||||||
|
<div class="custom-control custom-switch">
|
||||||
|
<input class="custom-control-input" name="saveconfig" type="checkbox" value="true" id="custom_SaveConfig" {{if .Peer.SaveConfig}}checked{{end}}>
|
||||||
|
<label class="custom-control-label" for="custom_SaveConfig">
|
||||||
|
Save Configuration (if Interface was edited via WireGuard configuration tool)
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<h3>Peer's global configuration</h3>
|
<h3>Peer's global configuration</h3>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
@ -314,6 +309,12 @@
|
|||||||
<input type="text" name="allowedip" class="form-control" id="custom_AllowedIP" placeholder="10.6.6.0/24" value="{{.Device.DefaultAllowedIPsStr}}">
|
<input type="text" name="allowedip" class="form-control" id="custom_AllowedIP" placeholder="10.6.6.0/24" value="{{.Device.DefaultAllowedIPsStr}}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label for="custom_MTU">Global MTU</label>
|
||||||
|
<input type="number" name="mtu" class="form-control" id="custom_MTU" placeholder="0" value="{{.Device.Mtu}}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<h3>Interface configuration hooks</h3>
|
<h3>Interface configuration hooks</h3>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-12">
|
<div class="form-group required col-md-12">
|
||||||
<label for="inputEmail">Email</label>
|
<label for="inputEmail">Email</label>
|
||||||
<input type="text" name="email" class="form-control" id="inputEmail" value="{{.User.Email}}">
|
<input type="text" name="email" class="form-control" id="inputEmail" value="{{.User.Email}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{else}}
|
{{else}}
|
||||||
@ -36,13 +36,13 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-12">
|
<div class="form-group required col-md-12">
|
||||||
<label for="inputFirstname">Firstname</label>
|
<label for="inputFirstname">Firstname</label>
|
||||||
<input type="text" name="firstname" class="form-control" id="inputFirstname" value="{{.User.Firstname}}">
|
<input type="text" name="firstname" class="form-control" id="inputFirstname" value="{{.User.Firstname}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-12">
|
<div class="form-group required col-md-12">
|
||||||
<label for="inputLastname">Lastname</label>
|
<label for="inputLastname">Lastname</label>
|
||||||
<input type="text" name="lastname" class="form-control" id="inputLastname" value="{{.User.Lastname}}">
|
<input type="text" name="lastname" class="form-control" id="inputLastname" value="{{.User.Lastname}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
@ -54,7 +54,7 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-12 {{if eq .User.CreatedAt .Epoch}}required{{end}}">
|
<div class="form-group col-md-12 {{if eq .User.CreatedAt .Epoch}}required{{end}}">
|
||||||
<label for="inputPassword">Password</label>
|
<label for="inputPassword">Password</label>
|
||||||
<input type="password" name="password" class="form-control" id="inputPassword">
|
<input type="password" name="password" class="form-control" id="inputPassword" {{if eq .User.CreatedAt .Epoch}}required{{end}}>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -48,6 +49,21 @@ func (s *Server) PostAdminEditInterface(c *gin.Context) {
|
|||||||
formDevice.DefaultAllowedIPsStr = common.ListToString(common.ParseStringList(formDevice.DefaultAllowedIPsStr))
|
formDevice.DefaultAllowedIPsStr = common.ListToString(common.ParseStringList(formDevice.DefaultAllowedIPsStr))
|
||||||
formDevice.DNSStr = common.ListToString(common.ParseStringList(formDevice.DNSStr))
|
formDevice.DNSStr = common.ListToString(common.ParseStringList(formDevice.DNSStr))
|
||||||
|
|
||||||
|
// Clean interface parameters based on interface type
|
||||||
|
switch formDevice.Type {
|
||||||
|
case wireguard.DeviceTypeClient:
|
||||||
|
formDevice.ListenPort = 0
|
||||||
|
formDevice.DefaultEndpoint = ""
|
||||||
|
formDevice.DefaultAllowedIPsStr = ""
|
||||||
|
formDevice.DefaultPersistentKeepalive = 0
|
||||||
|
formDevice.SaveConfig = false
|
||||||
|
case wireguard.DeviceTypeServer:
|
||||||
|
formDevice.FirewallMark = 0
|
||||||
|
formDevice.RoutingTable = ""
|
||||||
|
formDevice.SaveConfig = false
|
||||||
|
case wireguard.DeviceTypeCustom:
|
||||||
|
}
|
||||||
|
|
||||||
// Update WireGuard device
|
// Update WireGuard device
|
||||||
err := s.wg.UpdateDevice(formDevice.DeviceName, formDevice.GetConfig())
|
err := s.wg.UpdateDevice(formDevice.DeviceName, formDevice.GetConfig())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -118,15 +134,37 @@ func (s *Server) GetApplyGlobalConfig(c *gin.Context) {
|
|||||||
device := s.peers.GetDevice(currentSession.DeviceName)
|
device := s.peers.GetDevice(currentSession.DeviceName)
|
||||||
peers := s.peers.GetAllPeers(device.DeviceName)
|
peers := s.peers.GetAllPeers(device.DeviceName)
|
||||||
|
|
||||||
|
if device.Type == wireguard.DeviceTypeClient {
|
||||||
|
SetFlashMessage(c, "Cannot apply global configuration while interface is in client mode.", "danger")
|
||||||
|
c.Redirect(http.StatusSeeOther, "/admin/device/edit")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
updateCounter := 0
|
||||||
for _, peer := range peers {
|
for _, peer := range peers {
|
||||||
|
if peer.IgnoreGlobalSettings {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
peer.AllowedIPsStr = device.DefaultAllowedIPsStr
|
peer.AllowedIPsStr = device.DefaultAllowedIPsStr
|
||||||
|
peer.Endpoint = device.DefaultEndpoint
|
||||||
|
peer.PersistentKeepalive = device.DefaultPersistentKeepalive
|
||||||
|
peer.DNSStr = device.DNSStr
|
||||||
|
peer.Mtu = device.Mtu
|
||||||
|
|
||||||
|
if device.Type == wireguard.DeviceTypeServer {
|
||||||
|
peer.EndpointPublicKey = device.PublicKey
|
||||||
|
}
|
||||||
|
|
||||||
if err := s.peers.UpdatePeer(peer); err != nil {
|
if err := s.peers.UpdatePeer(peer); err != nil {
|
||||||
SetFlashMessage(c, err.Error(), "danger")
|
SetFlashMessage(c, err.Error(), "danger")
|
||||||
c.Redirect(http.StatusSeeOther, "/admin/device/edit")
|
c.Redirect(http.StatusSeeOther, "/admin/device/edit")
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
updateCounter++
|
||||||
}
|
}
|
||||||
|
|
||||||
SetFlashMessage(c, "Allowed IP's updated for all clients.", "success")
|
SetFlashMessage(c, fmt.Sprintf("Global configuration updated for %d clients.", updateCounter), "success")
|
||||||
c.Redirect(http.StatusSeeOther, "/admin/device/edit")
|
c.Redirect(http.StatusSeeOther, "/admin/device/edit")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,6 @@ func (s *Server) PrepareNewPeer(device string) (wireguard.Peer, error) {
|
|||||||
|
|
||||||
peer := wireguard.Peer{}
|
peer := wireguard.Peer{}
|
||||||
peer.IsNew = true
|
peer.IsNew = true
|
||||||
peer.AllowedIPsStr = dev.DefaultAllowedIPsStr
|
|
||||||
peerIPs := make([]string, len(deviceIPs))
|
peerIPs := make([]string, len(deviceIPs))
|
||||||
for i := range deviceIPs {
|
for i := range deviceIPs {
|
||||||
freeIP, err := s.peers.GetAvailableIp(device, deviceIPs[i])
|
freeIP, err := s.peers.GetAvailableIp(device, deviceIPs[i])
|
||||||
@ -46,24 +45,36 @@ func (s *Server) PrepareNewPeer(device string) (wireguard.Peer, error) {
|
|||||||
peer.PublicKey = key.PublicKey().String()
|
peer.PublicKey = key.PublicKey().String()
|
||||||
peer.UID = fmt.Sprintf("u%x", md5.Sum([]byte(peer.PublicKey)))
|
peer.UID = fmt.Sprintf("u%x", md5.Sum([]byte(peer.PublicKey)))
|
||||||
|
|
||||||
|
switch dev.Type {
|
||||||
|
case wireguard.DeviceTypeCustom:
|
||||||
|
fallthrough
|
||||||
|
case wireguard.DeviceTypeServer:
|
||||||
|
peer.EndpointPublicKey = dev.PublicKey
|
||||||
|
peer.Endpoint = dev.DefaultEndpoint
|
||||||
|
peer.DNSStr = dev.DNSStr
|
||||||
|
peer.PersistentKeepalive = dev.DefaultPersistentKeepalive
|
||||||
|
peer.AllowedIPsStr = dev.DefaultAllowedIPsStr
|
||||||
|
peer.Mtu = dev.Mtu
|
||||||
|
case wireguard.DeviceTypeClient:
|
||||||
|
}
|
||||||
|
|
||||||
return peer, nil
|
return peer, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreatePeerByEmail creates a new peer for the given email. If no user with the specified email was found, a new one
|
// CreatePeerByEmail creates a new peer for the given email.
|
||||||
// will be created.
|
|
||||||
func (s *Server) CreatePeerByEmail(device, email, identifierSuffix string, disabled bool) error {
|
func (s *Server) CreatePeerByEmail(device, email, identifierSuffix string, disabled bool) error {
|
||||||
user, err := s.users.GetOrCreateUser(email)
|
user := s.users.GetUser(email)
|
||||||
if err != nil {
|
|
||||||
return errors.WithMessagef(err, "failed to load/create related user %s", email)
|
|
||||||
}
|
|
||||||
|
|
||||||
peer, err := s.PrepareNewPeer(device)
|
peer, err := s.PrepareNewPeer(device)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.WithMessage(err, "failed to prepare new peer")
|
return errors.WithMessage(err, "failed to prepare new peer")
|
||||||
}
|
}
|
||||||
peer.Email = email
|
peer.Email = email
|
||||||
|
if user != nil {
|
||||||
peer.Identifier = fmt.Sprintf("%s %s (%s)", user.Firstname, user.Lastname, identifierSuffix)
|
peer.Identifier = fmt.Sprintf("%s %s (%s)", user.Firstname, user.Lastname, identifierSuffix)
|
||||||
|
} else {
|
||||||
|
peer.Identifier = fmt.Sprintf("%s (%s)", email, identifierSuffix)
|
||||||
|
}
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
if disabled {
|
if disabled {
|
||||||
peer.DeactivatedAt = &now
|
peer.DeactivatedAt = &now
|
||||||
|
@ -90,7 +90,7 @@ type Peer struct {
|
|||||||
// Misc. WireGuard Settings
|
// Misc. WireGuard Settings
|
||||||
EndpointPublicKey string `form:"endpointpubkey" binding:"required,base64"` // the public key of the remote endpoint
|
EndpointPublicKey string `form:"endpointpubkey" binding:"required,base64"` // the public key of the remote endpoint
|
||||||
PrivateKey string `form:"privkey" binding:"omitempty,base64"`
|
PrivateKey string `form:"privkey" binding:"omitempty,base64"`
|
||||||
IPsStr string `form:"ip" binding:"cidrlist,required_if=devicetype server"` // a comma separated list of IPs of the client
|
IPsStr string `form:"ip" binding:"cidrlist,required_if=DeviceType server"` // a comma separated list of IPs of the client
|
||||||
DNSStr string `form:"dns" binding:"iplist"` // comma separated list of the DNS servers for the client
|
DNSStr string `form:"dns" binding:"iplist"` // comma separated list of the DNS servers for the client
|
||||||
// Global Device Settings (can be ignored, only make sense if device is in server mode)
|
// Global Device Settings (can be ignored, only make sense if device is in server mode)
|
||||||
Mtu int `form:"mtu" binding:"gte=0,lte=1500"`
|
Mtu int `form:"mtu" binding:"gte=0,lte=1500"`
|
||||||
@ -230,7 +230,7 @@ type Device struct {
|
|||||||
|
|
||||||
// Core WireGuard Settings (Interface section)
|
// Core WireGuard Settings (Interface section)
|
||||||
PrivateKey string `form:"privkey" binding:"required,base64"`
|
PrivateKey string `form:"privkey" binding:"required,base64"`
|
||||||
ListenPort int `form:"port" binding:"omitempty,gt=0,lt=65535,required_if=devicetype server"`
|
ListenPort int `form:"port" binding:"required_if=Type server,omitempty,gt=0,lt=65535"`
|
||||||
FirewallMark int32 `form:"firewallmark" binding:"gte=0"`
|
FirewallMark int32 `form:"firewallmark" binding:"gte=0"`
|
||||||
// Misc. WireGuard Settings
|
// Misc. WireGuard Settings
|
||||||
PublicKey string `form:"pubkey" binding:"required,base64"`
|
PublicKey string `form:"pubkey" binding:"required,base64"`
|
||||||
@ -245,7 +245,7 @@ type Device struct {
|
|||||||
SaveConfig bool `form:"saveconfig"` // if set to `true', the configuration is saved from the current state of the interface upon shutdown, wg-quick addition
|
SaveConfig bool `form:"saveconfig"` // if set to `true', the configuration is saved from the current state of the interface upon shutdown, wg-quick addition
|
||||||
|
|
||||||
// Settings that are applied to all peer by default
|
// Settings that are applied to all peer by default
|
||||||
DefaultEndpoint string `form:"endpoint" binding:"omitempty,hostname_port,required_if=devicetype server"`
|
DefaultEndpoint string `form:"endpoint" binding:"required_if=Type server,omitempty,hostname_port"`
|
||||||
DefaultAllowedIPsStr string `form:"allowedip" binding:"cidrlist"` // comma separated list of IPs that are used in the client config file
|
DefaultAllowedIPsStr string `form:"allowedip" binding:"cidrlist"` // comma separated list of IPs that are used in the client config file
|
||||||
DefaultPersistentKeepalive int `form:"keepalive" binding:"gte=0"`
|
DefaultPersistentKeepalive int `form:"keepalive" binding:"gte=0"`
|
||||||
|
|
||||||
@ -386,21 +386,24 @@ func (m *PeerManager) InitFromPhysicalInterface() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if entries already exist in database, if not create them
|
// Check if device already exists in database, if not, create it
|
||||||
|
if err := m.validateOrCreateDevice(*device, ipAddresses, mtu); err != nil {
|
||||||
|
return errors.WithMessagef(err, "failed to validate device %s", device.Name)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if entries already exist in database, if not, create them
|
||||||
for _, peer := range peers {
|
for _, peer := range peers {
|
||||||
if err := m.validateOrCreatePeer(deviceName, peer); err != nil {
|
if err := m.validateOrCreatePeer(deviceName, peer); err != nil {
|
||||||
return errors.WithMessagef(err, "failed to validate peer %s for device %s", peer.PublicKey, deviceName)
|
return errors.WithMessagef(err, "failed to validate peer %s for device %s", peer.PublicKey, deviceName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err := m.validateOrCreateDevice(*device, ipAddresses, mtu); err != nil {
|
|
||||||
return errors.WithMessagef(err, "failed to validate device %s", device.Name)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// validateOrCreatePeer checks if the given WireGuard peer already exists in the database, if not, the peer entry will be created
|
// validateOrCreatePeer checks if the given WireGuard peer already exists in the database, if not, the peer entry will be created
|
||||||
|
// assumption: server mode is used
|
||||||
func (m *PeerManager) validateOrCreatePeer(device string, wgPeer wgtypes.Peer) error {
|
func (m *PeerManager) validateOrCreatePeer(device string, wgPeer wgtypes.Peer) error {
|
||||||
peer := Peer{}
|
peer := Peer{}
|
||||||
m.db.Where("public_key = ?", wgPeer.PublicKey.String()).FirstOrInit(&peer)
|
m.db.Where("public_key = ?", wgPeer.PublicKey.String()).FirstOrInit(&peer)
|
||||||
@ -408,21 +411,22 @@ func (m *PeerManager) validateOrCreatePeer(device string, wgPeer wgtypes.Peer) e
|
|||||||
if peer.PublicKey == "" { // peer not found, create
|
if peer.PublicKey == "" { // peer not found, create
|
||||||
peer.UID = fmt.Sprintf("u%x", md5.Sum([]byte(wgPeer.PublicKey.String())))
|
peer.UID = fmt.Sprintf("u%x", md5.Sum([]byte(wgPeer.PublicKey.String())))
|
||||||
peer.PublicKey = wgPeer.PublicKey.String()
|
peer.PublicKey = wgPeer.PublicKey.String()
|
||||||
peer.PrivateKey = "" // UNKNOWN
|
|
||||||
if wgPeer.PresharedKey != (wgtypes.Key{}) {
|
if wgPeer.PresharedKey != (wgtypes.Key{}) {
|
||||||
peer.PresharedKey = wgPeer.PresharedKey.String()
|
peer.PresharedKey = wgPeer.PresharedKey.String()
|
||||||
}
|
}
|
||||||
peer.Email = "autodetected@example.com"
|
peer.Email = "autodetected@example.com"
|
||||||
peer.Identifier = "Autodetected (" + peer.PublicKey[0:8] + ")"
|
peer.Identifier = "Autodetected Client (" + peer.PublicKey[0:8] + ")"
|
||||||
peer.UpdatedAt = time.Now()
|
peer.UpdatedAt = time.Now()
|
||||||
peer.CreatedAt = time.Now()
|
peer.CreatedAt = time.Now()
|
||||||
IPs := make([]string, len(wgPeer.AllowedIPs))
|
IPs := make([]string, len(wgPeer.AllowedIPs)) // use allowed IP's as the peer IP's
|
||||||
for i, ip := range wgPeer.AllowedIPs {
|
for i, ip := range wgPeer.AllowedIPs {
|
||||||
IPs[i] = ip.String()
|
IPs[i] = ip.String()
|
||||||
}
|
}
|
||||||
peer.AllowedIPsStr = "" // UNKNOWN
|
|
||||||
peer.SetIPAddresses(IPs...)
|
peer.SetIPAddresses(IPs...)
|
||||||
peer.DeviceName = device
|
peer.DeviceName = device
|
||||||
|
if wgPeer.Endpoint != nil {
|
||||||
|
peer.Endpoint = wgPeer.Endpoint.String() // TODO: do we need to import this for server mode?
|
||||||
|
}
|
||||||
|
|
||||||
res := m.db.Create(&peer)
|
res := m.db.Create(&peer)
|
||||||
if res.Error != nil {
|
if res.Error != nil {
|
||||||
@ -439,11 +443,12 @@ func (m *PeerManager) validateOrCreateDevice(dev wgtypes.Device, ipAddresses []s
|
|||||||
m.db.Where("device_name = ?", dev.Name).FirstOrInit(&device)
|
m.db.Where("device_name = ?", dev.Name).FirstOrInit(&device)
|
||||||
|
|
||||||
if device.PublicKey == "" { // device not found, create
|
if device.PublicKey == "" { // device not found, create
|
||||||
device.Type = DeviceTypeCustom // imported device, we do not (easily) know if it is a client or server
|
device.Type = DeviceTypeServer // imported device, we assume that server mode is used
|
||||||
device.PublicKey = dev.PublicKey.String()
|
device.PublicKey = dev.PublicKey.String()
|
||||||
device.PrivateKey = dev.PrivateKey.String()
|
device.PrivateKey = dev.PrivateKey.String()
|
||||||
device.DeviceName = dev.Name
|
device.DeviceName = dev.Name
|
||||||
device.ListenPort = dev.ListenPort
|
device.ListenPort = dev.ListenPort
|
||||||
|
device.FirewallMark = int32(dev.FirewallMark)
|
||||||
device.Mtu = 0
|
device.Mtu = 0
|
||||||
device.DefaultPersistentKeepalive = 16 // Default
|
device.DefaultPersistentKeepalive = 16 // Default
|
||||||
device.IPsStr = strings.Join(ipAddresses, ", ")
|
device.IPsStr = strings.Join(ipAddresses, ", ")
|
||||||
|
@ -2,8 +2,8 @@ package wireguard
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"embed"
|
"embed"
|
||||||
"html/template"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
"text/template"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed tpl/*
|
//go:embed tpl/*
|
||||||
|
@ -48,7 +48,7 @@ PublicKey = {{ .PublicKey }}
|
|||||||
PresharedKey = {{ .PresharedKey }}
|
PresharedKey = {{ .PresharedKey }}
|
||||||
{{- end}}
|
{{- end}}
|
||||||
AllowedIPs = {{ .AllowedIPsStr }}
|
AllowedIPs = {{ .AllowedIPsStr }}
|
||||||
{{- if ne .Endpoint ""}}
|
{{- if and (ne .Endpoint "") (ne $.Interface.Type "server")}}
|
||||||
Endpoint = {{ .Endpoint }}
|
Endpoint = {{ .Endpoint }}
|
||||||
{{- end}}
|
{{- end}}
|
||||||
{{- if ne .PersistentKeepalive 0}}
|
{{- if ne .PersistentKeepalive 0}}
|
||||||
|
@ -18,7 +18,7 @@ MTU = {{.Peer.Mtu}}
|
|||||||
|
|
||||||
[Peer]
|
[Peer]
|
||||||
PublicKey = {{ .Peer.EndpointPublicKey }}
|
PublicKey = {{ .Peer.EndpointPublicKey }}
|
||||||
Endpoint = {{ .Server.Endpoint }}
|
Endpoint = {{ .Peer.Endpoint }}
|
||||||
AllowedIPs = {{ .Peer.AllowedIPsStr }}
|
AllowedIPs = {{ .Peer.AllowedIPsStr }}
|
||||||
{{- if .Peer.PresharedKey}}
|
{{- if .Peer.PresharedKey}}
|
||||||
PresharedKey = {{ .Peer.PresharedKey }}
|
PresharedKey = {{ .Peer.PresharedKey }}
|
||||||
|
Loading…
Reference in New Issue
Block a user