Latest / CyberCode Academy / Course 44 - RH Security Specialist | Episode 7: Linux Group Security and the Power of PAM
Transcript
- 0:00Speaker 1: Imagine a massive, like grueling military obstacle course.
- 0:05Speaker 2: Right.
- 0:05Speaker 1: You've got hundreds of recruits lined up and you need
- 0:10Speaker 1: this rock solid system to determine who makes it through
- 0:14Speaker 1: the mud crawls and, you know, who gets pulled off
- 0:17Speaker 1: the course for failing a rope climb. Yeah.
- 0:19Speaker 2: And crucially, how to handle someone who tries to just
- 0:22Speaker 2: sneak in through a side gate.
- 0:23Speaker 1: Exactly. In the world of Linux and enterprise system administration,
- 0:27Speaker 1: managing these digital recruits and all the obstacles they have
- 0:30Speaker 1: to clear is, well, it's the absolute core of cybersecurity.
- 0:34Speaker 2: It really is.
- 0:35Speaker 1: So today we're plunging straight into the hidden mechanics of
- 0:38Speaker 1: how Linux actually secures a system for this deep dive.
- 0:42Speaker 1: We're going to start with the surprising, almost secretive ways
- 0:46Speaker 1: that group accounts operate.
- 0:47Speaker 2: Which is fascinating on its own.
- 0:49Speaker 1: Oh, totally. And then we're going to travel all the
- 0:51Speaker 1: way down into the central nervous system of Linux security,
- 0:54Speaker 1: which is this really incredible framework called PAM.
- 0:56Speaker 2: I really like that obstacle course framing, actually, because it
- 0:59Speaker 2: gets away from the idea that security is just a
- 1:02Speaker 2: thick wall or a locked door.
- 1:03Speaker 1: Right, like a static thing.
- 1:05Speaker 2: Yeah, exactly. A modern operating system isn't a static fortress
- 1:08Speaker 2: at all. It's a dynamic series of tests. Security at
- 1:12Speaker 2: this level is about creating modular, highly flexible rules that
- 1:16Speaker 2: make sense for the users who actually need to get
- 1:17Speaker 2: their work done. But it's also about giving administrators precise
- 1:21Speaker 2: control over how and when people are tested. It's really
- 1:26Speaker 2: about smart conditional logic.
- 1:28Speaker 1: Okay, let's unpack this because it's that conditional logic we
- 1:31Speaker 1: really need to untangle starting right at the file and
- 1:35Speaker 1: user level.
- 1:35Speaker 2: Right, before we even touch the massive backend frameworks.
- 1:38Speaker 1: Exactly. We have to look at how everyday access is
- 1:41Speaker 1: structured first. I mean, the baseline is pretty universal, right?
- 1:43Speaker 1: You have your standard permissions for reading, writing, and executing files.
- 1:47Speaker 2: Yeah, the basics.
- 1:48Speaker 1: And you've got your commands like chown to change file ownership,
- 1:52Speaker 1: tghgr for group ownership. And group pad for making new groups. Right.
- 1:56Speaker 2: That's day one stuff.
- 1:57Speaker 1: But when you start looking at the actual permission strings
- 1:59Speaker 1: on a Linux command line, there are some very specific
- 2:03Speaker 1: visual cues that completely change how a file behaves.
- 2:07Speaker 2: Oh.
- 2:08Speaker 1: And honestly, they're incredibly easy to misinterpret.
- 2:12Speaker 2: Oh, they are. They really are. I mean, the one
- 2:14Speaker 2: that causes the most confusion is definitely the distinction between
- 2:18Speaker 2: the SGID, the set group ID, and the sticky bit.
- 2:24Speaker 1: Oh, yeah, people conflate those constantly.
- 2:25Speaker 2: Constantly, because they both alter standard permissions, but they do
- 2:29Speaker 2: completely different things.
- 2:30Speaker 1: So let's break that down, because I've seen administrators stare
- 2:32Speaker 1: at a lowercase is in a permission string and just, like,
- 2:35Speaker 1: totally misinterpret what it's actually doing to the directory.
- 2:38Speaker 2: Right. So when you run an LSL command to look
- 2:40Speaker 2: at a folder's permissions, you're looking at a string of letters, right?
- 2:42Speaker 1: Right.
- 2:43Speaker 2: If you look at the section for group permissions and
- 2:45Speaker 2: you see a lowercase s instead of an x for execute,
- 2:48Speaker 2: that tells you the SGID bit is set and the
- 2:51Speaker 2: execute permission is granted.
- 2:53Speaker 1: And what does the SGID actually do in practice? Like,
- 2:56Speaker 1: why do we care?
- 2:57Speaker 2: Well, it forces inheritance. If a shared folder has the
- 3:01Speaker 2: SGID bit set, any new file created inside that folder
- 3:05Speaker 2: will automatically inherit the group ownership of the folder itself
- 3:10Speaker 2: rather than the default group of the user who just
- 3:12Speaker 2: created it. Oh, wow.
- 3:14Speaker 1: So it's essential for collaborative workspaces then. Exactly.
- 3:17Speaker 2: I mean, if a dev team is working in one directory,
- 3:20Speaker 2: you want all the files they make to be owned
- 3:23Speaker 2: by the developers group, no matter who specifically typed the code.
- 3:26Speaker 1: That makes a lot of sense.
- 3:27Speaker 2: But here's the catch. If you see an uppercase S
- 3:31Speaker 2: in that exact same spot, it means the SGID is set,
- 3:34Speaker 2: but the underlying execute permission is completely missing.
- 3:38Speaker 1: Oof. So it's broken.
- 3:40Speaker 2: Basically, yeah. It's a huge warning sign that the directory
- 3:43Speaker 2: might not function as intended, mostly because... Users can actually
- 3:46Speaker 2: execute commands inside it.
- 3:48Speaker 1: Okay, and that is distinct from the sticky bit, which
- 3:51Speaker 1: is another concept entirely.
- 3:53Speaker 2: Completely distinct. Yeah, the sticky bit shows up as a
- 3:56Speaker 2: T at the very end of the permission string. You
- 3:58Speaker 2: usually see this on the tmp directory. If a folder
- 4:00Speaker 2: has the sneaky bit set, it means that even if
- 4:03Speaker 2: a group has full write access to the folder, a
- 4:07Speaker 2: user can only delete or rename the files that they
- 4:10Speaker 2: personally owned.
- 4:11Speaker 1: Ah, so they can't just delete their coworkers' files.
- 4:13Speaker 2: Exactly. So to summarize, the S is about who owns
- 4:16Speaker 2: the new files, and the T is about who is
- 4:19Speaker 2: actually allowed to destroy them.
- 4:20Speaker 1: That makes perfect sense. It's a really precise visual shorthand.
- 4:24Speaker 1: But moving from file permissions to the groups themselves, I
- 4:27Speaker 1: came across a mechanic that fundamentally challenged how I thought
- 4:31Speaker 1: user management worked.
- 4:32Speaker 2: Oh. Well, what was that?
- 4:34Speaker 1: Group passwords.
- 4:36Speaker 2: Ah, yes.
- 4:36Speaker 1: I mean, wait. Normally your name is just added to
- 4:39Speaker 1: a list in the etc. group file, right? It's a
- 4:41Speaker 1: permanent roster. Why on earth would a group ever need
- 4:44Speaker 1: its own distinct password?
- 4:46Speaker 2: It does feel super counterintuitive if you only think of
- 4:48Speaker 2: groups as static lists.
- 4:49Speaker 1: Yeah, exactly.
- 4:50Speaker 2: But assigning a password directly to a group, which an
- 4:52Speaker 2: admin does using the gpassword command, by the way, it
- 4:55Speaker 2: creates a profoundly useful layer of temporary access.
- 4:59Speaker 1: Temporary. Okay. How so?
- 5:00Speaker 2: Well, when you set a group password, it actually gets
- 5:03Speaker 2: encrypted and stored in a completely separate file called Etcetera Shadow.
- 5:07Speaker 1: OK, so we have this password securely locked away. What
- 5:10Speaker 1: is the real world scenario where I would actually deploy this?
- 5:14Speaker 2: Imagine you have an outside auditor who comes into your company.
- 5:18Speaker 2: They need access to the finance team's internal files, but
- 5:21Speaker 2: like only for 48 hours. Right. You don't want to
- 5:24Speaker 2: permanently modify the primary group rosters. because people forget to
- 5:28Speaker 2: clean those up.
- 5:29Speaker 1: Oh, all the time.
- 5:30Speaker 2: And suddenly an external auditor has permanent access to your
- 5:33Speaker 2: financial records months later, which is a nightmare. Instead, you
- 5:37Speaker 2: just give the auditor the group password. Oh. That user
- 5:40Speaker 2: opens their terminal, types the new grep command, and enters
- 5:43Speaker 2: the password.
- 5:44Speaker 1: So they are essentially putting on a disguise for the
- 5:47Speaker 1: duration of that specific terminal session.
- 5:49Speaker 2: That's a great way to put it, yeah. For that session,
- 5:52Speaker 2: their primary group ID temporarily switches to the finance group.
- 5:55Speaker 2: They can read the files, collaborate, do whatever their job is.
- 5:59Speaker 2: As soon as they close the session, the disguise comes off.
- 6:02Speaker 2: It keeps your core Exceda group file pristine while still
- 6:05Speaker 2: allowing this like dynamic, secure collaboration.
- 6:08Speaker 1: That is so cool. And this framework also allows for
- 6:11Speaker 1: the delegation of power, right? Like a root sysadmin can
- 6:15Speaker 1: run a command. I think it's gpass-a to make a
- 6:18Speaker 1: standard user a group administrator.
- 6:20Speaker 2: Yeah, that's right.
- 6:21Speaker 1: So a team lead can manage their own team's roster.
- 6:25Speaker 1: Without opening an IT ticket every single time someone joins
- 6:28Speaker 1: the department.
- 6:29Speaker 2: Yeah.
- 6:29Speaker 1: But I noticed a very specific built-in limitation to that
- 6:33Speaker 1: delegated power.
- 6:34Speaker 2: Yes. And it's a critical safeguard. A delegated group administrator
- 6:38Speaker 2: can add regular users to their group and they can
- 6:40Speaker 2: remove regular users. But they are strictly forbidden from making
- 6:44Speaker 2: anyone else a group administrator.
- 6:45Speaker 1: Which stops a cascading web of unauthorized management. I mean.
- 6:49Speaker 1: If a manager could arbitrarily print out new manager badges
- 6:51Speaker 1: and hand them to their friends, IT would lose total
- 6:54Speaker 1: visibility into who actually controls the system.
- 6:56Speaker 2: Exactly. It completely prevents privilege creep. The buck stops with
- 7:00Speaker 2: the person root originally designated.
- 7:02Speaker 1: So all of this group management is fantastic for authorization, right?
- 7:05Speaker 1: Like determining what you are allowed to touch once you
- 7:09Speaker 1: are inside.
- 7:09Speaker 2: Right.
- 7:10Speaker 1: But it forces a much deeper question. Hmm. When that
- 7:14Speaker 1: auditor types in the group password or when any user
- 7:17Speaker 1: trying to log into the server in the first place,
- 7:20Speaker 1: what is the system actually doing behind the scenes to
- 7:23Speaker 1: verify them? It can't just be checking one file.
- 7:26Speaker 2: It absolutely isn't. And this is where we cross the
- 7:29Speaker 2: line from authorization over to authentication.
- 7:32Speaker 1: Okay, here we go.
- 7:33Speaker 2: We are moving into the absolute powerhouse of Linux security.
- 7:37Speaker 2: I'm talking about PAM. Plugable authentication modules.
- 7:40Speaker 1: Yes. To really grasp how brilliant PAM is, I think
- 7:44Speaker 1: we need to look at what the computing world looked
- 7:45Speaker 1: like before it existed. Because from what I understand, early
- 7:48Speaker 1: Unix security was just a sprawling, inefficient mess.
- 7:52Speaker 2: It was an architectural nightmare, honestly. If we connect this
- 7:55Speaker 2: to the bigger picture, historically, every single program on a
- 7:58Speaker 2: system that required a login had to have its security
- 8:01Speaker 2: logic hard-coded directly into its own source code.
- 8:04Speaker 1: Wait, really? Every single one?
- 8:06Speaker 2: Every single one. If you wrote a local login program,
- 8:09Speaker 2: you had to write the C code to check the
- 8:11Speaker 2: password file. If you wrote an FTP server, you had
- 8:14Speaker 2: to write that same code again. A mail client. You
- 8:17Speaker 2: wrote it again.
- 8:18Speaker 1: Which means if a new, stronger encryption algorithm was invented, or,
- 8:23Speaker 1: I don't know, if a company decided they wanted to
- 8:26Speaker 1: start using physical smart cards?
- 8:27Speaker 2: Yep. Every single application on the server had to be
- 8:30Speaker 2: manually rewritten, recompiled, and redeployed by the developers just to
- 8:35Speaker 2: support the new standard.
- 8:36Speaker 1: That sounds completely unsustainable. It was.
- 8:39Speaker 2: Pam revolutionized this by acting as a universal middleman. It
- 8:43Speaker 2: stripped the authentication logic entirely out of the individual applications.
- 8:47Speaker 1: Okay, so if I'm understanding this architecture correctly, today, when
- 8:50Speaker 1: I try to log in via SSH, the SSH program
- 8:54Speaker 1: itself has no idea how to verify my password. It
- 8:56Speaker 1: doesn't even know what a password hash is.
- 8:58Speaker 2: Exactly. The SSH daemon just takes what you typed, hands
- 9:01Speaker 2: it over to PAM, and says, hey, here's a user
- 9:03Speaker 2: and some credentials. Tell me if I should let them in.
- 9:06Speaker 2: PTAM looks at its own central configuration files, runs whatever
- 9:10Speaker 2: complex checks the sysadmin has designed. And simply hands SSH
- 9:14Speaker 2: back a yes or a no. The application is completely
- 9:18Speaker 2: blind to the mechanics of it.
- 9:19Speaker 1: But wait, I have to challenge that design for a second.
- 9:22Speaker 2: Sure, go for it.
- 9:23Speaker 1: In cybersecurity, we talk constantly about avoiding single points of failure.
- 9:28Speaker 1: By routing every single authentication request through one central framework,
- 9:32Speaker 1: haven't we just created the ultimate single point of failure?
- 9:36Speaker 1: I mean, if I make a typo in a PAM
- 9:39Speaker 1: configuration file, Couldn't I accidentally lock every single user, including myself,
- 9:43Speaker 1: out of the entire machine?
- 9:45Speaker 2: You absolutely could. And system administrators have definitely locked themselves
- 9:48Speaker 2: out of data centers doing exactly that.
- 9:50Speaker 1: I bet.
- 9:50Speaker 2: It is a massive single point of failure. But, you know,
- 9:53Speaker 2: in system architecture, everything is a trade-off. The risk of
- 9:56Speaker 2: a centralized failure is far outweighed by the security benefit
- 9:59Speaker 2: of centralized control.
- 10:01Speaker 1: Okay, fair enough.
- 10:02Speaker 2: If a vulnerability is found in an authentication method, you
- 10:05Speaker 2: update PAM once and instantly every application on the server
- 10:08Speaker 2: is secure. You don't have to pray that 50 different
- 10:12Speaker 2: software vendors patch their specific apps in time.
- 10:15Speaker 1: Okay, that makes sense. The centralized control is worth the risk,
- 10:18Speaker 1: provided it You know exactly what you were doing.
- 10:20Speaker 2: Exactly.
- 10:21Speaker 1: So let's figure out how this actually works. If I
- 10:25Speaker 1: look in the etcpan.d directory, I see a bunch of
- 10:28Speaker 1: configuration files named after different services, one for sudo, one
- 10:31Speaker 1: for password, one for strd.
- 10:32Speaker 2: Right. And the modules themselves live in userlib64 security while
- 10:37Speaker 2: the manuals are in eshirdoc. Right.
- 10:39Speaker 1: But here's where it gets really interesting. When you open
- 10:42Speaker 1: one of those config files up, it looks like a
- 10:44Speaker 1: wall of absolute gibberish. It's just this four-column grid of text.
- 10:49Speaker 1: How does the system read this?
- 10:50Speaker 2: To decode a PAM rulebook, you just need to understand
- 10:53Speaker 2: those four columns. Every single line is a directive, and
- 10:55Speaker 2: it always goes in this exact order. The interface, the
- 10:58Speaker 2: control flag, the module name, and finally, any arguments.
- 11:02Speaker 1: Okay, let's take those one by one. The first column
- 11:05Speaker 1: is the interface. There are four types, and they essentially
- 11:08Speaker 1: define what phase of the login process we are currently in. Correct.
- 11:12Speaker 2: Think of the interface as the category of the question
- 11:15Speaker 2: being asked. First, you have OFF. This is pure authentication.
- 11:19Speaker 2: It asks, are you who you say you are? Usually,
- 11:23Speaker 2: this means verifying a password or maybe a biometric scan.
- 11:27Speaker 1: Makes sense.
- 11:28Speaker 2: Second is account. This asks, even if you proved your identity,
- 11:33Speaker 2: are you allowed to be here right now? This module
- 11:36Speaker 2: checks if your account is expired, if your password needs
- 11:38Speaker 2: to be changed, or if you are trying to log
- 11:40Speaker 2: in outside of business hours.
- 11:43Speaker 1: That distinction is crucial. I mean, you could have the
- 11:45Speaker 1: perfectly correct password and pass the auth phase, but completely
- 11:48Speaker 1: fail the account phase because it's Sunday and you aren't
- 11:51Speaker 1: authorized to access the system on weekends.
- 11:53Speaker 2: Precisely. The third interface is password, which handles the internal
- 11:57Speaker 2: mechanics of actually updating or changing a password. And the
- 12:00Speaker 2: fourth is session, which does all the housekeeping. It sets
- 12:03Speaker 2: up your environment variables, mounts user directories, and handles the
- 12:07Speaker 2: logging before and after you are connected.
- 12:10Speaker 1: So that's the interface column. The second column is where
- 12:13Speaker 1: things get really intense. This is the control flag. It
- 12:16Speaker 1: tells PM... how to react based on whether the module
- 12:20Speaker 1: succeeds or fails. And this is where that military obstacle
- 12:23Speaker 1: course analogy really shines.
- 12:25Speaker 2: It really does, because the control flags basically dictate the
- 12:28Speaker 2: rules of the course. Let's walk through them.
- 12:30Speaker 1: Awesome. The first flag is optional. In our obstacle course,
- 12:33Speaker 1: this is like a mud puddle off to the side.
- 12:35Speaker 1: You can run through it. You can jump over it.
- 12:37Speaker 1: You can fall flat on your face in it. The
- 12:39Speaker 1: system knows what happened, but ultimately it ignores the result.
- 12:44Speaker 1: Your success or failure here doesn't affect your overall log-in.
- 12:47Speaker 2: Right. Optional is mostly used for background tasks or minor
- 12:50Speaker 2: logging where a failure shouldn't actually stop a user from working.
- 12:54Speaker 2: But next we have sufficient.
- 12:56Speaker 1: Ah, sufficient is like a golden ticket. If you pass
- 12:59Speaker 1: an obstacle marked sufficient, the system says, great, you're verified.
- 13:04Speaker 1: And you instantly pass the course. You don't have to
- 13:06Speaker 1: run any more authentication tests.
- 13:07Speaker 2: Right. You're in.
- 13:09Speaker 1: But the catch is, if you fail a sufficient module,
- 13:12Speaker 1: it's not a deal breaker. The system just says, OK, well,
- 13:15Speaker 1: that method didn't work. Keep running the rest of the
- 13:17Speaker 1: course and we'll try something else.
- 13:19Speaker 2: Exactly. It's often used for things like fingerprint scanners. If
- 13:23Speaker 2: your fingerprint works, sufficient lets you write in. If your
- 13:26Speaker 2: finger is wet and the scanner fails, it doesn't lock
- 13:29Speaker 2: you out. It just falls back to asking for your password.
- 13:32Speaker 1: That's really smart. But then we get to the heavy hitters,
- 13:35Speaker 1: required and requisite. These both mandate that you absolutely must
- 13:39Speaker 1: pass the module. But they handle failure in radically different ways.
- 13:44Speaker 2: Oh, yeah.
- 13:45Speaker 1: Let's talk about required first. If an obstacle is required
- 13:48Speaker 1: and you fail it, the system doesn't tell you. It
- 13:51Speaker 1: acts like nothing is wrong and makes you finish the
- 13:53Speaker 1: entire exhausting obstacle course, processing every single subsequent module, only
- 13:58Speaker 1: to pull you aside at the very end and say,
- 14:00Speaker 1: log in incorrect.
- 14:01Speaker 2: Yep, it forces you to run the whole stack.
- 14:03Speaker 1: But wait, why would an operating system do that? Isn't
- 14:06Speaker 1: waiting until the very end to reject someone a massive
- 14:08Speaker 1: waste of server compute power? If they fail step two,
- 14:12Speaker 1: why run steps three, four, and five?
- 14:15Speaker 2: It does cost compute power. But you gladly pay that
- 14:18Speaker 2: cost to prevent what's called a timing attack.
- 14:20Speaker 1: A kining attack.
- 14:21Speaker 2: Yeah. If Pam kicked a hacker out the exact millisecond
- 14:25Speaker 2: they failed a check, the hacker could measure the response time.
- 14:29Speaker 2: If a rejection takes two milliseconds, they know they failed
- 14:32Speaker 2: the very first module. If it takes 50 milliseconds, they
- 14:36Speaker 2: know they made it halfway down the file before failing.
- 14:39Speaker 1: Oh, wow.
- 14:40Speaker 2: By forcing every login attempt, both successful and failed, to
- 14:44Speaker 2: take the exact same amount of time and process the
- 14:47Speaker 2: exact same number of modules, you completely blind the attacker.
- 14:51Speaker 2: They get zero information about why they failed.
- 14:53Speaker 1: That is deviously brilliant. It's informational starvation.
- 14:56Speaker 2: It really is.
- 14:57Speaker 1: But that brings us to the final flag, requisite. You
- 15:00Speaker 1: must pass this. And if you fail a requisite obstacle,
- 15:03Speaker 1: a trap door opens immediately. You are severed from the
- 15:06Speaker 1: system instantly. No more processing, no more modules. You are
- 15:09Speaker 1: just gone.
- 15:10Speaker 2: And because of how sufficient and requisite can instantly halt
- 15:13Speaker 2: the process, the order of the lines in a PAM
- 15:15Speaker 2: configuration file is everything.
- 15:17Speaker 1: Because they're read top to bottom.
- 15:18Speaker 2: Exactly. If an admin carelessly drops a requisite flag at
- 15:22Speaker 2: the very bottom of the file, it completely defeats the
- 15:24Speaker 2: purpose of an immediate fail because the system has already
- 15:27Speaker 2: processed the entire stack anyway.
- 15:28Speaker 1: Okay, we know the vocabulary now. We have the interfaces
- 15:31Speaker 1: and the control flags. Let's put this into practice. Let's
- 15:35Speaker 1: run a simulation of a hacker or just an unauthorized
- 15:39Speaker 1: user trying to break into a secure server. And watch
- 15:42Speaker 1: how Pam processes their login top to bottom.
- 15:44Speaker 2: Let's do it. So let's say our attacker has managed
- 15:47Speaker 2: to steal the root system password. They sit down at
- 15:50Speaker 2: a coffee shop and try to SSH into the enterprise
- 15:53Speaker 2: server remotely. The SSH daemon receives the request and immediately hands.
- 15:58Speaker 1: It to Pam. And Pam looks at the ship configuration file.
- 16:01Speaker 1: Let's say the very first line is an auth interface
- 16:04Speaker 1: with a requisite control flag pointing to a module that
- 16:07Speaker 1: checks a file called etc security. What happens here?
- 16:10Speaker 2: Well, this is a location check. The security file contains
- 16:13Speaker 2: a list of physical hardwired terminals that are allowed to
- 16:16Speaker 2: log in as root. Because our hacker is trying to
- 16:19Speaker 2: log in remotely over the network, their terminal is not
- 16:21Speaker 2: on that list. And because the flag is requisite, the
- 16:24Speaker 2: trapdoor opens instantly. Even though they have the exact correct
- 16:28Speaker 2: root password, PM drops the connection immediately. They don't even
- 16:31Speaker 2: get the chance to type the password in.
- 16:33Speaker 1: Beautiful. Okay, new scenario. This is a regular employee logging in.
- 16:37Speaker 1: They pass the terminal check. Let's pause here because I
- 16:45Speaker 1: noticed a module argument in the documentation called Nullock.
- 16:48Speaker 2: Oh, boy.
- 16:49Speaker 1: Yeah. If an admin adds Nullock to the password check,
- 16:52Speaker 1: it literally allows a user to log in with a
- 16:55Speaker 1: completely blank password. Why would that ever exist?
- 16:58Speaker 2: It's a legacy feature. Yeah. And it is universally considered
- 17:02Speaker 2: a terrible idea in an enterprise environment.
- 17:04Speaker 1: I would hope so.
- 17:04Speaker 2: Yeah. I mean, it might be used on an isolated
- 17:07Speaker 2: air-gapped terminal on a factory floor where speed is more
- 17:10Speaker 2: important than security. But in the modern world, if you
- 17:13Speaker 2: see Nullock enabled on a production server, it is a
- 17:16Speaker 2: massive red flag. It overrides the fundamental purpose of authentication.
- 17:20Speaker 1: Good to know. So our user enters a strong password.
- 17:23Speaker 1: They pass the off phase. Next, PM switches to the
- 17:27Speaker 1: account interface. It checks a module looking for a file
- 17:30Speaker 1: called its Nufcalologen.
- 17:31Speaker 2: This is a maintenance switch. If a system administrator creates
- 17:34Speaker 2: a file named Nologen in the etc directory, PM sees
- 17:38Speaker 2: it and automatically denies access to all standard users, regardless
- 17:41Speaker 2: of their passwords.
- 17:42Speaker 1: Just a hard stop for everyone.
- 17:44Speaker 2: Yeah, it's a way to instantly lock down a server
- 17:46Speaker 2: so an admin can perform critical updates without users messing
- 17:49Speaker 2: with the database. Assuming that file isn't there, PAM moves
- 17:52Speaker 2: to the next account check. Is the user's password expired?
- 17:56Speaker 1: Let's say it is. The user's password expired yesterday. PM
- 17:59Speaker 1: sees this, but it doesn't kick them out. Instead, it
- 18:02Speaker 1: transitions to the password interface to force them to create
- 18:05Speaker 1: a new one. It calls a module named pamcracklib.so.
- 18:09Speaker 2: This is the dictionary attack prevention module. So the user
- 18:13Speaker 2: types in a new password, say company 2026. Pamcracklib.so cross-references
- 18:18Speaker 2: that against known dictionaries and common patterns. It realizes it's
- 18:22Speaker 2: far too weak. And if the administrator has appended an
- 18:25Speaker 2: argument like retry3 to this line, the system will give
- 18:28Speaker 2: the user exactly three attempts to generate a mathematically complex
- 18:32Speaker 2: password before it kills the session entirely.
- 18:35Speaker 1: And here is where I saw a piece of programming
- 18:38Speaker 1: logic that I thought was just so elegant. Once the
- 18:40Speaker 1: user finally types a strong enough password to pass the
- 18:44Speaker 1: cracklib test, the very next line in the stack is
- 18:47Speaker 1: the module that actually saves the password to the database.
- 18:51Speaker 2: Right.
- 18:51Speaker 1: But there is an argument attached to it called useAuthTalk.
- 18:55Speaker 1: Why is that there?
- 18:56Speaker 2: Well, think about the flow. The user just typed a
- 18:59Speaker 2: complex password and CrackLib analyzed it. If useAuthTalk wasn't there,
- 19:03Speaker 2: the next module would execute and blindly ask the user again, OK,
- 19:07Speaker 2: what password do you want to save?
- 19:08Speaker 1: Oh, I see.
- 19:09Speaker 2: Yeah, a malicious user could pass the CrackLib test with
- 19:11Speaker 2: a strong password, and then when prompted the second time,
- 19:14Speaker 2: just type in password 123 and save it.
- 19:16Speaker 1: Bypassing the entire security check.
- 19:18Speaker 2: Exactly. The useAuthTalk argument forces the system to grab the
- 19:22Speaker 2: exact authentication token, the exact keystrokes that were just verified
- 19:25Speaker 2: by Cracklib, and pass them directly down the stack. It
- 19:28Speaker 2: prevents double prompting, and it forces a choke point. You
- 19:31Speaker 2: cannot save a password that hasn't been physically vetted by
- 19:34Speaker 2: the previous module.
- 19:35Speaker 1: It guarantees compliance. It's brilliant. Finally, our user gets their
- 19:39Speaker 1: password saved, and Pam switches to the final interface sessions.
- 19:43Speaker 1: It loads the user's environment and logs their username and
- 19:46Speaker 1: the exact time of entry into Vorlog Secure, and it
- 19:48Speaker 1: will log in again the second they disconnect, creating a flawless,
- 19:51Speaker 1: unalterable audit trail.
- 19:53Speaker 2: And all of the terminal checks, the dictionary analysis, the
- 19:56Speaker 2: token passing, the login, it all happens in milliseconds. And
- 20:00Speaker 2: the SSH application that requested the login has absolutely no
- 20:03Speaker 2: idea how any of it was done. It just gets
- 20:05Speaker 2: a message back from PAM saying, user authenticated, let them in.
- 20:08Speaker 1: So what does this all mean? By entirely decoupling the
- 20:11Speaker 1: concept of security from the individual applications, PAM allows engineers
- 20:15Speaker 1: to build incredibly complex, robust defenses that can be swapped out, upgraded,
- 20:21Speaker 1: and audited from one central location. It takes what used
- 20:25Speaker 1: to be a chaotic, fragmented nightmare and turns it into structured,
- 20:29Speaker 1: controllable logic.
- 20:30Speaker 2: It's the ultimate plug-and-play security system.
- 20:33Speaker 1: It really is. Now, before we wrap up, let's look
- 20:36Speaker 1: at how all these pieces fit together. Think back to
- 20:38Speaker 1: our discussion on control flags and the order of operations.
- 20:42Speaker 1: If you were building a PAM configuration file and you
- 20:45Speaker 1: want to implement a biometric scan that instantly disconnects the
- 20:48Speaker 1: user without running any further background checks if the scan fails,
- 20:52Speaker 1: which control flag do you have to use?
- 20:54Speaker 2: Good question.
- 20:54Speaker 1: If you realize that it has to be the requisite flag,
- 20:57Speaker 1: you've got a solid grasp on how this architecture dictates behavior.
- 21:01Speaker 1: That's the trapdoor.
- 21:01Speaker 2: It is. And, you know, understanding how that architecture works,
- 21:05Speaker 2: this raises an important question for the future. Well, we've
- 21:08Speaker 2: seen how meticulously PAM can scrutinize a password or an
- 21:12Speaker 2: IP address, but PAM is highly extensible. Modern modules are
- 21:16Speaker 2: beginning to integrate behavioral tracking, analyzing the cadence of how
- 21:20Speaker 2: fast you type or the micro movements of your mouse
- 21:23Speaker 2: to continuously authenticate you during a session.
- 21:26Speaker 1: That sounds intense.
- 21:27Speaker 2: At what point does a system's absolute mathematical need to
- 21:31Speaker 2: guarantee that you are you cross the line into an
- 21:35Speaker 2: invasion of privacy? As these central frameworks become more powerful,
- 21:40Speaker 2: where is the boundary between a secure environment and an
- 21:43Speaker 2: invasive one?
- 21:44Speaker 1: That is a phenomenal thought. You want the system to
- 21:46Speaker 1: keep out the bad actors. But you don't necessarily want
- 21:49Speaker 1: the infrastructure analyzing your heart rate and posture while you're
- 21:52Speaker 1: just trying to open a spreadsheet. Right. Exactly. So really
- 21:55Speaker 1: delicate balance. Definitely something to mull over as you look
- 21:57Speaker 1: at your own system logs. Keep questioning the architecture and
- 22:00Speaker 1: we'll catch you on the next deep dive.