Pavel Loginov 3 years ago
parent
commit
e712586d1b
  1. 4
      app/funct.py
  2. 7
      app/options.py
  3. 13
      app/sql.py
  4. 12
      app/templates/ajax/load_telegram.html
  5. 6
      app/templates/metrics.html
  6. 6
      app/templates/smon.html
  7. 4
      config_other/httpd/roxy-wi.conf
  8. 5
      inc/style.css

4
app/funct.py

@ -942,9 +942,9 @@ def show_haproxy_log(serv, rows=10, waf='0', grep=None, hour='00', minut='00', h
elif service == 'apache':
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)
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)
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)

7
app/options.py

@ -1394,7 +1394,12 @@ if form.getvalue('installwaf'):
if form.getvalue('update_haproxy_wi'):
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:
print('error: ' + service + ' is not part of Roxy-WI')
sys.exit()

13
app/sql.py

@ -2924,20 +2924,23 @@ def delete_alert_history(keep_interval: int, service: str):
con.close()
def delete_portscanner_history(keep_interval: int, service: str):
def delete_portscanner_history(keep_interval: int):
con, cur = get_cur()
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:
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:
cur.execute(sql)
con.commit()
except sqltool.Error as e:
funct.out_error(e)
con.rollback()
cur.close()
con.close()
finally:
cur.close()
con.close()
def select_port_scanner_history(serv):

12
app/templates/ajax/load_telegram.html

@ -14,7 +14,7 @@
{% endif %}
<td style="width: 100%;"></td>
<td></td>
<td></td>
<td><span onclick="loadchecker()" class="service-reload" title="Reload Telegram channels"></span></td>
</tr>
{% for telegram in telegrams %}
<tr id="telegram-table-{{telegram.0}}" class="{{ loop.cycle('odd', 'even') }}">
@ -66,7 +66,7 @@
{% endif %}
<td style="width: 100%;"></td>
<td></td>
<td></td>
<td><span onclick="loadchecker()" class="service-reload" title="Reload Slack channels"></span></td>
</tr>
{% for slack in slacks %}
<tr id="slack-table-{{slack.0}}" class="{{ loop.cycle('odd', 'even') }}">
@ -108,15 +108,15 @@
<br /><br />
<div id="ajax-telegram"></div>
<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>,
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 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>
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://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://roxy-wi.org/howto.py?howto=slack" title="How to create Slack APP and use it with Roxy-WI" target="_blank">article</a>
</div>
{% else %}
<div style="text-align: center;">
<br />
<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>
</div>
{% endif %}

6
app/templates/metrics.html

@ -1,4 +1,5 @@
{% extends "base.html" %}
{% from 'include/input_macros.html' import checkbox %}
{% block content %}
<style>
table, th, tr, td {
@ -19,7 +20,7 @@
<div style="text-align: center;">
<br />
<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>
</div>
{% else %}
@ -46,6 +47,9 @@
<option value="720">12 hours</option>
</select>
</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()">
<span class="service-reload"></span>
</div>

6
app/templates/smon.html

@ -8,7 +8,7 @@
{% if smon_error != '' %}
<div style="text-align: center;">
<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>
</div>
{% elif smon_status.0 == 'failed' %}
@ -52,7 +52,7 @@
<th style="width: 15%;">Telegram</th>
<th style="width: 10%;">Group</th>
<th style="width: 100%;">Description</th>
<!--<th></th>-->
<!-- <th></th> -->
<th></th>
</tr>
</thead>
@ -68,7 +68,7 @@
<br /><br />
<div id="ajax"></div>
<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 id="smon-add-table" style="display: none;">
<table class="overview">

4
config_other/httpd/haproxy-wi.conf → config_other/httpd/roxy-wi.conf

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

5
inc/style.css

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

Loading…
Cancel
Save