diff --git a/app/create_db.py b/app/create_db.py index 2e98e6e3..0b7b7928 100644 --- a/app/create_db.py +++ b/app/create_db.py @@ -181,7 +181,7 @@ def update_db_v_31(**kwargs): sql.append("INSERT INTO settings (param, value, section, `desc`) values('server_state_file', '/etc/haproxy/haproxy.state', 'haproxy', 'Path to HAProxy state file');") sql.append("INSERT INTO settings (param, value, section, `desc`) values('haproxy_sock', '/var/run/haproxy.sock', 'haproxy', 'Path to HAProxy sock file');") sql.append("INSERT INTO settings (param, value, section, `desc`) values('haproxy_sock_port', '1999', 'haproxy', 'HAProxy sock port');") - sql.append("INSERT INTO settings (param, value, section, `desc`) values('firewall_enable', '0', 'haproxy', 'If enable this option Haproxy-wi will be configure firewalld based on config port');") + sql.append("INSERT INTO settings (param, value, section, `desc`) values('firewall_enable', '0', 'main', 'If enable this option Haproxy-wi will be configure firewalld based on config port');") sql.append("INSERT INTO settings (param, value, section, `desc`) values('apache_log_path', '/var/log/httpd/', 'logs', 'Path to Apache logs');") sql.append("INSERT INTO settings (param, value, section, `desc`) values('ldap_enable', '0', 'ldap', 'If 1 ldap enabled');") sql.append("INSERT INTO settings (param, value, section, `desc`) values('ldap_server', '', 'ldap', 'IP address ldap server');") diff --git a/app/options.py b/app/options.py index 53edec01..ec682411 100644 --- a/app/options.py +++ b/app/options.py @@ -1223,25 +1223,30 @@ if form.getvalue('bwlists_save'): except IOError as e: print('
Cat\'n save '+color+' list. %s
' % e) - servers = sql.get_dick_permit() path = sql.get_setting('haproxy_dir')+"/"+color - - for server in servers: - funct.ssh_command(server[2], ["sudo mkdir "+path]) - funct.ssh_command(server[2], ["sudo chown $(whoami) "+path]) - error = funct.upload(server[2], path+"/"+bwlists_save, list, dir='fullpath') + servers = [] + servers.append(serv) + + MASTERS = sql.is_master(serv) + for master in MASTERS: + if master[0] != None: + servers.append(master[0]) + for serv in servers: + funct.ssh_command(serv, ["sudo mkdir "+path]) + funct.ssh_command(serv, ["sudo chown $(whoami) "+path]) + error = funct.upload(serv, path+"/"+bwlists_save, list, dir='fullpath') if error: print('
Upload fail: %s
' % error) else: - print('
Edited '+color+' list was uploaded to '+server[1]+'
') + print('
Edited '+color+' list was uploaded to '+serv+'
') try: - funct.logging(server[1], 'has edited '+color+' list '+bwlists_save, haproxywi=1, login=1) + funct.logging(serv, 'has edited '+color+' list '+bwlists_save, haproxywi=1, login=1) except: pass if form.getvalue('bwlists_restart') == 'restart': - funct.ssh_command(server[2], ["sudo systemctl restart haproxy"]) + funct.ssh_command(serv, ["sudo systemctl restart haproxy"]) elif form.getvalue('bwlists_restart') == 'reload': - funct.ssh_command(server[2], ["sudo systemctl reload haproxy"]) + funct.ssh_command(serv, ["sudo systemctl reload haproxy"]) if form.getvalue('get_lists'): diff --git a/app/templates/add.html b/app/templates/add.html index c1f6e3c7..3ff63308 100644 --- a/app/templates/add.html +++ b/app/templates/add.html @@ -750,13 +750,20 @@ h3 {
- + + - + @@ -765,7 +772,26 @@ h3 { {{ list }} {% endfor %} - + {{ input('group', value=group, type='hidden') }} +
New black list - Exists black lists - New white list - Exists white lists + Server for uploadNew black listExists black lists
+ + + Name: {{ input('new_blacklist_name') }} + +
+ + + + + + + + + @@ -775,12 +801,11 @@ h3 { {% endfor %} - {{ input('group', value=group, type='hidden') }}
Server for uploadNew white listExists white lists
+ + Name: {{ input('new_whitelist_name') }}
+
In this section you can create and edit black and white lists. And after use them in the HAProxy configs or in the "Add proxy" pages
-