mirror of
https://github.com/fabriziosalmi/patterns.git
synced 2025-12-17 17:55:48 +00:00
Merge pull request #4 from Sebagabones/apacheFixes
import_caddy|apache|nginx_waf.py fixes love this approach Seba <3
This commit is contained in:
commit
b05a7d87c2
@ -9,10 +9,17 @@ APACHE_WAF_DIR = "/etc/modsecurity.d/"
|
||||
APACHE_CONF = "/etc/apache2/apache2.conf"
|
||||
INCLUDE_STATEMENT = "IncludeOptional /etc/modsecurity.d/*.conf"
|
||||
|
||||
|
||||
|
||||
def copy_waf_files():
|
||||
logging.info("Copying Apache WAF patterns...")
|
||||
os.makedirs(APACHE_WAF_DIR, exist_ok=True)
|
||||
subprocess.run(["cp", "-R", f"{WAF_DIR}/*", APACHE_WAF_DIR], check=True)
|
||||
list_of_files = os.listdir(WAF_DIR)
|
||||
for conf_file in list_of_files:
|
||||
if conf_file.endswith('.conf'):
|
||||
subprocess.run(["cp", f"{WAF_DIR}/{conf_file}", APACHE_WAF_DIR], check=True)
|
||||
|
||||
|
||||
|
||||
def update_apache_conf():
|
||||
logging.info("Ensuring WAF patterns are included in apache2.conf...")
|
||||
|
||||
@ -12,7 +12,10 @@ INCLUDE_STATEMENT = "import waf/*.conf"
|
||||
def copy_waf_files():
|
||||
logging.info("Copying Caddy WAF patterns...")
|
||||
os.makedirs(CADDY_WAF_DIR, exist_ok=True)
|
||||
subprocess.run(["cp", "-R", f"{WAF_DIR}/*", CADDY_WAF_DIR], check=True)
|
||||
list_of_files = os.listdir(WAF_DIR)
|
||||
for conf_file in list_of_files:
|
||||
if conf_file.endswith('.conf'):
|
||||
subprocess.run(["cp", f"{WAF_DIR}/{conf_file}", CADDY_WAF_DIR], check=True)
|
||||
|
||||
def update_caddyfile():
|
||||
logging.info("Ensuring WAF patterns are imported in Caddyfile...")
|
||||
|
||||
@ -12,7 +12,10 @@ INCLUDE_STATEMENT = "include /etc/nginx/waf/*.conf;"
|
||||
def copy_waf_files():
|
||||
logging.info("Copying Nginx WAF patterns...")
|
||||
os.makedirs(NGINX_WAF_DIR, exist_ok=True)
|
||||
subprocess.run(["cp", "-R", f"{WAF_DIR}/*", NGINX_WAF_DIR], check=True)
|
||||
list_of_files = os.listdir(WAF_DIR)
|
||||
for conf_file in list_of_files:
|
||||
if conf_file.endswith('.conf'):
|
||||
subprocess.run(["cp", f"{WAF_DIR}/{conf_file}", NGINX_WAF_DIR], check=True)
|
||||
|
||||
def update_nginx_conf():
|
||||
logging.info("Ensuring WAF patterns are included in nginx.conf...")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user