Operating Systems AWS

Ubuntu 22.04 LTS STIG-Hardened on AWS User Guide

| Product: Ubuntu 22.04 LTS STIG-Hardened on AWS

Overview

This guide covers launching and verifying the Ubuntu 22.04 LTS STIG-Hardened AMI from cloudimg on Amazon EC2. It is one version of the cloudimg Ubuntu listing on AWS Marketplace; you pick it as the software version when you subscribe and launch.

Ubuntu 22.04 (Jammy Jellyfish) is a long term support (LTS) release from Canonical, with standard security maintenance to 2027. This image starts from Ubuntu Server 22.04 LTS for EC2 and adds three things:

  • DISA STIG remediation. The image is remediated with the OpenSCAP DISA STIG profile for Ubuntu 22.04 from SCAP Security Guide 0.1.82, then rebooted and evaluated. On this build 191 of 195 scored rules pass (97.9%). 23 rules are waived because they cannot work on an EC2 image, each with its reason, and the four rules that do not pass are explained below. The HTML report, the machine-readable results, the tailoring, the waiver list and a summary ship in /usr/share/doc/cloudimg/.
  • EC2 defaults that keep you in control. Key-only SSH as ubuntu, root locked, no password on any account, IMDSv2 required, a host firewall (ufw) that allows SSH in and everything out, the AWS Systems Manager agent installed as a normal package, and time from the Amazon Time Sync Service.
  • Fully patched at build time, with unattended security upgrades switched on for your instance.

The remediation uses the free, open source SCAP Security Guide content and OpenSCAP. It does not use Canonical's Ubuntu Security Guide (USG) tool, and the image needs no Ubuntu Pro subscription.

What is on the image: Ubuntu Server 22.04 LTS (AWS kernel), cloud-init, OpenSSH, ufw, chrony, the AWS Systems Manager agent, AppArmor, auditd with the STIG audit rules, AIDE file integrity checking, OpenSCAP and the pinned SCAP Security Guide content used for the evaluation.

Default user: ubuntu · Architecture: x86_64 · Root volume: 8 GiB gp3 (grows to the size you choose at launch)

These images are remediated with an OpenSCAP profile and ship their own evaluation report. A STIG is a configuration standard published by the US Defense Information Systems Agency (DISA). The profile result is not a DISA approval or an authorisation to operate, and DISA has not reviewed or certified this image.

Security posture

  • No known credential. There is no default password and no baked in SSH key. The only key that works is the EC2 key pair you choose at launch, which cloud-init installs for ubuntu on first boot.
  • Key-only SSH. PasswordAuthentication no, PermitRootLogin no, keyboard-interactive off, and the STIG's restricted SSH ciphers and MACs. The root account has no password and is locked.
  • Per-instance identity. SSH host keys and the machine ID are generated fresh on every instance, so no two instances share a host key.
  • IMDSv2 required. The AMI is registered with ImdsSupport v2.0, so instances launched from it refuse token-less (IMDSv1) metadata requests by default.
  • Host firewall. ufw denies inbound traffic except SSH on 22 and allows outbound traffic, so the SSM agent, metadata service, DNS, time and package updates keep working.
  • Only SSH listens on the network. Everything else on the image listens on loopback only.

Prerequisites

  1. An AWS account and permission to launch EC2 instances
  2. An EC2 key pair in the Region you launch in
  3. A security group that allows TCP 22 from your own address (not from the whole internet)

Recommended instance type: m5.large. The image runs on any current x86_64 instance type.

Step 1: Launch the instance

Option A: AWS Marketplace console

  1. Open the cloudimg Ubuntu listing on AWS Marketplace and choose Continue to Subscribe, then Continue to Configuration.
  2. Under Software version, choose Ubuntu 22.04 LTS STIG-Hardened, then pick your Region and choose Continue to Launch.
  3. Choose Launch through EC2 for the full launch wizard.
  4. Pick an instance type (m5.large recommended) and your key pair.
  5. Under Network settings, allow SSH (port 22) from My IP only.
  6. Under Configure storage, set the root volume size you want (8 GiB minimum). The root filesystem grows to fill it on first boot. If your policy requires encryption at rest, set Encrypted on the volume here (see Step 5).
  7. Choose Launch instance.

Option B: AWS CLI

Run this on your own workstation. Replace the AMI ID with the one shown for your Region on the Marketplace launch page, and the key pair, security group and subnet with your own:

