mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
Added nat table status
This commit is contained in:
parent
21e0ffcc58
commit
7fd6119da8
11 changed files with 151 additions and 21 deletions
|
|
@ -8,15 +8,33 @@
|
|||
var deferred = $.Deferred();
|
||||
var self = this;
|
||||
console.log("Init CONFIG");
|
||||
$.get("/config.json", {
|
||||
format: "json"
|
||||
}).done(function(data){
|
||||
if(!data || data == undefined) throw new Error("Could not get config.json!");
|
||||
Object.keys(data).map(function(k) { self[k] = data[k]; });
|
||||
deferred.resolve();
|
||||
UCI.sync("juci").done(function(){
|
||||
if(UCI.juci && UCI.juci.settings){
|
||||
console.log("Using settings from config/juci on router");
|
||||
Object.keys(UCI.juci.settings).map(function(k){
|
||||
var i = UCI.juci.settings[k];
|
||||
if(i instanceof Object && "value" in i) self[k] = i.value;
|
||||
});
|
||||
deferred.resolve();
|
||||
} else {
|
||||
loadJSON();
|
||||
}
|
||||
}).fail(function(){
|
||||
deferred.reject();
|
||||
loadJSON();
|
||||
});
|
||||
function loadJSON(){
|
||||
console.log("Using settings from config.json on router");
|
||||
$.get("/config.json", {
|
||||
format: "json"
|
||||
}).done(function(data){
|
||||
if(!data || data == undefined) throw new Error("Could not get config.json!");
|
||||
Object.keys(data).map(function(k) { self[k] = data[k]; });
|
||||
deferred.resolve();
|
||||
}).fail(function(){
|
||||
deferred.reject();
|
||||
});
|
||||
}
|
||||
|
||||
return deferred.promise();
|
||||
}
|
||||
$juci.config = new JUCIConfig();
|
||||
|
|
|
|||
|
|
@ -44,6 +44,11 @@
|
|||
scope.UBUS.$init().fail(function(){
|
||||
console.error("UBUS failed to initialize!");
|
||||
}).always(function(){ next(); });
|
||||
},
|
||||
function(next){
|
||||
$uci.$init().fail(function(){
|
||||
console.error("UCI failed to initialize!");
|
||||
}).always(function(){ next(); });
|
||||
},
|
||||
function(next){
|
||||
$juci.config.$init().fail(function(){
|
||||
|
|
@ -139,12 +144,7 @@
|
|||
console.log("Failed to verify session.");
|
||||
next();
|
||||
});
|
||||
},
|
||||
function(next){
|
||||
$uci.$init().fail(function(){
|
||||
console.error("UCI failed to initialize!");
|
||||
}).always(function(){ next(); });
|
||||
},
|
||||
},
|
||||
function(next){
|
||||
// TODO: this will be moved somewhere else. What we want to do is
|
||||
// pick both a theme and plugins based on the router model.
|
||||
|
|
|
|||
17
luciexpress/htdocs/plugins/juci-mod-dropbear/dropbear.js
Normal file
17
luciexpress/htdocs/plugins/juci-mod-dropbear/dropbear.js
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
|
||||
UCI.$registerConfig("dropbear");
|
||||
UCI.dropbear.$registerSectionType("settings", {
|
||||
"enable": { dvalue: true, type: Boolean }, //Set to 0 to disable starting dropbear at system boot.
|
||||
"verbose": { dvalue: false, type: Boolean }, //Set to 1 to enable verbose output by the start script.
|
||||
"BannerFile": { dvalue: "", type: String} , //Name of a file to be printed before the user has authenticated successfully.
|
||||
"PasswordAuth": { dvalue: true, type: Boolean }, //Set to 0 to disable authenticating with passwords.
|
||||
"Port": { dvalue: 22, type: Number }, //Port number to listen on.
|
||||
"RootPasswordAuth": { dvalue: true, type: Boolean }, //Set to 0 to disable authenticating as root with passwords.
|
||||
"RootLogin": { dvalue: true, type: Boolean }, //Set to 0 to disable SSH logins as root.
|
||||
"GatewayPorts": { dvalue: false, type: Boolean }, //Set to 1 to allow remote hosts to connect to forwarded ports.
|
||||
"Interface": { dvalue: "", type: String }, //Tells dropbear to listen only on the specified interface.1)
|
||||
"rsakeyfile": { dvalue: "", type: String }, //Path to RSA file
|
||||
"dsskeyfile": { dvalue: "", type: String }, //Path to DSS/DSA file
|
||||
"SSHKeepAlive": { dvalue: 300, type: Number }, //Keep Alive
|
||||
"IdleTimeout": { dvalue: 0, type: Number } //Idle Timeout
|
||||
});
|
||||
|
|
@ -3,7 +3,45 @@
|
|||
<luci-config-section>
|
||||
<luci-config-heading>{{ 'Dropbear' | translate }}</luci-config-heading>
|
||||
<luci-config-info>{{ 'settings.dropbear.info' | translate }}</luci-config-info>
|
||||
|
||||
<luci-config-line title="{{'Enabled'|translate}}">
|
||||
<switch ng-model="dropbear.enable.value" class="green" ng-change="onApply()"></switch>
|
||||
</luci-config-line>
|
||||
<luci-config-line title="{{'Verbose logging'|translate}}">
|
||||
<switch ng-model="dropbear.verbose.value" class="green" ng-change="onApply()"></switch>
|
||||
</luci-config-line>
|
||||
<luci-config-line title="{{'Banner File'|translate}}">
|
||||
<input class="form-control" ng-model="dropbear.BannerFile.value" ng-blur="onApply()"></input>
|
||||
</luci-config-line>
|
||||
<luci-config-line title="{{'Password Authentication'|translate}}">
|
||||
<switch ng-model="dropbear.PasswordAuth.value" ng-change="onApply()"></switch>
|
||||
</luci-config-line>
|
||||
<luci-config-line title="{{'Port'|translate}}">
|
||||
<input class="form-control" ng-model="dropbear.Port.value" ng-blur="onApply()"></switch>
|
||||
</luci-config-line>
|
||||
<luci-config-line title="{{'Root Password Auth'|translate}}">
|
||||
<switch ng-model="dropbear.RootPasswordAuth.value" ng-change="onApply()"></switch>
|
||||
</luci-config-line>
|
||||
<luci-config-line title="{{'Root Login'|translate}}">
|
||||
<switch ng-model="dropbear.RootLogin.value" ng-change="onApply()"></switch>
|
||||
</luci-config-line>
|
||||
<luci-config-line title="{{'Gateway Ports'|translate}}">
|
||||
<switch ng-model="dropbear.GatewayPorts.value" ng-change="onApply()"></switch>
|
||||
</luci-config-line>
|
||||
<luci-config-line title="{{'Interface'|translate}}">
|
||||
<input class="form-control" ng-model="dropbear.Interface.value" ng-blur="onApply()"></switch>
|
||||
</luci-config-line>
|
||||
<luci-config-line title="{{'RSA Key File'|translate}}">
|
||||
<input class="form-control" ng-model="dropbear.rsakeyfile.value" ng-blur="onApply()"></switch>
|
||||
</luci-config-line>
|
||||
<luci-config-line title="{{'DSS Key File'|translate}}">
|
||||
<input class="form-control" ng-model="dropbear.dsskeyfile.value" ng-blur="onApply()"></switch>
|
||||
</luci-config-line>
|
||||
<luci-config-line title="{{'Connection Keep Alive'|translate}}">
|
||||
<input class="form-control" ng-model="dropbear.SSHKeepAlive.value" ng-blur="onApply()"></switch>
|
||||
</luci-config-line>
|
||||
<luci-config-line title="{{'Idle Timeout'|translate}}">
|
||||
<input class="form-control" ng-model="dropbear.IdleTimeout.value" ng-blur="onApply()"></switch>
|
||||
</luci-config-line>
|
||||
</luci-config-section>
|
||||
</div>
|
||||
</luci-layout-with-sidebar>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,14 @@
|
|||
//! Author: Martin K. Schröder <mkschreder.uk@gmail.com>
|
||||
|
||||
$juci.app.controller("DropbearSettings", function($scope){
|
||||
|
||||
JUCI.app
|
||||
.controller("DropbearSettings", function($scope, $uci){
|
||||
$uci.sync("dropbear").done(function(){
|
||||
if($uci.dropbear && $uci.dropbear.settings){
|
||||
$scope.dropbear = $uci.dropbear.settings;
|
||||
$scope.$apply();
|
||||
}
|
||||
});
|
||||
$scope.onSave = function(){
|
||||
$uci.save();
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"scripts": [
|
||||
"dropbear"
|
||||
],
|
||||
"pages": {
|
||||
"settings/dropbear": {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
global.JUCI = require("../../../../tests/lib-juci");
|
||||
require("../dropbear");
|
||||
|
||||
describe("Dropbear", function(){
|
||||
it("should have config dropbear and should have settings section named 'settings'", function(){
|
||||
expect($uci.dropbear).to.be.ok();
|
||||
expect($uci.dropbear.settings).to.be.ok();
|
||||
});
|
||||
});
|
||||
|
|
@ -1,5 +1,36 @@
|
|||
<luci-layout-with-sidebar>
|
||||
<div ng-controller="StatusNATPageCtrl">
|
||||
Nat
|
||||
<luci-config-section>
|
||||
<luci-config-heading>{{ 'Nat table' | translate }}</luci-config-heading>
|
||||
<luci-config-info>{{ 'status.nat.info' | translate }}</luci-config-info>
|
||||
<table class="table" style="font-size: 12px">
|
||||
<thead>
|
||||
<!--<th>IPV6</th>-->
|
||||
<th>Protocol</th>
|
||||
<!--<th>Expires</th>-->
|
||||
<th>Source</th>
|
||||
<th>Dest.</th>
|
||||
<th>Source Port</th>
|
||||
<th>Dest. Port</th>
|
||||
<th>RX Packets</th>
|
||||
<th>TX Packets</th>
|
||||
<th>RX Bytes</th>
|
||||
<th>TX Bytes</th>
|
||||
</thead>
|
||||
<tr ng-repeat="con in connections">
|
||||
<!--<td>{{con.ipv6}}</td>-->
|
||||
<td>{{con.protocol}}</td>
|
||||
<!--<td>{{con.expires}}</td>-->
|
||||
<td>{{con.src}}</td>
|
||||
<td>{{con.dest}}</td>
|
||||
<td>{{con.sport}}</td>
|
||||
<td>{{con.dport}}</td>
|
||||
<td>{{con.rx_packets}}</td>
|
||||
<td>{{con.rx_bytes}}</td>
|
||||
<td>{{con.tx_packets}}</td>
|
||||
<td>{{con.tx_bytes}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</luci-config-section>
|
||||
</div>
|
||||
</luci-layout-with-sidebar>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,9 @@
|
|||
$juci.module("status")
|
||||
.controller("StatusNATPageCtrl", function($scope){
|
||||
|
||||
JUCI.app
|
||||
.controller("StatusNATPageCtrl", function($scope, $rpc){
|
||||
$rpc.luci2.network.conntrack_table().done(function(table){
|
||||
if(table && table.entries){
|
||||
$scope.connections = table.entries.sort(function(a, b){ return (a.src+a.dest) < (b.src+b.dest); });
|
||||
$scope.$apply();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
<luci-layout-with-sidebar>
|
||||
<div ng-controller="StatusRestartPageCtrl">
|
||||
<luci-config-section>
|
||||
<luci-config-heading>{{ 'EasyBox' | translate }}</luci-config-heading>
|
||||
<luci-config-heading>{{ 'Restart' | translate }}</luci-config-heading>
|
||||
<luci-config-info>{{ 'status.restart.info' | translate }}</luci-config-info>
|
||||
<div class="alert alert-default"></div>
|
||||
<luci-config-lines>
|
||||
<luci-config-line title="{{'Click here to restart your device'|translate}}">
|
||||
|
|
|
|||
|
|
@ -376,6 +376,7 @@
|
|||
"switch_info",
|
||||
"switch_status",
|
||||
"device_list",
|
||||
"conntrack_table",
|
||||
"dslstats"
|
||||
],
|
||||
"luci2.network.bwmon": [
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue