mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
nginx syslog, max temp file size (#1302)
* www/nginx: add model and form support for SYSLOG servers * www/nginx: add model to template * www/nginx: add config file * www/nginx: version bump * www/nginx: add missing option * www/nginx: add support for max temp file size * www/nginx: add release note
This commit is contained in:
+1
-2
@@ -1,6 +1,5 @@
|
||||
PLUGIN_NAME= nginx
|
||||
PLUGIN_VERSION= 1.11
|
||||
PLUGIN_REVISION= 2
|
||||
PLUGIN_VERSION= 1.12
|
||||
PLUGIN_COMMENT= Nginx HTTP server and reverse proxy
|
||||
PLUGIN_DEPENDS= nginx
|
||||
PLUGIN_MAINTAINER= franz.fabian.94@gmail.com
|
||||
|
||||
@@ -8,6 +8,11 @@ reuse, SSL offload and HTTP media streaming.
|
||||
Plugin Changelog
|
||||
================
|
||||
|
||||
1.12
|
||||
|
||||
* add log to SYSLOG server support
|
||||
* add support for maximum temporary file size for request bodies
|
||||
|
||||
1.11
|
||||
|
||||
* add VTS(1) module for traffic status reports
|
||||
|
||||
@@ -663,4 +663,30 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
}
|
||||
}
|
||||
}
|
||||
// SYSLOG targets
|
||||
public function searchsyslog_targetAction()
|
||||
{
|
||||
return $this->searchBase('syslog_target', array('description', 'host', 'facility', 'severity'));
|
||||
}
|
||||
|
||||
public function getsyslog_targetAction($uuid = null)
|
||||
{
|
||||
$this->sessionClose();
|
||||
return $this->getBase('syslog_target', 'syslog_target', $uuid);
|
||||
}
|
||||
|
||||
public function addsyslog_targetAction()
|
||||
{
|
||||
return $this->addBase('syslog_target', 'syslog_target');
|
||||
}
|
||||
|
||||
public function delsyslog_targetAction($uuid)
|
||||
{
|
||||
return $this->delBase('syslog_target', $uuid);
|
||||
}
|
||||
|
||||
public function setsyslog_targetAction($uuid)
|
||||
{
|
||||
return $this->setBase('syslog_target', 'syslog_target', $uuid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ class IndexController extends \OPNsense\Base\IndexController
|
||||
$this->view->sni_hostname_map = $this->getForm("sni_hostname_map");
|
||||
$this->view->ipacl = $this->getForm("ipacl");
|
||||
$this->view->tls_fingerprint = $this->getForm("tls_fingerprint");
|
||||
$this->view->syslog_target = $this->getForm("syslog_target");
|
||||
$nginx = new Nginx();
|
||||
$this->view->show_naxsi_download_button =
|
||||
count(iterator_to_array($nginx->custom_policy->iterateItems())) == 0 &&
|
||||
|
||||
@@ -9,6 +9,13 @@
|
||||
<label>HTTPS Listen Port</label>
|
||||
<type>text</type>
|
||||
</field>
|
||||
<field>
|
||||
<id>httpserver.syslog_targets</id>
|
||||
<label>SYSLOG targets</label>
|
||||
<type>select_multiple</type>
|
||||
<style>selectpicker</style>
|
||||
<advanced>true</advanced>
|
||||
</field>
|
||||
<field>
|
||||
<id>httpserver.proxy_protocol</id>
|
||||
<label>PROXY Protocol</label>
|
||||
|
||||
@@ -263,6 +263,13 @@
|
||||
<advanced>true</advanced>
|
||||
<help>If you enable the WebSocket option, nginx will pass the upgrade header to the backed server.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>location.proxy_max_temp_file_size</id>
|
||||
<label>Maximum Temporary File Size</label>
|
||||
<type>text</type>
|
||||
<advanced>true</advanced>
|
||||
<help>The maximum temporary file size limit. This does not apply to cached requests and responses.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>location.proxy_ignore_client_abort</id>
|
||||
<label>Ignore Client Abort</label>
|
||||
|
||||
@@ -9,6 +9,13 @@
|
||||
<label>UDP Port</label>
|
||||
<type>checkbox</type>
|
||||
</field>
|
||||
<field>
|
||||
<id>streamserver.syslog_targets</id>
|
||||
<label>SYSLOG targets</label>
|
||||
<type>select_multiple</type>
|
||||
<style>selectpicker</style>
|
||||
<advanced>true</advanced>
|
||||
</field>
|
||||
<field>
|
||||
<id>streamserver.proxy_protocol</id>
|
||||
<label>PROXY Protocol</label>
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<form>
|
||||
<field>
|
||||
<id>syslog_target.description</id>
|
||||
<label>Description</label>
|
||||
<type>text</type>
|
||||
</field>
|
||||
<field>
|
||||
<id>syslog_target.host</id>
|
||||
<label>Host</label>
|
||||
<type>text</type>
|
||||
</field>
|
||||
<field>
|
||||
<id>syslog_target.port</id>
|
||||
<label>Port</label>
|
||||
<type>text</type>
|
||||
</field>
|
||||
<field>
|
||||
<id>syslog_target.facility</id>
|
||||
<label>Facility</label>
|
||||
<type>dropdown</type>
|
||||
</field>
|
||||
<field>
|
||||
<id>syslog_target.severity</id>
|
||||
<label>Severity</label>
|
||||
<type>dropdown</type>
|
||||
</field>
|
||||
<field>
|
||||
<id>syslog_target.tag</id>
|
||||
<label>Tag</label>
|
||||
<type>text</type>
|
||||
</field>
|
||||
<field>
|
||||
<id>syslog_target.nohostname</id>
|
||||
<label>No Hostname</label>
|
||||
<type>checkbox</type>
|
||||
</field>
|
||||
</form>
|
||||
@@ -403,6 +403,10 @@
|
||||
</OptionValues>
|
||||
<Required>N</Required>
|
||||
</satisfy>
|
||||
<proxy_max_temp_file_size type="IntegerField">
|
||||
<Required>N</Required>
|
||||
<MinimumValue>0</MinimumValue>
|
||||
</proxy_max_temp_file_size>
|
||||
</location>
|
||||
|
||||
<custom_policy type="ArrayField">
|
||||
@@ -549,6 +553,18 @@
|
||||
<servername type="CSVListField">
|
||||
<Required>Y</Required>
|
||||
</servername>
|
||||
<syslog_targets type="ModelRelationField">
|
||||
<Model>
|
||||
<template>
|
||||
<source>OPNsense.Nginx.Nginx</source>
|
||||
<items>syslog_target</items>
|
||||
<display>description</display>
|
||||
</template>
|
||||
</Model>
|
||||
<ValidationMessage>Selected SYSLOG target not found</ValidationMessage>
|
||||
<Required>N</Required>
|
||||
<multiple>Y</multiple>
|
||||
</syslog_targets>
|
||||
<listen_http_port type="PortField">
|
||||
<Required>N</Required>
|
||||
<default>80</default>
|
||||
@@ -746,6 +762,18 @@
|
||||
</check001>
|
||||
</Constraints>
|
||||
</listen_port>
|
||||
<syslog_targets type="ModelRelationField">
|
||||
<Model>
|
||||
<template>
|
||||
<source>OPNsense.Nginx.Nginx</source>
|
||||
<items>syslog_target</items>
|
||||
<display>description</display>
|
||||
</template>
|
||||
</Model>
|
||||
<ValidationMessage>Selected SYSLOG target not found</ValidationMessage>
|
||||
<Required>N</Required>
|
||||
<multiple>Y</multiple>
|
||||
</syslog_targets>
|
||||
<udp type="BooleanField">
|
||||
<Required>Y</Required>
|
||||
<default>0</default>
|
||||
@@ -1398,5 +1426,69 @@
|
||||
<MinimumValue>1</MinimumValue>
|
||||
</max_size>
|
||||
</cache_path>
|
||||
|
||||
<syslog_target type="ArrayField">
|
||||
<description type="TextField">
|
||||
<Required>Y</Required>
|
||||
</description>
|
||||
<host type="HostnameField">
|
||||
<Required>Y</Required>
|
||||
</host>
|
||||
<port type="PortField">
|
||||
<Required>N</Required>
|
||||
</port>
|
||||
<facility type="OptionField">
|
||||
<OptionValues>
|
||||
<kern>kern</kern>
|
||||
<user>user</user>
|
||||
<mail>mail</mail>
|
||||
<daemon>daemon</daemon>
|
||||
<auth>auth</auth>
|
||||
<intern>intern</intern>
|
||||
<lpr>lpr</lpr>
|
||||
<news>news</news>
|
||||
<uucp>uucp</uucp>
|
||||
<clock>clock</clock>
|
||||
<authpriv>authpriv</authpriv>
|
||||
<ftp>ftp</ftp>
|
||||
<ntp>ntp</ntp>
|
||||
<audit>audit</audit>
|
||||
<alert>alert</alert>
|
||||
<cron>cron</cron>
|
||||
<local0>local0</local0>
|
||||
<local1>local1</local1>
|
||||
<local2>local2</local2>
|
||||
<local3>local3</local3>
|
||||
<local4>local4</local4>
|
||||
<local5>local5</local5>
|
||||
<local6>local6</local6>
|
||||
<local7>local7</local7>
|
||||
</OptionValues>
|
||||
<Required>Y</Required>
|
||||
<default>local7</default>
|
||||
</facility>
|
||||
<severity type="OptionField">
|
||||
<OptionValues>
|
||||
<debug>debug</debug>
|
||||
<info>info</info>
|
||||
<notice>notice</notice>
|
||||
<warn>warn</warn>
|
||||
<error>error</error>
|
||||
<crit>crit</crit>
|
||||
<alert>alert</alert>
|
||||
<emerg>emerg</emerg>
|
||||
</OptionValues>
|
||||
<Required>Y</Required>
|
||||
<default>error</default>
|
||||
</severity>
|
||||
<tag type="TextField">
|
||||
<Required>N</Required>
|
||||
<mask>/[a-z][a-z0-9]*/i</mask>
|
||||
</tag>
|
||||
<nohostname type="BooleanField">
|
||||
<Required>Y</Required>
|
||||
<default>N</default>
|
||||
</nohostname>
|
||||
</syslog_target>
|
||||
</items>
|
||||
</model>
|
||||
|
||||
@@ -189,6 +189,22 @@
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li role="presentation" class="dropdown">
|
||||
<a data-toggle="dropdown"
|
||||
href="#"
|
||||
class="dropdown-toggle pull-right visible-lg-inline-block visible-md-inline-block visible-xs-inline-block visible-sm-inline-block"
|
||||
role="button">
|
||||
<b><span class="caret"></span></b>
|
||||
</a>
|
||||
<a data-toggle="tab" onclick="$('#subtab_item_nginx-other-syslog-target').click();"
|
||||
class="visible-lg-inline-block visible-md-inline-block visible-xs-inline-block visible-sm-inline-block"
|
||||
style="border-right:0px;"><b>{{ lang._('Other')}}</b></a>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li>
|
||||
<a data-toggle="tab" id="subtab_item_nginx-other-syslog-target" href="#subtab_nginx-other-syslog-target">{{ lang._('SYSLOG Targets')}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="content-box tab-content">
|
||||
@@ -598,6 +614,30 @@
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<div id="subtab_nginx-other-syslog-target" class="tab-pane fade">
|
||||
<table id="grid-syslog_target" class="table table-condensed table-hover table-striped table-responsive" data-editDialog="syslog_target_dlg">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="description" data-type="string" data-sortable="true" data-visible="true">{{ lang._('Description') }}</th>
|
||||
<th data-column-id="host" data-type="string" data-sortable="true" data-visible="true">{{ lang._('Host') }}</th>
|
||||
<th data-column-id="facility" data-type="string" data-sortable="true" data-visible="true">{{ lang._('Facility') }}</th>
|
||||
<th data-column-id="severity" data-type="string" data-sortable="true" data-visible="true">{{ lang._('Severity') }}</th>
|
||||
<th data-column-id="commands" data-width="7em" data-formatter="commands" data-sortable="false">{{ lang._('Commands') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<button data-action="add" type="button" class="btn btn-xs btn-default"><span class="fa fa-plus"></span></button>
|
||||
<button type="button" class="btn btn-xs reload_btn btn-primary"><span class="fa fa-refresh reloadAct_progress"></span></button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -618,3 +658,4 @@
|
||||
{{ partial("layout_partials/base_dialog",['fields': sni_hostname_map,'id':'sni_hostname_mapdlg', 'label':lang._('Edit SNI Hostname Mapping')]) }}
|
||||
{{ partial("layout_partials/base_dialog",['fields': ipacl,'id':'ipacl_dlg', 'label':lang._('Edit IP ACL')]) }}
|
||||
{{ partial("layout_partials/base_dialog",['fields': tls_fingerprint,'id':'tls_fingerprint_dlg', 'label':lang._('Edit TLS Fingerprint')]) }}
|
||||
{{ partial("layout_partials/base_dialog",['fields': syslog_target,'id':'syslog_target_dlg', 'label':lang._('Edit SYSLOG Target')]) }}
|
||||
|
||||
@@ -128,6 +128,10 @@ server {
|
||||
charset {{ server.charset }};
|
||||
{% endif %}
|
||||
access_log /var/log/nginx/{{ server.servername }}.access.log {{ server.access_log_format }};
|
||||
{% if server.syslog_targets is defined %}
|
||||
{% set syslog_targets = server.syslog_targets.split(',') %}
|
||||
{% include "OPNsense/Nginx/syslog_targets.conf" %}
|
||||
{% endif %}
|
||||
access_log /var/log/nginx/tls_handshake.log handshake;
|
||||
error_log /var/log/nginx/{{ server.servername }}.error.log;
|
||||
{% if server.root is defined and server.root != '' %}
|
||||
|
||||
@@ -147,6 +147,7 @@ location {{ location.matchtype }} {{ location.urlpattern }} {
|
||||
{% endif %}
|
||||
proxy_ignore_client_abort {% if location.proxy_ignore_client_abort == '1' %}on{% else %}off{% endif %};
|
||||
proxy_request_buffering {% if location.proxy_request_buffering == '1' %}on{% else %}off{% endif %};
|
||||
proxy_max_temp_file_size {% if location.proxy_max_temp_file_size is defined %}{{ location.proxy_max_temp_file_size }}{% else %}1024{% endif %}m;
|
||||
proxy_buffering {% if location.proxy_buffering == '1' %}on{% else %}off{% endif %};
|
||||
{% if location.path_prefix is defined and location.path_prefix != '' %}
|
||||
proxy_pass http{% if upstream.tls_enable == '1' %}s{% endif %}://upstream{{ location.upstream.replace('-','') }}{{ location.path_prefix }};
|
||||
|
||||
@@ -48,6 +48,10 @@
|
||||
{% endif %}
|
||||
|
||||
access_log /var/log/nginx/stream_{{ server['@uuid'] }}.access.log main;
|
||||
{% if server.syslog_targets is defined %}
|
||||
{% set syslog_targets = server.syslog_targets.split(',') %}
|
||||
{% include "OPNsense/Nginx/syslog_targets.conf" %}
|
||||
{% endif %}
|
||||
error_log /var/log/nginx/stream_{{ server['@uuid'] }}.error.log info;
|
||||
|
||||
{% if server.route_field == 'sni_upstream_map' %}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
{% for syslog_target_uuid in syslog_targets %}
|
||||
{% set syslog_target = helpers.getUUID(syslog_target_uuid) %}
|
||||
{% if syslog_target is defined %}
|
||||
access_log syslog:server={% if ':' in syslog_target.host %}[{% endif %}{{ syslog_target.host }}{% if ':' in syslog_target.host %}]{% endif %}:{{ syslog_target.port|default('514') }},{#
|
||||
#}facility={{ syslog_target.facility }},{#
|
||||
#}tag={{ syslog_target.tag|default('nginx') }},{#
|
||||
#}severity={{ syslog_target.severity }}{#
|
||||
#}{% if syslog_target.nohostname == '1' %},nohostname{% endif %} {{ server.access_log_format }};
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
File diff suppressed because one or more lines are too long
@@ -69,6 +69,7 @@ function init_grids() {
|
||||
'limit_request_connection',
|
||||
'snifwd',
|
||||
'tls_fingerprint',
|
||||
'syslog_target',
|
||||
'naxsirule'].forEach(function (element) {
|
||||
$("#grid-" + element).UIBootgrid(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user