96 Commits

Author SHA1 Message Date
fab
add09f044a
Update README.md 2025-01-03 13:25:16 +01:00
fab
472b26aef4
Update README.md 2025-01-03 13:24:40 +01:00
fab
9aba2163c2
Update owasp.py
Minor improvements.
2025-01-03 13:22:31 +01:00
fab
61e1a856c9
Update badbots.py
Improved error handling, logging and code structure.
2025-01-03 13:20:01 +01:00
fab
2356cdcff0
Update owasp2nginx.py 2025-01-03 13:18:21 +01:00
fab
8dcbfbeda4
Update import_nginx_waf.py 2025-01-03 13:17:55 +01:00
fab
a93481de4f
Update import_nginx_waf.py 2025-01-03 13:17:10 +01:00
fab
7ada922222
Update owasp2nginx.py 2025-01-03 13:16:19 +01:00
fab
77cecae490
Update import_haproxy_waf.py 2025-01-03 13:15:27 +01:00
fab
2c1401c1cf
Update owasp2haproxy.py
- Error Handling:
    - Added error handling for file operations, JSON parsing, and invalid rule structures.
    - Logs warnings for invalid rules instead of crashing.

- Path Handling:
    - Used pathlib.Path for better path manipulation and readability.
Made paths configurable via environment variables.

- Logging:
    - Replaced print() with Python's logging module for more flexible and structured logging.

- Input Validation:
    - Added checks for missing keys in the input JSON file.

- Rule Formatting:
    - Ensured proper formatting of HAProxy ACL rules.

- Output Directory Permissions:
    - Ensured the output directory is created with parents=True to handle nested directories.

- Code Structure:
    - Encapsulated the main logic in a main() function for better organization.
    - Added docstrings to functions for clarity.
