Aller au contenu
Opsentriq.
← Articles

DevSecOps · 1 novembre 2026 · 6 min de lecture

Le durcissement STIG dans un pipeline GitOps

Traitez le socle comme n'importe quel code : appliquez-le depuis le dépôt, analysez chaque build et bloquez les régressions plutôt que de viser un score parfait.

Cet article est disponible en anglais.

Most hardening efforts fail the same way. A team spends weeks bringing servers to a STIG baseline, passes a scan, and six months later the score has drifted because changes were made by hand. The fix is not more effort at audit time. It is making the baseline part of how systems are built and changed.

1. Keep the baseline in version control

Express hardening as code, usually Ansible roles or a hardened image build. The ComplianceAsCode project (the source of the SCAP Security Guide) publishes both SCAP content and remediation playbooks for RHEL and other platforms, which makes a solid starting point. Store your tailoring decisions next to the code so every deviation from the profile has a reviewer and a reason.

2. Scan every build, not every quarter

Run OpenSCAP against the image or test host in CI and keep the results as build artifacts. The ARF results file is the evidence; the HTML report is for people.

oscap xccdf eval \
  --profile xccdf_org.ssgproject.content_profile_stig \
  --results-arf arf.xml \
  --report report.html \
  /usr/share/xml/scap/ssg/content/ssg-rhel9-ds.xml

3. Gate on regressions

A pipeline that fails until every rule passes gets switched off. Instead, record the current failing rules, accept them as tracked exceptions, and fail the build only when a new rule starts failing. The exception list becomes a remediation backlog with owners and dates.

stig-scan:
  stage: test
  script:
    - ./scripts/run-oscap.sh
    - ./scripts/compare-to-accepted.sh arf.xml accepted-failures.txt
  artifacts:
    when: always
    paths: [arf.xml, report.html]
    expire_in: 1 year

4. Deploy only what was scanned

Promote the exact artifact that passed: an immutable image tag or digest, signed after the scan. GitOps then deploys that reference and nothing else. If someone rebuilds, the scan runs again.

5. Watch for drift

Schedule the same scan against running systems and compare it to the build result. Differences mean a manual change, which is either reverted or turned into code. Over time, the evidence an assessor asks for is simply the history of your pipeline.

Rédigé par l'équipe d'ingénierie Opsentriq. Les commandes sont données à titre d'exemple ; adaptez-les à votre environnement.