Pavel Loginov 2020-10-16 18:33:53 +06:00
parent 96bbb90f2f
commit 100d02c305
6 changed files with 638 additions and 545 deletions

View File

@ -43,19 +43,19 @@ white_lists = funct.get_files(dir=white_dir, format="lst")
black_lists = funct.get_files(dir=black_dir, format="lst")
template = template.render(title = "Add: ",
role = role,
user = user,
selects = servers,
add = form.getvalue('add'),
conf_add = form.getvalue('conf'),
group = user_group,
versions = funct.versions(),
options = sql.select_options(),
saved_servers = sql.select_saved_servers(),
white_lists = white_lists,
black_lists = black_lists,
token = token)
template = template.render(title="Add: ",
role=role,
user=user,
selects=servers,
add=form.getvalue('add'),
conf_add=form.getvalue('conf'),
group=user_group,
versions=funct.versions(),
options=sql.select_options(),
saved_servers=sql.select_saved_servers(),
white_lists=white_lists,
black_lists=black_lists,
token=token)
print(template)
if form.getvalue('mode') is not None:
@ -71,25 +71,29 @@ if form.getvalue('mode') is not None:
options_split = ""
ssl = ""
ssl_check = ""
backend = ""
if form.getvalue('balance') is not None:
balance = " balance " + form.getvalue('balance') + "\n"
if form.getvalue('balance') is not None:
balance = " balance " + form.getvalue('balance') + "\n"
if form.getvalue('health_check') is not None:
balance += " " + form.getvalue('health_check') + "\n"
if form.getvalue('ip') is not None:
ip = form.getvalue('ip')
if form.getvalue('listner') is not None:
name = "listen " + form.getvalue('listner')
backend = ""
end_name = form.getvalue('listner')
if form.getvalue('listener') is not None:
name = "listen " + form.getvalue('listener')
end_name = form.getvalue('listener')
elif form.getvalue('frontend') is not None:
name = "frontend " + form.getvalue('frontend')
backend = " default_backend " + form.getvalue('backends') + "\n"
end_name = form.getvalue('frontend')
elif form.getvalue('new_backend') is not None:
name = "backend " + form.getvalue('new_backend')
backend = ""
end_name = form.getvalue('new_backend')
if form.getvalue('backends') is not None:
backend = " default_backend " + form.getvalue('backends') + "\n"
if form.getvalue('maxconn'):
maxconn = " maxconn " + form.getvalue('maxconn') + "\n"
@ -102,7 +106,7 @@ if form.getvalue('mode') is not None:
ssl_check = " ssl verify"
if not ip and port is not None:
bind = " bind *:"+ port + " " + ssl + "\n"
bind = " bind *:" + port + " " + ssl + "\n"
elif port is not None:
bind = " bind " + ip + ":" + port + " " + ssl + "\n"
@ -166,12 +170,36 @@ if form.getvalue('mode') is not None:
if form.getvalue('servers') is not None:
servers = form.getlist('servers')
server_port = form.getlist('server_port')
send_proxy = form.getlist('send_proxy')
backup = form.getlist('backup')
i = 0
for server in servers:
if form.getvalue('template') is None:
servers_split += " server "+server+" " + server +":"+server_port[i]+ check + "\n"
try:
if send_proxy[i] == '1':
send_proxy_param = 'send-proxy'
else:
send_proxy_param = ''
except:
send_proxy_param = ''
try:
if backup[i] == '1':
backup_param = 'backup'
else:
backup_param = ''
except:
backup_param = ''
servers_split += " server {0} {0}:{1}{2} {3} {4} \n".format(server,
server_port[i],
check,
send_proxy_param,
backup_param)
else:
servers_split += " server-template "+form.getvalue('prefix')+" "+form.getvalue('template-number')+" "+ server +":"+server_port[i]+ check + "\n"
servers_split += " server-template {0} {1} {2}:{3} {4} \n".format(form.getvalue('prefix'),
form.getvalue('template-number'),
server,
server_port[i],
check)
i += 1
compression = form.getvalue("compression")
@ -193,16 +221,16 @@ if form.getvalue('mode') is not None:
waf = " filter spoe engine modsecurity config "+haproxy_dir+"/waf.conf\n"
waf += " http-request deny if { var(txn.modsec.code) -m int gt 0 }\n"
config_add = "\n" + name + "\n" + bind + mode + maxconn + balance + options_split + cache_s + filter + compression_s + waf + backend + servers_split + "\n" + cache_set + "\n"
config_add = "\n" + name + "\n" + bind + mode + maxconn + balance + options_split + cache_s + filter + compression_s + waf + backend + servers_split + "\n" + cache_set + "\n"
if form.getvalue('new_userlist') is not None:
name = "userlist "+form.getvalue('new_userlist')+ "\n"
name = "userlist "+form.getvalue('new_userlist') + "\n"
new_userlist_groups = ""
if form.getvalue('userlist-group') is not None:
groups = form.getlist('userlist-group')
for group in groups:
new_userlist_groups += " group "+group+ "\n"
new_userlist_groups += " group " + group + "\n"
new_users_list = ""
if form.getvalue('userlist-user') is not None:
@ -216,7 +244,7 @@ if form.getvalue('new_userlist') is not None:
group = ' groups '+userlist_user_group[i]
except:
group = ''
new_users_list += " user "+user+" insecure-password " + passwords[i] +group+ "\n"
new_users_list += " user "+user+" insecure-password " + passwords[i] + group + "\n"
i += 1
config_add = "\n" + name + new_userlist_groups + new_users_list
@ -239,7 +267,7 @@ try:
MASTERS = sql.is_master(serv)
for master in MASTERS:
if master[0] != None:
if master[0] is not None:
funct.upload_and_restart(master[0], cfg)
stderr = funct.upload_and_restart(serv, cfg, just_save="save")
@ -247,7 +275,7 @@ try:
print('<div class="alert alert-danger">%s</div><div id="close"><span title="Close" style="cursor: pointer; float: right;">X</span></div><script>$("#errorMess").click(function(){$("#error").remove();});</script>' % stderr)
else:
print('<meta http-equiv="refresh" content="0; url=add.py?add=%s&conf=%s&serv=%s">' % (name, config_add, serv))
print('</div>')
except:
pass

View File

