-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Fargate-based forensic analysis infrastructure #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
781d5a3
feat: add Fargate-based forensic analysis infrastructure
Stealinglight d71fe6f
fix: resolve Docker build CI failures
Stealinglight d293fc8
fix: remove unused imports and variables to fix ESLint errors
Stealinglight 2a70f4d
fix: remove unused pytsk3 and libewf-python packages causing build fa…
Stealinglight 32805bd
fix: share forensics-base image between CI jobs via artifact
Stealinglight b739c2f
fix: use plain docker build for tool images to see local base image
Stealinglight 4d8fe1d
fix: add missing build dependencies to yara and log2timeline Dockerfiles
Stealinglight 351196c
fix: remove non-existent hashlib-compat package from yara requirements
Stealinglight File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,217 @@ | ||
| name: Build Forensics Docker Images | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - 'packages/lambda-py/**' | ||
| - '.github/workflows/docker-build.yml' | ||
| pull_request: | ||
| branches: [main] | ||
| paths: | ||
| - 'packages/lambda-py/**' | ||
| - '.github/workflows/docker-build.yml' | ||
| workflow_dispatch: | ||
| inputs: | ||
| push_to_ecr: | ||
| description: 'Push images to ECR' | ||
| required: false | ||
| type: boolean | ||
| default: false | ||
| specific_tool: | ||
| description: 'Build specific tool (leave empty for all)' | ||
| required: false | ||
| type: choice | ||
| options: | ||
| - '' | ||
| - forensics-base | ||
| - yara | ||
| - clamav | ||
| - evidence-miner | ||
| - log2timeline | ||
|
|
||
| env: | ||
| AWS_REGION: us-east-1 | ||
| PROJECT_NAME: snapshot-sleuth | ||
|
|
||
| jobs: | ||
| build-base: | ||
| name: Build forensics-base | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| base-image: ${{ steps.build.outputs.image }} | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Build base image | ||
| id: build | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: packages/lambda-py/forensics-base | ||
| file: packages/lambda-py/forensics-base/Dockerfile | ||
| push: false | ||
| load: true | ||
| tags: ${{ env.PROJECT_NAME }}/forensics-base:${{ github.sha }} | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
|
|
||
| - name: Scan base image for vulnerabilities | ||
| uses: aquasecurity/trivy-action@master | ||
| with: | ||
| image-ref: ${{ env.PROJECT_NAME }}/forensics-base:${{ github.sha }} | ||
| format: 'sarif' | ||
| output: 'trivy-base-results.sarif' | ||
| severity: 'CRITICAL,HIGH' | ||
|
|
||
| - name: Upload Trivy results | ||
| uses: github/codeql-action/upload-sarif@v3 | ||
| if: always() | ||
| with: | ||
| sarif_file: 'trivy-base-results.sarif' | ||
| category: forensics-base | ||
|
|
||
| build-tools: | ||
| name: Build ${{ matrix.tool }} | ||
| runs-on: ubuntu-latest | ||
| needs: build-base | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| tool: [yara, clamav, evidence-miner, log2timeline] | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Build tool image | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: packages/lambda-py/${{ matrix.tool }}-tool | ||
| file: packages/lambda-py/${{ matrix.tool }}-tool/Dockerfile | ||
| push: false | ||
| load: true | ||
| tags: ${{ env.PROJECT_NAME }}/${{ matrix.tool }}:${{ github.sha }} | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
|
|
||
| - name: Scan tool image for vulnerabilities | ||
| uses: aquasecurity/trivy-action@master | ||
| with: | ||
| image-ref: ${{ env.PROJECT_NAME }}/${{ matrix.tool }}:${{ github.sha }} | ||
| format: 'sarif' | ||
| output: 'trivy-${{ matrix.tool }}-results.sarif' | ||
| severity: 'CRITICAL,HIGH' | ||
|
|
||
| - name: Upload Trivy results | ||
| uses: github/codeql-action/upload-sarif@v3 | ||
| if: always() | ||
| with: | ||
| sarif_file: 'trivy-${{ matrix.tool }}-results.sarif' | ||
| category: ${{ matrix.tool }} | ||
|
|
||
| push-to-ecr: | ||
| name: Push to ECR | ||
| runs-on: ubuntu-latest | ||
| needs: [build-base, build-tools] | ||
| if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event.inputs.push_to_ecr == 'true') | ||
| environment: production | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Configure AWS credentials | ||
| uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| aws-region: ${{ env.AWS_REGION }} | ||
|
|
||
| - name: Login to Amazon ECR | ||
| id: login-ecr | ||
| uses: aws-actions/amazon-ecr-login@v2 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Build and push forensics-base | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: packages/lambda-py/forensics-base | ||
| file: packages/lambda-py/forensics-base/Dockerfile | ||
| push: true | ||
| tags: | | ||
| ${{ steps.login-ecr.outputs.registry }}/${{ env.PROJECT_NAME }}/forensics-base:${{ github.sha }} | ||
| ${{ steps.login-ecr.outputs.registry }}/${{ env.PROJECT_NAME }}/forensics-base:latest | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
|
|
||
| - name: Build and push yara | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: packages/lambda-py/yara-tool | ||
| file: packages/lambda-py/yara-tool/Dockerfile | ||
| push: true | ||
| tags: | | ||
| ${{ steps.login-ecr.outputs.registry }}/${{ env.PROJECT_NAME }}/yara:${{ github.sha }} | ||
| ${{ steps.login-ecr.outputs.registry }}/${{ env.PROJECT_NAME }}/yara:latest | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
|
|
||
| - name: Build and push clamav | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: packages/lambda-py/clamav-tool | ||
| file: packages/lambda-py/clamav-tool/Dockerfile | ||
| push: true | ||
| tags: | | ||
| ${{ steps.login-ecr.outputs.registry }}/${{ env.PROJECT_NAME }}/clamav:${{ github.sha }} | ||
| ${{ steps.login-ecr.outputs.registry }}/${{ env.PROJECT_NAME }}/clamav:latest | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
|
|
||
| - name: Build and push evidence-miner | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: packages/lambda-py/evidence-miner-tool | ||
| file: packages/lambda-py/evidence-miner-tool/Dockerfile | ||
| push: true | ||
| tags: | | ||
| ${{ steps.login-ecr.outputs.registry }}/${{ env.PROJECT_NAME }}/evidence-miner:${{ github.sha }} | ||
| ${{ steps.login-ecr.outputs.registry }}/${{ env.PROJECT_NAME }}/evidence-miner:latest | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
|
|
||
| - name: Build and push log2timeline | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: packages/lambda-py/log2timeline-tool | ||
| file: packages/lambda-py/log2timeline-tool/Dockerfile | ||
| push: true | ||
| tags: | | ||
| ${{ steps.login-ecr.outputs.registry }}/${{ env.PROJECT_NAME }}/log2timeline:${{ github.sha }} | ||
| ${{ steps.login-ecr.outputs.registry }}/${{ env.PROJECT_NAME }}/log2timeline:latest | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
|
|
||
| - name: Summary | ||
| env: | ||
| COMMIT_SHA: ${{ github.sha }} | ||
| run: | | ||
| echo "## Docker Images Published" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo "| Image | Tag |" >> $GITHUB_STEP_SUMMARY | ||
| echo "| ----- | --- |" >> $GITHUB_STEP_SUMMARY | ||
| echo "| forensics-base | ${COMMIT_SHA}, latest |" >> $GITHUB_STEP_SUMMARY | ||
| echo "| yara | ${COMMIT_SHA}, latest |" >> $GITHUB_STEP_SUMMARY | ||
| echo "| clamav | ${COMMIT_SHA}, latest |" >> $GITHUB_STEP_SUMMARY | ||
| echo "| evidence-miner | ${COMMIT_SHA}, latest |" >> $GITHUB_STEP_SUMMARY | ||
| echo "| log2timeline | ${COMMIT_SHA}, latest |" >> $GITHUB_STEP_SUMMARY | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.