new options

This commit is contained in:
Mateusz Gruszczyński
2025-11-03 09:39:34 +01:00
parent e4a3671f90
commit 72bf6eb9d1
5 changed files with 168 additions and 103 deletions

View File

@@ -35,15 +35,18 @@ def index():
backend_server_ports = request.form.getlist('backend_server_ports[]')
backend_server_maxconns = request.form.getlist('backend_server_maxconns[]')
# ACL
is_acl = 'add_acl' in request.form
acl_name = request.form.get('acl', '')
acl_action = request.form.get('acl_action', '')
acl_backend_name = request.form.get('backend_name_acl', '')
# Custom ACL (NEW)
add_custom_acl = 'add_custom_acl' in request.form
custom_acl_name = request.form.get('custom_acl_name', '').strip() if add_custom_acl else ''
custom_acl_type = request.form.get('custom_acl_type', 'path_beg') if add_custom_acl else ''
custom_acl_value = request.form.get('custom_acl_value', '').strip() if add_custom_acl else ''
custom_acl_action = request.form.get('custom_acl_action', 'route') if add_custom_acl else ''
custom_acl_backend = request.form.get('custom_acl_backend', '').strip() if add_custom_acl else ''
custom_acl_redirect_url = request.form.get('custom_acl_redirect_url', '').strip() if add_custom_acl else ''
# SSL
use_ssl = 'ssl_checkbox' in request.form
ssl_cert_path = request.form.get('ssl_cert_path', '/etc/haproxy/certs/haproxy.pem')
ssl_cert_path = request.form.get('ssl_cert_path', '/app/ssl/haproxy-configurator.pem')
https_redirect = 'ssl_redirect_checkbox' in request.form
# DOS Protection
@@ -54,12 +57,6 @@ def index():
# Forward For
forward_for = 'forward_for_check' in request.form
# Forbidden paths
is_forbidden_path = 'add_acl_path' in request.form
forbidden_name = request.form.get('forbidden_name', '')
allowed_ip = request.form.get('allowed_ip', '')
forbidden_path = request.form.get('forbidden_path', '')
# SQL Injection
sql_injection_check = 'sql_injection_check' in request.form
@@ -69,14 +66,20 @@ def index():
# Remote uploads
is_remote_upload = 'remote_uploads_check' in request.form
# Path-based redirects
# Webshells
is_webshells = 'webshells_check' in request.form
# Path-based redirects (legacy)
add_path_based = 'add_path_based' in request.form
redirect_domain_name = request.form.get('redirect_domain_name', '')
root_redirect = request.form.get('root_redirect', '')
redirect_to = request.form.get('redirect_to', '')
# Webshells
is_webshells = 'webshells_check' in request.form
# Forbidden paths (legacy)
is_forbidden_path = 'add_acl_path' in request.form
forbidden_name = request.form.get('forbidden_name', '')
allowed_ip = request.form.get('allowed_ip', '')
forbidden_path = request.form.get('forbidden_path', '')
# Build backend_servers list
backend_servers = []
@@ -114,7 +117,13 @@ def index():
sticky_session = True
sticky_session_type = request.form.get('sticky_session_type', 'cookie')
# Call update_haproxy_config with all parameters
# Legacy ACL (unused, kept for compatibility)
is_acl = False
acl_name = ''
acl_action = ''
acl_backend_name = ''
# Call update_haproxy_config
message = update_haproxy_config(
frontend_name=frontend_name,
frontend_ip=frontend_ip,
@@ -158,7 +167,14 @@ def index():
backend_ssl_redirect=backend_ssl_redirect,
ssl_redirect_backend_name=ssl_redirect_backend_name,
ssl_redirect_port=ssl_redirect_port,
frontend_hostname=frontend_hostname
frontend_hostname=frontend_hostname,
add_custom_acl=add_custom_acl,
custom_acl_name=custom_acl_name,
custom_acl_type=custom_acl_type,
custom_acl_value=custom_acl_value,
custom_acl_action=custom_acl_action,
custom_acl_backend=custom_acl_backend,
custom_acl_redirect_url=custom_acl_redirect_url
)
# Determine message type