Skip to content
Tech Atlas, home
Search
Esc
  • All roadmapsBrowse every learning path
  • ExploreFind a technology area
  • ProjectsGuided projects and builds
  • My AtlasYour learning dashboard
Lesson 2 of 6 · Lab · 30 min · revision 2

Hardening a Linux Server Against a Benchmark

Measure an inherited Debian 12 server against a 13-rule CIS-style baseline, then fix SSH, accounts, file permissions, sudo rules and cleartext services, prove each fix with a negative test, and measure again with the baseline check and Lynis.

Contentsand lesson path

What you will learn

  • Apply a CIS Benchmark-based baseline to a Linux server (accounts, SSH, services, file permissions, kernel parameters, mandatory access control) and justify any deviations.

Prerequisites: Linux CLI

01. Goal and setup

You will take a Debian 12 server that someone else configured, measure it against a small baseline, fix every finding, and measure it again. The server is a container, so you can break and rebuild it freely. The baseline is a 13-rule subset of the areas in the CIS Debian Linux 12 Benchmark: SSH, accounts, services, file permissions, sudo and kernel parameters. It is not the full benchmark, and its rule IDs (S1, A1 and so on) are this lab's own, not CIS numbers. Lab 3 runs the real CIS profile with OpenSCAP.

You need: Docker, about 400 MB of free disk, and internet access for the package downloads. Tested versions: Debian 12 (bookworm) packages, OpenSSH 9.2p1, sudo 1.9.13p3 and Lynis 3.1.7. All commands assume bash on the host.

Two kinds of setting cannot change inside a container. Kernel parameters (sysctl) and AppArmor profiles belong to the host kernel, which every container shares. Step 8 writes the kernel settings to a file and shows why they do not apply here; on a VM you would apply them with the commands shown there.

Lab folder
harden-lab/
├── legacy.sh           step 2: plants the weaknesses of an inherited server
├── check.sh            step 2 and 9: the 13-rule baseline check (read-only)
├── 00-baseline.conf    step 3: SSH settings
├── 60-baseline.conf    step 8: kernel parameters
└── lynis-3.1.7.tar.gz  step 2: second-opinion scanner

Create the folder and download Lynis, an open-source security auditing tool. Check the archive against the SHA-256 hash published on the CISOfy download page before you use it.

Terminal
mkdir -p harden-lab && cd harden-lab
curl -sSLO https://downloads.cisofy.com/lynis/lynis-3.1.7.tar.gz
SUM=b5314a07fd85fa3ffc7da57b508f0108ec3280d84e4af823f805d95cbbc2428c
echo "$SUM  lynis-3.1.7.tar.gz" | sha256sum -c
Expected output
lynis-3.1.7.tar.gz: OK

Save the four files below in harden-lab/. Read legacy.sh first: each line creates one problem that the baseline looks for, such as a second account with user ID 0, a readable /etc/shadow, a sudo rule that runs a full editor as root, and Telnet and FTP served by inetd.

Bash · legacy.sh
#!/bin/bash
# legacy.sh: turn a fresh Debian 12 container into an "inherited" server.
# Every line plants one weakness that the baseline in check.sh looks for.
set -e
useradd -m -u 2001 -s /bin/bash deploy             # the web team's account
useradd -m -u 2002 -s /bin/bash legacy             # an old shared account
passwd -d legacy >/dev/null                        # ...with an empty password
useradd -o -u 0 -g 0 -M -d /root -s /bin/bash toor # a second UID 0 account
chmod 644 /etc/shadow                              # password hashes readable
cat > /etc/ssh/sshd_config.d/50-legacy.conf <<'CONF'
PermitRootLogin yes
PasswordAuthentication yes
PermitEmptyPasswords yes
MaxAuthTries 10
CONF
mkdir -p /etc/nginx /run/sshd
echo 'worker_processes 1;' > /etc/nginx/nginx.conf
echo 'deploy ALL=(root) NOPASSWD: /usr/bin/vim.tiny /etc/nginx/nginx.conf' \
  > /etc/sudoers.d/web
chmod 440 /etc/sudoers.d/web
printf '#!/bin/sh\ntar czf /var/backups/etc.tgz /etc\n' > /usr/local/bin/backup.sh
chmod 777 /usr/local/bin/backup.sh                 # world-writable, run by root
cat >> /etc/inetd.conf <<'CONF'
telnet stream tcp nowait root /usr/sbin/telnetd telnetd
ftp    stream tcp nowait root /usr/sbin/ftpd    ftpd
CONF
/usr/sbin/inetutils-inetd                          # starts telnet and FTP
echo "legacy state planted"
Bash · check.sh
#!/bin/bash
# check.sh: a 13-rule subset of a CIS-style Debian 12 server baseline.
# Read-only: it changes nothing. Run as root inside the lab container.
pass=0; total=0
rule() {  # rule ID "description" command...
  local id=$1 desc=$2; shift 2; total=$((total + 1))
  if "$@" >/dev/null 2>&1; then
    pass=$((pass + 1)); printf 'PASS  %-4s %s\n' "$id" "$desc"
  else
    printf 'FAIL  %-4s %s\n' "$id" "$desc"
  fi
}
sshd_is() { sshd -T 2>/dev/null | grep -qix "$1 $2"; }
max_tries() { [ "$(sshd -T | awk '$1=="maxauthtries"{print $2}')" -le 4 ]; }
one_uid0() { [ "$(awk -F: '$3==0' /etc/passwd | wc -l)" -eq 1 ]; }
no_empty_pw() { ! awk -F: '$2==""{f=1} END{exit !f}' /etc/shadow; }
no_cleartext_pkgs() {
  ! dpkg-query -W -f='${Status}\n' inetutils-telnetd inetutils-ftpd telnetd \
      vsftpd 2>/dev/null | grep -q 'install ok installed'
}
no_cleartext_ports() { ! ss -Htln | awk '{print $4}' | grep -Eq ':(21|23)$'; }
shadow_ok() {
  [ "$(stat -c '%U:%G' /etc/shadow)" = root:shadow ] &&
  [ $(( 0$(stat -c '%a' /etc/shadow) & 037 )) -eq 0 ]
}
no_world_writable() {
  [ -z "$(find /etc /usr/local/bin -xdev -type f -perm -0002 2>/dev/null)" ]
}
# Programs listed on GTFOBins that can start a shell; a short sample.
ESCAPES='vi|vim|vim\.tiny|nano|less|more|man|find|awk|env|tar|python3?|perl|bash|sh'
no_shell_escape_sudo() {
  ! grep -RhsE "^[^#]*ALL=.*/($ESCAPES)( |,|\$)" /etc/sudoers /etc/sudoers.d/
}
sysctl_file() {
  local f=/etc/sysctl.d/60-baseline.conf
  grep -qx 'net.ipv4.conf.all.accept_redirects = 0' "$f" &&
  grep -qx 'net.ipv4.conf.all.send_redirects = 0' "$f" &&
  grep -qx 'kernel.randomize_va_space = 2' "$f"
}
rule S1 "SSH: root cannot log in"             sshd_is permitrootlogin no
rule S2 "SSH: password logins disabled"       sshd_is passwordauthentication no
rule S3 "SSH: empty passwords refused"        sshd_is permitemptypasswords no
rule S4 "SSH: MaxAuthTries is 4 or less"      max_tries
rule S5 "SSH: X11 forwarding disabled"        sshd_is x11forwarding no
rule A1 "Accounts: only root has UID 0"       one_uid0
rule A2 "Accounts: no empty password fields"  no_empty_pw
rule V1 "Services: no telnet/FTP server pkgs" no_cleartext_pkgs
rule V2 "Services: nothing on TCP 21 or 23"   no_cleartext_ports
rule P1 "Perms: /etc/shadow root:shadow 640"  shadow_ok
rule P2 "Perms: no world-writable files"      no_world_writable
rule U1 "Sudo: no rule runs a shell-escape tool" no_shell_escape_sudo
rule K1 "Kernel: sysctl baseline file set"    sysctl_file
echo "score: $pass/$total"
Text · 00-baseline.conf
# /etc/ssh/sshd_config.d/00-baseline.conf  (OpenSSH 9.2, Debian 12)
# sshd keeps the FIRST value it reads for most keywords, and drop-ins are
# read in name order, so 00- wins over any later file.
PermitRootLogin no
PasswordAuthentication no
KbdInteractiveAuthentication no
PermitEmptyPasswords no
MaxAuthTries 4
X11Forwarding no
AllowTcpForwarding no
LoginGraceTime 60
ClientAliveInterval 300
ClientAliveCountMax 3
LogLevel VERBOSE
AllowGroups sshusers
Text · 60-baseline.conf
# /etc/sysctl.d/60-baseline.conf: kernel parameters from the baseline.
# Apply on a VM with: sysctl --system
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.all.rp_filter = 1
net.ipv4.tcp_syncookies = 1
kernel.randomize_va_space = 2
kernel.yama.ptrace_scope = 1
fs.suid_dumpable = 0

