2018-08-20 06:39:52 +00:00
{% extends "base.html" %}
2020-09-02 04:26:36 +00:00
{% block content %}
2019-12-30 16:41:16 +00:00
< script src = "/inc/waf.js" > < / script >
2020-09-02 04:26:36 +00:00
{% if manage_rules == '1' %}
{% from 'include/input_macros.html' import input, checkbox %}
< table class = "overview" id = "waf_rules" >
< tr class = "overviewHead" >
< td class = "padding10 first-collumn" >
Rule name
< / td >
2022-01-02 15:51:13 +00:00
< td style = "width: 100px;" > Enabled< / td >
< td > Description< / td >
< td > < / td >
2020-09-02 04:26:36 +00:00
< / tr >
{% for r in rules %}
2021-08-02 08:19:22 +00:00
< tr class = "{{ loop.cycle('odd', 'even') }}" id = "rule-{{r.id}}" >
< td class = "padding10 first-collumn" > {{r.rule_name}}< / td >
2020-09-02 04:26:36 +00:00
< td class = "checkbox" >
2021-08-02 08:19:22 +00:00
{% set id = 'rule_id-' + r.id|string() %}
{% if r.en == 1 %}
2020-09-02 04:26:36 +00:00
{{ checkbox(id, checked='checked') }}
{% else %}
{{ checkbox(id) }}
{% endif %}
< / td >
2021-08-02 08:19:22 +00:00
< td style = "padding-top: 5px;padding-bottom: 10px;" > {{r.desc}}< / td >
2022-01-02 15:51:13 +00:00
< td style = "padding: 0 10px 0 10px;" >
< a href = "waf.py?waf_rule_id={{r.id}}&serv={{serv}}" class = "ui-button ui-widget ui-corner-all" title = "View this rule versions" > View< / a >
< / td >
2020-09-02 04:26:36 +00:00
< / tr >
2019-10-06 06:31:56 +00:00
{% endfor %}
2020-09-02 04:26:36 +00:00
< / table >
2022-01-02 15:51:13 +00:00
{% elif waf_rule_file %}
< center >
< link rel = "stylesheet" href = "/inc/codemirror/codemirror.css" >
< script src = "/inc/codemirror/codemirror.js" > < / script >
< script src = "/inc/codemirror/modsec.js" > < / script >
< h4 > Config {{waf_rule_file}} from {{ serv }}< / h4 >
< / center >
< form action = "waf.py" name = "saveconfig" id = "saveconfig" method = "post" >
< input type = "hidden" value = "{{ serv }}" name = "serv" >
< input type = "hidden" value = "{{ cfg }}.old" name = "oldconfig" >
< input type = "hidden" value = "{{ token }}" name = "token" >
< input type = "hidden" value = "{{ service }}" name = "service" >
< div style = "margin-left: 20%;width: 60%;" >
< textarea name = "config" id = "config_text_area" class = "config" rows = "35" cols = "100" > {{ config }}< / textarea >
< / div >
< p >
< center >
< a href = "waf.py?manage_rules=1&serv={{serv}}" class = "ui-button ui-widget ui-corner-all" title = "Return to rules management" > Back< / a >
< / center >
< / p >
< / form >
< style >
.CodeMirror {
line-height: 1.2em;
height: 70%;
}
< / style >
< script >
var myCodeMirror = CodeMirror.fromTextArea(document.getElementById("config_text_area"),
{mode: "modsec", lineNumbers: true, autocapitalize: true, autocorrect: true, spellcheck: true, readOnly: true});
myCodeMirror.refresh();
< / script >
2020-09-02 04:26:36 +00:00
{% else %}
< style >
.alert-danger {
width: 450px;
display: inline-block;
height: 25px;
padding-top: 0px;
2019-10-06 06:31:56 +00:00
}
2020-09-02 04:26:36 +00:00
< / style >
< script >
$("#secIntervals").css("display", "none");
var ip = []
var hostnamea = []
{% for s in servers_all %}
2022-01-02 15:51:13 +00:00
{% if s.15|int() == 1 %}
2020-09-02 04:26:36 +00:00
ip.push("{{s[2]}}");
2021-07-21 04:57:58 +00:00
var host = "{{s[2]}}";
2020-09-02 04:26:36 +00:00
host = host.replace(/\./g, '\\.');
hostnamea.push(host);
2022-01-02 15:51:13 +00:00
{% endif %}
2020-09-02 04:26:36 +00:00
{% endfor %}
2020-11-02 17:01:08 +00:00
2020-09-02 04:26:36 +00:00
< / script >
{% if servers_all|length == 0 %}
{% include 'include/getstarted.html' %}
{% else %}
< table class = "overview" >
< tr class = "overviewHead" >
2021-07-21 04:57:58 +00:00
< td class = "padding10 first-collumn" > Server< / td >
< td class = "padding10" > Actions< / td >
< td class = "padding10" > WAF mode< / td >
< td > Metrics< / td >
< td > Manage rules< / td >
2022-03-02 20:09:39 +00:00
< td > Log< / td >
2020-09-02 04:26:36 +00:00
< td >
< a onclick = "showOverviewWaf(ip, hostnamea)" title = "Refresh" style = "float: right; margin-right: 25px;" >
< span class = "service-reload" > < / span >
< / a >
< / td >
< / tr >
{% for s in servers_all %}
2021-07-21 04:57:58 +00:00
< tr class = "{{ loop.cycle('odd', 'even') }}" id = "{{s[2]}}" > < / tr >
2020-09-02 04:26:36 +00:00
{% endfor %}
< / table >
< link href = "/inc/chart.min.css" rel = "stylesheet" >
< script src = "/inc/overview.js" > < / script >
< script src = "/inc/metrics.js" > < / script >
< script src = "/inc/chart.min.js" > < / script >
2020-11-02 17:01:08 +00:00
< div style = "padding-left: 25px;float: left;margin-top: 3px;" >
< b > Time range:< / b >
< select title = "Choose time range" id = "time-range" >
< option value = "30" > 30 minutes< / option >
< option value = "60" > 1 hour< / option >
< option value = "180" > 3 hours< / option >
< option value = "360" > 6 hours< / option >
< option value = "720" > 12 hours< / option >
< / select >
< / div >
< div id = "refresh" style = "text-align: right;margin-top: 10px;margin-right: 20px; margin-bottom: 10px;" title = "Refresh metrics" onclick = "showWafMetrics()" >
2020-09-02 04:26:36 +00:00
< span class = "service-reload" > < / span >
< / div >
{% for s in servers %}
< div class = "chart-container" >
2021-08-05 05:46:44 +00:00
< canvas id = "s_{{s.ip}}" role = "img" > < / canvas >
2020-09-02 04:26:36 +00:00
< / div >
{% endfor %}
< div id = "dialog-confirm" style = "display: none;" >
< p > < span class = "ui-icon ui-icon-alert" style = "float:left; margin:3px 12px 20px 0;" > < / span > Are you sure?< / p >
< / div >
< script >
function showWafMetrics() {
{% for s in servers %}
2021-08-05 05:46:44 +00:00
getWafChartData('{{s.ip}}');
2020-09-02 04:26:36 +00:00
{% endfor %}
}
showWafMetrics();
showOverviewWaf(ip, hostnamea);
2020-11-02 17:01:08 +00:00
$( function() {
$("#time-range").on('selectmenuchange', function () {
removeData()
let metrics = new Promise(
(resolve, reject) => {
{% for s in servers %}
2021-08-05 05:46:44 +00:00
getWafChartData('{{s.ip}}')
2020-11-02 17:01:08 +00:00
{% endfor %}
});
metrics.then();
});
});
2020-09-02 04:26:36 +00:00
< / script >
< div class = "add-note addName alert-info" style = "width: inherit; margin-right: 15px; clear: both;" >
2022-01-03 21:11:22 +00:00
Read the description and watch a video about WAF < a href = "https://roxy-wi.org/description.py?description=waf" class = "link" title = "WAF" target = "_blank" > here< / a >
2020-09-02 04:26:36 +00:00
< / div >
{% endif %}
2020-05-07 15:25:32 +00:00
{% endif %}
2018-08-20 06:39:52 +00:00
{% endblock %}