mirror of
https://github.com/fabriziosalmi/patterns.git
synced 2025-12-17 17:55:48 +00:00
Update nginx.yml
This commit is contained in:
parent
2aa998a792
commit
0ecebe6d74
17
.github/workflows/nginx.yml
vendored
17
.github/workflows/nginx.yml
vendored
@ -48,24 +48,25 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Separate map directives from WAF rules
|
- name: Extract and format map directives
|
||||||
run: |
|
run: |
|
||||||
# Extract map directives into a separate file
|
# Extract map directives and ensure they are properly formatted
|
||||||
grep -h "map " waf_rules/waf_patterns/nginx/*.conf > map_directives.conf || true
|
grep -h "map " waf_rules/waf_patterns/nginx/*.conf > map_directives.conf || true
|
||||||
echo "Extracted map directives into map_directives.conf"
|
echo "Extracted map directives into map_directives.conf"
|
||||||
|
|
||||||
|
# Add closing brace if missing
|
||||||
|
if ! grep -q "}" map_directives.conf; then
|
||||||
|
echo "}" >> map_directives.conf
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Contents of map_directives.conf:"
|
echo "Contents of map_directives.conf:"
|
||||||
cat map_directives.conf
|
cat map_directives.conf
|
||||||
|
|
||||||
# Remove map directives from the WAF rules
|
|
||||||
grep -L "map " waf_rules/waf_patterns/nginx/*.conf > waf_rules_without_map.conf || true
|
|
||||||
echo "WAF rules without map directives:"
|
|
||||||
cat waf_rules_without_map.conf
|
|
||||||
|
|
||||||
- name: Merge WAF rules into a single file with a server block
|
- name: Merge WAF rules into a single file with a server block
|
||||||
run: |
|
run: |
|
||||||
# Create a merged_waf_rules.conf file with a server block
|
# Create a merged_waf_rules.conf file with a server block
|
||||||
echo "server {" > merged_waf_rules.conf
|
echo "server {" > merged_waf_rules.conf
|
||||||
cat waf_rules_without_map.conf >> merged_waf_rules.conf
|
grep -L "map " waf_rules/waf_patterns/nginx/*.conf >> merged_waf_rules.conf || true
|
||||||
echo "}" >> merged_waf_rules.conf
|
echo "}" >> merged_waf_rules.conf
|
||||||
echo "Merged WAF rules into merged_waf_rules.conf"
|
echo "Merged WAF rules into merged_waf_rules.conf"
|
||||||
echo "Contents of merged_waf_rules.conf:"
|
echo "Contents of merged_waf_rules.conf:"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user