Pavel Loginov 2021-07-23 12:09:44 +06:00
parent 2bf43e5d29
commit e712586d1b
8 changed files with 35 additions and 22 deletions

View File

@ -942,9 +942,9 @@ def show_haproxy_log(serv, rows=10, waf='0', grep=None, hour='00', minut='00', h
elif service == 'apache': elif service == 'apache':
apache_log_path = sql.get_setting('apache_log_path') apache_log_path = sql.get_setting('apache_log_path')
if serv == 'haproxy-wi.access.log': if serv == 'roxy-wi.access.log':
cmd = "cat %s| awk -F\"/|:\" '$3>\"%s:00\" && $3<\"%s:00\"' |tail -%s %s %s" % (apache_log_path+"/"+serv, date, date1, rows, grep_act, exgrep_act) cmd = "cat %s| awk -F\"/|:\" '$3>\"%s:00\" && $3<\"%s:00\"' |tail -%s %s %s" % (apache_log_path+"/"+serv, date, date1, rows, grep_act, exgrep_act)
elif serv == 'haproxy-wi.error.log': elif serv == 'roxy-wi.error.log':
cmd = "cat %s| awk '$4>\"%s:00\" && $4<\"%s:00\"' |tail -%s %s %s" % (apache_log_path+"/"+serv, date, date1, rows, grep_act, exgrep_act) cmd = "cat %s| awk '$4>\"%s:00\" && $4<\"%s:00\"' |tail -%s %s %s" % (apache_log_path+"/"+serv, date, date1, rows, grep_act, exgrep_act)
elif serv == 'fail2ban.log': elif serv == 'fail2ban.log':
cmd = "cat %s| awk -F\"/|:\" '$3>\"%s:00\" && $3<\"%s:00\"' |tail -%s %s %s" % ("/var/log/"+serv, date, date1, rows, grep_act, exgrep_act) cmd = "cat %s| awk -F\"/|:\" '$3>\"%s:00\" && $3<\"%s:00\"' |tail -%s %s %s" % ("/var/log/"+serv, date, date1, rows, grep_act, exgrep_act)

View File

@ -1394,7 +1394,12 @@ if form.getvalue('installwaf'):
if form.getvalue('update_haproxy_wi'): if form.getvalue('update_haproxy_wi'):
service = form.getvalue('service') service = form.getvalue('service')
services = ['roxy-wi-checker', 'roxy-wi', 'roxy-wi-keep_alive', 'roxy-wi-smon', 'roxy-wi-metrics'] services = ['roxy-wi-checker',
'roxy-wi',
'roxy-wi-keep_alive',
'roxy-wi-smon',
'roxy-wi-metrics',
'roxy-wi-portscanner']
if service not in services: if service not in services:
print('error: ' + service + ' is not part of Roxy-WI') print('error: ' + service + ' is not part of Roxy-WI')
sys.exit() sys.exit()

View File

@ -2924,18 +2924,21 @@ def delete_alert_history(keep_interval: int, service: str):
con.close() con.close()
def delete_portscanner_history(keep_interval: int, service: str): def delete_portscanner_history(keep_interval: int):
con, cur = get_cur() con, cur = get_cur()
if mysql_enable == '1': if mysql_enable == '1':
sql = """ delete from port_scanner_history where date < now() - INTERVAL %s day and service = '%s'""" % (keep_interval, service) sql = """ delete from port_scanner_history where date < now() - INTERVAL %s day""" % keep_interval
else: else:
sql = """ delete from port_scanner_history where date < datetime('now', '-%s days') and service = '%s'""" % (keep_interval, service) sql = """ delete from port_scanner_history where date < datetime('now', '-%s days')""" % keep_interval
try: try:
cur.execute(sql) cur.execute(sql)
con.commit() con.commit()
except sqltool.Error as e: except sqltool.Error as e:
funct.out_error(e) funct.out_error(e)
con.rollback() con.rollback()
finally:
cur.close() cur.close()
con.close() con.close()

View File

@ -14,7 +14,7 @@
{% endif %} {% endif %}
<td style="width: 100%;"></td> <td style="width: 100%;"></td>
<td></td> <td></td>
<td></td> <td><span onclick="loadchecker()" class="service-reload" title="Reload Telegram channels"></span></td>
</tr> </tr>
{% for telegram in telegrams %} {% for telegram in telegrams %}
<tr id="telegram-table-{{telegram.0}}" class="{{ loop.cycle('odd', 'even') }}"> <tr id="telegram-table-{{telegram.0}}" class="{{ loop.cycle('odd', 'even') }}">
@ -66,7 +66,7 @@
{% endif %} {% endif %}
<td style="width: 100%;"></td> <td style="width: 100%;"></td>
<td></td> <td></td>
<td></td> <td><span onclick="loadchecker()" class="service-reload" title="Reload Slack channels"></span></td>
</tr> </tr>
{% for slack in slacks %} {% for slack in slacks %}
<tr id="slack-table-{{slack.0}}" class="{{ loop.cycle('odd', 'even') }}"> <tr id="slack-table-{{slack.0}}" class="{{ loop.cycle('odd', 'even') }}">
@ -108,15 +108,15 @@
<br /><br /> <br /><br />
<div id="ajax-telegram"></div> <div id="ajax-telegram"></div>
<div class="add-note alert addName alert-info" style="width: inherit; margin-right: 15px;"> <div class="add-note alert addName alert-info" style="width: inherit; margin-right: 15px;">
You can read the description of all parameters <a href="https://haproxy-wi.org/description.py?description=checker" title="Servers description" target="_blank">here</a>, You can read the description of all parameters <a href="https://roxy-wi.org/description.py?description=checker" title="Servers description" target="_blank">here</a>,
How to create and use Telegram bot in this <a href="https://haproxy-wi.org/howto.py?howto=checker" title="How to create Telegram bot and use it with Roxy-WI" target="_blank">article</a>, How to create and use Telegram bot in this <a href="https://roxy-wi.org/howto.py?howto=checker" title="How to create Telegram bot and use it with Roxy-WI" target="_blank">article</a>,
How to create and use Slack APP in this <a href="https://haproxy-wi.org/howto.py?howto=slack" title="How to create Slack APP and use it with Roxy-WI" target="_blank">article</a> How to create and use Slack APP in this <a href="https://roxy-wi.org/howto.py?howto=slack" title="How to create Slack APP and use it with Roxy-WI" target="_blank">article</a>
</div> </div>
{% else %} {% else %}
<div style="text-align: center;"> <div style="text-align: center;">
<br /> <br />
<h3>You do not have installed Backends checker <h3>You do not have installed Backends checker
Read <a href="https://haproxy-wi.org/services.py?service=checker#installation" title="Checker installation" style="color: #5d9ceb;" target="_blank">hear</a> Read <a href="https://roxy-wi.org/services.py?service=checker#installation" title="Checker installation" style="color: #5d9ceb;" target="_blank">hear</a>
how to install Checker service</h3> how to install Checker service</h3>
</div> </div>
{% endif %} {% endif %}

View File

@ -1,4 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
{% from 'include/input_macros.html' import checkbox %}
{% block content %} {% block content %}
<style> <style>
table, th, tr, td { table, th, tr, td {
@ -19,7 +20,7 @@
<div style="text-align: center;"> <div style="text-align: center;">
<br /> <br />
<h3>You do not have installed Metrics service. <h3>You do not have installed Metrics service.
Read <a href="https://haproxy-wi.org/services.py?service=metrics#installation" title="Metrics installation" style="color: #5d9ceb;" target="_blank">hear</a> Read <a href="https://roxy-wi.org/services.py?service=metrics#installation" title="Metrics installation" style="color: #5d9ceb;" target="_blank">hear</a>
how to install Metrics service</h3> how to install Metrics service</h3>
</div> </div>
{% else %} {% else %}
@ -46,6 +47,9 @@
<option value="720">12 hours</option> <option value="720">12 hours</option>
</select> </select>
</div> </div>
<div style="margin-top: 6px;">
{{ checkbox('hide_http_metrics', desc='Hide HTTP metrics', title='Hide HTTP metrics') }}
</div>
<div id="refresh" style="text-align: right;margin-top: 20px;margin-right: 10px;" title="Refresh metrics" onclick="showMetrics()"> <div id="refresh" style="text-align: right;margin-top: 20px;margin-right: 10px;" title="Refresh metrics" onclick="showMetrics()">
<span class="service-reload"></span> <span class="service-reload"></span>
</div> </div>

View File

@ -8,7 +8,7 @@
{% if smon_error != '' %} {% if smon_error != '' %}
<div style="text-align: center;"> <div style="text-align: center;">
<br /> <br />
<h3>You do not have installed SMON service. Read <a href="https://haproxy-wi.org/services.py?service=smon" <h3>You do not have installed SMON service. Read <a href="https://roxy-wi.org/services.py?service=smon"
title="Simple monitoring network ports with alerting via Telegram and WEB panel" target="_blank">here</a> how to install SMON service</h3> title="Simple monitoring network ports with alerting via Telegram and WEB panel" target="_blank">here</a> how to install SMON service</h3>
</div> </div>
{% elif smon_status.0 == 'failed' %} {% elif smon_status.0 == 'failed' %}
@ -52,7 +52,7 @@
<th style="width: 15%;">Telegram</th> <th style="width: 15%;">Telegram</th>
<th style="width: 10%;">Group</th> <th style="width: 10%;">Group</th>
<th style="width: 100%;">Description</th> <th style="width: 100%;">Description</th>
<!--<th></th>--> <!-- <th></th> -->
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
@ -68,7 +68,7 @@
<br /><br /> <br /><br />
<div id="ajax"></div> <div id="ajax"></div>
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;"> <div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
You can read the description of all parameters <a href="https://haproxy-wi.org/services.py?service=smon" title="SMON service description" target="_blank">here</a> You can read the description of all parameters <a href="https://roxy-wi.org/services.py?service=smon" title="SMON service description" target="_blank">here</a>
</div> </div>
<div id="smon-add-table" style="display: none;"> <div id="smon-add-table" style="display: none;">
<table class="overview"> <table class="overview">

View File

@ -7,8 +7,8 @@
SSLCertificateKeyFile /var/www/haproxy-wi/app/certs/haproxy-wi.key SSLCertificateKeyFile /var/www/haproxy-wi/app/certs/haproxy-wi.key
ServerName haproxy-wi.example.com ServerName haproxy-wi.example.com
ErrorLog /var/log/httpd/haproxy-wi.error.log ErrorLog /var/log/httpd/roxy-wi.error.log
CustomLog /var/log/httpd/haproxy-wi.access.log combined CustomLog /var/log/httpd/roxy-wi.access.log combined
TimeOut 600 TimeOut 600
LimitRequestLine 16380 LimitRequestLine 16380

View File

@ -4,6 +4,7 @@
--blue-color: #5d9ceb; --blue-color: #5d9ceb;
--link-dark-blue: #23527c; --link-dark-blue: #23527c;
--light-blue-color: #d1ecf1; --light-blue-color: #d1ecf1;
--menu-color: #06212a;
} }
html { html {
font-size: 10px; font-size: 10px;
@ -93,7 +94,7 @@ pre {
left: 0; left: 0;
z-index: 1000; z-index: 1000;
display: block; display: block;
background-color: #18262e; background-color: var(--menu-color);
font-size: 12px; font-size: 12px;
} }
.logoText { .logoText {
@ -478,7 +479,7 @@ ul{
font-size: 1.1em; font-size: 1.1em;
} }
.menu a{ .menu a{
background: #18262e; background: var(--menu-color);
color: #fff; color: #fff;
padding: 10px; padding: 10px;
display: block; display: block;