Skip to content

feat(http): login raté re-rend la page complète stylée (encart d'erre… #55

feat(http): login raté re-rend la page complète stylée (encart d'erre…

feat(http): login raté re-rend la page complète stylée (encart d'erre… #55

Workflow file for this run

name: CI
on:
push:
branches:
- main
- prod
- preprod
- staging
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Lint Python code
uses: astral-sh/ruff-action@v3
- name: Lint Dockerfiles
uses: hadolint/hadolint-action@v3.3.0
with:
recursive: true
- name: Bandit
uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install bandit
- run: bandit -r honeypots/ pipeline/ dashboard/ -ll -ii
test:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
pip install --upgrade pip
pip install pytest
find . -name "requirements*.txt" \
-not -path "./.git/*" \
| xargs -I {} pip install -r {}
- name: Run all tests
run: pytest --tb=short -v
# Valide que les secrets d'enrichissement sont montes et fonctionnels
# (AbuseIPDB, GreyNoise) sans monter la stack.
enrich:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install -r analyzer/requirements.txt
- name: Enrichissement live (valide les secrets)
env:
ABUSEIPDB_API_KEY: ${{ secrets.ABUSEIPDB_API_KEY }}
GREYNOISE_API_KEY: ${{ secrets.GREYNOISE_API_KEY }}
run: |
python - <<'PY'
import json
from analyzer.enrichers.abuseipdb import AbuseIPDBEnricher
from analyzer.enrichers.greynoise import GreyNoiseEnricher
ip = "71.6.199.23" # scanner Shodan : exerce les 2 enrichers
abuse = AbuseIPDBEnricher().enrich(ip)
gn = GreyNoiseEnricher().enrich(ip)
print(json.dumps({"abuse": abuse, "greynoise": gn}, indent=2))
assert abuse["abuse_score"] > 0, "AbuseIPDB=0 (ABUSEIPDB_API_KEY ?)"
assert gn["greynoise_classification"] not in ("", "unknown"), "GreyNoise vide (GREYNOISE_API_KEY ?)"
print("OK: 2 enrichers alimentes par les secrets")
PY
build:
needs: test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- image: honeypot-ftp
context: ./honeypots/ftp
- image: honeypot-http
context: ./honeypots/http
- image: honeypot-ssh
context: ./honeypots/ssh
- image: honeybot
context: ./attacker
- image: honeypot-analyzer
context: .
dockerfile: analyzer/Dockerfile
steps:
- uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v6
with:
images: |
qualite863/${{ matrix.image }}
tags: |
type=ref,event=branch
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/prod' || github.ref == 'refs/heads/main' }}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Login Docker
if: github.event_name != 'pull_request'
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Buildx
uses: docker/setup-buildx-action@v4
- name: Build and push
uses: docker/build-push-action@v7
with:
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile || format('{0}/Dockerfile', matrix.context) }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=${{ matrix.image }}
cache-to: type=gha,mode=max,scope=${{ matrix.image }}
scan:
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- image: honeypot-ftp
- image: honeypot-http
- image: honeypot-ssh
- image: honeybot
- image: honeypot-analyzer
steps:
# Login requis : honeypot-analyzer est un repo Docker Hub privé.
- name: Login Docker
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: aquasecurity/trivy-action@master
with:
image-ref: "qualite863/${{ matrix.image }}:latest"
format: "table"
exit-code: 1
ignore-unfixed: true
severity: "CRITICAL,HIGH"