check.sh reads the effective SSH configuration with sshd -T, which prints every setting after all files are merged. Reading sshd_config with grep is a common mistake, because it misses drop-in files and defaults. The sudo rule U1 searches for rules that name a program from a short list of tools known to start other commands.

02. Step 1: Start the server

Start a Debian 12 container with the folder mounted read-only at /lab, then install the server's packages. --init adds a small init process that cleans up exited child processes, as a real init system would.

Terminal
docker run -d --init --name harden-lab --hostname harden-lab -v "$PWD":/lab:ro \
  debian:12-slim sleep infinity >/dev/null
docker exec harden-lab bash -c 'apt-get update -qq &&
  apt-get install -y -qq --no-install-recommends openssh-server openssh-client \
  sudo vim-tiny inetutils-inetd inetutils-telnetd inetutils-ftpd iproute2 \
  procps >/dev/null 2>&1 && echo "packages installed"'
docker exec harden-lab bash -c '. /etc/os-release; echo "$PRETTY_NAME";
  sshd -V 2>&1; sudo -V | head -1'
Expected output
packages installed
Debian GNU/Linux 12 (bookworm)
OpenSSH_9.2, OpenSSL 3.0.22 25 Aug 2026
Sudo version 1.9.13p3

03. Step 2: Plant the legacy state and take a baseline score

Terminal
docker exec harden-lab bash /lab/legacy.sh
docker exec harden-lab bash /lab/check.sh
Expected output
useradd warning: toor's uid 0 outside of the UID_MIN 1000 and UID_MAX 60000 range.
legacy state planted
FAIL  S1   SSH: root cannot log in
FAIL  S2   SSH: password logins disabled
FAIL  S3   SSH: empty passwords refused
FAIL  S4   SSH: MaxAuthTries is 4 or less
FAIL  S5   SSH: X11 forwarding disabled
FAIL  A1   Accounts: only root has UID 0
FAIL  A2   Accounts: no empty password fields
FAIL  V1   Services: no telnet/FTP server pkgs
FAIL  V2   Services: nothing on TCP 21 or 23
FAIL  P1   Perms: /etc/shadow root:shadow 640
FAIL  P2   Perms: no world-writable files
FAIL  U1   Sudo: no rule runs a shell-escape tool
FAIL  K1   Kernel: sysctl baseline file set
score: 0/13

Every rule fails. Keep this output: a before-and-after report is the evidence that the work was done. A second scanner gives an independent view, so run Lynis too. Its hardening index is a score from 0 to 100 over its own tests, many of which check the kernel, so your number will differ.

Terminal
docker exec harden-lab bash -c 'mkdir -p /opt &&
  tar xzf /lab/lynis-3.1.7.tar.gz -C /opt --no-same-owner &&
  cd /opt/lynis && ./lynis audit system --quick --no-colors >/dev/null 2>&1;
  grep "^hardening_index=" /var/log/lynis-report.dat;
  grep "^warning\[\]=" /var/log/lynis-report.dat | cut -c11- |
  awk -F"|" "{print \$1, \$2}"'
Illustrative output (the index depends on the host kernel)
hardening_index=59
AUTH-9204 Multiple users with UID 0 found in passwd file
AUTH-9208 Multiple accounts found with same UID
AUTH-9283 Found accounts without password
LOGG-2138 klogd is not running, which could lead to missing kernel messages in log files

04. Step 3: Harden SSH

Debian's sshd_config starts with Include /etc/ssh/sshd_config.d/*.conf, and for most keywords sshd keeps the first value it reads. Files are included in name order, so 00-baseline.conf wins over 50-legacy.conf. The step prints the effective values while the legacy file is still there to prove it, then removes the legacy file so that nobody is misled later. AllowGroups sshusers limits logins to one group, and sshd -t checks the syntax before anything is reloaded.

