Latest / CyberCode Academy / Course 44 - RH Security Specialist | Episode 10: Linux System Logging and Auditing
Transcript
- 0:00Speaker 1: You know, when we think about a server running our apps,
- 0:03Speaker 1: there's often this illusion of silence.
- 0:06Speaker 2: Right, like it's just sitting there.
- 0:07Speaker 1: Yeah, exactly. We just imagine this machine in a dark,
- 0:10Speaker 1: you know, temperature-controlled data center somewhere, just humming along, quietly
- 0:14Speaker 1: surfing up web pages or processing database queries.
- 0:19Speaker 2: Right, totally peaceful.
- 0:20Speaker 1: But if you actually look under the hood... I mean,
- 0:23Speaker 1: the reality is a lot more chaotic. Like, your server
- 0:25Speaker 1: never actually stops talking.
- 0:27Speaker 3: Oh, no.
- 0:27Speaker 2: It's incredibly loud in there.
- 0:29Speaker 1: Right. It is obsessively writing down every single login attempt,
- 0:34Speaker 1: every drop network packet, every tiny background process. It just
- 0:38Speaker 1: generates this endless stream of consciousness, and it stores it
- 0:41Speaker 1: in these hidden text files called system logs.
- 0:44Speaker 3: Yeah.
- 0:44Speaker 2: And what's fascinating here is that for anyone managing these systems,
- 0:48Speaker 2: that stream of consciousness is the ultimate source of truth. But...
- 0:53Speaker 2: and this is a big but, that incredible strength is
- 0:56Speaker 2: also a fatal vulnerability.
- 0:58Speaker 1: Because it just keeps growing, right?
- 0:59Speaker 2: Exactly. I mean, these are just plain text files. Left
- 1:02Speaker 2: unchecked on a busy production server, they will write thousands
- 1:06Speaker 2: of lines per minute until they consume like 100% of
- 1:09Speaker 2: the disk space.
- 1:10Speaker 1: Oh, wow. So it just fills the whole drive.
- 1:13Speaker 2: Yeah, and I've actually seen this happen. When a hard
- 1:15Speaker 2: drive hits zero bytes of free space, the operating system
- 1:19Speaker 2: can't allocate memory anymore, services panic, And the entire server
- 1:23Speaker 2: just crashes.
- 1:24Speaker 1: Wait, really? It just dies? Yep.
- 1:26Speaker 2: The machine is effectively choked to death by its own memories.
- 1:29Speaker 1: That is wild. We're talking about a system literally being
- 1:32Speaker 1: taken down by its own security cameras.
- 1:34Speaker 2: Pretty much, yeah.
- 1:35Speaker 1: So, okay, our mission today for this deep dive is
- 1:39Speaker 1: to figure out how to survive that data flood. We
- 1:42Speaker 1: are going straight into the hidden black box of system logs.
- 1:46Speaker 2: Let's do it.
- 1:47Speaker 1: First, we need to understand the architectural pressure valves, you know,
- 1:50Speaker 1: the things that prevent these files from destroying our disks. Second,
- 1:53Speaker 1: we'll look at secretly shipping these records off-site so hackers
- 1:57Speaker 1: can't tamper with them.
- 1:58Speaker 2: Super important.
- 1:59Speaker 1: And finally, we'll go deep into the kernel to install
- 2:03Speaker 1: a surveillance system that basically intercepts and records system calls
- 2:07Speaker 1: before they even happen.
- 2:08Speaker 2: Which is going to be really fun.
- 2:09Speaker 1: So let's start with the first problem. How do we
- 2:11Speaker 1: handle a text file that literally never stops growing?
- 2:15Speaker 2: Well, your first line of defense here is this surprisingly
- 2:18Speaker 2: elegant little utility called LogRetate.
- 2:21Speaker 1: LogRetate. Okay.
- 2:22Speaker 2: Yeah. Its entire purpose is sustainable log growth. So at
- 2:27Speaker 2: its core, if you picture it, it automates the process
- 2:30Speaker 2: of moving an old bloated log file out of the
- 2:33Speaker 2: active stream, dropping a fresh empty file in its place,
- 2:36Speaker 2: and then managing the older files based on a strict
- 2:39Speaker 2: set of rules.
- 2:40Speaker 1: Okay, let's unpack this. It's basically like having an archivist. Right.
- 2:44Speaker 2: Yeah, that's a good way to look at it.
- 2:45Speaker 1: Imagine someone walking up to your desk at exactly midnight,
- 2:49Speaker 1: taking your massive filled up daily journal, stamping the date
- 2:52Speaker 1: on the cover and placing a brand new blank book
- 2:55Speaker 1: right on your desk for tomorrow. And then they take
- 2:58Speaker 1: the old journal and, I don't know, vacuum seal it
- 3:00Speaker 1: so it shrinks down and toss it into a closet.
- 3:04Speaker 1: And if the closet has a limit of, say, 30 books,
- 3:07Speaker 1: they just Throw away the oldest one to make room.
- 3:10Speaker 2: That is exactly what's happening. And as the system admin,
- 3:13Speaker 2: you are basically the head librarian giving that archivist their
- 3:17Speaker 2: marching orders.
- 3:18Speaker 1: So where do I give those orders? Like, where is
- 3:20Speaker 1: this configured?
- 3:21Speaker 2: So if you were to open up your terminal right now,
- 3:22Speaker 2: you'd find the master configuration file at slash, et cetera,
- 3:26Speaker 2: slash logretate.conf.
- 3:29Speaker 1: Okay, logretate.conf. Right.
- 3:31Speaker 2: And inside that file, you're primarily dealing with two types
- 3:34Speaker 2: of triggers, time and size.
- 3:35Speaker 1: Meaning I can tell it when to swap the books.
- 3:38Speaker 2: Exactly. You can configure the system to rotate logs daily, weekly,
- 3:41Speaker 2: or monthly. But, you know, for high throughput environments, say
- 3:45Speaker 2: you have a server ingesting high frequency financial trading data,
- 3:48Speaker 2: or maybe massive astronomical data sets, a log file might
- 3:51Speaker 2: balloon to several gigabytes in just a few hours.
- 3:54Speaker 1: Oh, wow. So waiting a week to rotate would be
- 3:56Speaker 1: a disaster.
- 3:57Speaker 2: It would be catastrophic. The drive would fill up before
- 3:59Speaker 2: the week is even over.
- 4:00Speaker 1: So you configure a hard size limit instead. You tell
- 4:03Speaker 1: the archivist, hey, The second this book hits 500 megabytes
- 4:06Speaker 1: or even 500 gigabytes, I don't care what time it is,
- 4:08Speaker 1: swap it out.
- 4:09Speaker 2: Spot on. You set a size threshold and you combine
- 4:12Speaker 2: that with a keep directive. So you might type something
- 4:15Speaker 2: like rotate five in the config. That ensures you only
- 4:19Speaker 2: ever hold the five most recent archives. The absolute oldest
- 4:23Speaker 2: is just systematically deleted.
- 4:24Speaker 1: Gotcha. That makes sense.
- 4:26Speaker 2: But what really makes this architecture resilient is how it
- 4:29Speaker 2: handles the complexity of modern servers. Because think about it.
- 4:33Speaker 2: You might have 50 different software packages running. Web servers, databases,
- 4:38Speaker 2: package managers.
- 4:39Speaker 1: Right. They all have their own logs.
- 4:41Speaker 2: Exactly. And if every single one of those programs wrote
- 4:44Speaker 2: their rules directly into your masterlogrotate.conf file, well, a single
- 4:49Speaker 2: syntax error from one bad update could corrupt your global
- 4:53Speaker 2: logging policy.
- 4:54Speaker 1: And then the whole server goes down because the logs
- 4:56Speaker 1: stop rotating.
- 4:57Speaker 2: Precisely. So Linux systems avoid that trap through modularity. Well,
- 5:01Speaker 2: right next to that main config file, there is a
- 5:03Speaker 2: directory called slash, et cetera, slash, log right, dot d,
- 5:06Speaker 2: just dot d at the end. Oh, okay.
- 5:08Speaker 1: So it's a folder.
- 5:09Speaker 2: Yeah. When you install a new package, it doesn't touch
- 5:11Speaker 2: your master global rules. It just drops its own isolated
- 5:15Speaker 2: application-specific configuration file right into that dot d folder.
- 5:20Speaker 1: Oh, I see. So if your web server update has
- 5:21Speaker 1: a bad config file, it only breaks the web server's
- 5:25Speaker 1: log rotation.
- 5:25Speaker 2: Exactly. It isolates the failure. It's brilliant.
- 5:28Speaker 1: That is really smart. Now, what about the vacuum sealing
- 5:32Speaker 1: part of my analogy, shrinking the files down?
- 5:35Speaker 2: Right, the compression. So you literally just add the word
- 5:37Speaker 2: compressed to your configuration file, and it leverages gzip. And
- 5:41Speaker 2: this is hugely effective because system logs are highly redundant.
- 5:45Speaker 1: Like repeating timestamps and stuff?
- 5:46Speaker 2: Yeah, repeating timestamps, identical warning strings, vast amounts of empty
- 5:50Speaker 2: white space. And text compression thrives on predictable redundancy.
- 5:54Speaker 1: So how small does it get?
- 5:55Speaker 2: I mean, you can take a 1.4 megabyte log file
- 5:58Speaker 2: and compress it down to like 291 bytes.
- 6:00Speaker 1: Wait, bytes, not kilobytes.
- 6:03Speaker 2: Bytes. You're shrinking the data footprint by over 99%.
- 6:06Speaker 1: That is insane. I mean, multiplying that efficiency across thousands
- 6:09Speaker 1: of files over, what, a five-year life cycle? That's the
- 6:12Speaker 1: difference between buying one hard drive and buying a whole
- 6:15Speaker 1: massive storage array.
- 6:16Speaker 2: Exactly. It saves a ton of money. But, and there's
- 6:20Speaker 2: a big mechanical problem here we have to talk about. Uh-oh.
- 6:22Speaker 1: What's the problem?
- 6:23Speaker 2: Let's say your database daemon is actively writing to a
- 6:27Speaker 2: file called error.log. It has an open file handle, right?
- 6:31Speaker 2: It's actively typing in the book.
- 6:33Speaker 1: Okay. I'm with you.
- 6:34Speaker 2: If LogGrate suddenly sweeps in, renames that file to error.log.1,
- 6:39Speaker 2: compresses it, and drops a blank error dot log in
- 6:42Speaker 2: its place. The database is going to panic. It doesn't
- 6:45Speaker 2: know the file was swapped.
- 6:46Speaker 1: Oh, because it's still trying to write to the old
- 6:48Speaker 1: piece of paper that was just yanked away.
- 6:50Speaker 2: Worse, actually. It will keep writing to the old file
- 6:53Speaker 2: even after it's been renamed and compressed.
- 6:55Speaker 1: Wait, how can it write to a zipped file?
- 6:57Speaker 2: Because the operating system tracks files by their underlying inode number,
- 7:01Speaker 2: not their human readable name. So the database keeps pouring
- 7:04Speaker 2: text into a compressed archives, and you end up with
- 7:07Speaker 2: a completely corrupted, unreadable file.
- 7:10Speaker 1: Oh, yikes. So how do we fix that?
- 7:12Speaker 2: LogRotate uses these things called pre-rotate and post-rotate scripts. They
- 7:16Speaker 2: allow you to automatically execute shell commands at the exact
- 7:20Speaker 2: millisecond the files are swapped.
- 7:22Speaker 3: Oh, nice.
- 7:22Speaker 1: So we use a post-rotate script to basically tap the
- 7:25Speaker 1: database on the shoulder.
- 7:26Speaker 2: Exactly. The log gets swapped, and the script instantly sends
- 7:30Speaker 2: a signal, usually a SIGUP or a reload command, to
- 7:33Speaker 2: the database team.
- 7:34Speaker 1: And that signal tells it, hey, drop the old file
- 7:37Speaker 1: and open a connection to this new blank one.
- 7:39Speaker 2: You got it. And it happens so fast that no
- 7:41Speaker 2: data is lost in the transition.
- 7:43Speaker 1: That's super clean.
- 7:44Speaker 3: It is.
- 7:45Speaker 2: Oh, and one quick gotcha for anyone who might be
- 7:48Speaker 2: testing this architecture on their own machines.
- 7:50Speaker 1: Yeah, what's the catch?
- 7:51Speaker 2: LogRotate relies on Cron, which is the system's time-based job scheduler,
- 7:56Speaker 2: to run daily. Cron actually writes down a state file
- 8:00Speaker 2: recording exactly when it last ran the rotation.
- 8:03Speaker 3: Okay.
- 8:03Speaker 2: So if you edit your config file right now and
- 8:05Speaker 2: then just sit there waiting for something to happen, nothing will.
- 8:08Speaker 2: The system knows it already rotated the logs today.
- 8:11Speaker 1: Oh, I see. It's like, I already did my tours.
- 8:13Speaker 1: Leave me alone.
- 8:14Speaker 2: Exactly. So to test it, you have to bypass that
- 8:17Speaker 2: state file. You run the log or take command manually
- 8:20Speaker 2: from your terminal and pass the dash F flag, the
- 8:24Speaker 2: force flag.
- 8:25Speaker 1: Dash F. Got it. So you're telling the kernel, ignore
- 8:28Speaker 1: the schedule, do it right now. Right.
- 8:30Speaker 2: It's an essential troubleshooting step.
- 8:32Speaker 1: Okay. So if we successfully deploy this, our server's internal
- 8:36Speaker 1: storage is safe, right? The system won't crush itself.
- 8:39Speaker 2: Correct.
- 8:40Speaker 1: But here's where it gets really interesting to me. A
- 8:43Speaker 1: local log is inherently vulnerable. Let's say a hacker breaks
- 8:47Speaker 1: into your system, bypasses the firewalls, and gets root access.
- 8:51Speaker 1: What's the very first thing they do?
- 8:53Speaker 2: They cover their tracks.
- 8:54Speaker 1: Exactly. They'll go into the logs, like the secure log,
- 8:57Speaker 1: and delete the entries showing their IP address. I mean,
- 9:00Speaker 1: with a few keystrokes, your forensic evidence is completely gone.
- 9:03Speaker 2: And that's why the standard countermeasure is centralized remote logging.
- 9:06Speaker 1: Centralized remote logging. Okay, walk me through that.
- 9:08Speaker 2: So the moment an event occurs on a client server,
- 9:11Speaker 2: before an attacker even has time to type their next command,
- 9:14Speaker 2: a copy of that log entry is fired over the
- 9:16Speaker 2: network to a highly secured, isolated repository, a central vault.
- 9:21Speaker 3: Oh, wow.
- 9:21Speaker 1: So even if they delete the local copy, it's too late.
- 9:24Speaker 1: The evidence is already off-site.
- 9:26Speaker 2: Exactly. To destroy the evidence, the attacker would have to
- 9:29Speaker 2: execute a secondary breach into this hardened vault server, which,
- 9:32Speaker 2: by the way, probably doesn't even allow SSH connections.
- 9:35Speaker 3: It's locked down tight. But wait, we can't just toss
- 9:39Speaker 3: raw text over a standard network connection, right? Like, if
- 9:43Speaker 3: there's a momentary network blip or a switch gets congested,
- 9:46Speaker 3: we drop packets. And dropping packets means losing forensic data.
- 9:50Speaker 2: You're absolutely right. There has to be a specialized transport
- 9:53Speaker 2: mechanism for this. And the modern standard is a tool
- 9:55Speaker 2: called Schuss's log.
- 9:57Speaker 1: Arsaz log, the R.
- 10:00Speaker 2: It replaces the ancient syslog protocol that was used 20
- 10:03Speaker 2: or 30 years ago, and it brings enterprise-grade reliability.
- 10:06Speaker 1: How does it do that?
- 10:07Speaker 2: The key architectural difference is in the transport layer. The
- 10:11Speaker 2: old protocol used UDP user datagram protocol. And UDP is
- 10:15Speaker 2: basically fire and forget. The client shoots the message onto
- 10:18Speaker 2: the network. and honestly doesn't care if the server actually
- 10:20Speaker 2: received it.
- 10:21Speaker 1: That sounds bad for security logs. It is.
- 10:23Speaker 2: So Schuster's log utilizes TCP, the transmission control protocol.
- 10:27Speaker 1: Ah, okay. Because TCP requires a handshake, right? Like needing
- 10:30Speaker 1: a signature for a package delivery.
- 10:32Speaker 2: Exactly. The sender and receiver have to acknowledge every single packet.
- 10:35Speaker 2: If a packet gets lost in transit, TCP just automatically
- 10:38Speaker 2: retransmits it.
- 10:39Speaker 1: Perfect. So how do we actually set this up?
- 10:41Speaker 2: It's pretty straightforward. On the central vault server, you open
- 10:44Speaker 2: up slash et cetera slash rcslog.conf. You just uncomment a
- 10:49Speaker 2: couple lines for the TCP module, which binds the listening
- 10:52Speaker 2: service to port 514.
- 10:54Speaker 1: Port 514. Right.
- 10:55Speaker 2: So the vault just sits there, keeping port 514 open,
- 10:57Speaker 2: waiting to acknowledge incoming data. Then, on the client side,
- 11:00Speaker 2: you open that exact same config file, scroll down to
- 11:03Speaker 2: the rules section and define what you want to send,
- 11:05Speaker 2: and you just point it to the vault server's IP
- 11:07Speaker 2: address on port 514. Okay, but wait.
- 11:09Speaker 1: The syntax uses wildcards, right? Like, I could write star
- 11:13Speaker 1: dot star to send absolutely every log from every facility
- 11:16Speaker 1: to the vault.
- 11:17Speaker 2: You could, yes.
- 11:18Speaker 1: But if I have an infrastructure with, say, 50 or
- 11:21Speaker 1: 100 servers, and they're all sending star.star with a network,
- 11:25Speaker 1: haven't we just recreated the disk space crisis from part one?
- 11:29Speaker 1: Except now it's all piling up on one centralized machine.
- 11:33Speaker 2: Yeah, you need a petabyte-scale storage array to hold the
- 11:35Speaker 2: background noise of 100 machines.
- 11:38Speaker 3: Right.
- 11:38Speaker 1: So how do we avoid that?
- 11:40Speaker 2: You apply network-level filtering right at the source. So the
- 11:44Speaker 2: client doesn't have to send star.star anymore. you can configure
- 11:47Speaker 2: it to send, say, star.info.
- 11:49Speaker 1: Star.info, so that drops all the low-level debugging spam.
- 11:52Speaker 2: Exactly. It only transmits informational events and higher. Or you
- 11:56Speaker 2: could use authprev.star, which strictly forwards authentication and security logs,
- 12:02Speaker 2: completely ignoring the noisy web server traffic.
- 12:04Speaker 1: But here's the catch. If I filter down to star.info
- 12:08Speaker 1: just to save my storage budget, I feel like I'm
- 12:10Speaker 1: literally handing a sophisticated hacker a map of my blind spot.
- 12:14Speaker 2: Oh, absolutely.
- 12:15Speaker 1: Because if they use some crazy kernel exploit that only
- 12:17Speaker 1: generates low-level debug noise, they bypass the vault completely. Our
- 12:22Speaker 1: pristine central server never even sees the attack because we
- 12:25Speaker 1: told the clients to drop those packets.
- 12:27Speaker 2: And right there, you've identified the fundamental tension in security engineering.
- 12:31Speaker 2: It's always visibility versus infrastructure cost.
- 12:34Speaker 1: Yeah, that makes sense.
- 12:35Speaker 2: I mean, if you had the storage area network to
- 12:37Speaker 2: ingest a petabyte of raw star dot star logs and
- 12:41Speaker 2: the processing power to actually search it, you send everything.
- 12:44Speaker 2: But most environments don't have that luxury.
- 12:47Speaker 1: So what's the compromise?
- 12:48Speaker 2: Usually it's deploying immutable local logs on the client machines
- 12:52Speaker 2: alongside that filtered Dorsey log string. So even if you
- 12:55Speaker 2: miss the debug noise on the central vault, the attacker
- 12:58Speaker 2: still can't modify the local record without triggering an alarm.
- 13:02Speaker 1: Okay, that's a solid middle ground. Now let's say we
- 13:04Speaker 1: set all this up. We write the clients to the vault.
- 13:06Speaker 1: We restart the services and suddenly nothing arrives. The vault
- 13:10Speaker 1: is just completely silent. What did we do wrong?
- 13:13Speaker 2: Ah, the silent failure. It is almost always the host-based firewall.
- 13:18Speaker 3: The firewall.
- 13:19Speaker 1: Of course.
- 13:20Speaker 2: Yeah, the vault server daemon is happily listening on port 514,
- 13:23Speaker 2: but services like Iptables or Firewall are sitting right in
- 13:27Speaker 2: front of it, just dropping unapproved traffic by default.
- 13:29Speaker 1: So the TCP handshake never even finishes.
- 13:32Speaker 3: Right.
- 13:33Speaker 2: The firewall shreds the incoming request. You have to explicitly
- 13:36Speaker 2: author a rule to allow inbound TCP traffic on port 514.
- 13:40Speaker 1: It's the network equivalent of checking if the machine is
- 13:43Speaker 1: actually plugged into the wall.
- 13:44Speaker 2: Totally.
- 13:45Speaker 1: Okay, so our architecture is getting really robust now. We
- 13:48Speaker 1: have local log rotation managing disk space, and we've got
- 13:52Speaker 1: remote Versys log streams guaranteeing forensic preservation.
- 13:57Speaker 2: They're a good shake.
- 13:58Speaker 1: But what does this all mean when we actually read
- 14:01Speaker 1: these standard logs? Because they're painfully high level, right?
- 14:04Speaker 2: Oh, yeah. Very basic.
- 14:05Speaker 1: They tell us, like, user X authenticated at this time,
- 14:08Speaker 1: or the Apache service restarted. What if we have a
- 14:11Speaker 1: malicious insider? Or what if a third-party vendor has remote
- 14:14Speaker 1: access to update a proprietary database, and we need to
- 14:17Speaker 1: verify they aren't copying customer records? Standard langs do not
- 14:21Speaker 1: capture granular keystrokes.
- 14:23Speaker 2: No, they don't. And to achieve that forensic-level granularity, you
- 14:27Speaker 2: actually have to bypass application-level logging entirely. You have to
- 14:31Speaker 2: hook directly into the operating system's kernel.
- 14:34Speaker 1: Hooking into the kernel. Okay, how do we do that?
- 14:35Speaker 2: This is where we deploy Audit, the Linux Audit daemon.
- 14:39Speaker 1: Audit. So most logging is reactive, right? An app does something,
- 14:43Speaker 1: then writes a note about it. But hooking into the kernel,
- 14:46Speaker 1: that sounds entirely different.
- 14:48Speaker 2: It's a fundamental shift in surveillance. So modern operating systems
- 14:51Speaker 2: are divided into two distinct areas, user space and kernel space.
- 14:55Speaker 1: Okay.
- 14:56Speaker 2: When a user runs a command to open a file
- 14:58Speaker 2: like slash etc slash shadow, which has all your encrypted passwords,
- 15:02Speaker 2: they don't just open it. Their application in user space
- 15:05Speaker 2: has to ask the kernel to for permission to interact
- 15:08Speaker 2: with the hardware.
- 15:09Speaker 1: And it does that by issuing a system call, right?
- 15:11Speaker 2: A syscall. Exactly.
- 15:13Speaker 1: Let me contextualize this for a second. Standard logging is
- 15:16Speaker 1: kind of like having a security camera pointing at the
- 15:18Speaker 1: lobby of a bank. You see who walks in and
- 15:20Speaker 1: who walks out. But audit is like placing a physical
- 15:22Speaker 1: inspector inside the bank's pneumatic tubes. When a teller tries
- 15:26Speaker 1: to send a canister to the vault, the inspector physically
- 15:29Speaker 1: intercepts the tube, opens it, checks the identity of the teller,
- 15:33Speaker 1: verifies the payload, records the exact microsecond of the request,
- 15:37Speaker 1: and then lets the system call proceed.
- 15:39Speaker 2: That is a perfect analogy. The audit framework intercepts events
- 15:44Speaker 2: at the Cisco level before the action is even completed
- 15:46Speaker 2: by the hardware.
- 15:47Speaker 3: Wow.
- 15:48Speaker 2: It tracks the exact user ID, even if they've escalated
- 15:51Speaker 2: their privileges using sudo or master origin through complex SSH tunneling.
- 15:56Speaker 2: It records network socket connections, file modifications, execution commands, all
- 16:01Speaker 2: with uncompromising detail.
- 16:03Speaker 1: That is incredibly powerful. And I'm guessing we configure this
- 16:06Speaker 1: inspector in what slash et cetera slash audit slash audit
- 16:09Speaker 1: dot com.
- 16:10Speaker 2: You got it. That's the top level config file.
- 16:12Speaker 1: But here is the obvious danger to me. If we
- 16:15Speaker 1: are intercepting and writing a log for every single system call,
- 16:18Speaker 1: the volume of data generated must be astronomical. We are
- 16:21Speaker 1: right back to the disk space crisis from earlier, but
- 16:23Speaker 1: like on steroids.
- 16:25Speaker 2: It's a lot of data.
- 16:26Speaker 3: Yes. Yeah.
- 16:27Speaker 1: And we can't just log or take our way out
- 16:28Speaker 1: of it because this demon is tied directly to the kernel.
- 16:32Speaker 1: If the audit drive fills up, what happens to all
- 16:35Speaker 1: those system calls? Do they just stop?
- 16:37Speaker 2: The architecture of audit is actually built with ruthless fail-safes
- 16:41Speaker 2: for this exact scenario. In that config file, you define
- 16:44Speaker 2: space left actions.
- 16:46Speaker 1: Okay, like thresholds.
- 16:47Speaker 3: Yeah.
- 16:48Speaker 2: You establish a threshold, say 75% disk capacity. The moment
- 16:51Speaker 2: the partition hits that mark, audit bypasses its own mechanisms
- 16:56Speaker 2: and And blasts a critical warning to the standard syslog facility.
- 17:00Speaker 1: Oh, so it alerts the administrators that the surveillance data
- 17:02Speaker 1: is about to overrun the partition. Right.
- 17:05Speaker 2: It waves a massive red flag.
- 17:06Speaker 1: But a warning at 75%. What if it's 3.0 AM
- 17:10Speaker 1: on a Sunday? The admin sleeps through the pager duty,
- 17:13Speaker 1: the disk keeps filling up, and we hit 100% capacity.
- 17:16Speaker 1: What happens then? Does the kernel panic? Does it freeze
- 17:19Speaker 1: the entire server?
- 17:20Speaker 2: So the default engineering philosophy of audit is that availability
- 17:23Speaker 2: trumps surveillance.
- 17:24Speaker 1: Okay, meaning the server needs to stay up.
- 17:27Speaker 2: Right. You configure an admin space left action, and it's
- 17:30Speaker 2: typically set to suspend. When the disk hits absolute zero
- 17:34Speaker 2: free bytes, audit basically falls on its own sword.
- 17:38Speaker 1: Wait, it just gives up.
- 17:39Speaker 2: It completely disables the kernel auditing hooks. It just stops
- 17:44Speaker 2: writing data so the operating system can continue executing system
- 17:47Speaker 2: calls and serving production traffic.
- 17:49Speaker 3: Wow.
- 17:50Speaker 1: The server deliberately blinds its own security cameras just to
- 17:54Speaker 1: keep its heart beating. That is a crazy calculated sacrifice.
- 17:57Speaker 2: It is. But you can configure it differently if you want.
- 18:00Speaker 1: Yeah.
- 18:01Speaker 2: In high security environments like military networks or financial clearinghouses,
- 18:04Speaker 2: you might change that action from suspend to halt.
- 18:07Speaker 1: Halt. Like stop everything.
- 18:09Speaker 2: Literally. In that architecture, the moment the audit trail is
- 18:12Speaker 2: compromised by a full disk, the demon sends a halt
- 18:15Speaker 2: command to the kernel and just crashes the server.
- 18:17Speaker 1: No way. It just kills the machine. Yep.
- 18:20Speaker 2: The philosophy there is, if we cannot definitively record what
- 18:24Speaker 2: is happening, this machine is not allowed to exist.
- 18:26Speaker 1: That is the ultimate security posture. Just pull the plug.
- 18:30Speaker 2: It really is.
- 18:31Speaker 1: Man, let's look at the incredible ground we've covered today.
- 18:34Speaker 1: We started with the sheer crushing volume of server noise,
- 18:38Speaker 1: engineering a sustainable local archive using Logretate to prevent disk failure.
- 18:43Speaker 3: Check.
- 18:44Speaker 1: Then we hardened our architecture by streaming those logs over
- 18:47Speaker 1: a TCP handshake using a Versys log on port 514,
- 18:52Speaker 1: which protects our forensic data from local tampering.
- 18:55Speaker 2: Absolutely.
- 18:56Speaker 1: And finally, we went deep into kernel space, deploying audit
- 18:59Speaker 1: to intercept system calls and track granular behavior, complete with
- 19:03Speaker 1: automated fail safes to balance surveillance and system availability.
- 19:07Speaker 2: And, you know, if we connect this to the bigger picture,
- 19:10Speaker 2: this whole journey raises a pretty profound architectural question. for
- 19:14Speaker 2: anyone building modern infrastructure.
- 19:16Speaker 1: What's that?
- 19:16Speaker 2: As storage gets cheaper and processing power scales up, system
- 19:20Speaker 2: logs are transitioning from just being diagnostic tools to being
- 19:23Speaker 2: highly valuable data commodities. I mean, when we utilize kernel-level
- 19:27Speaker 2: hooks to capture every keystroke, every file that's encrypted, every
- 19:29Speaker 2: network socket, the boundary between essential security monitoring and absolute
- 19:33Speaker 2: total surveillance basically vanishes.
- 19:35Speaker 1: Because you can see literally everything.
- 19:38Speaker 2: Exactly. You have the capability to track everything. The real
- 19:41Speaker 2: challenge now is defining exactly where you draw that line
- 19:44Speaker 2: in your own systems. Where's the boundary between actionable security
- 19:48Speaker 2: intelligence and just drowning in an ocean of your own
- 19:53Speaker 2: surveillance data?
- 19:54Speaker 1: It's the ultimate balancing act. The mechanics are waiting for
- 19:58Speaker 1: us right there in the configuration files, but the philosophy, well,
- 20:01Speaker 1: that's up to the engineer.
- 20:03Speaker 2: Well said.
- 20:04Speaker 1: Before you go, listener, it is time to put these
- 20:06Speaker 1: concepts to work. Here is a quick mental exercise to
- 20:09Speaker 1: lock in the architecture we just explored. Imagine you were
- 20:12Speaker 1: deploying a critical web server today. Your security team gives
- 20:16Speaker 1: you two mandatory requirements.
- 20:18Speaker 2: Listen closely.
- 20:19Speaker 1: First, your massive local traffic logs must be archived and
- 20:23Speaker 1: compressed every single day so the machine doesn't crash. Second,
- 20:27Speaker 1: a copy of those logs must be guaranteed delivery to
- 20:29Speaker 1: a remote centralized vault for forensic safety. Think about the
- 20:33Speaker 1: exact network port you need to open, the specific protocol
- 20:36Speaker 1: that guarantees delivery, and the two configuration files you have
- 20:39Speaker 1: to edit to make this a reality.
- 20:41Speaker 2: Got your answers.
- 20:41Speaker 1: Let's see. You would need to edit slash et cetera
- 20:44Speaker 1: slash LogRotate.conf to set your daily rotation and compression triggers
- 20:49Speaker 1: protecting your local disk. Then you would open slash et
- 20:52Speaker 1: cetera slash ArcheeseLog.conf and configure the TCP module. to send
- 20:57Speaker 1: your data stream to the remote vault on port 514.
- 20:59Speaker 2: Spot on.
- 21:00Speaker 1: If you mapped that out, you are well on your
- 21:02Speaker 1: way to mastering the forensic architecture of your systems. Keep experimenting,
- 21:06Speaker 1: keep breaking things in a safe environment, and we'll catch
- 21:08Speaker 1: you on the next deep dive.