diff --git a/README.md b/README.md index 8584a1f3..66ed93e1 100644 --- a/README.md +++ b/README.md @@ -15,10 +15,10 @@ Web interface(user-friendly web GUI, alerting, monitoring and secure) for managi ![alt text](image/haproxy-wi-config-show.png "Show config page") # Features: -1. Configure HAProxy In a jiffy with haproxy-wi -2. View and analyse Status of all Frontend/backend server via haproxy-wi from a single control panel. +1. Configure HAProxy In a jiffy with HAProxy-WI +2. View and analyse Status of all Frontend/backend server via HAProxy-WI from a single control panel. 3. Enable/disable servers through stats page without rebooting HAProxy -4. View/Analyse HAproxy logs straight from the haproxy-wi web interface +4. View/Analyse HAproxy logs straight from the HAProxy-WI web interface 5. Create and visualise the HAproxy workflow from Web Ui. 6. Push Your changes to your HAproxy servers with a single click through web interface 7. Get info on past changes, Evaluate your config files and restore a previous stable config anytime with a single click straight from Web interface @@ -32,7 +32,7 @@ Web interface(user-friendly web GUI, alerting, monitoring and secure) for managi 15. Send notifications to telegram directly from HAProxy-WI 16. HAProxy-WI supports high Availability to ensure uptime to all Master slave servers configured 17. SSL certificate support. -18. SSH Key support for managing multiple HAproxy Servers straight from haproxy-wi +18. SSH Key support for managing multiple HAProxy Servers straight from HAProxy-WI 19. SYN flood protect 20. Alerting about changes backends state 21. Alerting about HAProxy service state @@ -45,6 +45,7 @@ Web interface(user-friendly web GUI, alerting, monitoring and secure) for managi 28. Mobile-ready desing 29. REST API 30. Installation and Upgrading HAProxy service via HAProxy-WI +31. Backup HAProxy's config files through HAProxy-WI ![alt text](image/haproxy-wi-metrics.png "Merics") diff --git a/app/create_db.py b/app/create_db.py index 7b8e8340..0cddf1c5 100644 --- a/app/create_db.py +++ b/app/create_db.py @@ -8,7 +8,7 @@ if mysql_enable == '1': mysql_password = funct.get_config_var('mysql', 'mysql_password') mysql_db = funct.get_config_var('mysql', 'mysql_db') mysql_host = funct.get_config_var('mysql', 'mysql_host') - mysql_port = funct.get_config_var('mysql', 'mysql_port') + mysql_port = funct.get_config_var('mysql', 'mysql_port') import mysql.connector as sqltool else: db = "/var/www/haproxy-wi/app/haproxy-wi.db" @@ -123,6 +123,7 @@ def create_table(**kwargs): CREATE TABLE IF NOT EXISTS `version` (`version` varchar(64)); CREATE TABLE IF NOT EXISTS `options` ( `id` INTEGER NOT NULL, `options` VARCHAR ( 64 ), `groups` VARCHAR ( 120 ), PRIMARY KEY(`id`)); CREATE TABLE IF NOT EXISTS `saved_servers` ( `id` INTEGER NOT NULL, `server` VARCHAR ( 64 ), `description` VARCHAR ( 120 ), `groups` VARCHAR ( 120 ), PRIMARY KEY(`id`)); + CREATE TABLE IF NOT EXISTS `backups` ( `id` INTEGER NOT NULL, `server` VARCHAR ( 64 ), `rhost` VARCHAR ( 120 ), `rpath` VARCHAR ( 120 ), `type` VARCHAR ( 120 ), `time` VARCHAR ( 120 ), cred INTEGER, `description` VARCHAR ( 120 ), PRIMARY KEY(`id`)); """ try: cur.executescript(sql) @@ -456,9 +457,10 @@ def update_db_v_3_8_1(**kwargs): cur.close() con.close() + def update_ver(**kwargs): con, cur = get_cur() - sql = """update version set version = '3.10.1.0'; """ + sql = """update version set version = '3.11.0.0'; """ try: cur.execute(sql) con.commit() diff --git a/app/haproxy-wi.db.sql b/app/haproxy-wi.db.sql index 2f5199ba..6542fbaa 100644 --- a/app/haproxy-wi.db.sql +++ b/app/haproxy-wi.db.sql @@ -18,3 +18,4 @@ CREATE TABLE IF NOT EXISTS `settings` (`param` varchar(64) UNIQUE, value varchar CREATE TABLE IF NOT EXISTS `version` (`version` varchar(64)); CREATE TABLE IF NOT EXISTS `options` ( `id` INTEGER NOT NULL, `options` VARCHAR ( 64 ), `groups` VARCHAR ( 120 ), PRIMARY KEY(`id`)); CREATE TABLE IF NOT EXISTS `saved_servers` ( `id` INTEGER NOT NULL, `server` VARCHAR ( 64 ), `description` VARCHAR ( 120 ), `groups` VARCHAR ( 120 ), PRIMARY KEY(`id`)); +CREATE TABLE IF NOT EXISTS `backups` ( `id` INTEGER NOT NULL, `server` VARCHAR ( 64 ), `rhost` VARCHAR ( 120 ), `rpath` VARCHAR ( 120 ), `time` VARCHAR ( 120 ), cred INTEGER, `description` VARCHAR ( 120 ), PRIMARY KEY(`id`)); \ No newline at end of file diff --git a/app/sql.py b/app/sql.py index 6e950bf9..ac206122 100644 --- a/app/sql.py +++ b/app/sql.py @@ -350,7 +350,7 @@ def write_user_token(login, user_token): try: cur.execute(sql) except sqltool.Error as e: - print('An error occurred: ' + e.args[0] + ' X') + out_error(e) for id in cur.fetchall(): if mysql_enable == '1': sql = """ insert into token (user_id, token, exp) values('%s', '%s', now()+ INTERVAL %s day) """ % (id[0], user_token, token_ttl) @@ -620,6 +620,7 @@ def update_ssh(id, name, enable, group, username, password): cur.close() con.close() + def show_update_ssh(name, page): from jinja2 import Environment, FileSystemLoader env = Environment(loader=FileSystemLoader('templates/ajax')) @@ -1501,7 +1502,7 @@ if form.getvalue('updateuser') is not None: if check_group(group, role_id): if funct.is_admin(level=role_id): update_user(new_user, email, role, group, id, activeuser) - funct.logging('user with id '+id, ' user '+user+' updated ', haproxywi=1, login=1) + funct.logging('user with id '+id, ' user '+new_user+' updated ', haproxywi=1, login=1) else: funct.logging(new_user, ' tried to privilege escalation', haproxywi=1, login=1) @@ -1687,7 +1688,6 @@ if form.getvalue('sshdel') is not None: pass if delete_ssh(sshdel): print("Ok") - funct.logging('the ssh '+sshdel, ' deleted ', haproxywi=1, login=1) if form.getvalue('newtelegram'): diff --git a/app/templates/servers.html b/app/templates/servers.html index e43a2b98..59606199 100644 --- a/app/templates/servers.html +++ b/app/templates/servers.html @@ -284,7 +284,7 @@