Terminal
docker exec -i harden-lab bash <<'SH'
install -m 600 /lab/00-baseline.conf /etc/ssh/sshd_config.d/00-baseline.conf
groupadd -g 2100 sshusers && usermod -aG sshusers deploy
echo "--- legacy file still present, baseline file read first:"
sshd -T | grep -E '^(permitrootlogin|passwordauthentication|maxauthtries) '
rm /etc/ssh/sshd_config.d/50-legacy.conf
sshd -t && echo "sshd -t: configuration OK"
sshd -T | grep -E '^(permitemptypasswords|x11forwarding|allowgroups) '
SH
Expected output
--- legacy file still present, baseline file read first:
maxauthtries 4
permitrootlogin no
passwordauthentication no
sshd -t: configuration OK
x11forwarding no
permitemptypasswords no
allowgroups sshusers

05. Step 4: Prove it with real logins, and replace FTP with SFTP

A setting is only proven when a login fails. Start sshd, give root and deploy a key each, and try three things: a password login, a root login with a valid key, and an SFTP upload by deploy. Root is refused twice over: it is not in sshusers, and PermitRootLogin no would refuse it anyway. SFTP needs no extra service, because Debian's sshd already runs the sftp-server subsystem.

Terminal
docker exec -i harden-lab bash <<'SH'
/usr/sbin/sshd -E /var/log/sshd.log
ssh-keygen -q -t ed25519 -N "" -f /root/.ssh/id_ed25519
cp /root/.ssh/id_ed25519.pub /root/.ssh/authorized_keys
su - deploy -c 'ssh-keygen -q -t ed25519 -N "" -f ~/.ssh/id_ed25519 &&
  cp ~/.ssh/id_ed25519.pub ~/.ssh/authorized_keys'
ssh-keyscan -t ed25519 127.0.0.1 2>/dev/null > /etc/ssh/ssh_known_hosts
echo "--- password login as legacy:"
ssh -o BatchMode=yes -o PreferredAuthentications=password [email protected] true
echo "--- key login as root (root has a valid key):"
ssh -o BatchMode=yes [email protected] true
grep -o 'root from .*AllowGroups' /var/log/sshd.log
echo "--- SFTP upload as deploy (replaces FTP):"
su - deploy -c 'echo report > report.txt && mkdir -p uploads &&
  echo "put report.txt uploads/" | sftp -q -b - [email protected] && ls uploads'
SH
Expected output
--- password login as legacy:
[email protected]: Permission denied (publickey).
--- key login as root (root has a valid key):
[email protected]: Permission denied (publickey).
root from 127.0.0.1 not allowed because none of user's groups are listed in AllowGroups
--- SFTP upload as deploy (replaces FTP):
sftp> put report.txt uploads/
report.txt

06. Step 5: Fix accounts and file permissions

Find the second UID 0 account and the empty password first, then fix them. A plain userdel toor refuses, because process 1 also runs as UID 0 and userdel checks for running processes by UID. -f removes the entry anyway; it still prints the warning. usermod -L -e 1 -s /usr/sbin/nologin locks the old shared account, expires it and removes its shell, which keeps its files for review. The world-writable backup script is fixed with chmod go-w.

Terminal
docker exec -i harden-lab bash <<'SH'
awk -F: '$3==0 {print "uid 0:", $1}' /etc/passwd
awk -F: '$2=="" {print "empty password:", $1}' /etc/shadow
userdel -f toor   # -f: process 1 also runs as UID 0, which blocks a plain userdel
usermod -L -e 1 -s /usr/sbin/nologin legacy
chown root:shadow /etc/shadow && chmod 640 /etc/shadow
find /etc /usr/local/bin -xdev -type f -perm -0002 -print -exec chmod go-w {} +
echo "--- after:"
awk -F: '$3==0 {print "uid 0:", $1}' /etc/passwd
grep '^legacy:' /etc/shadow | cut -d: -f1,2,8
stat -c '%a %U:%G %n' /etc/shadow /usr/local/bin/backup.sh
SH
Expected output
uid 0: root
uid 0: toor
empty password: legacy
userdel: user toor is currently used by process 1
/usr/local/bin/backup.sh
--- after:
uid 0: root
legacy:!:1
640 root:shadow /etc/shadow
755 root:root /usr/local/bin/backup.sh

07. Step 6: Replace the editor rule with sudoedit

The planted rule lets deploy run vim.tiny as root on one file. An editor can start other programs, and anything it starts inherits root, so the rule is a root shell in practice. Defenders use the GTFOBins catalogue to spot such programs in sudo rules. You do not need to demonstrate the problem; replace the rule and prove the replacement.