@ -13,7 +13,8 @@ if mysql_enable == '1':
else:
db = "haproxy-wi.db"
import sqlite3 as sqltool
def check_db():
if mysql_enable == '0':
import os
@ -46,7 +47,8 @@ def check_db():
else:
return False
con.close()
def get_cur():
try:
if mysql_enable == '0':
@ -57,10 +59,11 @@ def get_cur():
database=mysql_db)
cur = con.cursor()
except sqltool.Error as e:
funct.logging('DB ', ' '+e, haproxywi=1, login=1)
funct.logging('DB ', ' '+str(e), haproxywi=1, login=1)
else:
return con, cur
def create_table(**kwargs):
con, cur = get_cur()
if mysql_enable == '0':
@ -76,9 +79,10 @@ def create_table(**kwargs):
activeuser INTEGER NOT NULL DEFAULT 1,
PRIMARY KEY(`id`)
);
INSERT INTO user (username, email, password, role, groups) VALUES ('admin','admin@localhost','21232f297a57a5a743894a0e4a801fc3','admin','1'),
('editor','editor@localhost','5aee9dbd2a188839105073571bee1b1f','editor','1'),
('guest','guest@localhost','084e0343a0486ff05530df6c705c8bb4','guest','1');
INSERT INTO user (username, email, password, role, groups) VALUES
('admin','admin@localhost','21232f297a57a5a743894a0e4a801fc3','admin','1'),
('editor','editor@localhost','5aee9dbd2a188839105073571bee1b1f','editor','1'),
('guest','guest@localhost','084e0343a0486ff05530df6c705c8bb4','guest','1');
CREATE TABLE IF NOT EXISTS `servers` (
`id` INTEGER NOT NULL,
`hostname` VARCHAR ( 64 ),
@ -102,8 +106,8 @@ def create_table(**kwargs):
PRIMARY KEY(`id`)
);
INSERT INTO `role` (name, description) VALUES ('admin','Can do everything'),
('editor','Can edit configs'),
('guest','Read only access');
('editor','Can edit configs'),
('guest','Read only access');
CREATE TABLE IF NOT EXISTS `groups` (
`id` INTEGER NOT NULL,
@ -624,12 +628,14 @@ def update_db_v_4_4_2_1(**kwargs):
print('Updating... go to version 4.4.2')
else:
print("An error occurred:", e)
cur.close()
con.close()
return False
else:
print("DB was update to 4.4.2")
cur.close()
con.close()
return True
cur.close()
con.close()
def update_db_v_4_3_2_1(**kwargs):
@ -724,7 +730,7 @@ def update_db_v_4_5_1(**kwargs):
def update_ver(**kwargs):
con, cur = get_cur()
sql = """update version set version = '4.5.1.0'; """
sql = """update version set version = '4.5.2.0'; """
try:
cur.execute(sql)
con.commit()

View File

@ -1,14 +1,17 @@
{% extends "base.html" %}
{% block content %}
{% from 'include/input_macros.html' import input, checkbox, select %}
<style>
.container {
margin-right: 0;
}
h3 {
width: 98.8%
}
</style>
{% set balance_params = dict() %}
{% set balance_params = {'roundrobin':'roundrobin','source':'source','leastconn':'leastconn','first':'first',
'rdp-cookie':'rdp-cookie', 'uri':'uri', 'uri whole':'uri whole', 'static-rr': 'static-rr',
'url_param userid':'url_param userid'} %}
{% set checks = dict() %}
{% set checks = {'':'Choose custom health check','option tcp-check':'Check a TCP Port',
'option ssl-hello-chk':'Check an SSL Port','option httpchk':'Check an HTTP service',
'option ldap-check':'Check an LDAP service', 'option mysql-check':'Check a MySql Service',
'option pgsql-check':'Check a PgSQL Service', 'option redis-check': 'Check a Redis Service',
'option smtpchk':'Check an SMTP service'} %}
<script src="/inc/add.js"></script>
<div id="tabs">
<ul>
@ -26,9 +29,9 @@ h3 {
<ul id='browse_histroy'></ul>
{% include 'include/add_proxy.html' %}
<div id="listen">
<form name="add-listner" action="/app/add.py" method="post">
<table class="add-table">
<caption><h3>Add listen</h3></caption>
<form name="add-listener" action="/app/add.py" method="post">
<table class="add-table">
<caption><h3>Add listen</h3></caption>
<tr>
<td class="addName">Select server: </td>
<td class="addOption">
@ -36,187 +39,189 @@ h3 {
<option disabled selected>Choose server</option>
{% for select in selects %}
<option value="{{ select.2 }}">{{ select.1 }}</option>
{% endfor %}
{% endfor %}
</select>
<div class="tooltip tooltipTop"><b>Note:</b> If you re-configure the master server, the slave server will re-configured automatically</div>
</td>
<td rowspan="5" class="add-note addName alert-info">
A "listen" section defines a complete proxy with its frontend and backend parts combined in one section. It is generally useful for TCP-only traffic.
<br /><br />
All proxy names must be formed from upper and lower case letters, digits,
'-' (dash), '_' (underscore) , '.' (dot) and ':' (colon). ACL names are
All proxy names must be formed from upper and lower case letters, digits, '-' (dash), '_' (underscore) , '.' (dot) and ':' (colon). ACL names are
case-sensitive, which means that "www" and "WWW" are two different proxies.
<br /><br />
Historically, all proxy names could overlap, it just caused troubles in the
logs. Since the introduction of content switching, it is mandatory that two
proxies with overlapping capabilities (frontend/backend) have different names.
However, it is still permitted that a frontend and a backend share the same
Historically, all proxy names could overlap, it just caused troubles in the logs. Since the introduction of content switching, it is mandatory that two
proxies with overlapping capabilities (frontend/backend) have different names. However, it is still permitted that a frontend and a backend share the same
name, as this configuration seems to be commonly encountered.
</td>
</tr>
<tr>
<td class="addName">Name:</td>
<td class="addOption">
{{ input('name', name='listner', title="Name Listner", placeholder="web_80", required='required') }}
</td>
</tr>
<tr>
<td class="addName">IP and Port:</td>
<td class="addOption">
{{ input('ip', placeholder="Any", size='15') }}<b>:</b>
{{ input('listen-port', name='port', type="number", title="Port for bind listen", placeholder="8080", size='5', required='required') }}
<div class="tooltip tooltipTop">
IP for bind listener, <b>if empty will be assigned on all IPs</b>.
Start typing IP, or press down.<br>If you are using <b>VRRP, leave the IP field blank</b>. If you assign an IP, the slave server will not start
</div>
</td>
</tr>
<tr class="advance">
<td class="addName">Mode: </td>
<td class="addOption">
{% set values = dict() %}
{% set values = {'http':'http','tcp':'tcp'} %}
{{ select('listen-mode-select', name='mode', values=values, selected='http', required='required', class='force_close') }}
<span id="https-listen-span">
<label for="https-listen" style="margin-top: 5px;" title="Enable ssl">SSL?</label>
<input type="checkbox" id="https-listen" name="ssl" value="https" >
</span>
<div id="https-hide-listen" style="display: none;">
<br /><span class="tooltip tooltipTop">Enter name to pem file, or press down:</span><br />
{{ input('path-cert-listen', name="cert", placeholder="some_cert.pem", size='39') }}<br />
<label for="ssl-check-listen" style="margin-top: 5px;">Disable ssl verify on servers?</label><input type="checkbox" id="ssl-check-listen" name="ssl-check" value="ssl-check" checked>
</div>
</td>
</tr>
<tr class="advance">
<td class="addName">Maxconn: </td>
<td class="addOption">
{{ input('maxconn', value='2000', type="number", title="Fix the maximum number of concurrent connections on a frontend", size='5', required='required') }}
<div class="tooltip tooltipTop">This value should not exceed the global maxconn. Default global maxconn value: 2000</div>
</td>
</tr>
<tr class="advance">
<td class="addName">Balance: </td>
<td class="addOption">
{% set values = dict() %}
{% set values = {'roundrobin':'roundrobin','source':'source','leastconn':'leastconn', 'first':'first', 'rdp-cookie':'rdp-cookie'} %}
{{ select('balance', values=values, selected='roundrobin', required='required', class='force_close') }}
</td>
</tr>
<tr class="advance">
<td class="addName"><span title="Cache support start 1.8 and latter">Web acceleration(?):</span></td>
<td class="addOption">
<span class="controlgroup">
{{ checkbox('compression', title='Enable Compression', value='1', desc='Compression') }}
{{ checkbox('cache', title='Enable cache', value='2', desc='Cache') }}
{{ checkbox('ssl_offloading', title='Enable SSL Offloading', desc='SSL Offloading') }}
</span>
</td>
</tr>
<tr class="advance">
<td class="addName"><span title="Web application firewall">WAF(?):</span></td>
<td class="addOption">
<span class="controlgroup">
{{ checkbox('slow_atack', title='Slow atack protect', desc='Slow atack') }}
{{ checkbox('ddos', title='DDOS atack protect', desc='DDOS') }}
{{ checkbox('blacklist_checkbox', title='Use blacklist', desc='Blacklist') }}
{{ checkbox('waf', title='Web application firewall', desc='WAF', value='1') }}
{{ checkbox('antibot', title='Antibot Protection', desc='Antibot', value='1') }}
</span>
<div id="blacklist-hide" style="display: none;">
<br /><span class="tooltip tooltipTop">Enter the name of the blacklist, or press down:</span><br />
{{ input('blacklist-hide-input', size='39', name="blacklist", placeholder="blacklist.lst") }}
</div>
</td>
</tr>
<tr class="advance">
<td class="addName">Options:</td>
<td class="addOption">
<span class="controlgroup">
{{ checkbox('forward_for', title='Option Forward for if none', desc='Forward for') }}
{{ checkbox('redispatch', title='Enable Redispatch', desc='Redispatch') }}
{% set values = dict() %}
{% set values = {'Off':'Off','Server only':'Server only','Force close':'Force close','Pretend keep alive':'Pretend keep alive'} %}
{{ select('force_close', values=values, first='Force HTTP close', class='force_close') }}
{{ checkbox('cookie', title='Set cookie', desc='Set cookie', value='1') }}
{{ checkbox('options-listen-show', title='Set options manualy', desc='Set options') }}
</span>
<br>
<span id="cookie_div" style="display: none;">
<input type="text" placeholder="name" name="cookie_name" id="cookie_name" class="form-control"><br><br>
<input type="text" placeholder="domain" name="cookie_domain" class="form-control"><br><br>
<span class="controlgroup">
<tr>
<td class="addName">Name:</td>
<td class="addOption">
{{ input('name', name='listener', title="Name Listener", placeholder="web_80", required='required') }}
</td>
</tr>
<tr>
<td class="addName">IP and Port:</td>
<td class="addOption">
{{ input('ip', placeholder="Any", size='15') }}<b>:</b>
{{ input('listen-port', name='port', type="number", title="Port for bind listen", placeholder="8080", size='5', required='required') }}
<div class="tooltip tooltipTop">
IP for bind listener, <b>if empty will be assigned on all IPs</b>.
Start typing IP, or press down.<br>If you are using <b>VRRP, leave the IP field blank</b>. If you assign an IP, the slave server will not start
</div>
</td>
</tr>
<tr class="advance">
<td class="addName">Mode: </td>
<td class="addOption">
{% set values = dict() %}
{% set values = {'None':'None','rewrite':'rewrite','indirect':'indirect','insert':'insert'} %}
{{ select('rewrite', values=values, first='rewrite/indirect/insert', class='force_close') }}
{{ checkbox('prefix', title='This keyword indicates that instead of relying on a dedicated cookie for the persistence, an existing one will be completed', desc='prefix', value='prefix') }}
{{ checkbox('nocache', title='This option is recommended in conjunction with the insert mode when there is a cache between the client and HAProxy', desc='nocache', value='nocache') }}
{{ checkbox('postonly', title='This option ensures that cookie insertion will only be performed on responses to POST requests', desc='postonly', value='postonly') }}
{{ checkbox('dynamic', title='Activate dynamic cookies. When used, a session cookie is dynamically created for each server', desc='dynamic', value='dynamic') }}
<span id="dynamic_div" style="display: none;">
dynamic-cookie-key: {{ input('dynamic-cookie-key', placeholder="your-custom-key") }}
{% set values = {'http':'http','tcp':'tcp'} %}
{{ select('listen-mode-select', name='mode', values=values, selected='http', required='required', class='force_close') }}
<span id="https-listen-span">
<label for="https-listen" style="margin-top: 5px;" title="Enable ssl">SSL?</label>
<input type="checkbox" id="https-listen" name="ssl" value="https" >
</span>
</span>
</span>
<div id="options-listen-show-div" style="display: none;">
<div class="tooltip">
<span style="padding-right: 10px;">Start typing options: </span>
{{ input('options') }}
<span style="padding-left: 10px;">
or press down. <a href="http://cbonte.github.io/haproxy-dconv/1.7/configuration.html" target="_blanck" style="color: #23527c" title="HAproxy docs">Read more about options</a>
<div id="https-hide-listen" style="display: none;">
<br /><span class="tooltip tooltipTop">Enter name to pem file, or press down:</span><br />
{{ input('path-cert-listen', name="cert", placeholder="some_cert.pem", size='39') }}<br />
<label for="ssl-check-listen" style="margin-top: 5px;">Disable ssl verify on servers?</label><input type="checkbox" id="ssl-check-listen" name="ssl-check" value="ssl-check" checked>
</div>
</td>
</tr>
<tr class="advance">
<td class="addName">Maxconn: </td>
<td class="addOption">
{{ input('maxconn', value='2000', type="number", title="Fix the maximum number of concurrent connections on a frontend", size='5', required='required') }}
<div class="tooltip tooltipTop">This value should not exceed the global maxconn. Default global maxconn value: 2000</div>
</td>
</tr>
<tr class="advance">
<td class="addName">Balance: </td>
<td class="addOption">
{{ select('balance', values=balance_params, selected='roundrobin', required='required', class='force_close') }}
</td>
</tr>
<tr class="advance">
<td class="addName">Health check: </td>
<td class="addOption">
{{ select('listener_checks', name='health_check', values=checks, selected='', class='force_close') }}
<span id="listener_checks_note" class="tooltip tooltipTop"></span>
</td>
</tr>
<tr class="advance">
<td class="addName"><span title="Cache support start 1.8 and latter">Web acceleration(?):</span></td>
<td class="addOption">
<span class="controlgroup">
{{ checkbox('compression', title='Enable Compression', value='1', desc='Compression') }}
{{ checkbox('cache', title='Enable cache', value='2', desc='Cache') }}
{{ checkbox('ssl_offloading', title='Enable SSL Offloading', desc='SSL Offloading') }}
</span>
<br />
<span style="padding-right: 10px;">Start typing saved options: </span>
{{ input('saved-options') }}
It are the options that you saved in the "Options" tab
</div>
<textarea name="option" title="Options thru" id="optionsInput" cols=80 rows=5 placeholder="acl test hdr_beg(host) -i some_host"></textarea>
</div>
</td>
</tr>
<tr>
<td class="addName">Servers:</td>
<td class="addOption">
{% include 'include/add_servers.html' %}
<br>
<br>
{{ checkbox('template-listen', name='template', title='Use server-template instead servers list', value='template', desc='Server-template') }}
</td>
</tr>
<tr class="advance">
<td class="addName">Check:</td>
<td class="addOption">
<div>
<label for="controlgroup-listen-show" style="margin-top: 5px;" title="Change default check">Custom check params</label>
<input type="checkbox" id="controlgroup-listen-show" name="default-check" value="1">
<span class="tooltip tooltipTop"> Default params: inter 2000 rise 2 fall 5</span>
</div>
<div class="controlgroup" id="controlgroup-listen" style="display: none;">
<label for="check-servers-listen" title="Ebable servers check">Check</label>
<input type="checkbox" id="check-servers-listen" name="check-servers" checked value="1">
{% set values = dict() %}
{% set values = {'1000':'1000','2000':'2000','3000':'3000'} %}
{{ select('inter-listen', values=values, first='inter', class='force_close') }}
{% set values = dict() %}
{% set values = {'1':'1','2':'2','3':'3'} %}
{{ select('rise-listen', name='rise', values=values, first='rise', class='force_close') }}
{% set values = dict() %}
{% set values = {'4':'4','5':'5','6':'6'} %}
{{ select('fall-listen', name='fall', values=values, first='fall', class='force_close') }}
</div>
</td>
</tr>
<tr class="advance-show">
<td class="addName">Advanced:</td>
<td class="addOption"><span title="Show Advanced settings" style="cursor: pointer">Show Advanced settings</span></td>
</tr>
<tr>
<td class="addButton">
<button type="submit" value="submit">Add Listen</button>
</td>
</tr>
</td>
</tr>
<tr class="advance">
<td class="addName"><span title="Web application firewall">WAF(?):</span></td>
<td class="addOption">
<span class="controlgroup">
{{ checkbox('slow_atack', title='Slow attack protect', desc='Slow attack') }}
{{ checkbox('ddos', title='DDOS attack protect', desc='DDOS') }}
{{ checkbox('blacklist_checkbox', title='Use blacklist', desc='Blacklist') }}
{{ checkbox('waf', title='Web application firewall', desc='WAF', value='1') }}
{{ checkbox('antibot', title='Antibot Protection', desc='Antibot', value='1') }}
</span>
<div id="blacklist-hide" style="display: none;">
<br /><span class="tooltip tooltipTop">Enter the name of the blacklist, or press down:</span><br />
{{ input('blacklist-hide-input', size='39', name="blacklist", placeholder="blacklist.lst") }}
</div>
</td>
</tr>
<tr class="advance">
<td class="addName">Options:</td>
<td class="addOption">
<span class="controlgroup">
{{ checkbox('forward_for', title='Option Forward for if none', desc='Forward for') }}
{{ checkbox('redispatch', title='Enable Redispatch', desc='Redispatch') }}
{% set values = dict() %}
{% set values = {'Off':'Off','Server only':'Server only','Force close':'Force close','Pretend keep alive':'Pretend keep alive'} %}
{{ select('force_close', values=values, first='Force HTTP close', class='force_close') }}
{{ checkbox('cookie', title='Set cookie', desc='Set cookie', value='1') }}
{{ checkbox('options-listen-show', title='Set options manually', desc='Set options') }}
</span>
<br>
<span id="cookie_div" style="display: none;">
<input type="text" placeholder="name" name="cookie_name" id="cookie_name" class="form-control"><br><br>
<input type="text" placeholder="domain" name="cookie_domain" class="form-control"><br><br>
<span class="controlgroup">
{% set values = dict() %}
{% set values = {'None':'None','rewrite':'rewrite','indirect':'indirect','insert':'insert'} %}
{{ select('rewrite', values=values, first='rewrite/indirect/insert', class='force_close') }}
{{ checkbox('prefix', title='This keyword indicates that instead of relying on a dedicated cookie for the persistence, an existing one will be completed', desc='prefix', value='prefix') }}
{{ checkbox('nocache', title='This option is recommended in conjunction with the insert mode when there is a cache between the client and HAProxy', desc='nocache', value='nocache') }}
{{ checkbox('postonly', title='This option ensures that cookie insertion will only be performed on responses to POST requests', desc='postonly', value='postonly') }}
{{ checkbox('dynamic', title='Activate dynamic cookies. When used, a session cookie is dynamically created for each server', desc='dynamic', value='dynamic') }}
<span id="dynamic_div" style="display: none;">
dynamic-cookie-key: {{ input('dynamic-cookie-key', placeholder="your-custom-key") }}
</span>
</span>
</span>
<div id="options-listen-show-div" style="display: none;">
<div class="tooltip">
<span style="padding-right: 10px;">Start typing options: </span>
{{ input('options') }}
<span style="padding-left: 10px;">
or press down. <a href="http://cbonte.github.io/haproxy-dconv/1.7/configuration.html" target="_blanck" style="color: #23527c" title="HAproxy docs">Read more about options</a>
</span>
<br />
<span style="padding-right: 10px;">Start typing saved options: </span>
{{ input('saved-options') }}
It are the options that you saved in the "Options" tab
</div>
<textarea name="option" title="Options thru" id="optionsInput" cols=80 rows=5 placeholder="acl test hdr_beg(host) -i some_host"></textarea>
</div>
</td>
</tr>
<tr>
<td class="addName">Servers:</td>
<td class="addOption">
{% include 'include/add_servers.html' %}
<br>
<br>
{{ checkbox('template-listen', name='template', title='Use server-template instead servers list', value='template', desc='Server-template') }}
</td>
</tr>
<tr class="advance">
<td class="addName">Check:</td>
<td class="addOption">
<div>
<label for="controlgroup-listen-show" style="margin-top: 5px;" title="Change default check">Custom check params</label>
<input type="checkbox" id="controlgroup-listen-show" name="default-check" value="1">
<span class="tooltip tooltipTop"> Default params: inter 2000 rise 2 fall 5</span>
</div>
<div class="controlgroup" id="controlgroup-listen" style="display: none;">
<label for="check-servers-listen" title="Ebable servers check">Check</label>
<input type="checkbox" id="check-servers-listen" name="check-servers" checked value="1">
{% set values = dict() %}
{% set values = {'1000':'1000','2000':'2000','3000':'3000'} %}
{{ select('inter-listen', values=values, first='inter', class='force_close') }}
{% set values = dict() %}
{% set values = {'1':'1','2':'2','3':'3'} %}
{{ select('rise-listen', name='rise', values=values, first='rise', class='force_close') }}
{% set values = dict() %}
{% set values = {'4':'4','5':'5','6':'6'} %}
{{ select('fall-listen', name='fall', values=values, first='fall', class='force_close') }}
</div>
</td>
</tr>
<tr class="advance-show">
<td class="addName">Advanced:</td>
<td class="addOption"><span title="Show Advanced settings" class="link">Show Advanced settings</span></td>
</tr>
<tr>
<td class="addButton">
<button type="submit" value="submit">Add Listen</button>
</td>
</tr>
</table>
</form>
</table>
</div>
<!-- Second tabs -->
@ -239,129 +244,125 @@ h3 {
<td rowspan="5" class="add-note addName alert-info">
A "frontend" section describes a set of listening sockets accepting client connections.
<br /><br />
All proxy names must be formed from upper and lower case letters, digits,
'-' (dash), '_' (underscore) , '.' (dot) and ':' (colon). ACL names are
All proxy names must be formed from upper and lower case letters, digits, '-' (dash), '_' (underscore) , '.' (dot) and ':' (colon). ACL names are
case-sensitive, which means that "www" and "WWW" are two different proxies.
<br /><br />
Historically, all proxy names could overlap, it just caused troubles in the
logs. Since the introduction of content switching, it is mandatory that two
proxies with overlapping capabilities (frontend/backend) have different names.
However, it is still permitted that a frontend and a backend share the same
Historically, all proxy names could overlap, it just caused troubles in the logs. Since the introduction of content switching, it is mandatory that two
proxies with overlapping capabilities (frontend/backend) have different names. However, it is still permitted that a frontend and a backend share the same
name, as this configuration seems to be commonly encountered.
</td>
</tr>
<tr>
<td class="addName">Name:</td>
<td class="addOption">
<input type="text" name="frontend" id="new_frontend" required title="Name frontend" placeholder="web_80" class="form-control">
</td>
</tr>
<tr>
<td class="addName">IP and Port:</td>
<td class="addOption">
<input type="text" name="ip" id="ip1" size="15" placeholder="Any" class="form-control"><b>:</b>
<input type="number" name="port" required title="Port for bind frontend" placeholder="8080" class="form-control">
<div class="tooltip tooltipTop">
IP for bind listener, <b>if empty will be assigned on all IPs</b>.
Start typing IP, or press down.<br>If you are using <b>VRRP, leave the IP field blank</b>. If you assign an IP, the slave server will not start
</div>
</td>
</tr>
<tr class="advance">
<td class="addName">Mode: </td>
<td class="addOption">
{% set values = dict() %}
{% set values = {'http':'http','tcp':'tcp'} %}
{{ select('frontend-mode-select', name='mode', values=values, selected='http', required='required', class='force_close') }}
<span id="https-frontend-span">
<label for="https-frontend" style="margin-top: 5px;">SSL?</label>
<input type="checkbox" id="https-frontend" name="ssl" value="https">
</span>
<div id="https-hide-frontend" style="display: none;">
<br /><span class="tooltip tooltipTop">Enter name to pem file, or press down:</span><br />
{{ input('path-cert-frontend', name="cert", placeholder="some_cert.pem", size='39') }}
</div>
</td>
</tr>
<tr class="advance">
<td class="addName">Maxconn: </td>
<td class="addOption">
{{ input('maxconn', value='2000', type="number", title="Fix the maximum number of concurrent connections on a frontend", size='5', required='required') }}
<div class="tooltip tooltipTop">This value should not exceed the global maxconn. Default global maxconn value: 2000</div>
</td>
</tr>
<tr class="advance">
<td class="addName"><span title="Cache support start 1.8 and latter">Web acceleration(?):</span></td>
<td class="addOption">
<span class="controlgroup">
{{ checkbox('compression2', title='Enable Compression', value='1', desc='Compression') }}
{{ checkbox('cache2', title='Enable cache', value='2', desc='Cache') }}
{{ checkbox('ssl_offloading1', title='Enable SSL Offloading', desc='SSL Offloading') }}
</span>
</td>
</tr>
<tr class="advance">
<td class="addName"><span title="Web application firewall">WAF(?):</span></td>
<td class="addOption">
<span class="controlgroup">
{{ checkbox('slow_atack1', title='Slow atack protect', desc='Slow atack') }}
{{ checkbox('ddos1', title='DDOS atack protect', desc='DDOS') }}
{{ checkbox('blacklist_checkbox1', title='Use blacklist', desc='Blacklist') }}
{{ checkbox('waf2', name='waf', title='Web application firewall', desc='WAF', value='1') }}
{{ checkbox('antibot1', title='Antibot Protection', desc='Antibot', value='1') }}
</span>
<div id="blacklist-hide1" style="display: none;">
<br /><span class="tooltip tooltipTop">Enter the name of the blacklist, or press down:</span><br />
{{ input('blacklist-hide-input1', size='39', name="blacklist", placeholder="blacklist.lst") }}
</div>
</td>
</tr>
<tr class="advance">
<td class="addName">Options:</td>
<td class="addOption">
<span class="controlgroup">
{{ checkbox('forward_for1', title='Option Forward for if none', desc='Forward for') }}
{% set values = dict() %}
{% set values = {'Off':'Off','Server only':'Server only','Force close':'Force close','Pretend keep alive':'Pretend keep alive'} %}
{{ select('force_close', values=values, first='Force HTTP close', class='force_close') }}
{{ checkbox('options-frontend-show', title='Set options manualy', desc='Set options') }}
</span>
<div id="options-frontend-show-div" style="display: none;">
<div style="font-size: 12px; padding-bottom: 10px;">
<span style="padding-right: 10px;">Start typing options: </span>
{{ input('options1') }}
<span style="padding-left: 10px;">
or press down. <a href="http://cbonte.github.io/haproxy-dconv/1.7/configuration.html" target="_blanck" style="color: #23527c" title="HAproxy docs">Read more about options</a>
</span>
<br />
<span style="padding-right: 10px;">Start typing saved options: </span>
{{ input('saved-options1') }}
It are the options that you saved in the "Options" tab
<tr>
<td class="addName">Name:</td>
<td class="addOption">
<input type="text" name="frontend" id="new_frontend" required title="Name frontend" placeholder="web_80" class="form-control">
</td>
</tr>
<tr>
<td class="addName">IP and Port:</td>
<td class="addOption">
<input type="text" name="ip" id="ip1" size="15" placeholder="Any" class="form-control"><b>:</b>
<input type="number" name="port" required title="Port for bind frontend" placeholder="8080" class="form-control">
<div class="tooltip tooltipTop">
IP for bind listener, <b>if empty will be assigned on all IPs</b>.
Start typing IP, or press down.<br>If you are using <b>VRRP, leave the IP field blank</b>. If you assign an IP, the slave server will not start
</div>
<textarea name="option" title="Options thru" cols=80 rows=5 id="optionsInput1" placeholder="acl test hdr_beg(host) -i some_host"></textarea>
</div>
</td>
</tr>
<tr>
<td class="addName">Default backend</td>
<td class="addOption">
<div style="font-size: 12px; padding-bottom: 10px;">Start typing backend, or press down</div>
{{ input('backends', name='backends', placeholder="some_backend", size='30') }}
<span style="font-size: 12px; padding-left: 10px;"> .</span>
<p style="font-size: 12px"><b>Note:</b> If backend doesn't exist, you must first <a href="#" style="color: #23527c" title="Create backend" class="redirectBackend">create a new backend</a>.</p>
</td>
</tr>
<tr class="advance-show">
<td class="addName">Advanced:</td>
<td class="addOption"><span title="Show Advanced settings" style="cursor: pointer">Show Advanced settings</span></td>
</tr>
<tr>
<td class="addButton">
<button type="submit">Add Frontend</button>
</td>
</tr>
</form>
</td>
</tr>
<tr class="advance">
<td class="addName">Mode: </td>
<td class="addOption">
{% set values = dict() %}
{% set values = {'http':'http','tcp':'tcp'} %}
{{ select('frontend-mode-select', name='mode', values=values, selected='http', required='required', class='force_close') }}
<span id="https-frontend-span">
<label for="https-frontend" style="margin-top: 5px;">SSL?</label>
<input type="checkbox" id="https-frontend" name="ssl" value="https">
</span>
<div id="https-hide-frontend" style="display: none;">
<br /><span class="tooltip tooltipTop">Enter name to pem file, or press down:</span><br />
{{ input('path-cert-frontend', name="cert", placeholder="some_cert.pem", size='39') }}
</div>
</td>
</tr>
<tr class="advance">
<td class="addName">Maxconn: </td>
<td class="addOption">
{{ input('maxconn', value='2000', type="number", title="Fix the maximum number of concurrent connections on a frontend", size='5', required='required') }}
<div class="tooltip tooltipTop">This value should not exceed the global maxconn. Default global maxconn value: 2000</div>
</td>
</tr>
<tr class="advance">
<td class="addName"><span title="Cache support start 1.8 and latter">Web acceleration(?):</span></td>
<td class="addOption">
<span class="controlgroup">
{{ checkbox('compression2', title='Enable Compression', value='1', desc='Compression') }}
{{ checkbox('cache2', title='Enable cache', value='2', desc='Cache') }}
{{ checkbox('ssl_offloading1', title='Enable SSL Offloading', desc='SSL Offloading') }}
</span>
</td>
</tr>
<tr class="advance">
<td class="addName"><span title="Web application firewall">WAF(?):</span></td>
<td class="addOption">
<span class="controlgroup">
{{ checkbox('slow_atack1', title='Slow attack protect', desc='Slow attack') }}
{{ checkbox('ddos1', title='DDOS attack protect', desc='DDOS') }}
{{ checkbox('blacklist_checkbox1', title='Use blacklist', desc='Blacklist') }}
{{ checkbox('waf2', name='waf', title='Web application firewall', desc='WAF', value='1') }}
{{ checkbox('antibot1', title='Antibot Protection', desc='Antibot', value='1') }}
</span>
<div id="blacklist-hide1" style="display: none;">
<br /><span class="tooltip tooltipTop">Enter the name of the blacklist, or press down:</span><br />
{{ input('blacklist-hide-input1', size='39', name="blacklist", placeholder="blacklist.lst") }}
</div>
</td>
</tr>
<tr class="advance">
<td class="addName">Options:</td>
<td class="addOption">
<span class="controlgroup">
{{ checkbox('forward_for1', title='Option Forward for if none', desc='Forward for') }}
{% set values = dict() %}
{% set values = {'Off':'Off','Server only':'Server only','Force close':'Force close','Pretend keep alive':'Pretend keep alive'} %}
{{ select('force_close', values=values, first='Force HTTP close', class='force_close') }}
{{ checkbox('options-frontend-show', title='Set options manually', desc='Set options') }}
</span>
<div id="options-frontend-show-div" style="display: none;">
<div style="font-size: 12px; padding-bottom: 10px;">
<span style="padding-right: 10px;">Start typing options: </span>
{{ input('options1') }}
<span style="padding-left: 10px;">
or press down. <a href="http://cbonte.github.io/haproxy-dconv/1.7/configuration.html" target="_blanck" style="color: #23527c" title="HAproxy docs">Read more about options</a>
</span>
<br />
<span style="padding-right: 10px;">Start typing saved options: </span>
{{ input('saved-options1') }}
It are the options that you saved in the "Options" tab
</div>
<textarea name="option" title="Options thru" cols=80 rows=5 id="optionsInput1" placeholder="acl test hdr_beg(host) -i some_host"></textarea>
</div>
</td>
</tr>
<tr>
<td class="addName">Default backend</td>
<td class="addOption">
<div style="font-size: 12px; padding-bottom: 10px;">Start typing backend, or press down</div>
{{ input('backends', name='backends', placeholder="some_backend", size='30') }}
<p style="font-size: 12px"><b>Note:</b> If you want to use a default backend, you must <span title="Create backend" id="redirectBackend" class="link">create a new backend</span> first.</p>
</td>
</tr>
<tr class="advance-show">
<td class="addName">Advanced:</td>
<td class="addOption"><span title="Show Advanced settings" class="link">Show Advanced settings</span></td>
</tr>
<tr>
<td class="addButton">
<button type="submit">Add Frontend</button>
</td>
</tr>
</table>
</form>
</div>
<!-- Third tabs -->
@ -384,144 +385,146 @@ h3 {
<td rowspan="4" class="add-note addName alert-info">
A "backend" section describes a set of servers to which the proxy will connect to forward incoming connections.
<br /><br />
All proxy names must be formed from upper and lower case letters, digits,
'-' (dash), '_' (underscore) , '.' (dot) and ':' (colon). ACL names are
All proxy names must be formed from upper and lower case letters, digits, '-' (dash), '_' (underscore) , '.' (dot) and ':' (colon). ACL names are
case-sensitive, which means that "www" and "WWW" are two different proxies.
<br /><br />
Historically, all proxy names could overlap, it just caused troubles in the
logs. Since the introduction of content switching, it is mandatory that two
proxies with overlapping capabilities (frontend/backend) have different names.
However, it is still permitted that a frontend and a backend share the same
Historically, all proxy names could overlap, it just caused troubles in the logs. Since the introduction of content switching, it is mandatory that two
proxies with overlapping capabilities (frontend/backend) have different names. However, it is still permitted that a frontend and a backend share the same
name, as this configuration seems to be commonly encountered.
</td>
</tr>
<tr>
<td class="addName">Name:</td>
<td class="addOption">
{{ input('new_backend', title="Name backend", placeholder="web_80", required='required') }}
</td>
</tr>
<tr class="advance">
<td class="addName">Mode: </td>
<td class="addOption">
{% set values = dict() %}
{% set values = {'http':'http','tcp':'tcp'} %}
{{ select('backend-mode-select', name='mode', values=values, selected='http', required='required', class='force_close') }}
<span id="https-backend-span">
<label for="https-backend" style="margin-top: 5px;">SSL enabled on frontend?</label>
<input type="checkbox" id="https-backend" name="ssl" value="https">
</span>
<div id="https-hide-backend" style="display: none;">
<label for="ssl-check" style="margin-top: 5px;">Disable SSL verify on servers?</label><input type="checkbox" id="ssl-check" name="ssl-check" value="ssl-check" checked>
</div>
</td>
</tr>
<tr class="advance">
<td class="addName">Balance: </td>
<tr>
<td class="addName">Name:</td>
<td class="addOption">
{{ input('new_backend', title="Name backend", placeholder="web_80", required='required') }}
</td>
</tr>
<tr class="advance">
<td class="addName">Mode: </td>
<td class="addOption">
{% set values = dict() %}
{% set values = {'roundrobin':'roundrobin','source':'source','leastconn':'leastconn', 'first':'first', 'rdp-cookie':'rdp-cookie'} %}
{{ select('balance', values=values, selected='roundrobin', required='required', class='force_close') }}
{% set values = {'http':'http','tcp':'tcp'} %}
{{ select('backend-mode-select', name='mode', values=values, selected='http', required='required', class='force_close') }}
<span id="https-backend-span">
<label for="https-backend" style="margin-top: 5px;">Is SSL enabled on frontend?</label>
<input type="checkbox" id="https-backend" name="ssl" value="https">
</span>
<div id="https-hide-backend" style="display: none;">
<label for="ssl-check" style="margin-top: 5px;">Disable SSL verify on servers</label><input type="checkbox" id="ssl-check" name="ssl-check" value="ssl-check" checked>
</div>
</td>
</tr>
<tr class="advance">
<td class="addName"><span title="Cache support start 1.8 and latter">Web acceleration(?):</span></td>
<td class="addOption">
<span class="controlgroup">
{{ checkbox('compression3', title='Enable Compression', value='1', desc='Compression') }}
{{ checkbox('cache3', title='Enable cache', value='2', desc='Cache') }}
{{ checkbox('ssl_offloading2', title='Enable SSL Offloading', desc='SSL Offloading') }}
</span>
</td>
</tr>
<tr class="advance">
<td class="addName">Options:</td>
<td class="addOption">
<span class="controlgroup">
{{ checkbox('forward_for2', title='Option Forward for if none', desc='Forward for') }}
{{ checkbox('redispatch2', title='Enable Redispatch', desc='Redispatch') }}
{% set values = dict() %}
{% set values = {'Off':'Off','Server only':'Server only','Force close':'Force close','Pretend keep alive':'Pretend keep alive'} %}
{{ select('force_close', values=values, first='Force HTTP close', class='force_close') }}
{{ checkbox('cookie2', title='Set cookie', desc='Set cookie', value='1') }}
{{ checkbox('options-backend-show', title='Set options manualy', desc='Set options') }}
</span>
<br>
<span id="cookie_div2" style="display: none;">
<input type="text" placeholder="name" name="cookie_name" id="cookie_name2" class="form-control"><br><br>
<input type="text" placeholder="domain" name="cookie_domain" class="form-control"><br><br>
</tr>
<tr class="advance">
<td class="addName">Balance: </td>
<td class="addOption">
{{ select('balance', values=balance_params, selected='roundrobin', required='required', class='force_close') }}
</td>
</tr>
<tr class="advance">
<td class="addName">Health check: </td>
<td class="addOption">
{{ select('backend_checks', name='health_check', values=checks, selected='', class='force_close') }}
<span id="backend_checks_note" class="tooltip tooltipTop"></span>
</td>
</tr>
<tr class="advance">
<td class="addName"><span title="Cache support start 1.8 and latter">Web acceleration(?):</span></td>
<td class="addOption">
<span class="controlgroup">
{{ checkbox('compression3', title='Enable Compression', value='1', desc='Compression') }}
{{ checkbox('cache3', title='Enable cache', value='2', desc='Cache') }}
{{ checkbox('ssl_offloading2', title='Enable SSL Offloading', desc='SSL Offloading') }}
</span>
</td>
</tr>
<tr class="advance">
<td class="addName">Options:</td>
<td class="addOption">
<span class="controlgroup">
{{ checkbox('forward_for2', title='Option Forward for if none', desc='Forward for') }}
{{ checkbox('redispatch2', title='Enable Redispatch', desc='Redispatch') }}
{% set values = dict() %}
{% set values = {'None':'None','rewrite':'rewrite','indirect':'indirect','insert':'insert'} %}
{{ select('rewrite2', values=values, first='rewrite/indirect/insert', class='force_close') }}
{{ checkbox('prefix2', name='prefix', title='This keyword indicates that instead of relying on a dedicated cookie for the persistence, an existing one will be completed', desc='prefix', value='prefix') }}
{{ checkbox('nocache2', name='nocache', title='This option is recommended in conjunction with the insert mode when there is a cache between the client and HAProxy', desc='nocache', value='nocache') }}
{{ checkbox('postonly2', name='postonly', title='This option ensures that cookie insertion will only be performed on responses to POST requests', desc='postonly', value='postonly') }}
{{ checkbox('dynamic2', name='dynamic', title='Activate dynamic cookies. When used, a session cookie is dynamically created for each server', desc='dynamic', value='dynamic') }}
<span id="dynamic_div2" style="display: none;">
dynamic-cookie-key: {{ input('dynamic-cookie-key2', name='dynamic-cookie-key', placeholder="your-custom-key") }}
{% set values = {'Off':'Off','Server only':'Server only','Force close':'Force close','Pretend keep alive':'Pretend keep alive'} %}
{{ select('force_close', values=values, first='Force HTTP close', class='force_close') }}
{{ checkbox('cookie2', title='Set cookie', desc='Set cookie', value='1') }}
{{ checkbox('options-backend-show', title='Set options manually', desc='Set options') }}
</span>
<br>
<span id="cookie_div2" style="display: none;">
<input type="text" placeholder="name" name="cookie_name" id="cookie_name2" class="form-control"><br><br>
<input type="text" placeholder="domain" name="cookie_domain" class="form-control"><br><br>
<span class="controlgroup">
{% set values = dict() %}
{% set values = {'None':'None','rewrite':'rewrite','indirect':'indirect','insert':'insert'} %}
{{ select('rewrite2', values=values, first='rewrite/indirect/insert', class='force_close') }}
{{ checkbox('prefix2', name='prefix', title='This keyword indicates that instead of relying on a dedicated cookie for the persistence, an existing one will be completed', desc='prefix', value='prefix') }}
{{ checkbox('nocache2', name='nocache', title='This option is recommended in conjunction with the insert mode when there is a cache between the client and HAProxy', desc='nocache', value='nocache') }}
{{ checkbox('postonly2', name='postonly', title='This option ensures that cookie insertion will only be performed on responses to POST requests', desc='postonly', value='postonly') }}
{{ checkbox('dynamic2', name='dynamic', title='Activate dynamic cookies. When used, a session cookie is dynamically created for each server', desc='dynamic', value='dynamic') }}
<span id="dynamic_div2" style="display: none;">
dynamic-cookie-key: {{ input('dynamic-cookie-key2', name='dynamic-cookie-key', placeholder="your-custom-key") }}
</span>
</span>
</span>
</span>
<div id="options-backend-show-div" style="display: none;">
<div style="font-size: 12px; padding-bottom: 10px;">
<span style="padding-right: 10px;">Start typing options: </span>
{{ input('options2') }}
<span style="padding-left: 10px;">
or press down. <a href="http://cbonte.github.io/haproxy-dconv/1.7/configuration.html" target="_blanck" style="color: #23527c" title="HAproxy docs">Read more about options</a>
</span>
<br />
<span style="padding-right: 10px;">Start typing saved options: </span>
<input type="text" id="saved-options2" class="form-control">
It are the options that you saved in the "Options" tab
<div id="options-backend-show-div" style="display: none;">
<div style="font-size: 12px; padding-bottom: 10px;">
<span style="padding-right: 10px;">Start typing options: </span>
{{ input('options2') }}
<span style="padding-left: 10px;">
or press down. <a href="http://cbonte.github.io/haproxy-dconv/1.7/configuration.html" target="_blanck" style="color: #23527c" title="HAproxy docs">Read more about options</a>
</span>
<br />
<span style="padding-right: 10px;">Start typing saved options: </span>
<input type="text" id="saved-options2" class="form-control">
It are the options that you saved in the "Options" tab
</div>
<textarea name="option" title="Options thru" cols=80 rows=5 id="optionsInput2" placeholder="acl test hdr_beg(host) -i some_host"></textarea>
</div>
<textarea name="option" title="Options thru" cols=80 rows=5 id="optionsInput2" placeholder="acl test hdr_beg(host) -i some_host"></textarea>
</div>
</td>
</tr>
<tr>
<td class="addName">Servers:</td>
<td class="addOption">
{% include 'include/add_servers.html' %}
<br>
<br>
{{ checkbox('template-backend', name='template', title='Use server-template instead servers list', value='template', desc='Server-template') }}
</td>
</tr>
<tr class="advance">
<td class="addName">Check:</td>
<td class="addOption">
<div>
<label for="controlgroup-backend-show" style="margin-top: 5px;" title="Change default check">Custom check params</label>
<input type="checkbox" id="controlgroup-backend-show" name="default-check">
<span class="tooltip tooltipTop"> Default params: inter 2000 rise 2 fall 5</span>
</div>
<div class="controlgroup" id="controlgroup-backend" style="display: none;">
<label for="check-servers-backend" title="Ebable servers check">Check</label>
<input type="checkbox" id="check-servers-backend" name="check-servers" checked value="1">
{% set values = dict() %}
{% set values = {'1000':'1000','2000':'2000','3000':'3000'} %}
{{ select('inter-backend', values=values, first='inter', class='force_close') }}
{% set values = dict() %}
{% set values = {'1':'1','2':'2','3':'3'} %}
{{ select('rise-backend', name='rise', values=values, first='rise', class='force_close') }}
{% set values = dict() %}
{% set values = {'4':'4','5':'5','6':'6'} %}
{{ select('fall-backend', name='fall', values=values, first='fall', class='force_close') }}
</div>
</td>
</tr>
<tr class="advance-show">
<td class="addName">Advanced:</td>
<td class="addOption"><span title="Show Advanced settings" style="cursor: pointer">Show Advanced settings</span></td>
</tr>
<tr>
<td class="addButton">
<button type="submit" value="" name="" class="btn btn-default">Add Backend</button>
</td>
</tr>
</form>
</td>
</tr>
<tr>
<td class="addName">Servers:</td>
<td class="addOption">
{% include 'include/add_servers.html' %}
<br>
<br>
{{ checkbox('template-backend', name='template', title='Use server-template instead servers list', value='template', desc='Server-template') }}
</td>
</tr>
<tr class="advance">
<td class="addName">Check:</td>
<td class="addOption">
<div>
<label for="controlgroup-backend-show" style="margin-top: 5px;" title="Change default check">Custom check params</label>
<input type="checkbox" id="controlgroup-backend-show" name="default-check">
<span class="tooltip tooltipTop"> Default params: inter 2000 rise 2 fall 5</span>
</div>
<div class="controlgroup" id="controlgroup-backend" style="display: none;">
<label for="check-servers-backend" title="Ebable servers check">Check</label>
<input type="checkbox" id="check-servers-backend" name="check-servers" checked value="1">
{% set values = dict() %}
{% set values = {'1000':'1000','2000':'2000','3000':'3000'} %}
{{ select('inter-backend', values=values, first='inter', class='force_close') }}
{% set values = dict() %}
{% set values = {'1':'1','2':'2','3':'3'} %}
{{ select('rise-backend', name='rise', values=values, first='rise', class='force_close') }}
{% set values = dict() %}
{% set values = {'4':'4','5':'5','6':'6'} %}
{{ select('fall-backend', name='fall', values=values, first='fall', class='force_close') }}
</div>
</td>
</tr>
<tr class="advance-show">
<td class="addName">Advanced:</td>
<td class="addOption"><span title="Show Advanced settings" class="link">Show Advanced settings</span></td>
</tr>
<tr>
<td class="addButton">
<button type="submit" value="" name="" class="btn btn-default">Add Backend</button>
</td>
</tr>
</table>
</form>
</div>
<div id="ssl">
@ -726,7 +729,7 @@ h3 {
<tr>
<td class="addName">Select server: </td>
<td class="addOption">
<select required name="serv" id="serv3">
<select required name="serv" id="userlist_serv">
<option disabled selected>Choose server</option>
{% for select in selects %}
<option value="{{ select.2 }}">{{ select.1 }}</option>
@ -873,5 +876,23 @@ $( function() {
});
}
});
function makeid(length) {
var result = '';
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}
var serv_ports = $('.send_proxy');
console.log(serv_ports)
for (var i = 0; i <= serv_ports.length; i++) {
var uniqId = makeid(3);
$(serv_ports[i]).append('<label for="' + uniqId + '" class="send_proxy_label" title="Set send-proxy for this server">send-proxy</label><input type="checkbox" name="send_proxy" value="1" id="' + uniqId + '">');
var uniqId = makeid(3);
$(serv_ports[i]).append('<label for="' + uniqId + '" class="send_proxy_label" title="Set this server as backup server">backup</label><input type="checkbox" name="backup" value="1" id="' + uniqId + '">');
}
</script>
{% endblock %}

View File

@ -1,14 +1,22 @@
<style>
.send_proxy_label {
padding: 3px !important;
}
</style>
<span name="add_servers">
<input name="prefix" class="prefix form-control" title="servers prefix" size="3" placeholder="web" style="display: none;">
<input name="template-number" class="prefix form-control" title="servers num" value="3" type="number" style="width: 35px; display: none;">
<input name="servers" required title="Backend IP" size=14 placeholder="xxx.xxx.xxx.xxx" class="form-control">:
<input name="server_port" required title="Backend IP" size=1 placeholder="yyy" class="form-control">
<input name="server_port" required title="Backend IP" size=3 placeholder="yyy" class="form-control">
<span class="send_proxy"></span>
<br />
<input name="servers" title="Backend port" size=14 placeholder="xxx.xxx.xxx.xxx" class="form-control second-server"><span class="second-server">:</span>
<input name="server_port" title="Backend port" size=1 placeholder="yyy" class="form-control second-server">
<input name="server_port" title="Backend port" size=3 placeholder="yyy" class="form-control second-server">
<span class="send_proxy"></span>
<br />
<input name="servers" title="Backend port" size=14 placeholder="xxx.xxx.xxx.xxx" class="form-control second-server"><span class="second-server">:</span>
<input name="server_port" title="Backend port" size=1 placeholder="yyy" class="form-control second-server">
<input name="server_port" title="Backend port" size=3 placeholder="yyy" class="form-control second-server">
<span class="send_proxy"></span>
</span>
<span>
<a class="add-server" name="add-server-input" title="Add backend server" style="cursor: pointer;"></a>

View File

@ -886,9 +886,9 @@ $( function() {
toastr.error('Wrong e-mail format');
}
});
var add_server_var = '<br /><input name="servers" title="Backend IP" size=14 placeholder="xxx.xxx.xxx.xxx" class="form-control">: <input name="server_port" title="Backend port" size=1 placeholder="yyy" class="form-control">'
var add_server_var = '<br /><input name="servers" title="Backend IP" size=14 placeholder="xxx.xxx.xxx.xxx" class="form-control">: <input name="server_port" title="Backend port" size=3 placeholder="yyy" class="form-control">'
$('[name=add-server-input]').click(function() {
$("[name=add_servers]").append(add_server_var);
$("[name=add_servers]").append(add_server_var);
});
var add_userlist_var = '<br /><input name="userlist-user" title="User name" placeholder="user_name" class="form-control"> <input name="userlist-password" required title="User password. By default it insecure-password" placeholder="password" class="form-control"> <input name="userlist-user-group" title="User`s group" placeholder="user`s group" class="form-control">'
$('#add-userlist-user').click(function() {
@ -933,9 +933,10 @@ $( function() {
resetProxySettings()
$( "#tabs" ).tabs( "option", "active", 2 );
} );
$( ".redirectBackend" ).on( "click", function() {
$( "#redirectBackend" ).on( "click", function() {
resetProxySettings()
$( "#tabs" ).tabs( "option", "active", 3 );
history.pushState('Add backend', 'Add backend', 'add.py#backend')
} );
$( ".redirectSsl" ).on( "click", function() {
$( "#tabs" ).tabs( "option", "active", 4 );
@ -986,6 +987,78 @@ $( function() {
resetProxySettings();
createHttps(3, 'backend');
});
var tcp_note = 'The check is valid when the server answers with a <b>SYN/ACK</b> packet'
var ssl_note = 'The check is valid if the server answers with a valid SSL server <b>hello</b> message'
var httpchk_note = 'The check is valid if the server answers with a status code of <b>2xx</b> or <b>3xx</b>'
var ldap_note = 'The check is valid if the server response contains a successful <b>resultCode</b>.\n' +
'<p>You must configure the LDAP servers according to this check to allow anonymous binding. ' +
'You can do this with an IP alias on the server side that allows only HAProxy IP addresses to bind to it.</p>'
var mysql_note = 'The check is valid if the server response contains a successful <b>Authentication</b> request'
var pgsql_note = 'The check is valid if the server response contains a successful <b>Authentication</b> request'
var redis_note = 'The check is valid if the server response contains the string <b>+PONG</b>'
var smtpchk_note = 'The check is valid if the server response code starts with <b>\'2\'</b>'
$( "#listener_checks" ).on('selectmenuchange',function() {
if ($( "#listener_checks option:selected" ).val() == "option tcp-check") {
$("#listener_checks_note").html(tcp_note)
}
if ($( "#listener_checks option:selected" ).val() == "option ssl-hello-chk") {
$("#listener_checks_note").html(ssl_note)
}
if ($( "#listener_checks option:selected" ).val() == "option httpchk") {
$("#listener_checks_note").html(httpchk_note)
}
if ($( "#listener_checks option:selected" ).val() == "option ldap-check") {
$("#listener_checks_note").html(ldap_note)
}
if ($( "#listener_checks option:selected" ).val() == "option mysql-check") {
$("#listener_checks_note").html(mysql_note)
}
if ($( "#listener_checks option:selected" ).val() == "option pgsql-check") {
$("#listener_checks_note").html(pgsql_note)
}
if ($( "#listener_checks option:selected" ).val() == "option redis-check") {
$("#listener_checks_note").html(redis_note)
}
if ($( "#listener_checks option:selected" ).val() == "option smtpchk") {
$("#listener_checks_note").html(smtpchk_note)
}
if ($( "#listener_checks option:selected" ).val() == "") {
$("#listener_checks_note").html('')
}
});
$( "#backend_checks" ).on('selectmenuchange',function() {
if ($( "#backend_checks option:selected" ).val() == "") {
$("#backend_checks_note").html('')
}
if ($( "#backend_checks option:selected" ).val() == "option tcp-check") {
$("#backend_checks_note").html(tcp_note)
}
if ($( "#backend_checks option:selected" ).val() == "option ssl-hello-chk") {
$("#backend_checks_note").html(ssl_note)
}
if ($( "#backend_checks option:selected" ).val() == "option httpchk") {
$("#backend_checks_note").html(httpchk_note)
}
if ($( "#backend_checks option:selected" ).val() == "option ldap-check") {
$("#backend_checks_note").html(ldap_note)
}
if ($( "#backend_checks option:selected" ).val() == "option mysql-check") {
$("#backend_checks_note").html(mysql_note)
}
if ($( "#backend_checks option:selected" ).val() == "option pgsql-check") {
$("#backend_checks_note").html(pgsql_note)
}
if ($( "#backend_checks option:selected" ).val() == "option redis-check") {
$("#backend_checks_note").html(redis_note)
}
if ($( "#backend_checks option:selected" ).val() == "option smtpchk") {
$("#backend_checks_note").html(smtpchk_note)
}
if ($( "#backend_checks option:selected" ).val() == "") {
$("#backend_checks_note").html('')
}
});
});
function resetProxySettings() {
$('[name=port]').val('');
@ -1319,4 +1392,4 @@ function saveList(action, list, color) {
}
}
} );
}
}

View File

@ -15,15 +15,14 @@ body {
h2 {
background: #5D9CEB;
border: 1px solid #5D9CEB;
padding: 3px;
padding-left: 2%;
padding: 3px 3px 3px 2%;
color: #fff;
margin-top: 0px;
margin-bottom: 0px;
margin-top: 0;
margin-bottom: 0;
}
h3 {
margin-top: -0;
margin-bottom: 0px;
margin-bottom: 0;
background: #d1ecf1;
padding: 0.3em;
font-size: 1.6em;
@ -74,7 +73,7 @@ pre {
cursor: pointer;
}
.icon-hapservs {
margin-bottom: 0px;
margin-bottom: 0;
}
.top-menu {
position: absolute;
@ -133,9 +132,8 @@ pre {
}
#version {
float: left;
padding: 20px;
padding-top: 10px;
font-size: 14.5px;
padding: 10px 20px 20px;
font-size: 14.5px;
font-weight: bold;
}
#logo_footer {
@ -153,11 +151,9 @@ pre {
margin-right: 20px;
}
.footer-link, .footer-copyright {
padding: 20px;
color: #5d9ceb;
font-size: 0.9em;
padding-top: 12px;
padding-right: 5px;
padding: 12px 5px 20px 20px;
}
.footer-copyright {
color: #586069 ;
@ -204,7 +200,7 @@ pre {
}
.auto-refresh-interval {
float: right;
padding: 0px 15px;
padding: 0 15px;
margin-top: 5px;
margin-bottom: 10px;
margin-left: 60%;
@ -217,8 +213,7 @@ pre {
}
.auto-refresh-ul ul li {
margin: 0;
padding: 0;
padding-left: 15px;
padding: 0 0 0 15px;
border: 0;
font-family: inherit;
vertical-align: baseline;
@ -230,7 +225,7 @@ pre {
position: fixed;
color: #000;
font-size: 12px;
height: 15;
height: 15px;
}
.auto-refresh-reload-icon {
margin-top: 3px;
@ -277,27 +272,14 @@ pre {
.paramInSec {
font-weight: bold;
}
/*.donate-menu {
font-weight: bold;
font-style: italic;
font-size: 15px;
color: #fff;
margin-left: 30px;
position: fixed;
margin-left: 65px;
margin-top: 15px;
}*/
.line {
background-color: #f3f8fb;
border: 1px solid #ddd;
}
.line, .line3 {
padding-top:5px;
padding-bottom: 5px;
padding-left: 10px;
padding-right: 10px;
padding: 5px 10px;
}
.line:hover, {
.line:hover {
background-color: #f6f8fa;
}
.line3:hover {
@ -365,8 +347,7 @@ pre {
max-width: 50%;
min-height: 160px;
float: left;
margin: 20px;
margin-top: 0;
margin: 0 20px 20px;
}
.overviewHead {
border-radius: 5px;
@ -421,10 +402,8 @@ pre {
.add-button, .add-button-wi {
background-color: #5CB85C;
border-radius: 5px;
color: #fff;
padding: 5px;
padding-right: 10px;
padding-left: 10px;
color: #fff;
padding: 5px 10px;
float: right;
margin-right: 1px;
cursor: pointer;
@ -445,8 +424,7 @@ pre {
background-color: red;
}
.padding10 {
padding: 10px;
padding-left: 0px;
padding: 10px 10px 10px 0;
border: none;
width: 15%;
}
@ -510,8 +488,7 @@ ul{
background: #48505A;
padding: 10px 0 10px 20px;
color: #fff;
border-left-color: #5D9CEB;
border-left: 4px solid #5D9CEB;
border-left: 4px solid #5D9CEB;
}
.menu li:first-child a, .menu li .v_menu li:first-child a{
border-radius: 3px 3px 0 0;
@ -557,12 +534,12 @@ ul{
margin-left: 20px;
}
@keyframes shadow {
from {box-shadow: 0px 0px 0px red inset;}
from {box-shadow: 0 0 0 red inset;}
50% {text-shadow: 0 0 30px black;}
to {box-shadow: 0 -5px 5px -5px rgb(38, 137, 60) inset}
}
@keyframes shadow-red {
from {box-shadow: 0px 0px 0px red inset;}
from {box-shadow: 0 0 0 red inset;}
50% {text-shadow: 0 0 30px black;}
to {box-shadow: 0 -5px 5px -5px #5D9CEB inset}
}
@ -597,8 +574,7 @@ ul{
}
.ui-state-active {
background-color: #4A89D8 !important;
border: none !important;
border-color: #5D9CEB !important;
border: none #5D9CEB !important;
}
.ui-tabs-nav {
border-radius: 0 !important;
@ -648,14 +624,15 @@ a {
}
a:hover, a:focus {
color: #23527c;
text-decoration: derline;
text-decoration: underline;
}
a:focus {
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
.logs_link, .accordion-link {
.logs_link, .accordion-link, .link {
color: #23527c !important;
cursor: pointer;
}
table {
border-spacing: 0;
@ -728,9 +705,8 @@ td,th {
width: 300px;
}
.validateTips {
width: 540px;
margin: 0;
margin-bottom: 10px;
width: 540px;
margin: 0 0 10px;
}
#errorMess {
float: right;
@ -761,14 +737,8 @@ label {
border: 1px solid #A4C7F5;
height: 165px;
width: 375px;
padding: 20px;
padding-top: 10px;
padding-left: 15px;
padding-right: 15px;
margin: 20px;
margin-right: 5px;
margin-bottom: 20px ;
margin-top: 0px;
padding: 10px 15px 20px;
margin: 0 5px 20px 20px;
display: block;
float: left;
}
@ -814,19 +784,11 @@ label {
float: left;
}
.ajax-server {
margin: 25px;
margin-left: 757px;
margin-bottom: 0;
margin: 25px 25px 0 757px;
width: 778px;
display: none;
margin-top: px;
margin-bottom: 0px;
margin-top: 0px;
height: 185px;
padding-bottom: 0px;
padding-top: 10px;
padding-left: 15px;
padding-right: 15px;
padding: 10px 15px 0;
}
.haproxy-info {
display: inline-block;
@ -890,10 +852,7 @@ label {
}
.group_name {
font-size: 18px;
padding: 20px;
padding-left:15px;
padding-bottom: 0px;
padding-top: 10px;
padding: 10px 20px 0 15px;
}
.smon_services {
width: 192px;
@ -1148,11 +1107,9 @@ label {
}
#stats_filter_text {
float: left;
padding: 5px;
font-size: 20px;
padding-top: 0;
margin-top: -2px;
padding-right: 10px;
padding: 0 10px 5px 5px;
}
.stats_active, .stats_drain, .stats_maintain, .stats_down, .stats_not_checked, .stats_backup, .stats_frontends, .stats_backends {
color: #000 ;
@ -1181,4 +1138,4 @@ label {
}
.stats_frontends {
background-color: rgb(93, 156, 235) !important;
}
}