Skip to content

Commit 3776cce

Browse files
PHP2Shell Shield: layered AWS WAF virtual patch for CVE-2026-109618/109619
Terraform lab that deploys a patched PHP workload behind an ALB and an AWS WAF web ACL implementing AWS's PHP2Shell guidance: - AWSManagedRulesPHPRuleSet pinned to Version_2.3 (PHP2Shell_BODY), Core rule set and Known bad inputs managed groups - Custom signature, multipart, oversize-body and POST rate-limit rules, plus an optional label-based exception - One rule_mode variable for the Count -> Block rollout - php.ini / php-fpm hardening, patched-PHP guard in variable validation - KMS-encrypted WAF logs, saved Logs Insights queries, dashboard, alarm - tests/validate.sh covering every layer, CI with validate, tflint, checkov and shellcheck Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0 parents  commit 3776cce

34 files changed

Lines changed: 2192 additions & 0 deletions

‎.github/workflows/ci.yml‎

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
terraform:
13+
name: Terraform fmt / validate / tflint
14+
runs-on: ubuntu-latest
15+
defaults:
16+
run:
17+
working-directory: terraform
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- uses: hashicorp/setup-terraform@v3
22+
with:
23+
terraform_version: 1.7.5
24+
25+
- name: terraform fmt
26+
run: terraform fmt -check -recursive
27+
28+
- name: terraform init
29+
run: terraform init -backend=false -input=false
30+
31+
- name: terraform validate
32+
run: terraform validate
33+
34+
- uses: terraform-linters/setup-tflint@v4
35+
36+
- name: tflint
37+
run: |
38+
tflint --init --config "$GITHUB_WORKSPACE/.tflint.hcl"
39+
tflint --config "$GITHUB_WORKSPACE/.tflint.hcl" --format compact
40+
env:
41+
GITHUB_TOKEN: ${{ github.token }}
42+
43+
checkov:
44+
name: Checkov IaC security scan
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v4
48+
49+
- uses: bridgecrewio/checkov-action@v12
50+
with:
51+
directory: terraform
52+
framework: terraform
53+
quiet: true
54+
55+
shellcheck:
56+
name: ShellCheck
57+
runs-on: ubuntu-latest
58+
steps:
59+
- uses: actions/checkout@v4
60+
61+
- name: shellcheck
62+
run: shellcheck tests/*.sh scripts/*.sh

‎.gitignore‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Terraform
2+
.terraform/
3+
*.tfstate
4+
*.tfstate.*
5+
*.tfplan
6+
crash.log
7+
crash.*.log
8+
*.tfvars
9+
*.tfvars.json
10+
!*.tfvars.example
11+
override.tf
12+
override.tf.json
13+
*_override.tf
14+
*_override.tf.json
15+
16+
# OS / editor
17+
.DS_Store
18+
.vscode/
19+
.idea/

‎.tflint.hcl‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
plugin "terraform" {
2+
enabled = true
3+
preset = "recommended"
4+
}
5+
6+
plugin "aws" {
7+
enabled = true
8+
version = "0.38.0"
9+
source = "github.com/terraform-linters/tflint-ruleset-aws"
10+
}

‎LICENSE‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Joshua Amah
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)