mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
net/wireguard: add some debugging tabs (#845)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
PLUGIN_NAME= wireguard
|
||||
PLUGIN_VERSION= 0.3
|
||||
PLUGIN_VERSION= 0.4
|
||||
PLUGIN_COMMENT= WireGuard VPN service
|
||||
PLUGIN_DEPENDS= wireguard
|
||||
PLUGIN_MAINTAINER= m.muenz@gmail.com
|
||||
|
||||
+22
@@ -44,4 +44,26 @@ class ServiceController extends ApiMutableServiceControllerBase
|
||||
static protected $internalServiceTemplate = 'OPNsense/Wireguard';
|
||||
static protected $internalServiceEnabled = 'enabled';
|
||||
static protected $internalServiceName = 'wireguard';
|
||||
|
||||
/**
|
||||
* show wireguard config
|
||||
* @return array
|
||||
*/
|
||||
public function showconfAction()
|
||||
{
|
||||
$backend = new Backend();
|
||||
$response = $backend->configdRun("wireguard showconf");
|
||||
return array("response" => $response);
|
||||
}
|
||||
|
||||
/**
|
||||
* show wireguard handshakes
|
||||
* @return array
|
||||
*/
|
||||
public function showhandshakeAction()
|
||||
{
|
||||
$backend = new Backend();
|
||||
$response = $backend->configdRun("wireguard showhandshake");
|
||||
return array("response" => $response);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
<li class="active"><a data-toggle="tab" href="#general">{{ lang._('General') }}</a></li>
|
||||
<li><a data-toggle="tab" href="#servers">{{ lang._('Server') }}</a></li>
|
||||
<li><a data-toggle="tab" href="#clients">{{ lang._('Endpoints') }}</a></li>
|
||||
<li><a data-toggle="tab" href="#showconf">{{ lang._('List Configuration') }}</a></li>
|
||||
<li><a data-toggle="tab" href="#showhandshake">{{ lang._('Handshakes') }}</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content content-box tab-content">
|
||||
@@ -102,12 +104,32 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
<br /><br />
|
||||
</div>
|
||||
</div>
|
||||
<div id="showconf" class="tab-pane fade in">
|
||||
<pre id="listshowconf"></pre>
|
||||
</div>
|
||||
<div id="showhandshake" class="tab-pane fade in">
|
||||
<pre id="listshowhandshake"></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ partial("layout_partials/base_dialog",['fields':formDialogEditWireguardClient,'id':'dialogEditWireguardClient','label':lang._('Edit Endpoint')])}}
|
||||
{{ partial("layout_partials/base_dialog",['fields':formDialogEditWireguardServer,'id':'dialogEditWireguardServer','label':lang._('Edit Server')])}}
|
||||
|
||||
<script>
|
||||
|
||||
// Put API call into a function, needed for auto-refresh
|
||||
function update_showconf() {
|
||||
ajaxCall(url="/api/wireguard/service/showconf", sendData={}, callback=function(data,status) {
|
||||
$("#listshowconf").text(data['response']);
|
||||
});
|
||||
}
|
||||
|
||||
function update_showhandshake() {
|
||||
ajaxCall(url="/api/wireguard/service/showhandshake", sendData={}, callback=function(data,status) {
|
||||
$("#listshowhandshake").text(data['response']);
|
||||
});
|
||||
}
|
||||
|
||||
$( document ).ready(function() {
|
||||
var data_get_map = {'frm_general_settings':"/api/wireguard/general/get"};
|
||||
mapDataToFormUI(data_get_map).done(function(data){
|
||||
@@ -135,6 +157,10 @@ $( document ).ready(function() {
|
||||
}
|
||||
);
|
||||
|
||||
// Call function update_neighbor with a auto-refresh of 5 seconds
|
||||
setInterval(update_showconf, 5000);
|
||||
setInterval(update_showhandshake, 5000);
|
||||
|
||||
$("#saveAct").click(function(){
|
||||
saveFormToEndpoint(url="/api/wireguard/general/set", formid='frm_general_settings',callback_ok=function(){
|
||||
$("#saveAct_progress").addClass("fa fa-spinner fa-pulse");
|
||||
|
||||
@@ -21,3 +21,15 @@ command:/usr/local/opnsense/scripts/OPNsense/Wireguard/genkey.sh
|
||||
parameters: %s
|
||||
type:script_output
|
||||
message:generating Wireguard keys
|
||||
|
||||
[showconf]
|
||||
command:/usr/local/bin/wg show all
|
||||
parameters:
|
||||
type:script_output
|
||||
message:show Wireguard config
|
||||
|
||||
[showhandshake]
|
||||
command:/usr/local/bin/wg show all latest-handshakes
|
||||
parameters:
|
||||
type:script_output
|
||||
message:show Wireguard handshakes
|
||||
|
||||
Reference in New Issue
Block a user