Port upstream security fixes and features from ngoduykhanh/wireguard-ui
- Escape HTML in client list and wake-on-LAN names to prevent XSS - Log successful/failed login attempts with remote address - Fix leading-comma bug in AllowedIPs template when only extra allowed IPs are set - Add PreUp script support for server interfaces (alongside existing PostUp/PreDown/PostDown) - Fix endpoint parsing to support IPv6 addresses (upstream PR #223) Cherry-picked from upstream PRs #656, #653, #680, #673, #223. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
5a7709bc6e
commit
fc0d192e59
@@ -143,6 +143,10 @@ All Servers
|
||||
<input type="text" class="form-control" id="_iface_listen_port" name="_iface_listen_port"
|
||||
placeholder="e.g. 51822">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="_iface_pre_up" class="control-label">Pre Up Script</label>
|
||||
<input type="text" class="form-control" id="_iface_pre_up" placeholder="Pre Up Script">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="_iface_post_up" class="control-label">Post Up Script</label>
|
||||
<input type="text" class="form-control" id="_iface_post_up" placeholder="Post Up Script">
|
||||
@@ -439,6 +443,7 @@ All Servers
|
||||
modal.find("#_iface_server_id").val(serverId);
|
||||
modal.find("#_iface_addresses").val((obj.Interface && obj.Interface.addresses) ? obj.Interface.addresses.join(", ") : "");
|
||||
modal.find("#_iface_listen_port").val(obj.Interface ? obj.Interface.listen_port : "");
|
||||
modal.find("#_iface_pre_up").val(obj.Interface ? obj.Interface.pre_up : "");
|
||||
modal.find("#_iface_post_up").val(obj.Interface ? obj.Interface.post_up : "");
|
||||
modal.find("#_iface_pre_down").val(obj.Interface ? obj.Interface.pre_down : "");
|
||||
modal.find("#_iface_post_down").val(obj.Interface ? obj.Interface.post_down : "");
|
||||
@@ -455,6 +460,7 @@ All Servers
|
||||
const data = {
|
||||
"addresses": addresses,
|
||||
"listen_port": $("#_iface_listen_port").val(),
|
||||
"pre_up": $("#_iface_pre_up").val(),
|
||||
"post_up": $("#_iface_post_up").val(),
|
||||
"pre_down": $("#_iface_pre_down").val(),
|
||||
"post_down": $("#_iface_post_down").val()
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
<button type="button"
|
||||
class="btn btn-outline-primary btn-sm btn_modify_wake_on_lan_host"
|
||||
data-toggle="modal" data-target="#modal_wake_on_lan_host"
|
||||
data-name="{{ .Name }}" data-mac-address="{{ .MacAddress }}">Edit
|
||||
data-name="{{ .Name | attrescaper }}" data-mac-address="{{ .MacAddress }}">Edit
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline-danger btn-sm" data-toggle="modal"
|
||||
data-target="#modal_remove_wake_on_lan_host"
|
||||
@@ -98,7 +98,7 @@
|
||||
</button>
|
||||
</div>
|
||||
<hr>
|
||||
<span class="info-box-text"><i class="fas fa-address-card"></i> <span class="name">{{ .Name }}</span></span>
|
||||
<span class="info-box-text"><i class="fas fa-address-card"></i> <span class="name">{{ .Name | attrescaper }}</span></span>
|
||||
<span class="info-box-text"><i class="fas fa-ethernet"></i> <span class="mac-address">{{ .MacAddress }}</span></span>
|
||||
<span class="info-box-text"><i class="fas fa-clock"></i>
|
||||
<span class="latest-used">
|
||||
|
||||
+9
-1
@@ -8,6 +8,7 @@ Address = {{$first :=true}}{{range .serverConfig.Interface.Addresses }}{{if $fir
|
||||
ListenPort = {{ .serverConfig.Interface.ListenPort }}
|
||||
PrivateKey = {{ .serverConfig.KeyPair.PrivateKey }}
|
||||
{{if .globalSettings.MTU}}MTU = {{ .globalSettings.MTU }}{{end}}
|
||||
PreUp = {{ .serverConfig.Interface.PreUp }}
|
||||
PostUp = {{ .serverConfig.Interface.PostUp }}
|
||||
PreDown = {{ .serverConfig.Interface.PreDown }}
|
||||
PostDown = {{ .serverConfig.Interface.PostDown }}
|
||||
@@ -27,7 +28,14 @@ Table = {{ .globalSettings.Table }}
|
||||
[Peer]
|
||||
PublicKey = {{ .Client.PublicKey }}
|
||||
{{if .Client.PresharedKey}}PresharedKey = {{ .Client.PresharedKey }}{{end}}
|
||||
AllowedIPs = {{$first :=true}}{{range .Client.AllocatedIPs }}{{if $first}}{{$first = false}}{{else}},{{end}}{{.}}{{end}}{{range .Client.ExtraAllowedIPs }},{{.}}{{end}}
|
||||
AllowedIPs = {{ $first := true }}
|
||||
{{- range .Client.AllocatedIPs -}}
|
||||
{{- if not $first}}, {{ end -}}{{ . -}}{{ $first = false -}}
|
||||
{{- end -}}
|
||||
{{- range .Client.ExtraAllowedIPs -}}
|
||||
{{- if not $first}}, {{ end -}}{{ . -}}{{ $first = false -}}
|
||||
{{- end }}
|
||||
{{"\n"}}
|
||||
{{if $.globalSettings.PersistentKeepalive}}PersistentKeepalive = {{ $.globalSettings.PersistentKeepalive }}{{end}}
|
||||
{{if .Client.Endpoint}}Endpoint = {{ .Client.Endpoint }}{{end}}
|
||||
{{end}}{{end}}
|
||||
|
||||
Reference in New Issue
Block a user