sudoedit copies the file, runs the editor as deploy, and writes the result back as root only after the editor exits. The new rule is written to web.new and checked with visudo -cf before it replaces the old one, so a typo cannot lock you out of sudo. Sudo ignores files in sudoers.d whose names contain a dot, so the draft is never active. The negative test asks sudo, as root, whether deploy may still run the editor, and then has deploy try it: both are refused. -n stops sudo from asking for a password, so the attempt fails at once. The last command makes the intended change through sudoedit, with vim.tiny reading the keystrokes from standard input.

Terminal
docker exec -i harden-lab bash <<'SH'
echo "--- before:"
sudo -l -U deploy | tail -1
cat > /etc/sudoers.d/web.new <<'RULE'
# The web team edits one file. sudoedit copies it, runs the editor as the
# user, then writes the result back as root.
deploy ALL=(root) NOPASSWD: sudoedit /etc/nginx/nginx.conf
RULE
visudo -cf /etc/sudoers.d/web.new && chmod 440 /etc/sudoers.d/web.new &&
  mv /etc/sudoers.d/web.new /etc/sudoers.d/web
visudo -c
echo "--- after:"
sudo -l -U deploy | tail -1
echo "--- negative test: the old editor rule is gone"
sudo -l -U deploy /usr/bin/vim.tiny /etc/nginx/nginx.conf ||
  echo "vim.tiny as root: not allowed (exit $?)"
su - deploy -c 'sudo -n /usr/bin/vim.tiny /etc/nginx/nginx.conf'
echo "--- the intended edit still works"
su - deploy -c "printf 'Goworker_processes 2;\033:wq\n' |
  SUDO_EDITOR=/usr/bin/vim.tiny sudoedit -n /etc/nginx/nginx.conf >/dev/null 2>&1"
stat -c '%U:%G %a' /etc/nginx/nginx.conf; cat /etc/nginx/nginx.conf
SH
Expected output
--- before:
    (root) NOPASSWD: /usr/bin/vim.tiny /etc/nginx/nginx.conf
/etc/sudoers.d/web.new: parsed OK
/etc/sudoers: parsed OK
/etc/sudoers.d/README: parsed OK
/etc/sudoers.d/web: parsed OK
--- after:
    (root) NOPASSWD: sudoedit /etc/nginx/nginx.conf
--- negative test: the old editor rule is gone
vim.tiny as root: not allowed (exit 1)
sudo: a password is required
--- the intended edit still works
root:root 644
worker_processes 1;
worker_processes 2;

sudo -l -U deploy <command> prints nothing and exits with 1 when the command is not allowed. When deploy tries the old command, sudo cannot find a rule that allows it without a password, so it asks for one; given one, it would report that the user is not allowed. The file is still owned by root, and the new line is in it.

08. Step 7: Retire Telnet and FTP

Terminal
docker exec -i harden-lab bash <<'SH'
ss -Htlnp | awk '{split($6, p, "\""); print $4, p[2]}' | sort
exec 3<>/dev/tcp/127.0.0.1/21; head -n1 <&3 | tr -d '\r'; exec 3<&-
kill "$(pgrep -x inetutils-inetd)"
apt-get purge -y -qq inetutils-telnetd inetutils-ftpd inetutils-inetd \
  >/dev/null 2>&1 && echo "purged telnet, FTP and inetd"
echo "--- listening now:"
ss -Htlnp | awk '{split($6, p, "\""); print $4, p[2]}' | sort
SH
Expected output
0.0.0.0:21 inetutils-inetd
0.0.0.0:22 sshd
0.0.0.0:23 inetutils-inetd
[::]:22 sshd
220 harden-lab FTP server (GNU inetutils 2.4) ready.
purged telnet, FTP and inetd
--- listening now:
0.0.0.0:22 sshd
[::]:22 sshd

The banner on port 21 shows a cleartext service that anyone on the network can talk to. Stopping inetd closes the ports for now, but only purging the packages stops a reboot or an update from bringing them back. The step lists listening sockets with ss before and after, so the report shows that the change happened.

09. Step 8: Kernel parameters and MAC (VM-only parts)

Terminal
docker exec -i harden-lab bash <<'SH'
install -m 644 /lab/60-baseline.conf /etc/sysctl.d/60-baseline.conf
sysctl -p /etc/sysctl.d/60-baseline.conf 2>&1 | head -2
echo "--- MAC label of this shell:"
cat /proc/self/attr/current
SH
Expected output (on a host that uses AppArmor)
sysctl: permission denied on key "net.ipv4.conf.all.accept_redirects"
sysctl: permission denied on key "net.ipv4.conf.default.accept_redirects"
--- MAC label of this shell:
docker-default (enforce)

Docker mounts /proc/sys read-only, so sysctl cannot change kernel settings from inside a container. That is correct behaviour: those settings belong to the shared host kernel. The file still matters, because it is what a VM or a host image will load at boot, and rule K1 checks it. The second line shows that this shell is already confined by an AppArmor profile, docker-default, in enforce mode. MAC is active even here, but the profile belongs to Docker, not to you. On a SELinux host you will see a different label.

On a Debian 12 VM, the matching commands are below. They are not run in this lab, so there is no output to copy.

Terminal · on a VM only (illustrative, not run here)
sudo install -m 644 60-baseline.conf /etc/sysctl.d/60-baseline.conf
sudo sysctl --system                       # load every file in sysctl.d
sysctl net.ipv4.conf.all.accept_redirects  # expect: ... = 0
sudo aa-status                             # profiles in enforce mode

10. Step 9: Measure again

Terminal
docker exec harden-lab bash /lab/check.sh
docker exec harden-lab bash -c 'cd /opt/lynis &&
  ./lynis audit system --quick --no-colors >/dev/null 2>&1;
  grep "^hardening_index=" /var/log/lynis-report.dat;
  grep "^warning\[\]=" /var/log/lynis-report.dat | cut -c11- |
  awk -F"|" "{print \$1, \$2}"'
Expected output (check.sh)
PASS  S1   SSH: root cannot log in
PASS  S2   SSH: password logins disabled
PASS  S3   SSH: empty passwords refused
PASS  S4   SSH: MaxAuthTries is 4 or less
PASS  S5   SSH: X11 forwarding disabled
PASS  A1   Accounts: only root has UID 0
PASS  A2   Accounts: no empty password fields
PASS  V1   Services: no telnet/FTP server pkgs
PASS  V2   Services: nothing on TCP 21 or 23
PASS  P1   Perms: /etc/shadow root:shadow 640
PASS  P2   Perms: no world-writable files
PASS  U1   Sudo: no rule runs a shell-escape tool
PASS  K1   Kernel: sysctl baseline file set
score: 13/13
Illustrative output (Lynis)
hardening_index=63
LOGG-2138 klogd is not running, which could lead to missing kernel messages in log files

The baseline went from 0/13 to 13/13, and the Lynis warnings about accounts are gone. The klogd warning remains because a container has no kernel log daemon; on a report, record it as not applicable with that reason. Lynis did not reach 100, and that is expected: its index covers many tests outside this subset, such as partitions, a firewall and file integrity monitoring. Each score only describes its own rule set. When you are finished, remove the container.

Terminal
docker rm -f harden-lab

11. Check your understanding

Practice check · 3 questions

Reading this lab's results

Three questions about what you saw in steps 3 to 9.

Q1. A colleague adds `/etc/ssh/sshd_config.d/90-debug.conf` with `MaxAuthTries 10` and reloads sshd. `00-baseline.conf` still says `MaxAuthTries 4`. What does `sshd -T` report?
Q2. In step 5, why did a plain `userdel toor` refuse to remove the account?
Q3. After the lab, check.sh reports 13/13 and the Lynis index is in the 60s. What should your report say?
Practice only: not graded, not saved, not evidence.

12. Apply it

Move toward the skill project:

  • Run check.sh on your own Ubuntu Server VM. Add rules for the areas it does not cover, such as AllowTcpForwarding or a firewall default policy.
  • Apply 60-baseline.conf on the VM with sysctl --system, and add a runtime check that compares each key with sysctl -n.
  • Review every sudo rule on the VM against GTFOBins, and replace each editor or pager rule with sudoedit or an exact command.

13. Review prompt

Without looking back, explain: why sshd -T is a better source than sshd_config for checks; why 00-baseline.conf wins over later drop-ins; how you proved that password and root logins were refused; why an editor in a sudo rule is a root shell in practice, and how sudoedit and visudo -cf make the replacement safe; why purging Telnet and FTP is better than stopping them; and which settings could not be applied in the container and why.

References

Your progress

Reading state

Sign in to save that you finished reading this lesson.

Sign in to mark reading complete

Prove this skill

8 questions · about 6 minutes · scored automatically. Marking a lesson as read never demonstrates a skill.
Take the skill check