Skip to content

Commit 9ae2bad

Browse files
committed
Add test scenarios for the Ubuntu 26.04 CIS rules
47 scenarios covering the 13 new rules. The APT scenarios exercise quoted and unquoted values, case variants, commented settings, deb-src entries, options blocks such as [signed-by=...], and deb822 URIs lines carrying more than one URI. service_update-notifier-motd_disabled ships only a pass scenario. The unit is a static oneshot, so it is never enabled and never lingers active, and the check reports the same result whether or not it has been masked. Recorded in the rule's warnings block.
1 parent dd994ad commit 9ae2bad

48 files changed

Lines changed: 406 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
# platform = multi_platform_ubuntu
3+
4+
mkdir -p /etc/apt/apt.conf.d
5+
touch /etc/apt/apt.conf
6+
find /etc/apt/apt.conf /etc/apt/apt.conf.d -maxdepth 1 -type f -exec sed -ri '/^[[:space:]]*Acquire::AllowDowngradeToInsecureRepositories[[:space:]]+/Id' {} + 2>/dev/null || true
7+
8+
echo '# Acquire::AllowDowngradeToInsecureRepositories "1";' >> /etc/apt/apt.conf
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
# platform = multi_platform_ubuntu
3+
4+
mkdir -p /etc/apt/apt.conf.d
5+
touch /etc/apt/apt.conf
6+
find /etc/apt/apt.conf /etc/apt/apt.conf.d -maxdepth 1 -type f -exec sed -ri '/^[[:space:]]*Acquire::AllowDowngradeToInsecureRepositories[[:space:]]+/Id' {} + 2>/dev/null || true
7+
8+
echo 'Acquire::AllowDowngradeToInsecureRepositories "0";' >> /etc/apt/apt.conf.d/99-cis-repository-security
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
# platform = multi_platform_ubuntu
3+
4+
mkdir -p /etc/apt/apt.conf.d
5+
touch /etc/apt/apt.conf
6+
find /etc/apt/apt.conf /etc/apt/apt.conf.d -maxdepth 1 -type f -exec sed -ri '/^[[:space:]]*Acquire::AllowDowngradeToInsecureRepositories[[:space:]]+/Id' {} + 2>/dev/null || true
7+
8+
# The APT default is compliant, so no setting at all must pass.
9+
exit 0
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
# platform = multi_platform_ubuntu
3+
4+
mkdir -p /etc/apt/apt.conf.d
5+
touch /etc/apt/apt.conf
6+
find /etc/apt/apt.conf /etc/apt/apt.conf.d -maxdepth 1 -type f -exec sed -ri '/^[[:space:]]*Acquire::AllowDowngradeToInsecureRepositories[[:space:]]+/Id' {} + 2>/dev/null || true
7+
8+
echo 'Acquire::AllowDowngradeToInsecureRepositories "1";' >> /etc/apt/apt.conf
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
# platform = multi_platform_ubuntu
3+
4+
mkdir -p /etc/apt/apt.conf.d
5+
touch /etc/apt/apt.conf
6+
find /etc/apt/apt.conf /etc/apt/apt.conf.d -maxdepth 1 -type f -exec sed -ri '/^[[:space:]]*Acquire::AllowDowngradeToInsecureRepositories[[:space:]]+/Id' {} + 2>/dev/null || true
7+
8+
# APT option names are case insensitive and values may be unquoted.
9+
echo 'acquire::allowdowngradetoinsecurerepositories 1;' >> /etc/apt/apt.conf.d/70-cac-test
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
# platform = multi_platform_ubuntu
3+
4+
mkdir -p /etc/apt/apt.conf.d
5+
touch /etc/apt/apt.conf
6+
find /etc/apt/apt.conf /etc/apt/apt.conf.d -maxdepth 1 -type f -exec sed -ri '/^[[:space:]]*Acquire::AllowInsecureRepositories[[:space:]]+/Id' {} + 2>/dev/null || true
7+
8+
echo '# Acquire::AllowInsecureRepositories "1";' >> /etc/apt/apt.conf
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
# platform = multi_platform_ubuntu
3+
4+
mkdir -p /etc/apt/apt.conf.d
5+
touch /etc/apt/apt.conf
6+
find /etc/apt/apt.conf /etc/apt/apt.conf.d -maxdepth 1 -type f -exec sed -ri '/^[[:space:]]*Acquire::AllowInsecureRepositories[[:space:]]+/Id' {} + 2>/dev/null || true
7+
8+
echo 'Acquire::AllowInsecureRepositories "0";' >> /etc/apt/apt.conf.d/99-cis-repository-security
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
# platform = multi_platform_ubuntu
3+
4+
mkdir -p /etc/apt/apt.conf.d
5+
touch /etc/apt/apt.conf
6+
find /etc/apt/apt.conf /etc/apt/apt.conf.d -maxdepth 1 -type f -exec sed -ri '/^[[:space:]]*Acquire::AllowInsecureRepositories[[:space:]]+/Id' {} + 2>/dev/null || true
7+
8+
# The APT default is compliant, so no setting at all must pass.
9+
exit 0
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
# platform = multi_platform_ubuntu
3+
4+
mkdir -p /etc/apt/apt.conf.d
5+
touch /etc/apt/apt.conf
6+
find /etc/apt/apt.conf /etc/apt/apt.conf.d -maxdepth 1 -type f -exec sed -ri '/^[[:space:]]*Acquire::AllowInsecureRepositories[[:space:]]+/Id' {} + 2>/dev/null || true
7+
8+
echo 'Acquire::AllowInsecureRepositories "1";' >> /etc/apt/apt.conf
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
# platform = multi_platform_ubuntu
3+
4+
mkdir -p /etc/apt/apt.conf.d
5+
touch /etc/apt/apt.conf
6+
find /etc/apt/apt.conf /etc/apt/apt.conf.d -maxdepth 1 -type f -exec sed -ri '/^[[:space:]]*Acquire::AllowInsecureRepositories[[:space:]]+/Id' {} + 2>/dev/null || true
7+
8+
# APT option names are case insensitive and values may be unquoted.
9+
echo 'acquire::allowinsecurerepositories 1;' >> /etc/apt/apt.conf.d/70-cac-test

0 commit comments

Comments
 (0)