2025-01-03 13:14:27 +01:00
fab
4655a25c4d
Update import_apache_waf.py
- Error Handling: Added try-except blocks to handle file operations, subprocess commands, and permission issues. Logs detailed error messages for debugging.
- Path Handling: Used pathlib.Path for better path manipulation and readability. Made paths configurable via environment variables.
- File Permissions: Ensured the target directory is created with parents=True to handle nested directories. Checked if files already exist in the target directory to avoid unnecessary overwrites.
- Logging: Added more detailed logging for better transparency and debugging.
- Subprocess Security: Added checks for apachectl and systemctl commands to ensure compatibility with supported systems.
- Input Validation: Validated the existence of .conf files before copying them.
- Code Structure: Encapsulated the main logic in a main() function for better organization.
- Added docstrings to functions for clarity.
2025-01-03 13:12:12 +01:00
fab
55297a76cf
Update owasp2apache.py
- Error Handling: Added error handling for file operations, JSON parsing, and invalid rule structures. Logs warnings for invalid rules instead of crashing.
- Unique Rule IDs: Each rule is assigned a unique id to avoid collisions in ModSecurity.
- Path Handling: Used pathlib.Path for better path manipulation and readability.
- Logging: Replaced print() with Python's logging module for more flexible and structured logging.
- Input Validation: Added checks for missing keys in the input JSON file.
- Template for Rules: Used a template string (MODSEC_RULE_TEMPLATE) for consistent rule formatting.
- Output Directory Permissions: Ensured the output directory is created with parents=True to handle nested directories.
2025-01-03 13:09:05 +01:00
fab
e59be8dd91
Update import_traefik_waf.py
Minor improvements,
2025-01-03 13:06:49 +01:00
fab
c7a580c983
Update owasp2traefik.py
Should fix resulting exported rules to match Traefik standards.
2025-01-03 11:31:58 +01:00
github-actions[bot]
93271ca213 Update: [Fri Jan 3 00:25:56 UTC 2025] 2025-01-03 00:25:56 +00:00
fab
9d057542c3
Update update_patterns.yml
Caddy support removed. 
Please check [this](https://github.com/fabriziosalmi/caddy-waf/)  project instead.
2025-01-03 00:15:47 +01:00
fab
75770a28ce
Update README.md 2025-01-02 19:08:47 +01:00
fab
af94e34764
Update README.md
Caddy support removed. Please check and contribute to the caddy-waf project [here](https://github.com/fabriziosalmi/caddy-waf).
2025-01-02 19:08:12 +01:00
fab
e6b1df2016
Delete waf_patterns/caddy directory 2025-01-02 19:05:52 +01:00
fab
25bae0e731
Delete owasp2caddy.py 2025-01-02 19:05:36 +01:00
fab
62e615c33b
Delete import_caddy_waf.py 2025-01-02 19:05:22 +01:00
fab
46a5414dcf
Update README.md 2025-01-02 13:56:42 +01:00
github-actions[bot]
a98af4e049 Update: [Wed Jan 1 11:56:40 UTC 2025] 2025-01-01 11:56:40 +00:00
fab
9f1266f81f
Update badbots.py
parsing fixes
2025-01-01 12:56:12 +01:00
github-actions[bot]
0c9e469587 Update: [Wed Jan 1 00:28:50 UTC 2025] 2025-01-01 00:28:50 +00:00
github-actions[bot]
9c9068b34e Update: [Tue Dec 31 00:25:45 UTC 2024] 2024-12-31 00:25:45 +00:00
github-actions[bot]
204e19f8c2 Update: [Mon Dec 30 00:27:08 UTC 2024] 2024-12-30 00:27:08 +00:00
github-actions[bot]
3760d3dcde Update: [Sun Dec 29 23:20:18 UTC 2024] 2024-12-29 23:20:18 +00:00
fab
36f08db3eb
Update owasp.py
- verify github function fixed
2024-12-30 00:18:50 +01:00
fab
a3065eb405
Update README.md 2024-12-30 00:11:41 +01:00
fab
f347ac2817
Update badbots.py
- Introduced concurrency with ThreadPoolExecutor for faster bot list fetching.
- Added rate limiting and exponential backoff for resilient fetch operations.
- Expanded bot list sources to include new datasets for improved coverage.
- Implemented GitHub token authentication for rate-limited endpoints.
- Refactored file generation to use pathlib for better path management.
- Replaced os.path with Path for consistency and readability.
- Modularized retry logic and enhanced error handling for robustness.
- Ensured bot lists are aggregated and deduplicated across sources.
- Improved logging for better visibility into fetch and write operations.
2024-12-30 00:08:12 +01:00
fab
7f7f7fecd4
Update owasp.py
- Added exponential backoff and retry logic for GitHub API requests to handle rate limits and transient errors.
- Introduced SHA verification for fetched blobs to ensure data integrity.
- Implemented optional GitHub token support for authenticated requests.
- Improved handling of the latest matching tag by dynamically sorting and selecting the newest available version.
- Reorganized functions for better modularity and readability.
- Added error handling for blob fetching and decoding with base64 processing.
- Directory creation for output files now ensured, improving save reliability.
2024-12-29 23:50:29 +01:00
github-actions[bot]
1e4bb70b5d Update: [Sun Dec 22 00:28:28 UTC 2024] 2024-12-22 00:28:28 +00:00
fab
b05a7d87c2
Merge pull request #4 from Sebagabones/apacheFixes
import_caddy|apache|nginx_waf.py fixes love this approach Seba <3
2024-12-21 17:55:33 +01:00
Seb
c58a1b486f Added fixes to Caddy and Ngnix
Did the same fixes that have been done to Apache to Caddy and Nginx
2024-12-21 23:03:25 +08:00
Seb
6c267fbb63 Tidied the code a bit
Whoops, forgot to actually clean the code in my haste, apologies
2024-12-21 22:59:50 +08:00
Sebastian Gazey
d34ec3ecf5 seems to work 2024-12-21 22:51:02 +08:00
Seb
613f77c538 Fixed astrix not being passed to shell
Initially tried to add all files ending in .conf in correct dir to a
string in {a,b,c,d} form for cp, but ran into a char limit for cp so
sadly went with the slower for loop method
2024-12-21 22:43:34 +08:00
fab
e652bccf66
Update owasp.py
Minor improvements.
2024-12-21 11:31:31 +01:00
fab
2763bbc13b
Update badbots.py
Fix for fallback #1 URL which lands nowhere (404).
2024-12-21 11:29:45 +01:00
fab
4fa74ecb89
Update README.md 2024-12-21 11:24:39 +01:00
fab
6c76dbeff2
Update README.md 2024-12-21 10:32:01 +01:00
fab
160dc7541a
Update README.md 2024-12-21 10:00:37 +01:00
fab
b8f3f0f312
Update README.md 2024-12-21 10:00:11 +01:00
fab
57a404ccf3
Update README.md 2024-12-21 09:14:46 +01:00
fab
4f238e10a2
Create import_haproxy_waf.py 2024-12-21 09:08:22 +01:00
fab
a76150763a
Create import_traefik_waf.py 2024-12-21 09:07:35 +01:00
fab
1974e98a13
Create import_apache_waf.py 2024-12-21 09:05:54 +01:00
fab
caa5d3a192
Create import_caddy_waf.py 2024-12-21 09:05:37 +01:00
fab
3f42ce22d8
Create import_nginx_waf.py 2024-12-21 09:05:16 +01:00