2020-11-05 19:37:51 +01:00
<!DOCTYPE html>
< html lang = "en" >
< head >
< meta charset = "utf-8" >
< meta name = "viewport" content = "width=device-width, initial-scale=1.0, shrink-to-fit=no" >
2020-11-06 12:21:47 +01:00
< title > {{ .Static.WebsiteTitle }} - Admin< / title >
< meta name = "description" content = "{{ .Static.WebsiteTitle }}" >
2020-11-05 19:37:51 +01:00
< link rel = "stylesheet" href = "/css/bootstrap.min.css" >
< link rel = "stylesheet" href = "/fonts/fontawesome-all.min.css" >
< link rel = "stylesheet" href = "/css/custom.css" >
< / head >
2020-11-09 14:32:20 +01:00
< body id = "page-top" class = "d-flex flex-column min-vh-100" >
2020-11-05 19:37:51 +01:00
{{template "prt_nav.html" .}}
2020-11-09 14:32:20 +01:00
< div class = "container mt-5" >
< h1 > WireGuard VPN Administration< / h1 >
2020-11-10 22:23:05 +01:00
{{template "prt_flashes.html" .}}
2020-11-06 12:21:47 +01:00
< div class = "card" >
< div class = "card-header" >
< div class = "d-flex align-items-center" >
2021-04-05 18:38:38 +02:00
< span class = "mr-auto" > Interface status for < strong > {{.Device.DeviceName}}< / strong > {{if eq $.Device.Type "server"}}(server mode){{end}}{{if eq $.Device.Type "client"}}(client mode){{end}}< / span >
< a href = "/admin/device/write?dev={{.Device.DeviceName}}" title = "Write interface configuration" > < i class = "fas fa-save" > < / i > < / a >
2020-11-17 08:01:03 +01:00
< a href = "/admin/device/download?dev={{.Device.DeviceName}}" title = "Download interface configuration" > < i class = "fas fa-download" > < / i > < / a >
2020-11-09 20:26:34 +01:00
2020-11-17 08:01:03 +01:00
< a href = "/admin/device/edit?dev={{.Device.DeviceName}}" title = "Edit interface settings" > < i class = "fas fa-cog" > < / i > < / a >
2020-11-06 12:21:47 +01:00
< / div >
2020-11-05 19:37:51 +01:00
< / div >
2020-11-06 12:21:47 +01:00
< div class = "card-body" >
< div class = "row" >
2021-04-05 18:38:38 +02:00
{{if eq $.Device.Type "server"}}
2020-11-06 12:21:47 +01:00
< div class = "col-sm-6" >
< table class = "table table-sm table-borderless device-status-table" >
< tbody >
< tr >
< td > Public Key:< / td >
< td > {{.Device.PublicKey}}< / td >
< / tr >
< tr >
< td > Public Endpoint:< / td >
2021-04-02 23:48:30 +02:00
< td > {{.Device.DefaultEndpoint}}< / td >
2020-11-06 12:21:47 +01:00
< / tr >
< tr >
< td > Listening Port:< / td >
< td > {{.Device.ListenPort}}< / td >
< / tr >
< tr >
< td > Enabled Peers:< / td >
< td > {{len .Device.Interface.Peers}}< / td >
< / tr >
2020-11-09 20:26:34 +01:00
< tr >
< td > Total Peers:< / td >
< td > {{.TotalPeers}}< / td >
< / tr >
2020-11-06 12:21:47 +01:00
< / tbody >
< / table >
< / div >
< div class = "col-sm-6" >
< table class = "table table-sm table-borderless device-status-table" >
< tbody >
< tr >
< td > IP Address:< / td >
< td > {{.Device.IPsStr}}< / td >
< / tr >
< tr >
< td > Default allowed IP's:< / td >
2021-04-02 23:48:30 +02:00
< td > {{.Device.DefaultAllowedIPsStr}}< / td >
2020-11-06 12:21:47 +01:00
< / tr >
< tr >
< td > Default DNS servers:< / td >
< td > {{.Device.DNSStr}}< / td >
< / tr >
< tr >
< td > Default MTU:< / td >
< td > {{.Device.Mtu}}< / td >
< / tr >
< tr >
< td > Default Keepalive Interval:< / td >
2021-04-02 23:48:30 +02:00
< td > {{.Device.DefaultPersistentKeepalive}}< / td >
2020-11-06 12:21:47 +01:00
< / tr >
< / tbody >
< / table >
< / div >
2021-04-05 18:38:38 +02:00
{{end}}
{{if eq $.Device.Type "client"}}
< div class = "col-sm-6" >
< table class = "table table-sm table-borderless device-status-table" >
< tbody >
< tr >
< td > Public Key:< / td >
< td > {{.Device.PublicKey}}< / td >
< / tr >
< tr >
< td > Enabled Endpoints:< / td >
< td > {{len .Device.Interface.Peers}}< / td >
< / tr >
< tr >
< td > Total Endpoints:< / td >
< td > {{.TotalPeers}}< / td >
< / tr >
< / tbody >
< / table >
< / div >
< div class = "col-sm-6" >
< table class = "table table-sm table-borderless device-status-table" >
< tbody >
< tr >
< td > IP Address:< / td >
< td > {{.Device.IPsStr}}< / td >
< / tr >
< tr >
< td > DNS servers:< / td >
< td > {{.Device.DNSStr}}< / td >
< / tr >
< tr >
< td > Default MTU:< / td >
< td > {{.Device.Mtu}}< / td >
< / tr >
< / tbody >
< / table >
< / div >
{{end}}
2020-11-06 12:21:47 +01:00
< / div >
2020-11-05 19:37:51 +01:00
< / div >
< / div >
2020-11-07 18:36:23 +01:00
< div class = "mt-4 row" >
2021-07-30 13:43:39 +02:00
< div class = "col-sm-8 col-12" >
2021-04-05 18:38:38 +02:00
{{if eq $.Device.Type "server"}}
2021-02-24 21:24:45 +01:00
< h2 class = "mt-2" > Current VPN Peers< / h2 >
2021-04-03 19:11:05 +02:00
{{end}}
2021-04-05 18:38:38 +02:00
{{if eq $.Device.Type "client"}}
2021-04-03 19:11:05 +02:00
< h2 class = "mt-2" > Current VPN Endpoints< / h2 >
{{end}}
2020-11-07 18:36:23 +01:00
< / div >
2021-07-30 13:43:39 +02:00
< div class = "col-sm-4 col-12 text-right" >
< a href = "/admin/peer/emailall" data-toggle = "confirmation" data-title = "Send mail to all peers?" title = "Send mail to all peers" class = "btn btn-light" > < i class = "fa fa-fw fa-paper-plane" > < / i > < / a >
2021-04-05 18:38:38 +02:00
{{if eq $.Device.Type "server"}}
2021-07-30 13:43:39 +02:00
< a href = "/admin/peer/createldap" title = "Add multiple peers" class = "btn btn-primary" > < i class = "fa fa-fw fa-plus" > < / i > < i class = "fa fa-fw fa-users" > < / i > < / a >
2021-04-03 19:11:05 +02:00
{{end}}
2021-07-30 13:43:39 +02:00
< a href = "/admin/peer/create" title = "Add a peer" class = "btn btn-primary" > < i class = "fa fa-fw fa-plus" > < / i > < i class = "fa fa-fw fa-user" > < / i > < / a >
2020-11-07 18:36:23 +01:00
< / div >
< / div >
< div class = "mt-2 table-responsive" >
2020-11-06 12:21:47 +01:00
< table class = "table table-sm" id = "userTable" >
2020-11-05 19:37:51 +01:00
< thead >
2020-11-06 12:21:47 +01:00
< tr >
2020-11-05 19:37:51 +01:00
< th scope = "col" class = "list-image-cell" > < / th > <!-- Status and expand -->
2021-02-24 21:24:45 +01:00
< th scope = "col" > < a href = "?sort=id" > Identifier < i class = "fa fa-fw {{.Session.GetSortIcon " peers " " id " } } " > < / i > < / a > < / th >
< th scope = "col" > < a href = "?sort=pubKey" > Public Key < i class = "fa fa-fw {{.Session.GetSortIcon " peers " " pubKey " } } " > < / i > < / a > < / th >
2021-04-05 23:18:02 +02:00
{{if eq $.Device.Type "server"}}
2021-02-24 21:24:45 +01:00
< th scope = "col" > < a href = "?sort=mail" > E-Mail < i class = "fa fa-fw {{.Session.GetSortIcon " peers " " mail " } } " > < / i > < / a > < / th >
2021-04-05 23:18:02 +02:00
{{end}}
{{if eq $.Device.Type "server"}}
2021-02-24 21:24:45 +01:00
< th scope = "col" > < a href = "?sort=ip" > IP's < i class = "fa fa-fw {{.Session.GetSortIcon " peers " " ip " } } " > < / i > < / a > < / th >
2021-04-05 23:18:02 +02:00
{{end}}
{{if eq $.Device.Type "client"}}
< th scope = "col" > < a href = "?sort=endpoint" > Endpoint < i class = "fa fa-fw {{.Session.GetSortIcon " peers " " endpoint " } } " > < / i > < / a > < / th >
{{end}}
2021-02-24 21:24:45 +01:00
< th scope = "col" > < a href = "?sort=handshake" > Handshake < i class = "fa fa-fw {{.Session.GetSortIcon " peers " " handshake " } } " > < / i > < / a > < / th >
2020-11-05 19:37:51 +01:00
< th scope = "col" > < / th > <!-- Actions -->
< / tr >
< / thead >
< tbody >
2020-11-06 12:21:47 +01:00
{{range $i, $p :=.Peers}}
2021-03-21 12:36:11 +01:00
{{$peerUser:=(userForEmail $.Users $p.Email)}}
2020-11-07 10:31:48 +01:00
< tr id = "user-pos-{{$i}}" { { if $ p . DeactivatedAt } } class = "disabled-peer" { { end } } >
2020-11-05 19:37:51 +01:00
< th scope = "row" class = "list-image-cell" >
< a href = "#{{$p.UID}}" data-toggle = "collapse" class = "collapse-indicator collapsed" > < / a >
<!-- online check -->
2020-11-17 08:01:03 +01:00
< span title = "Online status" class = "online-status" id = "online-{{$p.UID}}" data-pkey = "{{$p.PublicKey}}" > < i class = "fas fa-unlink" > < / i > < / span >
2020-11-05 19:37:51 +01:00
< / th >
< td > {{$p.Identifier}}< / td >
2021-04-05 20:00:11 +02:00
< td > {{$p.PublicKey}}< / td >
2021-04-05 23:18:02 +02:00
{{if eq $.Device.Type "server"}}
2020-11-05 19:37:51 +01:00
< td > {{$p.Email}}< / td >
2021-04-05 23:18:02 +02:00
{{end}}
{{if eq $.Device.Type "server"}}
2020-11-05 19:37:51 +01:00
< td > {{$p.IPsStr}}< / td >
2021-04-05 23:18:02 +02:00
{{end}}
{{if eq $.Device.Type "client"}}
< td > {{$p.Endpoint}}< / td >
{{end}}
2020-11-09 20:26:34 +01:00
< td > < span data-toggle = "tooltip" data-placement = "left" title = "" data-original-title = "{{$p.LastHandshakeTime}}" > {{$p.LastHandshake}}< / span > < / td >
2020-11-05 19:37:51 +01:00
< td >
2020-11-06 12:21:47 +01:00
{{if eq $.Session.IsAdmin true}}
2020-11-17 08:01:03 +01:00
< a href = "/admin/peer/edit?pkey={{$p.PublicKey}}" title = "Edit peer" > < i class = "fas fa-cog" > < / i > < / a >
2020-11-05 19:37:51 +01:00
{{end}}
< / td >
< / tr >
< tr class = "hiddenRow" >
2020-11-09 14:32:20 +01:00
< td colspan = "7" class = "hiddenCell" style = "white-space:nowrap" >
2020-11-05 19:37:51 +01:00
< div class = "collapse" id = "{{$p.UID}}" data-parent = "#userTable" >
< div class = "row collapsedRow" >
< div class = "col-md-6 leftBorder" >
2020-11-06 12:21:47 +01:00
< ul class = "nav nav-tabs" >
< li class = "nav-item" >
2020-11-07 10:31:48 +01:00
< a class = "nav-link active" data-toggle = "tab" href = "#t1{{$p.UID}}" > Personal< / a >
2020-11-06 12:21:47 +01:00
< / li >
2021-04-05 18:38:38 +02:00
{{if eq $.Device.Type "server"}}
2020-11-06 12:21:47 +01:00
< li class = "nav-item" >
< a class = "nav-link" data-toggle = "tab" href = "#t2{{$p.UID}}" > Configuration< / a >
< / li >
2021-04-05 18:38:38 +02:00
{{end}}
2020-11-06 12:21:47 +01:00
< li class = "nav-item" >
2020-11-09 11:06:02 +01:00
< a class = "nav-link" data-toggle = "tab" href = "#t3{{$p.UID}}" > Danger Zone< / a >
2020-11-06 12:21:47 +01:00
< / li >
< / ul >
< div class = "tab-content" id = "tabContent{{$p.UID}}" >
< div id = "t1{{$p.UID}}" class = "tab-pane fade active show" >
2020-11-09 14:32:20 +01:00
< h4 > User details< / h4 >
2021-03-21 12:36:11 +01:00
{{if not $peerUser}}
2021-02-24 21:24:45 +01:00
< p > No user information available...< / p >
2020-11-07 10:31:48 +01:00
{{else}}
< ul >
2021-03-21 12:36:11 +01:00
< li > Firstname: {{$peerUser.Firstname}}< / li >
< li > Lastname: {{$peerUser.Lastname}}< / li >
< li > Phone: {{$peerUser.Phone}}< / li >
< li > Mail: {{$peerUser.Email}}< / li >
2020-11-07 10:31:48 +01:00
< / ul >
{{end}}
2020-11-16 22:39:41 +01:00
< h4 > Connection / Traffic< / h4 >
2020-11-09 14:32:20 +01:00
{{if not $p.Peer}}
< p > No Traffic data available...< / p >
{{else}}
2020-11-17 08:01:03 +01:00
< p class = "ml-4" > {{if $p.DeactivatedAt}}-{{else}}< i class = "fas fa-network-wired" title = "Last Endpoint" > < / i > {{$p.Peer.Endpoint}}{{end}}< / p >
< p class = "ml-4" > {{if $p.DeactivatedAt}}-{{else}}< i class = "fas fa-long-arrow-alt-down" title = "Download" > < / i > {{formatBytes $p.Peer.ReceiveBytes}} / < i class = "fas fa-long-arrow-alt-up" title = "Upload" > < / i > {{formatBytes $p.Peer.TransmitBytes}}{{end}}< / p >
2020-11-09 14:32:20 +01:00
{{end}}
2020-11-05 19:37:51 +01:00
< / div >
2021-04-05 18:38:38 +02:00
{{if eq $.Device.Type "server"}}
2020-11-06 12:21:47 +01:00
< div id = "t2{{$p.UID}}" class = "tab-pane fade" >
< pre > {{$p.Config}}< / pre >
2020-11-05 19:37:51 +01:00
< / div >
2021-04-05 18:38:38 +02:00
{{end}}
2020-11-06 12:21:47 +01:00
< div id = "t3{{$p.UID}}" class = "tab-pane fade" >
2020-11-09 11:06:02 +01:00
< a href = "/admin/peer/delete?pkey={{$p.PublicKey}}" class = "btn btn-danger" title = "Delete peer" > Delete< / a >
2020-11-05 19:37:51 +01:00
< / div >
< / div >
< / div >
2020-11-09 20:26:34 +01:00
< div class = "col-md-3" >
2021-04-05 18:38:38 +02:00
{{if eq $.Device.Type "server"}}
2020-11-06 12:21:47 +01:00
< img class = "list-image-large" src = "/user/qrcode?pkey={{$p.PublicKey}}" / >
2021-04-05 18:38:38 +02:00
{{end}}
2020-11-05 19:37:51 +01:00
< / div >
2020-11-09 20:26:34 +01:00
< div class = "col-md-3" >
2021-04-05 18:38:38 +02:00
{{if eq $.Device.Type "server"}}
2020-11-09 20:26:34 +01:00
< div class = "float-right mt-5" >
< a href = "/admin/peer/download?pkey={{$p.PublicKey}}" class = "btn btn-primary" title = "Download configuration" > Download< / a >
< a href = "/admin/peer/email?pkey={{$p.PublicKey}}" class = "btn btn-primary" title = "Send configuration via Email" > Email< / a >
< / div >
2021-04-05 18:38:38 +02:00
{{end}}
2020-11-09 20:26:34 +01:00
< / div >
2020-11-05 19:37:51 +01:00
< / div >
< / div >
< / td >
< / tr >
{{end}}
< / tbody >
< / table >
2020-11-06 12:21:47 +01:00
< p > Currently listed peers: < strong > {{len .Peers}}< / strong > < / p >
2020-11-05 19:37:51 +01:00
< / div >
< / div >
2020-11-10 09:31:02 +01:00
{{template "prt_footer.html" .}}
2020-11-05 19:37:51 +01:00
< script src = "/js/jquery.min.js" > < / script >
< script src = "/js/jquery.easing.js" > < / script >
2021-07-30 13:43:39 +02:00
< script src = "/js/popper.min.js" > < / script >
< script src = "/js/bootstrap.bundle.min.js" > < / script >
< script src = "/js/bootstrap-confirmation.min.js" > < / script >
2020-11-05 19:37:51 +01:00
< script src = "/js/custom.js" > < / script >
< / body >
< / html >