Changelog: https://roxy-wi.org/changelog#7.0.1
pull/364/head
Aidaho 2023-10-16 14:43:58 +03:00
parent ec6db8265c
commit 3bcd2a5077
8 changed files with 18 additions and 10 deletions

View File

@ -222,7 +222,7 @@ def haproxy_section_add(haproxy_id):
@route('/haproxy/<haproxy_id>/section/delete', method=['POST'])
@route('/haproxy/<haproxy_id:int>/section/delete', method=['POST'])
def haproxy_section_add(haproxy_id):
def haproxy_section_delete(haproxy_id):
if not check_login(required_service=1):
return dict(error=_error_auth)
return api_funct.edit_section(haproxy_id, delete=1)

View File

@ -124,8 +124,9 @@ def action_haproxy_waf(server_ip: str, action: str) -> str:
except Exception as e:
return str(e)
roxywi_common.logging(server_ip, f'HAProxy WAF service has been {action}ed', roxywi=1, login=1, keep_history=1,
service='haproxy')
roxywi_common.logging(
server_ip, f'HAProxy WAF service has been {action}ed', roxywi=1, login=1, keep_history=1, service='haproxy'
)
commands = [f"sudo systemctl {action} waf"]
server_mod.ssh_command(server_ip, commands)
return f"success: WAF has been {action}"

View File

@ -227,7 +227,7 @@ def install_service(server_ip: str, service: str, docker: str, syn_flood_protect
show_installation_output(return_out['error'], return_out['output'], service_name, rc=return_out['rc'])
except Exception as e:
raise Exception(e)
if service == 'nginx':
try:
sql.update_nginx(server_ip)
@ -322,8 +322,10 @@ def grafana_install():
return f'success: Grafana and Prometheus servers were installed. You can find Grafana on http://{host}:3000<br>'
def keepalived_master_install(master: str, eth: str, eth_slave: str, vrrp_ip: str, virt_server: int, syn_flood: int,
return_to_master: int, haproxy: int, nginx: int, router_id: int, api=0) -> str:
def keepalived_master_install(
master: str, eth: str, eth_slave: str, vrrp_ip: str, virt_server: int, syn_flood: int, return_to_master: int,
haproxy: int, nginx: int, router_id: int, api=0
) -> str:
script = "install_keepalived.sh"
proxy = sql.get_setting('proxy')
keepalived_path_logs = sql.get_setting('keepalived_path_logs')
@ -373,8 +375,9 @@ def keepalived_master_install(master: str, eth: str, eth_slave: str, vrrp_ip: st
return show_success_installation(service)
def keepalived_slave_install(master: str, slave: str, eth: str, eth_slave: str, vrrp_ip: str, syn_flood: int,
haproxy: int, nginx: int, router_id: int, api=0) -> str:
def keepalived_slave_install(
master: str, slave: str, eth: str, eth_slave: str, vrrp_ip: str, syn_flood: int, haproxy: int, nginx: int, router_id: int, api=0
) -> str:
script = "install_keepalived.sh"
proxy = sql.get_setting('proxy')
keepalived_path_logs = sql.get_setting('keepalived_path_logs')

View File

@ -173,6 +173,7 @@ def telegram_send_mess(mess, level, **kwargs):
try:
bot = telebot.TeleBot(token=token_bot)
bot.send_message(chat_id=channel_name, text=f'{level}: {mess}')
return 'ok'
except Exception as e:
roxywi_common.logging('Roxy-WI server', str(e), roxywi=1)
raise Exception(f'error: {e}')
@ -206,6 +207,7 @@ def slack_send_mess(mess, level, **kwargs):
try:
client.chat_postMessage(channel=f'#{channel_name}', text=f'{level}: {mess}')
return 'ok'
except SlackApiError as e:
roxywi_common.logging('Roxy-WI server', str(e), roxywi=1)
raise Exception(f'error: {e}')
@ -250,6 +252,7 @@ def pd_send_mess(mess, level, server_ip=None, service_id=None, alert_type=None,
session.resolve(dedup_key)
else:
session.trigger(mess, 'Roxy-WI', dedup_key=dedup_key, severity=level, custom_details={'server': server_ip, 'alert': mess})
return 'ok'
except Exception as e:
roxywi_common.logging('Roxy-WI server', str(e), roxywi=1)
raise Exception(f'error: {e}')

View File

@ -28,7 +28,6 @@ def load_checker() -> None:
try:
user_params = roxywi_common.get_users_params()
user = user_params['user']
except Exception:
return redirect(url_for('login_page'))

View File

@ -102,7 +102,7 @@ def receiver(receiver_name):
group = common.checkAjaxInput(request.form.get('group'))
page = common.checkAjaxInput(request.form.get('page'))
page = page.split("#")[0]
return alerting.add_receiver_channel(receiver_name, token, channel, group, page)
elif request.method == 'PUT':
token = common.checkAjaxInput(request.form.get('receiver_token'))

View File

@ -192,6 +192,7 @@ def versions(service, server_ip):
if 'No such file or directory' in str(e):
pass
else:
configs_dir = get_config.get_config_var('configs', f'{service}_save_configs_dir')
os.remove(os.path.join(configs_dir, get))
try:
file.add(get + "\n")

View File

@ -175,6 +175,7 @@ def get_list(server_ip, list_id, list_name):
def delete_ip_from_list():
ip_id = common.checkAjaxInput(request.form.get('list_ip_id_for_delete'))
ip = common.is_ip_or_dns(request.form.get('list_ip_for_delete'))
serv = common.is_ip_or_dns(request.form.get('serv'))
list_id = common.checkAjaxInput(request.form.get('list_id_for_delete'))
list_name = common.checkAjaxInput(request.form.get('list_name'))