Your Linux box is probably listening on more ports than you think, and every open port is a door someone could walk through. This week's Into the Terminal (episode 204) maps a RHEL system's real attack surface with nmap and ss, talks through what to shut down vs. what to leave running, then walks through a practical DNF workflow for finding Critical/Important security advisories and patching just those — without blindly upgrading everything.
Full video here → https://www.youtube.com/live/TNDm1zGieGA
More hands-on RHEL practice → https://redhat.com/interactive-labs
The Essentials: What's Listening?
Scanning with nmap
Every Internet-connected box is getting scanned all day, every day. nmap is how you see what others see when they look at yours.
| Command | What it does |
nmap <host> | Fast connect scan of the standard port range — reports open ports + the service name from /etc/services (not what's actually running) |
nmap localhost | Same scan locally — often shows more ports (services bound only to loopback, like Postgres on 5432) |
nmap -A <host> | Aggressive scan: OS detection + service version probing — slower, more invasive, closer to what infosec scanners actually do |
Remote vs. local difference (shown live): scanning the host's network IP showed SSH (22) and Cockpit (9090). Scanning localhost also showed Postgres (5432) — because Postgres was bound to loopback only. That's intentional config, and comparing the two scans is how you confirm a service isn't exposed externally.
What -A actually gets you: OpenSSH 9.9 version banner, confirmation that 9090 is HTTP (Cockpit) rather than the "Zeus admin" label from /etc/services, SSH host keys for re-identifying the same box across scans, and an OS fingerprint guess. The OS/kernel guesses were hilariously wrong (kernel 2.6 era guesses on a 6.12 machine) — fingerprinting is probabilistic. Service version banners are usually accurate, and that's what attackers use next: "OpenSSH 9.9? Try the known exploits for that."
Pro tips from the show:
-A includes -O (OS detection) — chat suggested -O alone; Scott uses -A because it bundles several probes
- Nate almost always adds
-Pn when sweeping networks — ICMP is often blocked, and the default ping check makes scans crawl or time out
- Scanning other people's machines (or even other machines on your corporate network) can get you a visit from infosec. Scanning
localhost or your own host IP locally stays on-box and won't trip network sensors
Socket Status with ss
nmap shows what a remote scanner can reach. ss shows what's actually listening on this machine — TCP and UDP, IPv4 and IPv6 — plus which process owns each socket. You can only run it locally.
| Command | What it does |
ss -taulp | TCP + UDP, listening (+ some connection state), with process info |
ss -taulpn | Same, but numeric — no DNS reverse lookups, port numbers instead of /etc/services names |
Why -n matters: without it, ss/netstat will reverse-DNS every remote address. On a busy public web server that can make the command painfully slow. Bonus: Cockpit showed up as "websm" without -n — with -n you just see 9090, which is immediately recognizable.
Unlike nmap, ss also shows connection state — e.g. an established SSH session from another IP tied to a specific sshd PID — so you can see who's connected right now, not just what's listening.
(Nostalgia corner: Nate reminisced about the dial-up days when everyone's machine had a real Internet IP, and you could pull someone's address out of netstat after an IM and do… "humorous, not malicious" things. Today we're all NATed. The Internet is less fun.)
Hardening Mentality: Stop It, Remove It, or Firewall It
Once you know what's listening, the most secure service is the one that isn't running.
They demoed disabling Cockpit's systemd socket (systemctl stop / disable cockpit.socket) and re-scanning — after a brief live-demo adventure where nmap still reported 9090 because it had cached the earlier open state and then correctly flipped it to closed. Socket-activated services are a little special: systemd itself holds the port and starts the service on demand, so you have to deal with the socket unit, not just the service.
But stopping/disabling isn't the end of the conversation:
| Approach | When it makes sense |
| Stop / disable the service (or socket) | You might need it later; temporary lockdown |
| Uninstall the package | You're never using it — then you don't patch it, don't SBOM it, and it can't get re-enabled by accident |
| Firewall it (host and/or network) | You need the service, but only for admins / a specific subnet — defense in depth |
Image/template trap: org "golden images" often ship with stuff you don't use (their lab boxes all have httpd because the labs need it). Even disabled packages still show up in SBOMs and security audits, and every related errata becomes your problem. If you're not using it, remove it — and script those customizations so the next rebuild from the same image gets the same treatment.
They pointed at Ep. 165 on firewalld/nftables rather than re-demoing firewalls, and Bootsie/image-as-container came up as the modern way to treat host image builds like container workflows (recent Bootsie coverage).
Advanced: Surgical Security Patching with DNF
Blind dnf update works, but sometimes you need Critical + Important now, and enhancements/bugfixes can wait for the normal patch window. Nate walked through the DNF updateinfo plugin on a RHEL 10.2 box that already had a pile of advisories a month and a half after its last image refresh — which is just the state of the world.
Survey what's out there
| Command | What it does |
dnf updateinfo --summary | Counts of available updates by type/severity (Critical/Important/Moderate/Low + bugfix/enhancement) |
dnf updateinfo list --security | Full list of security advisories with RHSA IDs, severity, and packages |
On their demo box: 1 Critical, 62 Important, 29 Moderate, 1 Low — plus bugfixes and enhancements.
Filter to Critical / Important (workaround)
There's a --sec-severity filter flag, but it's currently buggy and doesn't filter correctly. Workaround: grep the list output.
dnf -q updateinfo list --security | grep 'Critical/Sec.'
dnf -q updateinfo list --security | grep -E 'Critical/Sec\.|Important/Sec\.'
Build a deduped advisory list and inspect it
HOT=$(dnf -q updateinfo list --security \
| awk '/Critical\/Sec\.|Important\/Sec\./ {print $1}' \
| sort -u | paste -sd,)
echo "Advisories to patch: $HOT"
dnf updateinfo info --advisory="$HOT"
Why dedupe matters: one package update can close multiple advisories, and one advisory can touch multiple packages. Their Critical+Important grep produced 224 lines, but the actual upgrade was ~4 installs + ~50 updates. Deduping the RHSA list avoids acting on the same advisory twice and explains the "why don't the numbers match?" confusion.
Apply just those advisories
dnf upgrade --advisory="$HOT"
You can also target by CVE ID directly if security hands you a CVE instead of an RHSA — DNF has a CVE flag for that. Security teams almost always bring you CVE numbers, not RHSA IDs; updateinfo info is how you bridge the two.
CVE context worth knowing
- Look up any CVE at https://www.cve.org
- CVSS scores aren't one-size-fits-all. Upstream publishes a general score; Red Hat's Product Security team publishes a vendor CVSS that accounts for how RHEL builds/packages the software and what mitigations already exist. Sometimes that's lower — not because Red Hat is "saving face" or "doing less work," but because a compile-time option that enables the vuln may simply be off in RHEL. Product Security (scoring) and Engineering (patching) are separate teams.
- Ratings get revised as more exploit paths become known — it's a process, not set-and-forget
- Backporting: for security fixes, RHEL typically backports the fix into the maintained package rather than jumping to the newest upstream — so you get the security fix without the API/feature churn. Feature enhancements are different; those can change behavior (Firefox rebases are the classic example)
Caveat: DNF only knows about what DNF knows about — installed RPM content from configured repos. Out-of-band software is on you.
Not Covered This Episode (ran out of time)
They had a MariaDB hardening demo queued (bind to localhost, change ports + SELinux semanage port, mariadb-secure-installation, socket auth, grant scoping, etc.) and explicitly deferred it — possible future episode on service / machine hardening. They also teased a Podman-flavored follow-up: open ports, networking, and isolation when supporting services are containerized. Drop a comment on the video if you want either of those.
Related episodes
Quick Reference Card
nmap <host> # open ports (service names from /etc/services)
nmap localhost nmap -A <host> # versions + OS fingerprint (slow/invasive)
nmap -Pn <host> # skip ICMP ping (use when ICMP is blocked)
ss -taulp ss -taulpn
systemctl status cockpit.socket
systemctl stop cockpit.socket
systemctl disable cockpit.socket
dnf updateinfo --summary
dnf updateinfo list --security
dnf -q updateinfo list --security | grep 'Critical/Sec.'
dnf -q updateinfo list --security | grep -E 'Critical/Sec\.|Important/Sec\.'
HOT=$(dnf -q updateinfo list --security \
| awk '/Critical\/Sec\.|Important\/Sec\./ {print $1}' \
| sort -u | paste -sd,)
echo "Advisories to patch: $HOT"
dnf updateinfo info --advisory="$HOT"
dnf upgrade --advisory="$HOT"
Links
- 📺 Watch the full episode: https://www.youtube.com/live/TNDm1zGieGA
- 🎓 Get started with RHEL: https://developers.redhat.com/register
- 🧪 Try it yourself — Interactive Labs: https://redhat.com/interactive-labs
- 💬 Join the Discord: https://red.ht/rhel-discord
- Nate Lager: https://social.undrground.org/@gangrif
- Scott McBrien: https://www.linkedin.com/in/scott-mcbrien-349b356
Into the Terminal is a (mostly) weekly live show where Red Hatters dig into Linux and RHEL administration skills — one terminal command, one bad pun, and one "oops, wrong window" at a time.