mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
Merge pull request #1255 from opnsense/ngx_vts_api
www/nginx: add basic VTS support
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
||||
PLUGIN_NAME= nginx
|
||||
PLUGIN_VERSION= 1.10
|
||||
PLUGIN_VERSION= 1.11
|
||||
PLUGIN_COMMENT= Nginx HTTP server and reverse proxy
|
||||
PLUGIN_DEPENDS= nginx
|
||||
PLUGIN_MAINTAINER= franz.fabian.94@gmail.com
|
||||
|
||||
@@ -8,6 +8,12 @@ reuse, SSL offload and HTTP media streaming.
|
||||
Plugin Changelog
|
||||
================
|
||||
|
||||
1.11
|
||||
|
||||
* add VTS(1) module for traffic status reports
|
||||
|
||||
(1) https://github.com/vozlt/nginx-module-vts
|
||||
|
||||
1.10
|
||||
|
||||
* fix content security settings (missing checkbox, correct templating)
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
vhost_traffic_status_zone shared:vhost_traffic_status:20m;
|
||||
server {
|
||||
listen unix:/var/run/nginx_status.sock;
|
||||
location /vts {
|
||||
vhost_traffic_status_display;
|
||||
vhost_traffic_status_display_format json;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,4 +100,21 @@ class ServiceController extends ApiMutableServiceControllerBase
|
||||
|
||||
return array('status' => $status);
|
||||
}
|
||||
|
||||
/**
|
||||
* retrieve extended status of service
|
||||
* @return array response message
|
||||
* @throws \Exception when configd action fails
|
||||
*/
|
||||
public function vtsAction()
|
||||
{
|
||||
$backend = new Backend();
|
||||
$vts = json_decode($backend->configdRun('nginx vts'), true);
|
||||
if ($vts != null) {
|
||||
return $vts;
|
||||
}
|
||||
|
||||
$this->response->setStatusCode(404, "Not Found");
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/usr/local/bin/php
|
||||
<?php
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_UNIX_SOCKET_PATH, '/var/run/nginx_status.sock');
|
||||
curl_setopt($ch, CURLOPT_URL, "http://localhost/vts");
|
||||
curl_exec($ch);
|
||||
@@ -55,3 +55,9 @@ description:Automatically ban attacking hosts (nginx plugin)
|
||||
command:/usr/local/opnsense/scripts/nginx/naxsi_rule_download.php
|
||||
parameters:
|
||||
type:script
|
||||
|
||||
[vts]
|
||||
command:/usr/local/opnsense/scripts/nginx/vts.php
|
||||
parameters:
|
||||
type:script_output
|
||||
|
||||
|
||||
Reference in New Issue
Block a user