Blog · 2026-11-16 · Hands-on

Check a hardened RHEL 9 STIG AMI yourself

We publish an OpenSCAP score for each RHEL 9 DISA STIG image, with the date it was measured, on the Applied table. You do not have to take that number on trust. This how-to launches a StigReady Applied RHEL 9 DISA STIG image, sets your credentials, and runs the same scan on your own instance.

Before you start

Commands marked (our script) come from StigReady. Everything else is a standard RHEL or OpenSCAP command.

1. Launch and connect

  1. Subscribe from the listing, then launch the image in EC2 with your key pair.
  2. The recommended security group allows SSH only from private address ranges. Set it to your admin network's range at launch.
  3. Connect as ec2-user.
ssh -i your-key.pem ec2-user@<instance-ip>

STIG images are built with FIPS mode enabled. The build stops if FIPS mode is not on. To see it on your instance:

cat /proc/sys/crypto/fips_enabled    # 1 means FIPS mode is on

2. Set your credentials first

The STIG asks for a boot loader password, a root password and a password for sudo. AWS Marketplace does not allow an AMI to ship passwords, hashed ones included. So the image ships none, and a script on the image sets yours.

sudo stigready-set-credentials    # (our script)

The script is plain bash at /usr/sbin/stigready-set-credentials. Besides the passwords, it writes /etc/cloud/cloud.cfg.d/99-stigready-sudo-password.cfg, so cloud-init does not add NOPASSWD back for a new default user. Read it before you run it: sudo less /usr/sbin/stigready-set-credentials.

If you skip this step, the boot loader, root and sudo password rules fail in your scan. Our published score counts them as failures too.

3. Install the scanner

sudo subscription-manager register     # your Red Hat account
sudo dnf install -y openscap-scanner unzip

Installing packages writes new dnf log files under /var/log. If the rule on /var/log file permissions fails, check whether the file is one this install just wrote. Our build resets the mode of only the log files its own scanner install wrote, then scans.

4. Get the same benchmark content

We score with one pinned release of the SCAP Security Guide (SSG) from the ComplianceAsCode project. At the time of writing it is 0.1.82. To compare with our number, use the same release. Ask support which release a given image version was scored with.

cd ~
curl -fsSLO https://github.com/ComplianceAsCode/content/releases/download/v0.1.82/scap-security-guide-0.1.82.zip
echo "765e84bdce7f9055f9b9c2dd0ee2b713d4255f8eec94eac6d35ea4973c28919c  scap-security-guide-0.1.82.zip" | sha256sum -c -
unzip -o scap-security-guide-0.1.82.zip scap-security-guide-0.1.82/ssg-rhel9-ds.xml

The SHA-256 is the one our build checks before it uses the file. If the instance cannot reach GitHub, download the file elsewhere, check the hash there, and copy it over with scp.

5. Scan: read only

sudo oscap xccdf eval \
  --profile xccdf_org.ssgproject.content_profile_stig \
  --results results.xml \
  --results-arf arf.xml \
  --report report.html \
  scap-security-guide-0.1.82/ssg-rhel9-ds.xml

This is the command our build runs, with the differences described below. oscap exits 0 when every rule passes and 2 when some fail. Both mean the scan ran.

Do not add --remediate. That flag changes the system to make rules pass, and then you are no longer measuring the image you launched. Our build never runs it, and a check on every change to our build fails if it comes back.

Two things in our build differ from the plain command above:

6. Count the score our way

Our published score is pass ÷ (pass + fail) × 100. Rules that are not applicable or not selected are left out.

p=$(sudo grep -o '<result>pass</result>' results.xml | wc -l)
f=$(sudo grep -o '<result>fail</result>' results.xml | wc -l)
awk -v p="$p" -v f="$f" 'BEGIN { printf "pass=%d fail=%d score=%.1f%%\n", p, f, 100*p/(p+f) }'

Open report.html in a browser for each rule's result. Keep arf.xml: it is the full machine-readable result.

Compare your number with the published score and date. That score counts every documented exemption as a failure. Exempted rules, such as smartcard/CAC, remote log offload and a few that would break a cloud instance, fail in your scan as they did in ours. The evidence bundle lists each one with a POA&M entry and the action left to you. POA&M and SBOM available on request.

Your number can differ from ours. Setting your credentials passes rules that failed in our scan. Updates you install and changes you make after launch can move it either way. If the numbers differ and you cannot see why, tell us.

7. Leave the instance as you found it

Our build removes the scanner after it scans, so the image ships without it. To do the same:

sudo dnf remove -y openscap-scanner unzip
rm -rf ~/scap-security-guide-0.1.82*

What this does and does not show

The scan measures this instance against the SSG STIG profile on the day you run it. The image supports your configuration-management work. It does not by itself make a system compliant, authorized or assessed.

Related

Questions? contact@stigready.com