aws ec2 run-instances \
  --image-id ami-0123456789abcdef0 \
  --instance-type m5.large \
  --key-name my-key-pair \
  --security-group-ids sg-0123456789abcdef0 \
  --subnet-id subnet-0123456789abcdef0 \
  --block-device-mappings 'DeviceName=/dev/sda1,Ebs={VolumeSize=20,VolumeType=gp3,Encrypted=true}' \
  --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=ubuntu-2204-stig}]'

You do not need --metadata-options: the AMI already makes IMDSv2 required.

Step 2: Connect via SSH

From your workstation, connect as ubuntu with the key pair you chose:

ssh -i ~/.ssh/my-key-pair.pem ubuntu@<public-ip>

Before the login completes, SSH prints the Standard Mandatory DoD Notice and Consent Banner that the STIG requires (Step 9 shows how to replace it with your own organisation's notice). There is no password to enter. If SSH asks for one, or says Too many authentication failures, see Troubleshooting below.

You can also connect without opening port 22 at all through AWS Systems Manager Session Manager, if the instance has an instance profile that allows Systems Manager. The agent is installed and running on this image.

Step 3: Confirm the release

grep -E '^(NAME|VERSION|ID|VERSION_ID|PRETTY_NAME)=' /etc/os-release
uname -srm
dpkg --print-architecture

Expected output:

PRETTY_NAME="Ubuntu 22.04.5 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.5 LTS (Jammy Jellyfish)"
ID=ubuntu
Linux 6.8.0-1066-aws x86_64
amd64

Terminal output showing os-release reporting Ubuntu 22.04.5 LTS Jammy Jellyfish, uname reporting the x86_64 AWS kernel, dpkg reporting amd64, the first lines of the DoD notice in /etc/issue.net, and sssd not installed

The -aws kernel is Canonical's kernel flavour for EC2, with the Nitro network and NVMe drivers built in. Your kernel version may be newer if updates have installed since this image was built.

Step 4: Read the compliance evidence

The evaluation the build ran after its reboot ships on the image:

ls -lh /usr/share/doc/cloudimg/
python3 -c "import json; s=json.load(open('/usr/share/doc/cloudimg/stig-summary.json')); print('profile:      ', s['profileLabel'], '(SCAP Security Guide', s['ssgVersion'] + ')'); print('scored rules: ', s['scored'], ' pass:', s['pass'], ' fail:', s['fail'], ' errors:', s['error'], ' rate:', str(s['ratePct']) + '%'); print('waived:       ', s['waived'], ' not applicable:', s['notapplicable'], ' not checked:', s['notchecked']); print('evaluated at: ', s['evaluatedAt'])"

Expected output:

total 19M
-rw-r--r-- 1 root root 1.6K Oct 18 21:27 scap-security-guide-LICENSE.txt
-rw-r--r-- 1 root root  17M Oct 18 21:30 stig-arf.xml
-rw-r--r-- 1 root root 2.1M Oct 18 21:30 stig-report.html
-rw-r--r-- 1 root root 1.3K Oct 18 21:30 stig-summary.json
-rw-r--r-- 1 root root 4.2K Oct 18 21:30 stig-tailoring.xml
-rw-r--r-- 1 root root 8.9K Oct 18 21:30 stig-waivers.txt
profile:       DISA STIG (SCAP Security Guide 0.1.82)
scored rules:  195  pass: 191  fail: 4  errors: 0  rate: 97.9%
waived:        23  not applicable: 7  not checked: 5
evaluated at:  2026-10-18T21:30:24Z

Terminal output showing the shipped compliance files in /usr/share/doc/cloudimg, the summary of the DISA STIG evaluation with 195 scored rules, 191 passing, 4 failing and a 97.9 percent pass rate, the four failing rule names and the 23 waived rules grouped by category

  • stig-report.html is the full OpenSCAP report, rule by rule. Copy it to your workstation and open it in a browser.
  • stig-arf.xml is the same evaluation in the machine-readable ARF format, for compliance tooling.
  • stig-tailoring.xml is the exact tailoring used, so you can re-run the same evaluation (Step 6).
  • The pass rate is pass / (pass + fail + error + unknown). Rules that are not applicable to this machine, not selected, waived, or that need a manual check (not checked) are not counted.

To copy the report to your workstation, run this on the workstation:

scp -i ~/.ssh/my-key-pair.pem ubuntu@<public-ip>:/usr/share/doc/cloudimg/stig-report.html .

The 23 waived rules

grep -v '^#' /usr/share/doc/cloudimg/stig-waivers.txt | cut -f1,2

Expected output:

sudo_remove_nopasswd    [default-user-sudo]
grub2_password  [serial-console-and-boot]
grub2_uefi_password [serial-console-and-boot]
accounts_maximum_age_login_defs [key-only-account-aging]
account_disable_post_pw_expiration  [key-only-account-aging]
auditd_data_disk_full_action    [audit-sizing-8gb]
is_fips_mode_enabled    [fips]
install_smartcard_packages  [smartcard]
package_opensc_installed    [smartcard]
smartcard_configure_ca  [smartcard]
smartcard_configure_cert_checking   [smartcard]
smartcard_configure_crl [smartcard]
smartcard_pam_enabled   [smartcard]
sssd_enable_smartcards  [smartcard]
package_sssd_installed  [sssd-pki]
package_nss_sss_installed   [sssd-pki]
package_pam_sss_installed   [sssd-pki]
service_sssd_enabled    [sssd-pki]
sssd_certification_path_trust_anchor    [sssd-pki]
sssd_enable_pam_services    [sssd-pki]
sssd_enable_user_cert   [sssd-pki]
sssd_offline_cred_expiration    [sssd-pki]
auditd_audispd_configure_remote_server  [audit-remote-destination]

The full reason for each is the third column of the same file. In short:

  • Passwordless sudo for ubuntu (default-user-sudo): ubuntu has no password; cloud-init gives it password-free sudo. Removing NOPASSWD would leave the only administrator unable to use sudo at all. Accounts you create yourself still need their password for sudo (Step 12).
  • Boot loader passwords (serial-console-and-boot): a GRUB password would have to be baked into the image, giving every instance the same secret. Set your own if you need one.
  • Password ageing defaults (key-only-account-aging): the accounts cloud-init creates are key-only. A default ageing limit would expire them and lock the SSH key out, so PASS_MAX_DAYS stays unlimited. Set an age on accounts you give a password with sudo chage -M 60 <user>.
  • Halt on a full audit disk (audit-sizing-8gb): on a single 8 GiB root volume the audit log shares the disk with the operating system, so halting when the disk fills would take the whole instance down. auditd rotates its log at 8 MB, keeps five files, and suspends logging if the disk fills (Step 11). Put /var/log/audit on its own volume if you need the STIG's halt action.
  • FIPS mode (fips): FIPS needs a FIPS-validated kernel and modules, which on Ubuntu come with an Ubuntu Pro subscription. FIPS is not enabled or claimed.
  • Smart cards (smartcard): EC2 instances have no smart-card readers, so the smart-card (CAC/PIV) packages and PAM settings would only add a login path nobody can use.
  • SSSD for PKI logins (sssd-pki): the STIG uses SSSD only as the client for DoD PKI smart-card logins against a directory. The content installs SSSD, its PAM and NSS modules and a configuration for a placeholder domain, and SSSD refuses to start without a real domain, so the service failed on every boot. SSSD is therefore not installed. If you join a directory, install SSSD and configure it for your own domain and certificate authority.
  • Remote audit server (audit-remote-destination): the STIG sends audit records to a remote log server through audisp-remote, and the content fills in a placeholder host name (logcollector). An image cannot know your log server, and the placeholder would send every audit record to whichever host answers to that name in your network, or queue and drop them when none does. audisp-remote is installed but inactive; Step 9 shows how to point it at your own collector.

The four rules that do not pass

python3 -c "import json; [print(r) for r in json.load(open('/usr/share/doc/cloudimg/stig-summary.json'))['failingRules']]"

Expected output:

auditd_offload_logs
encrypt_partitions
ufw_rate_limit
verify_use_mappers

What each one means on this image:

  • auditd_offload_logs: the STIG requires audit records to be copied off the machine regularly. Where they go is your choice (CloudWatch Logs through the CloudWatch agent, a central syslog server, or audisp-remote), so an image cannot set it (the remote audit server is waived for the same reason, above). The audit rules are loaded and auditd is running (Step 9).
  • encrypt_partitions: the STIG wants the disks encrypted inside the operating system (LUKS). This image boots from a plain EBS volume. Encryption at rest on EC2 is done by EBS: set Encrypted on the volume when you launch (Step 1), or turn on EBS encryption by default for your account. EBS encryption is invisible to the operating system, so this check still reports fail on an encrypted volume.
  • ufw_rate_limit: the STIG wants ufw to rate-limit incoming connections (ufw limit). That allows a source six new connections in 30 seconds, which breaks tools that open several SSH sessions in a row (Ansible, CI pipelines, scp loops), so it is not switched on. Your security group already restricts who can reach port 22. To apply it, run sudo ufw limit 22/tcp.
  • verify_use_mappers: this checks the smart-card certificate mapping in pam_pkcs11. The smart-card packages are not installed (see the waived rules), so there is no pam_pkcs11 configuration to set.

Step 5: Re-run the evaluation yourself

You can repeat the evaluation at any time with the same content and tailoring. It takes under a minute:

sudo oscap xccdf eval \
  --tailoring-file /usr/share/doc/cloudimg/stig-tailoring.xml \
  --profile xccdf_co.cloudimg_profile_stig_ec2_single \
  --results /tmp/stig-check-results.xml --report /tmp/stig-check-report.html \
  /usr/share/xml/scap/ssg/content/ssg-ubuntu2204-ds.xml > /tmp/stig-check.log 2>&1
echo "oscap exit code: $? (2 = at least one rule did not pass)"
sudo python3 -c "import re,collections; c=collections.Counter(re.findall(r'<result>(\w+)</result>', open('/tmp/stig-check-results.xml').read())); s=sum(c[k] for k in ('pass','fail','error','unknown')); print(dict(sorted(c.items()))); print('pass rate: %.1f%%' % (100.0*c['pass']/s))"

Expected output on a freshly launched instance:

oscap exit code: 2 (2 = at least one rule did not pass)
{'fail': 4, 'notapplicable': 7, 'notchecked': 5, 'notselected': 432, 'pass': 191}
pass rate: 97.9%

Your own report is at /tmp/stig-check-report.html. As you install software and change settings, re-run this to see how your changes affect the result.

Step 6: Confirm IMDSv2 is required

curl -s -o /dev/null -w 'IMDSv1 request without a token: HTTP %{http_code}\n' http://169.254.169.254/latest/meta-data/instance-id
TOKEN=$(curl -s -X PUT -H 'X-aws-ec2-metadata-token-ttl-seconds: 60' http://169.254.169.254/latest/api/token)
curl -s -H "X-aws-ec2-metadata-token: $TOKEN" -w '\n' http://169.254.169.254/latest/meta-data/placement/region

Expected output (your Region may differ):

IMDSv1 request without a token: HTTP 401
us-east-1

A request without a session token is refused with HTTP 401, and the same request with a token works. Scripts and SDKs on the instance must use IMDSv2; every current AWS SDK and the AWS CLI do this automatically.

Step 7: The host firewall and listening ports

sudo ufw status verbose
sudo ss -tlnp

Expected output:

Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip

To                         Action      From
--                         ------      ----
Anywhere on lo             ALLOW IN    Anywhere
22/tcp                     ALLOW IN    Anywhere
Anywhere (v6) on lo        ALLOW IN    Anywhere (v6)
22/tcp (v6)                ALLOW IN    Anywhere (v6)

State  Recv-Q Send-Q Local Address:Port Peer Address:PortProcess
LISTEN 0      4096   127.0.0.53%lo:53        0.0.0.0:*    users:(("systemd-resolve",pid=412,fd=14))
LISTEN 0      100        127.0.0.1:25        0.0.0.0:*    users:(("master",pid=1152,fd=13))
LISTEN 0      128          0.0.0.0:22        0.0.0.0:*    users:(("sshd",pid=656,fd=3))
LISTEN 0      128             [::]:22           [::]:*    users:(("sshd",pid=656,fd=4))
LISTEN 0      100            [::1]:25           [::]:*    users:(("master",pid=1152,fd=14))

Terminal output showing ufw active with default deny incoming and allow outgoing and SSH allowed on 22/tcp, the listening addresses with only port 22 on all interfaces and DNS and mail on loopback, and a token-less IMDSv1 request refused with HTTP 401

Only sshd listens on the network. The DNS stub resolver (53) and the local mail relay (25, for system mail) listen on loopback only.

Opening a port for your own service takes two steps: allow it in the instance's security group, and allow it in ufw. For example, for a web server on 443, run on the instance:

sudo ufw allow 443/tcp

If a port is open in the security group but not in ufw (or the other way round), the traffic will not arrive.

Step 8: Time sync and the Systems Manager agent

systemctl is-active chrony amazon-ssm-agent
chronyc -n sources
dpkg -s snapd >/dev/null 2>&1 && echo "snapd: installed" || echo "snapd: not installed"

Expected output (the pool servers and timings vary):

active
active
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^* 169.254.169.123               3   4   377     1  -2702ns[-4992ns] +/-  426us
^- 91.189.91.157                 2   6    37    32   +738us[ +734us] +/-   29ms
^- 185.125.190.57                2   6    37    32  -3491us[-3494us] +/-   45ms
^- 185.125.190.56                2   6    37    33  -1314us[-1318us] +/-   47ms
^- 185.125.190.58                2   6    37    34  +1951us[+1963us] +/-   50ms
^- 108.32.93.57                  2   6    37    33  +1214us[+1210us] +/- 4865us
^- 66.244.16.123                 2   6    37    33  -1211us[-1215us] +/-   62ms
^- 23.155.72.147                 2   6    37    32  +1341us[+1337us] +/-   62ms
^- 66.42.71.197                  2   6    37    32  -2174us[-2178us] +/-   46ms
snapd: not installed

The ^* marks the source chrony is using: 169.254.169.123, the Amazon Time Sync Service. It is reachable from every instance without internet access, so time stays correct in a private subnet too. The public Ubuntu pool servers are fallbacks.

The AWS Systems Manager agent is installed from Amazon's Debian package rather than as a snap, and snapd is removed.

Step 9: STIG settings on the instance

sudo sshd -T | grep -E '^(permitrootlogin|passwordauthentication|pubkeyauthentication|clientaliveinterval|clientalivecountmax|x11forwarding|banner|ciphers|macs|kexalgorithms) '
sudo passwd -S root
grep -h '^TMOUT' /etc/profile.d/*.sh
grep -vE '^\s*(#|$)' /etc/security/faillock.conf
grep -vE '^\s*(#|$)' /etc/security/pwquality.conf
grep -E '^(UMASK|PASS_MIN_DAYS|PASS_MAX_DAYS|ENCRYPT_METHOD)' /etc/login.defs
sudo auditctl -s | grep -E '^(enabled|failure)'
sudo auditctl -l | wc -l
sudo aa-status --enabled && echo "apparmor: enabled"
for p in sssd libpam-sss libnss-sss; do dpkg -s "$p" >/dev/null 2>&1 && echo "$p: installed" || echo "$p: not installed"; done

Expected output:

clientaliveinterval 600
clientalivecountmax 1
permitrootlogin no
pubkeyauthentication yes
passwordauthentication no
x11forwarding no
ciphers aes256-ctr,aes256-gcm@openssh.com,aes128-ctr,aes128-gcm@openssh.com
macs hmac-sha2-512,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha2-256-etm@openssh.com
banner /etc/issue.net
kexalgorithms ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256
root L 10/14/2026 0 99999 7 -1
TMOUT=900
audit
deny = 3
fail_interval = 900
silent
unlock_time = 0
dcredit = -1
dictcheck = 1
difok = 8
enforcing = 1
lcredit = -1
minlen = 15
ocredit = -1
ucredit = -1
UMASK 077
PASS_MAX_DAYS   99999
PASS_MIN_DAYS 1
ENCRYPT_METHOD SHA512
enabled 1
failure 1
60
apparmor: enabled
sssd: not installed
libpam-sss: not installed
libnss-sss: not installed

Terminal output showing the effective SSH settings with root login and password authentication off, a ten minute idle timeout and the STIG ciphers and MACs, the root account locked, the faillock and password quality settings, the shell timeout, 60 audit rules loaded, auditd, AppArmor, chrony and the SSM agent active, and chrony synchronised to the Amazon Time Sync Service

What these mean day to day:

  • SSH. Root login and passwords are off. The ciphers, MACs and key exchange are the STIG's approved set (AES ciphers, SHA-2 MACs, NIST elliptic-curve and group-exchange Diffie-Hellman key exchange), which current SSH clients support. With clientaliveinterval 600 and clientalivecountmax 1, the server checks a silent connection every ten minutes and drops it if the client does not answer.
  • Shell timeout. TMOUT=900 is read-only, so an interactive shell left idle for 15 minutes exits. Long jobs should run under tmux, screen, nohup or a systemd unit rather than in an open terminal.
  • Account lockout. faillock locks an account after 3 wrong passwords within 15 minutes, and unlock_time = 0 means it stays locked until an administrator unlocks it (see Troubleshooting). This only affects accounts that have a password, because SSH is key-only.
  • Passwords you set. New passwords need at least 15 characters with an upper case letter, a lower case letter, a digit and a symbol, may not be a dictionary word, and may be changed at most once a day.
  • New files. The default umask for new accounts is 077, so new home directories and files are private to their owner.
  • Audit. auditd is running with the STIG's 60 audit rules (privileged commands, identity files, module loading, permission changes and more). The audit log is /var/log/audit/audit.log. To also send the records to your own log server with audisp-remote, set remote_server = <your-log-server> in /etc/audit/audisp-remote.conf, set active = yes in /etc/audit/plugins.d/au-remote.conf, then run sudo systemctl restart auditd. The default port is TCP 60, which your collector must accept.
  • L in the passwd -S root line means the root account is locked.

The login banner. /etc/issue.net (shown by SSH) carries the Standard Mandatory DoD Notice and Consent Banner, which the STIG requires word for word on US Department of Defense systems. If your organisation is not a DoD system or uses its own notice, replace the text in both banner files, for example:

sudo cp /etc/issue.net /etc/issue.net.dod
echo "Authorized users only. All activity may be monitored and reported." | sudo tee /etc/issue.net /etc/issue

EC2 Serial Console and recovery. No account on this image has a password, so the serial console cannot log in until you set one. If you want serial console access, set a password for your own user on your running instance (the password is yours and is not on the image; it must meet the rules above):

sudo passwd ubuntu

Step 10: Patch level and automatic updates

The image is fully patched at build time. Check what is pending now:

sudo apt-get update -qq
apt-get -s -o APT::Get::Always-Include-Phased-Updates=true dist-upgrade | awk '/^Inst /{n++} END{print "pending upgrades: " n+0}'
apt-mark showhold
uname -r

Expected output on an instance launched soon after the image was built (later launches show the updates released since):

pending upgrades: 0
6.8.0-1066-aws

unattended-upgrades is on, so security updates install automatically every day. To update everything now, run:

sudo apt-get update && sudo apt-get -y dist-upgrade

Reboot if a new kernel was installed:

sudo systemctl reboot

Step 11: Disk size, swap and file integrity

df -h /
swapon --noheadings --show | wc -l
sudo ls -l /etc/cron.daily/aide

Expected output with the default 8 GiB root volume (on a larger volume, Size is larger):

Filesystem      Size  Used Avail Use% Mounted on
/dev/root       7.6G  2.0G  5.6G  27% /
0
-rwxr-xr-x 1 root root 34194 Dec 30  2021 /etc/cron.daily/aide
  • Disk growth. cloud-init grows the root partition and filesystem to the volume size on first boot. To grow later, increase the EBS volume size in the console or with aws ec2 modify-volume, then reboot (or run sudo growpart /dev/nvme0n1 1 && sudo resize2fs /dev/nvme0n1p1).
  • Swap. The image has no swap. Add a swap file yourself if your workload needs one.
  • AIDE. The file integrity database is built from the image's own files, and Ubuntu 22.04's AIDE package runs its daily check from /etc/cron.daily/aide.
  • Audit log space. On the 8 GiB default, the audit log shares the root filesystem. auditd rotates /var/log/audit/audit.log at 8 MB and keeps five files, so local audit history is short on a busy machine: offload the logs (see auditd_offload_logs in Step 4), and launch with a larger root volume or put /var/log/audit on its own EBS volume if you keep more locally.

Step 12: Install software and add users

The instance uses the standard Ubuntu archives:

sudo apt-get update -qq
apt-cache policy nginx | sed -n '1,3p'

Expected output (the version changes over time):

nginx:
  Installed: (none)
  Candidate: 1.18.0-6ubuntu14.21

Install and start software in the usual way, for example sudo apt-get install -y nginx then sudo systemctl enable --now nginx, and open its port in the security group and ufw (Step 7). Re-run the evaluation (Step 5) afterwards to see whether the new software changed the result.

To add another administrator, create the account, add it to the sudo group and give it an SSH key:

sudo adduser --disabled-password --gecos "" alice
sudo usermod -aG sudo alice
sudo install -d -m 700 -o alice -g alice /home/alice/.ssh
echo "ssh-ed25519 AAAA... alice@laptop" | sudo tee /home/alice/.ssh/authorized_keys
sudo chown alice:alice /home/alice/.ssh/authorized_keys && sudo chmod 600 /home/alice/.ssh/authorized_keys
sudo passwd alice

Because SSH is key-only, a new account needs its key in authorized_keys. The password you set with sudo passwd alice is what sudo asks for (it must meet the password rules in Step 9). If your policy ages passwords, set it per account, for example sudo chage -M 60 alice. Only ubuntu, created by cloud-init, has password-free sudo.

Common use cases

  • A base for workloads that must show DISA STIG alignment on Ubuntu 22.04, with the evaluation report already on the machine
  • Government, defence-supply-chain and regulated workloads that start from a STIG baseline instead of hardening by hand
  • Software that is certified or packaged for Ubuntu 22.04 rather than 24.04
  • Fleets managed through Systems Manager, with IMDSv2 required from the first boot
  • A starting point for your own golden image: add your software, re-run Step 5, and keep the report with your build

Troubleshooting

SSH says "Too many authentication failures"

If your SSH agent holds several keys, it can use up the server's attempts before it offers the right one. Tell SSH to offer only the key you name:

ssh -o IdentitiesOnly=yes -i ~/.ssh/my-key-pair.pem ubuntu@<public-ip>

SSH or the shell disconnects when idle

That is the STIG's shell timeout: an interactive shell left idle for 15 minutes exits (TMOUT=900, read-only). Run long jobs under tmux, screen or nohup, or as a systemd unit. If the connection itself drops while you are idle, a network device between you and the instance is closing quiet connections; a client-side keep-alive helps (ssh -o ServerAliveInterval=60 ...).

Cannot connect via SSH

  1. Check the instance is running and has passed its status checks.
  2. Check the security group allows TCP 22 from your current public address.
  3. Use the user name ubuntu and the key pair chosen at launch. Password login is disabled, so a wrong key never falls back to a password prompt.
  4. If your SSH client is very old, it may not support the STIG ciphers and key exchange. Update it.
  5. If you changed ufw, make sure 22/tcp is still allowed. Session Manager (Step 2) still works if SSH is blocked, provided the instance has a Systems Manager instance profile.

An account is locked after wrong passwords

faillock keeps an account locked after three failures until an administrator clears it. From ubuntu (or Session Manager), check and reset it:

sudo faillock --user alice
sudo faillock --user alice --reset

My service is running but not reachable

Allow the port in both the security group and ufw (Step 7). sudo ufw status shows the ufw rules; sudo ss -tlnp shows whether the service listens on all addresses or only on loopback.

A tool that uses instance metadata fails

The image requires IMDSv2. Old scripts that call http://169.254.169.254/ without a token get HTTP 401. Update them to request a token first (Step 6), or use the AWS CLI or a current SDK.

Package manager issues

Refresh the package lists first:

sudo apt-get update

If the archives are unreachable, check that the instance has outbound internet access (a public IP or a NAT gateway) and that DNS resolves:

getent hosts archive.ubuntu.com

Important notes

Ubuntu is free and open source software. It is a distribution of thousands of packages, each under its own licence (GPL, LGPL, MIT, BSD, Apache 2.0 and others); each package's terms are in /usr/share/doc/<package>/copyright. No subscription or licence key is needed to run this image. The compliance tooling is OpenSCAP (LGPL 2.1 or later) and SCAP Security Guide content (BSD 3-Clause, licence text in /usr/share/doc/cloudimg/scap-security-guide-LICENSE.txt).

Ubuntu 22.04 LTS receives standard security maintenance until 2027. For a longer runway on a new deployment, the Ubuntu 24.04 LTS versions of this listing are maintained until 2029.

The DISA STIG profile used here is the OpenSCAP profile for Ubuntu 22.04 published in SCAP Security Guide. A pass rate measures this image as built; your own changes affect it, which is why the evaluation can be re-run (Step 5). Some STIG requirements are about how you operate the system (log offloading, directory and smart-card authentication, encryption choices) and are yours to meet.

Ubuntu is a trademark of Canonical Ltd. The names are used only to identify the software and the profile. cloudimg is not affiliated with or endorsed by Canonical Ltd, the Defense Information Systems Agency or the US Department of Defense.

Support

For help with this image, contact cloudimg support: