Latest / CyberCode Academy / Course 44 - RH Security Specialist | Episode 8: Console Security and SSH Banners
Transcript
- 0:00Speaker 1: So picture this for a second. You have spent, I
- 0:03Speaker 1: don't know, months building this absolute state-of-the-art digital fortress.
- 0:08Speaker 2: Oh, yeah, the dream setup.
- 0:09Speaker 1: Right. You've got the best firewalls money can buy, insanely
- 0:13Speaker 1: complex passwords, military-grade remote encryption. I mean, you are practically invincible.
- 0:18Speaker 2: Right, right. On paper.
- 0:20Speaker 1: Exactly, on paper. But then someone simply walks up to
- 0:24Speaker 1: the physical server sitting in your basement, plugs in this, like,
- 0:27Speaker 1: cheap plastic keyboard... and hits three little keys, Control, Alt,
- 0:33Speaker 1: and Delete.
- 0:33Speaker 2: And that's it.
- 0:34Speaker 1: And just like that, the entire system goes down.
- 0:36Speaker 2: Yeah, it is the ultimate anti-climax. I mean, you design
- 0:40Speaker 2: this bank vault to withstand a literal siege, and someone
- 0:43Speaker 2: defeats it by just, you know, walking through a propped
- 0:47Speaker 2: open screen door out back.
- 0:48Speaker 1: It's terrifying. So welcome to today's deep dive. Our mission
- 0:51Speaker 1: today is pretty clear. We are going to lock down
- 0:54Speaker 1: that front door of your server, which is what we
- 0:56Speaker 1: call the system console. We're going to walk you through
- 0:58Speaker 1: exactly how to physically and digitally secure a Linux system,
- 1:03Speaker 1: moving layer by layer. So we'll start at the physical keyboard,
- 1:06Speaker 1: travel down into the hardware boot sequence, and then finally
- 1:09Speaker 1: secure that network login screen.
- 1:11Speaker 2: And to really appreciate the system console, you kind of
- 1:14Speaker 2: have to look at its architecture first. Okay.
- 1:17Speaker 1: Lay it on us.
- 1:17Speaker 2: Because this isn't just some bolted on interface, right? The
- 1:22Speaker 2: system console is one of the original foundational features of
- 1:26Speaker 2: the Linux kernel itself.
- 1:27Speaker 1: So it's deeply integrated.
- 1:29Speaker 2: Very deeply. It's the primary way the kernel communicates raw
- 1:32Speaker 2: text to you and, you know, receives your text input.
- 1:36Speaker 2: You can access it through virtual terminals, serial ports, or,
- 1:40Speaker 2: and this is most common for our scenario today, just
- 1:42Speaker 2: a standard VGA monitor plugged right into the back of
- 1:45Speaker 2: the physical machine.
- 1:46Speaker 1: Just right into the hardware.
- 1:47Speaker 2: Exactly. It's raw, it's direct, and if you leave it unprotected,
- 1:50Speaker 2: it is highly, highly vulnerable.
- 1:52Speaker 1: Okay, let's unpack this, because that direct physical access is
- 1:55Speaker 1: exactly where the danger lies, right? Your network firewalls just
- 1:59Speaker 1: don't matter at all if someone's hands are on the
- 2:01Speaker 1: physical hardware.
- 2:02Speaker 2: They really don't.
- 2:03Speaker 1: So let's start with that self-destruct button we mentioned, Control-Alt-Delete.
- 2:07Speaker 1: By default, if you just have a keyboard plugged into
- 2:10Speaker 1: a Linux server and you hit those three keys, the
- 2:13Speaker 1: server just reboots.
- 2:14Speaker 2: Just reboots.
- 2:14Speaker 1: No password asked, no confirmation, nothing.
- 2:17Speaker 2: Which is terrifying from a security standpoint. I mean, a
- 2:20Speaker 2: threat actor could use that to cause an immediate denial
- 2:22Speaker 2: of service, right?
- 2:23Speaker 1: Yeah.
- 2:23Speaker 2: Just shutting down your application for everyone.
- 2:25Speaker 1: Just for chaos.
- 2:26Speaker 2: For chaos, yeah. Or, even more dangerously, they can use
- 2:30Speaker 2: that forced reboot to intercept the boot process as the
- 2:34Speaker 2: machine wakes back up.
- 2:36Speaker 1: Oh, okay. So if we know this is a massive vulnerability,
- 2:40Speaker 1: I have to assume there is some configuration file deep
- 2:43Speaker 1: in the system that dictates this default behavior, right? And
- 2:46Speaker 1: we can just, I don't know, change it.
- 2:48Speaker 2: There is.
- 2:49Speaker 1: Yeah.
- 2:49Speaker 2: But how you change it really depends on the architecture
- 2:52Speaker 2: of your specific system. Okay. So if you're working on
- 2:54Speaker 2: an older Linux system specifically, one running a version of
- 2:58Speaker 2: the upstart package prior to, I think it's version 0.6.5.12.
- 3:01Speaker 1: Yeah.
- 3:03Speaker 2: You handle this by modifying a specific file.
- 3:06Speaker 1: And upstart is just for context. Right.
- 3:09Speaker 2: Upstart is a background manager. It's the init system responsible
- 3:12Speaker 2: for handling tasks and services when your machine first boots up.
- 3:15Speaker 1: Makes sense.
- 3:16Speaker 2: So the file controlling this reboot behavior is located at slash,
- 3:20Speaker 2: et cetera, slash init slash control alt delete dot conf.
- 3:26Speaker 1: Okay. And what's in that file?
- 3:27Speaker 2: Inside there, there's a literal command instructing the system to
- 3:31Speaker 2: to execute the shutdown sequence when those keys are pressed.
- 3:34Speaker 1: Just sitting there in plain text.
- 3:35Speaker 2: Exactly. And the old way to fix this was simply
- 3:39Speaker 2: to comment out that line. You just put a symbol
- 3:41Speaker 2: in front of it so the system ignores the instruction.
- 3:43Speaker 1: Okay, but just turning it off feels like, I don't know,
- 3:46Speaker 1: kind of a missed opportunity because there is a much
- 3:49Speaker 1: more clever trap we can set here.
- 3:50Speaker 2: Oh, absolutely.
- 3:51Speaker 1: Instead of just leaving the file blank, we can replace
- 3:53Speaker 1: that shutdown command entirely.
- 3:55Speaker 2: We can. Yeah, you would replace the shutdown command with
- 3:57Speaker 2: a system logger command.
- 3:58Speaker 1: Ooh, I like where this is going. Right.
- 4:00Speaker 2: So the syntax would be exec slash shore slash bin
- 4:05Speaker 2: slash logger, followed by some custom message in quotes.
- 4:09Speaker 1: Something like control, delete, pressed, and ignored.
- 4:13Speaker 2: Perfect. Exactly that.
- 4:14Speaker 1: So by replacing that command, if I'm understanding the mechanics
- 4:17Speaker 1: right here, it's kind of like rewiring that bank vault
- 4:20Speaker 1: self-destruct button. Yeah.
- 4:22Speaker 2: That's a good way to look at it.
- 4:23Speaker 1: So when a malicious actor breaks in and gleefully presses
- 4:26Speaker 1: the button, nothing blows up. Mm-hmm. But instead, a hidden
- 4:29Speaker 1: camera silently takes their picture and writes a note in
- 4:33Speaker 1: the security log.
- 4:34Speaker 2: Right.
- 4:34Speaker 1: The attacker just thinks the machine is lagging or maybe
- 4:37Speaker 1: ignoring them, but we've actually logged their physical presence.
- 4:40Speaker 2: And preserving the availability of your server while simultaneously gaining
- 4:44Speaker 2: that critical intelligence, that's a huge win.
- 4:47Speaker 1: Definitely.
- 4:48Speaker 2: However, there is a pretty significant catch with editing that
- 4:53Speaker 2: original configuration file directly.
- 4:55Speaker 1: Uh-oh. What is it?
- 4:57Speaker 2: Well, think about what happens when you run a routine
- 4:59Speaker 2: system update to patch general security vulnerabilities.
- 5:03Speaker 1: Oh, the package manager is going to see my modified
- 5:06Speaker 1: file and probably, wait, it's going to overwrite it with
- 5:09Speaker 1: a fresh default version, isn't it?
- 5:11Speaker 2: It will, yeah. And suddenly your server is vulnerable to
- 5:14Speaker 2: control alt delete all over again.
- 5:17Speaker 1: And you wouldn't even realize the configuration changed.
- 5:19Speaker 2: Exactly. You'd have no idea. This is why modern systems
- 5:23Speaker 2: use a different approach. If your system runs a newer
- 5:26Speaker 2: version of Upstart, Instead of editing that original file, you
- 5:30Speaker 2: create a brand new file called an override file.
- 5:32Speaker 1: Okay.
- 5:33Speaker 2: So you copy the original file to slash, et cetera,
- 5:35Speaker 2: slash init, slash control alt delete dot override, and you
- 5:39Speaker 2: put your logger command in there.
- 5:41Speaker 1: I love this concept. It's essentially like taking a sticky
- 5:43Speaker 1: note with your custom instructions and slapping it right over
- 5:46Speaker 1: the original manual.
- 5:47Speaker 2: Yeah, exactly. The system reads your sticky note and just
- 5:50Speaker 2: ignores the printed page underneath.
- 5:52Speaker 1: And because it's your personal sticky note, An automated system
- 5:55Speaker 1: update won't ever overwrite it.
- 5:58Speaker 2: Precisely. And building on that, if you are working on
- 6:01Speaker 2: more modern distributions, like, say, CentOS 7 or Red Hat
- 6:04Speaker 2: Enterprise Linux 7.
- 6:05Speaker 1: The ones using systems, right.
- 6:07Speaker 2: The ones using systems instead of upstart. The process there
- 6:10Speaker 2: is even more streamlined. You don't even need to open
- 6:12Speaker 2: a text editor.
- 6:13Speaker 1: Oh, wow, really?
- 6:13Speaker 2: Yeah, you just run one single command of the terminal.
- 6:15Speaker 1: Yeah.
- 6:16Speaker 2: It's system.pectl mask central.del.target.
- 6:21Speaker 1: Masking it. Okay, what is that actually doing at the
- 6:23Speaker 1: file level? Are we still dealing with sticky notes here?
- 6:26Speaker 2: Sort of, but we're dealing with symbolic links, symlinks.
- 6:30Speaker 1: Okay.
- 6:30Speaker 2: When you run that mask command, the system creates a
- 6:33Speaker 2: shortcut that points the control alt delete target directly to
- 6:38Speaker 2: slash dev slash null. Ah.
- 6:41Speaker 1: And in Linux architecture, slash dev slash null is essentially
- 6:45Speaker 1: a black hole.
- 6:46Speaker 2: It's a total black hole. Any data or commands sent
- 6:49Speaker 2: there just vanishes. So you completely disable the function at
- 6:52Speaker 2: the system level.
- 6:52Speaker 1: That's incredibly clean.
- 6:54Speaker 2: It is. But, and this is a crucial piece of
- 6:57Speaker 2: actionable advice here, regardless of which method you use, you
- 7:00Speaker 2: must reboot the server afterward. Make it stick. Yeah, you
- 7:03Speaker 2: have to restart the machine to ensure those new rules
- 7:06Speaker 2: are permanently baked into the running daemon, which is that
- 7:09Speaker 2: silent background program. handling your system processes.
- 7:12Speaker 1: Okay, I follow the logic for the command line. That
- 7:14Speaker 1: makes total sense. But I need to push back here
- 7:16Speaker 1: for a second because we are assuming a text-only interface.
- 7:19Speaker 2: Right.
- 7:20Speaker 1: What if the server has a graphical user interface installed,
- 7:23Speaker 1: like a full desktop environment? If I mask the command
- 7:27Speaker 1: line target and point it to a black hole, Does
- 7:30Speaker 1: that stop an attacker from hitting Control-Alt-Delete on the GUI
- 7:33Speaker 1: to bring up the graphical logout prompt?
- 7:36Speaker 2: It does not. And you've hit on a really critical
- 7:38Speaker 2: distinction in Linux architecture here.
- 7:40Speaker 1: I knew it!
- 7:41Speaker 2: Yeah, the canline fix does not stop the GUI shortcut.
- 7:45Speaker 2: A graphical desktop environment operates on a completely different layer.
- 7:49Speaker 2: It handles keyboard shortcuts completely independently of that low-level system
- 7:54Speaker 2: daemon we just reconfigured. So if an attacker sees a
- 7:57Speaker 2: graphical desktop, hitting those keys will still bring up the
- 8:00Speaker 2: power prompt.
- 8:01Speaker 1: So the graphical layer just intercepts the keystrokes before they
- 8:04Speaker 1: even reach the underlying system. So how do we lock
- 8:07Speaker 1: down that specific desktop environment?
- 8:10Speaker 2: You have to tackle it within the desktop settings themselves. Right.
- 8:14Speaker 2: If you're sitting at that GUI, you navigate through the interface.
- 8:17Speaker 2: Usually it's clicking applications, then system tools, then settings, and
- 8:21Speaker 2: finally keyboard shortcuts.
- 8:22Speaker 1: Sounds like standard desktop stuff.
- 8:24Speaker 2: It is. And in that list, you'll find a specific
- 8:27Speaker 2: entry for logout mapped to those keys. You select it,
- 8:31Speaker 2: and then you physically hold down the backspace key to
- 8:34Speaker 2: change its value to disabled.
- 8:36Speaker 1: And there is a really frustrating quirk here for anyone
- 8:39Speaker 1: trying this for the first time, right? Once you set
- 8:41Speaker 1: it to disabled, you can't just click apply or save.
- 8:44Speaker 2: Oh, so annoying. Yeah. The desktop environment temporarily hijacks or
- 8:48Speaker 2: grabs all your keyboard and mouse inputs so it can
- 8:51Speaker 2: record your new shortcut keys.
- 8:53Speaker 1: So your mouse is just dead.
- 8:55Speaker 2: Totally dead. Because of how it actively listens for input,
- 8:59Speaker 2: it locks up your mouse clicks completely. You actually have
- 9:02Speaker 2: to hit the escape key on your keyboard to release
- 9:05Speaker 2: that input grab and properly exit the menu to save
- 9:08Speaker 2: the change.
- 9:09Speaker 1: It's those little mechanical quirks that drive you crazy if
- 9:12Speaker 1: you don't understand the mechanisms behind them.
- 9:14Speaker 2: Oh, absolutely.
- 9:15Speaker 1: All right. So we have successfully stopped an attacker from
- 9:17Speaker 1: rebooting the running operating system. whether they're in the terminal
- 9:21Speaker 1: or on a shiny desktop. But let's take this a
- 9:24Speaker 1: step further down the hardware stack. What if they realize
- 9:28Speaker 1: they can't reboot the OS gracefully, so they just reach
- 9:31Speaker 1: around the back, pull the power plug out of the wall,
- 9:34Speaker 1: and plug it back in?
- 9:35Speaker 2: Brute force approach.
- 9:36Speaker 1: Exactly. And when the machine wakes up, they shove a
- 9:39Speaker 1: malicious USB drive into the port to boot their own
- 9:43Speaker 1: operating system.
- 9:44Speaker 2: Yeah, and that bypasses everything we have talked about so far. Everything. Everything.
- 9:49Speaker 2: Because now you're dealing with the BIOS, the basic input-output system. Right.
- 9:54Speaker 2: This is the code baked into the motherboard that runs
- 9:56Speaker 2: before your operating system even knows it exists. If a
- 10:00Speaker 2: threat actor can force the hardware to boot from an
- 10:02Speaker 2: external USB drive or a CD, your Linux security configurations
- 10:07Speaker 2: are completely irrelevant.
- 10:08Speaker 1: Because they're not even interacting with Linux at that point.
- 10:11Speaker 2: Exactly. They aren't interacting with your OS at all. They're
- 10:14Speaker 2: just mounting your hard drive from their own system to
- 10:16Speaker 2: steal or corrupt your data.
- 10:18Speaker 1: So if they bypass the OS entirely, we can't fix
- 10:21Speaker 1: this in Linux at all. We have to go deeper
- 10:23Speaker 1: into the hardware itself.
- 10:24Speaker 2: That is the core of it. Yeah. Every motherboard manufacturer
- 10:28Speaker 2: designs their BIOS a little differently. So you'll usually have
- 10:31Speaker 2: to press a specific key like F2 or delete during
- 10:35Speaker 2: that initial power on to enter the settings.
- 10:37Speaker 1: Right. We've all seen that quick flash on the screen.
- 10:39Speaker 2: Exactly.
- 10:40Speaker 1: Yeah.
- 10:40Speaker 2: And the universal rule for a secure physical server is
- 10:43Speaker 2: to find the boot order menu in there, and explicitly
- 10:46Speaker 2: disable booting from any external devices.
- 10:49Speaker 1: So no USBs, no CD drives.
- 10:51Speaker 2: None. The server must only be allowed to boot from
- 10:54Speaker 2: its own internal primary hard drive.
- 10:56Speaker 1: Okay, so the power cord gets yanked, they plug it
- 10:59Speaker 1: back in, they try the USB, but the BIOS just
- 11:02Speaker 1: ignores it. The machine starts booting from the internal hard drive.
- 11:06Speaker 1: But here's where it gets really interesting. They are sitting
- 11:09Speaker 1: there watching the screen as the server wakes up, just
- 11:12Speaker 1: waiting to intercept the boot process right before the operating
- 11:15Speaker 1: system actually takes over.
- 11:16Speaker 2: Yeah, they're waiting for the GRUB bootloader.
- 11:18Speaker 1: GRUB.
- 11:19Speaker 2: GRUB, yeah. Stands for Grand Unified Bootloader. It's this critical
- 11:22Speaker 2: piece of software that bridges the gap between the BIOS
- 11:25Speaker 2: and your Linux kernel. When a Linux system starts, GRUB
- 11:29Speaker 2: usually presents a menu for a few seconds, asking which
- 11:32Speaker 2: version of the kernel you want to load. And if
- 11:34Speaker 2: an attacker has a keyboard plugged in, they can hit
- 11:36Speaker 2: any key to interrupt that automated countdown.
- 11:39Speaker 1: I'm assuming they aren't just doing this to stall the
- 11:42Speaker 1: boot process, right? Like, what is the actual tactical goal
- 11:45Speaker 1: of interrupting Grub?
- 11:47Speaker 2: Their goal is to edit the boot parameters to force
- 11:50Speaker 2: the system into what's called single user mode.
- 11:53Speaker 1: Okay, and what is single user mode normally used for?
- 11:56Speaker 2: Legitimately, it's a diagnostic and recovery environment. It's meant for
- 12:00Speaker 2: system administrators to fix a severely broken machine.
- 12:03Speaker 1: Like if the network is down or something?
- 12:05Speaker 2: Right, or if the file system is corrupted. But the
- 12:08Speaker 2: terrifying part is that By default, booting into single user
- 12:12Speaker 2: mode drops you directly into a root shell.
- 12:15Speaker 1: Oh, wow.
- 12:16Speaker 2: Yeah, meaning you have the highest possible level of administrative privilege.
- 12:20Speaker 2: And it does this without ever asking for a password.
- 12:22Speaker 1: Wait, really? So if I can touch the keyboard during those, what,
- 12:25Speaker 1: three to five seconds while it boots, I can become
- 12:28Speaker 1: the ultimate super user of the machine?
- 12:30Speaker 2: You can. It's a massive vulnerability for a physical server.
- 12:34Speaker 1: Yeah, we need to put a padlock on that Grub
- 12:36Speaker 1: menu immediately.
- 12:37Speaker 2: We do, and we secure it by setting a master
- 12:40Speaker 2: Grub password. But crucially, we don't just type a password
- 12:44Speaker 2: into a configuration file in plain text where anyone with
- 12:47Speaker 2: read access could see it.
- 12:48Speaker 1: Right, that would be bad.
- 12:49Speaker 2: We have to hash it.
- 12:50Speaker 1: Okay, walk us through that mechanism. How are we locking
- 12:53Speaker 1: this down step-by-step in the terminal?
- 12:56Speaker 2: First, you need to generate that secure hash. You open
- 12:59Speaker 2: your terminal and run a built-in utility called GrubMD5 Crypt. Okay.
- 13:05Speaker 2: The system will prompt you to type in your desired
- 13:07Speaker 2: master password. And once you hit enter, the system doesn't
- 13:11Speaker 2: actually save what you typed. It doesn't.
- 13:13Speaker 1: No.
- 13:13Speaker 2: Instead, it runs your password through an algorithm and spits
- 13:16Speaker 2: out a long, messy, seemingly random string of characters on
- 13:19Speaker 2: your screen.
- 13:20Speaker 1: And that string is the MD5 hash.
- 13:22Speaker 2: Exactly. That string is your hash.
- 13:24Speaker 1: And just to clarify the computer science concept here for
- 13:27Speaker 1: anyone studying cybersecurity with us, Hashing is fundamentally different from encryption, right?
- 13:32Speaker 1: With encryption, you have a key to unscramble the data
- 13:35Speaker 1: back into plain text.
- 13:36Speaker 2: That is the crucial difference. Yeah. A hash is a
- 13:39Speaker 2: mathematical one-way street. The algorithm scrambles your password into that string,
- 13:45Speaker 2: but it is computationally infeasible to reverse it.
- 13:48Speaker 1: So even if I see the hash, I can't read
- 13:50Speaker 1: it to figure out the original password.
- 13:52Speaker 2: Exactly. You can't. When you eventually try to log in,
- 13:55Speaker 2: the system just takes your attempted password, hashes it again...
- 13:58Speaker 2: and sees if the two messy strings match.
- 14:00Speaker 1: That makes perfect sense. Okay, so we take this generated
- 14:04Speaker 1: messy string of characters, we copy it, and then where
- 14:07Speaker 1: does it live?
- 14:08Speaker 2: You open up the main bootloader configuration file, which is
- 14:11Speaker 2: typically located at slash boot slash grub slash grub.conf, depending
- 14:16Speaker 2: on your setup.
- 14:17Speaker 1: Right.
- 14:17Speaker 2: You find the section that defines your operating system menu entries,
- 14:21Speaker 2: and you add a new line near the top. It's
- 14:23Speaker 2: password dash dash md5 followed by a space md5. And
- 14:26Speaker 2: then you just paste that messy hash string you just copied.
- 14:29Speaker 1: And save it.
- 14:30Speaker 2: You save the file, and the bootloader is officially logged.
- 14:33Speaker 1: I want to break down what this resulting experience actually
- 14:36Speaker 1: looks like for the user, because the mechanics here are fascinating.
- 14:39Speaker 2: Oh, it's great.
- 14:40Speaker 1: So the next time you reboot that server, it powers on,
- 14:43Speaker 1: the BIOS hands off to Grub, and the Grub menu
- 14:46Speaker 1: counts down just like normal. If no one touches anything,
- 14:50Speaker 1: it boots all the way into the operating system without
- 14:52Speaker 1: asking for a password. which is obviously essential for a
- 14:56Speaker 1: server sitting unattended in a rack somewhere. Right.
- 14:59Speaker 2: You want it to come back up automatically.
- 15:00Speaker 1: But if a malicious user is standing there and they
- 15:03Speaker 1: hit the E key to edit the boot parameters, trying
- 15:06Speaker 1: to launch that single user mode attack we talked about,
- 15:09Speaker 1: they are totally blocked. The screen just stares back at them. Yep.
- 15:13Speaker 2: The system completely refuses to let them view or edit
- 15:16Speaker 2: the kernel parameters. The E key is just disabled until
- 15:19Speaker 2: authentication occurs.
- 15:20Speaker 1: So to get in, they now have to press the
- 15:22Speaker 1: P key. And when they press P, the system finally
- 15:25Speaker 1: prompts for that master password we just created.
- 15:28Speaker 2: Exactly.
- 15:29Speaker 1: I like to think of this like a valet key
- 15:32Speaker 1: for a car. When you give the parking attendant a
- 15:35Speaker 1: valet key, they can turn the car on, drive it
- 15:37Speaker 1: around the block, and park it. That's your normal automated
- 15:40Speaker 1: boot process.
- 15:41Speaker 2: That's a great analogy.
- 15:42Speaker 1: But if that attendant decides they want to pop the
- 15:44Speaker 1: trunk or open the hood to mess with the underlying
- 15:46Speaker 1: engine mechanics, the car locks them out. For that, you
- 15:50Speaker 1: need the master key.
- 15:52Speaker 2: And the practical advantage of that valet key setup is
- 15:55Speaker 2: that you aren't hindering the server's day-to-day operational availability.
- 15:59Speaker 1: Right.
- 16:00Speaker 2: You allow it to perform its basic function, running the OS,
- 16:03Speaker 2: while completely locking down the underlying engine parameters from unauthorized tampering.
- 16:08Speaker 1: Okay, so we successfully locked the physical door in the basement.
- 16:11Speaker 1: The keyboard traps are set, the GUI is disabled, the
- 16:14Speaker 1: BIOS is restricted, and the bootloader is locked tight. The
- 16:19Speaker 1: physical hardware is a fortress.
- 16:21Speaker 2: It really is.
- 16:22Speaker 1: But an attacker doesn't need to be in the building
- 16:24Speaker 1: if they can just knock on your digital front door
- 16:26Speaker 1: over the internet.
- 16:27Speaker 2: Sadly true.
- 16:28Speaker 1: Let's look at the Remote Access Protocol, SSH, or Secure Shell.
- 16:32Speaker 1: When you connect to the server remotely over a network,
- 16:35Speaker 1: what is the very first thing that greets you on
- 16:37Speaker 1: the screen?
- 16:39Speaker 2: Well, usually it's a default banner message. And this is
- 16:41Speaker 2: where administrators frequently undermine their own security. Really?
- 16:44Speaker 1: How so?
- 16:45Speaker 2: Because... When you establish an SSH connection, before you are
- 16:48Speaker 2: even prompted for a username or a password, the system
- 16:52Speaker 2: reads a text file, specifically slash et cetera slash issue
- 16:56Speaker 2: dot net, and it just displays its contents to whoever's
- 16:59Speaker 2: knocking on that digital door.
- 17:01Speaker 1: Okay. And looking at how these things are set up,
- 17:03Speaker 1: the defaults in that file are incredibly verbose. It's not
- 17:07Speaker 1: just a generic automated greeting, is it?
- 17:10Speaker 2: It is the complete opposite of generic. By default... it
- 17:14Speaker 2: often proudly announces the exact operating system distribution version.
- 17:18Speaker 1: Like, welcome to CentOS release 6.5 or something.
- 17:21Speaker 2: Exactly like that. And it will frequently broadcast the specific
- 17:25Speaker 2: version of the Linux kernel that is currently running on
- 17:28Speaker 2: the hardware.
- 17:29Speaker 1: Which seems entirely counterintuitive to security. I mean, if I'm
- 17:32Speaker 1: an attacker, I'm likely doing a reconnaissance scan of thousands
- 17:35Speaker 1: of IP addresses just looking for an easy target.
- 17:37Speaker 2: Absolutely. The first phase of any cyber attack is always reconnaissance.
- 17:42Speaker 2: By leaving those defaults in place... You're basically doing the
- 17:45Speaker 2: attacker's homework for them. If they know your exact OS
- 17:48Speaker 2: and kernel version before they even attempt to log in,
- 17:51Speaker 2: they don't have to guess what exploits to try. They
- 17:54Speaker 2: can cross-reference that specific kernel version against a database of
- 17:58Speaker 2: known vulnerabilities and launch a highly targeted attack tailored perfectly
- 18:03Speaker 2: to your machine's weaknesses.
- 18:05Speaker 1: We are practically handing them the blueprints to the fortress
- 18:08Speaker 1: before they even try the doorknob.
- 18:09Speaker 2: Pretty much.
- 18:10Speaker 1: So how do we fix this and set up a
- 18:12Speaker 1: proper custom banner... That doesn't leak our system's architecture to
- 18:16Speaker 1: the whole world.
- 18:17Speaker 2: Well, it requires a two-step process to tie the SSH
- 18:19Speaker 2: service to your customized message file. First, you need to
- 18:23Speaker 2: tell the SSH daemon to actually look for and display
- 18:26Speaker 2: a banner.
- 18:26Speaker 1: Okay.
- 18:27Speaker 2: You do this by editing the main SSH configuration file,
- 18:30Speaker 2: which is located at slash, et cetera, slash, slash, slash, slash, yo, underscore, config.
- 18:34Speaker 2: Got it. You scroll through that text until you find
- 18:37Speaker 2: a line that usually says hash banner none.
- 18:40Speaker 1: Hash meaning the pound sign, right? Right.
- 18:41Speaker 2: The hash symbol at the front means the line is
- 18:43Speaker 2: commented out. The system is just ignoring it.
- 18:45Speaker 1: So we remove the hash to activate the command.
- 18:48Speaker 2: You remove the hash, and you change the path so
- 18:50Speaker 2: the line reads. Bannerspace slash et cetera slash issue dot net.
- 18:55Speaker 2: You save that file, and then you restart the SSH
- 18:58Speaker 2: service so it reads the new configuration and applies the rules.
- 19:02Speaker 1: And then comes the fun part. We actually get to
- 19:04Speaker 1: dictate exactly what that banner says.
- 19:06Speaker 2: We do.
- 19:06Speaker 1: We open slash et cetera slash issue.net. We delete all
- 19:10Speaker 1: that default OS and kernel telemetry, and we write our
- 19:12Speaker 1: own message. Now, I have to admit, part of me
- 19:16Speaker 1: gets very excited about the psychological warfare aspect of this.
- 19:19Speaker 2: Oh, I know where this is going.
- 19:20Speaker 1: Like, you could put a message that says something completely
- 19:23Speaker 1: unhinged just to scare them off. Like, unauthorized users will
- 19:26Speaker 1: be tracked down and beaten with a stick.
- 19:29Speaker 2: I mean, while you technically have the freedom to write
- 19:31Speaker 2: whatever you want, standard professional warnings are far more effective
- 19:35Speaker 2: for the legal protection we are actually trying to achieve here.
- 19:38Speaker 1: Yeah, that's probably fair. So practically speaking, you want a
- 19:41Speaker 1: message that reads something like, private server, authorized access only.
- 19:45Speaker 1: All connections are heavily monitored and logged. Disconnect immediately if
- 19:49Speaker 1: you are not... an authorized user.
- 19:51Speaker 2: Exactly. And this goes far beyond just sounding intimidating to
- 19:54Speaker 2: a script kitty, you know.
- 19:56Speaker 1: Yeah.
- 19:56Speaker 2: You are establishing the legal perimeter of your server.
- 19:59Speaker 1: The legal perimeter. Right.
- 20:01Speaker 2: If you ever have to prosecute an individual for breaching
- 20:04Speaker 2: your system, having a clear understanding This unambiguous warning banner
- 20:09Speaker 2: that they were forced to acknowledge proves intent.
- 20:12Speaker 1: Oh, that makes a lot of sense.
- 20:13Speaker 2: It proves they knew they were accessing a restricted private system.
- 20:17Speaker 2: It completely nullifies the legal defense of, oh, I just
- 20:21Speaker 2: stumbled into this server by accident and didn't know it
- 20:22Speaker 2: was off-limits.
- 20:23Speaker 1: So it's essentially a no trespassing sign with real legal weight.
- 20:27Speaker 2: Exactly. Exactly.
- 20:28Speaker 1: Let's take a breath because we have covered some serious
- 20:31Speaker 1: architectural ground today.
- 20:32Speaker 2: We really have. From the physical hardware all the way
- 20:35Speaker 2: up to the remote network protocols.
- 20:37Speaker 1: Yeah. We started by understanding the history of the Linux console.
- 20:41Speaker 1: Then we rewired the physical control alt delete button so
- 20:44Speaker 1: that instead of crashing the server, it leaves a silent
- 20:47Speaker 1: trap log using a background demon. We navigated the very
- 20:50Speaker 1: weird input grabbing quirks of desktop menus to lock down
- 20:54Speaker 1: the GUI shortcuts. We disabled external media in the BIOS
- 20:58Speaker 1: and generated an unbreakable MD5 hash to lock our grub
- 21:02Speaker 1: bootloader so an attacker can't hijack single user mode.
- 21:05Speaker 2: It's a lot of layers.
- 21:07Speaker 1: And finally, we wiped our system's sensitive telemetry off the
- 21:10Speaker 1: SSH remote login screen and replaced it with a stern,
- 21:13Speaker 1: legally sound warning banner. So when we step back and
- 21:17Speaker 1: look at all these pieces, what does this all mean
- 21:19Speaker 1: for someone managing a server today?
- 21:22Speaker 2: It means that true security is never just a single
- 21:24Speaker 2: impenetrable wall. It is about layers. It's the core concept
- 21:29Speaker 2: of defense in depth. You can't just buy a shiny
- 21:32Speaker 2: firewall to secure your network traffic and assume you are safe.
- 21:35Speaker 2: You must secure the physical metal box sitting in the room.
- 21:38Speaker 2: You must secure the hardware boot sequence underneath the operating system.
- 21:41Speaker 2: And you must carefully curate the remote prompts that greet
- 21:44Speaker 2: the outside world.
- 21:45Speaker 1: Because if one layer fails.
- 21:46Speaker 2: Exactly. If one layer fails or if a threat actor
- 21:49Speaker 2: circumvents it, the next layer is already waiting to catch them.
- 21:52Speaker 1: I love that. Before we wrap up, I have a
- 21:54Speaker 1: quick mental exercise for you to test your own setup
- 21:58Speaker 1: at home or at work. Think about the systems you
- 22:00Speaker 1: rely on every single day, whether you're studying programming or
- 22:04Speaker 1: managing infrastructure.
- 22:05Speaker 2: Good idea.
- 22:06Speaker 1: If you had to configure an SSH banner right now,
- 22:10Speaker 1: what legally sound, clearly defined message would you write? What
- 22:15Speaker 1: would your digital perimeter signs say? And perhaps more importantly,
- 22:19Speaker 1: do you actually know if your local machine prevents someone
- 22:22Speaker 1: from editing its bootloader? Next time you reboot, pay attention
- 22:26Speaker 1: to those first three seconds. Try hitting a key. Are
- 22:29Speaker 1: you genuinely protected or are you just hoping nobody tries?
- 22:32Speaker 2: That's an excellent way to audit your own environment. And
- 22:35Speaker 2: I actually want to leave you with one final puzzle
- 22:37Speaker 2: to ponder on your own.
- 22:38Speaker 1: Ooh, all right. Let's hear it.
- 22:39Speaker 2: We spent this entire deep dive talking about how to
- 22:42Speaker 2: lock down a physical server, right?
- 22:44Speaker 1: Yep.
- 22:44Speaker 2: How the hardware boots, who can plug a physical keyboard
- 22:47Speaker 2: into it, and who can interrupt it. But consider this.
- 22:50Speaker 2: What happens when that physical server is perfectly secure, locked
- 22:53Speaker 2: in a biometric vault somewhere, but the machine you are
- 22:56Speaker 2: operating is actually a virtual machine?
- 22:59Speaker 1: Oh.
- 23:00Speaker 2: If the underlying hypervisor, the software hosting your virtual machine,
- 23:04Speaker 2: is compromised by an attacker, where does your front door
- 23:08Speaker 2: really begin?
- 23:08Speaker 1: Oof. When the physical vault itself is just an illusion
- 23:12Speaker 1: in the software, that changes the threat model completely.
- 23:15Speaker 2: It sure does.
- 23:16Speaker 1: It really makes you realize that building a digital fortress
- 23:18Speaker 1: requires constant vigilance at every single layer of the stack.
- 23:22Speaker 1: Thanks for joining us, and we'll catch you on the
- 23:24Speaker 1: next Deep Dive.