The Good PAM Flashcards

1
Q

What are the four things that make up a PAM statement

A

TYPE

CONTROL

MODULE

ARGUMENTS

IN ORDER:

auth required pam_unix.so no_warn try_first_pall nullok

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Describe Type

A

Describe what the module will be dictating

Auth - authorization

Account - specifies account settings. User can log in every other day of the week

Session - How session is taken up and torn down. Created this directory, then take it down.

Password - For updating auth creds.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Describe Controls

A

How PAM reacts to success or failure.

Required - Must return success for access. If fail it will go through remaining modules. All encompassing no.

Requisite - must succeed for access, can fail to future modules. Failure is a stopping point though. Only use when you have to, bad for security.

optional - If no other control has a say this will normally give a success. Good for additional functions like giving you a time out between bad logins.

sufficient - Success is enough to provide access if a required isn’t failed. No further modules are processed for success, for a failure though it no biggie, it’s an optional failure and isn’t concrete. If you end with this always make a pam_denied
auth required pam_denied.so

binding - not used. Stops on success, failure moves on

include - pull one policy into another

binding

include

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are arguments/flags

A

Additional options for your particular module

debug - log debugging via syslog

no_warn - gives you back no reason for failure

use_first_pass - Doesn’t request your password over per module, just use the original one.

try_first_pass - Use previous pass but if that doesn’t work use a new one.

expose_account - prints to the stdout the issue of what’s wrong.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Name some common modules

A

pam_unix.so - Interactions with baseline password files /etc/group passwd and shadow

pam_wheel.so - Allow access if in wheel group or you can specify group:
auth required pam_wheel.so group=animals deny

pam_permit.so

pam_deny.so

pam_exec.so - run a command

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Deny a group from accessing ssh

A

vi /etc/pam.d/sshd

auth required pam_wheel.so group=animals deny

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

PAM return codes and functions

A

Return Code - Found in module documentation, every module will give exactly 1

Function - Dialog of what pam is doing, you won’t see these.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are extended controls?

A

They can be used to replace your standard controls. They determine how the module handles rejection.

auth [user_unknown=ignore success=ok ignore=ignore \
default=bad] pam_securetty.so

These are just pam responses minus the “PAM_” part. For instance, PAM_SUCCESS is just success=ok

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the extended control actions?

A

bad - Will process rest of modules but this is a failure

die - request has failed, stop processing

ok - Success if everything before and after is ok

done - Success, stop processing, failure if previous failure though

ignore - response doesn’t alter policy response. Earlier bad or ok still stands

reset - throw away previous bad or ok

number like 1, 3, etc. - Skip that many following modules.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What would the below policy do:

auth required pam_breathalizer.so
auth requisite pam_ddr.so
auth required pam_genescan.so uth required

A

Need to pass breathalizer or you get an all encompassing failure, but it will continue.

ddr needs to be success, this will stop processing policy if failed.

genscan is required if ddr is succeeded, will continue processing though.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Make a control like required, requisite, etc using only Extended Controls

A

Required:
auth [success=ok new_authtok_reqd=ok ignore=ignore default=bad]

Requisite:
auth [success=ok new_authtok_reqd=ok ignore=ignore default=die]

Sufficient:
auth [success=done new_authtok_reqd=done default=ignore

Optional:
auth [success=ok new_authtok_reqd=ok default=ignore]

PAM_NEW_AUTHTOK_REQD = password should be changed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Show the reason why you were booted from a ssh login

A

vi /etc/pam.d/sshd

auth optional pam_exec.so expose_account

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

substack control vs include control

A

substack - a failure in a substack doesn’t cause a failure in your main policy, it will just fail that substack. This can return a success or failure but will continue on to your policy.

This makes the secondary substack policy act like a required statement as it keeps going but holds fast to the failure.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Create a policy statement that says if a user doesn’t match root to allow them access

A

auth required pam_succeed_if.so user != root quiet_success

REMEMBER, ALTHOUGH YOU CAN USE : IN “INGROUP” STATMENTS, “:” DOESN’T WORK FOR JUST “USER”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Create a policy statement that says to deny access if a user is not mwl jkh or des
What if you want them to allow if in a group.

A

auth required pam_succeed_if.so user notin mwl:jkh:des
ingroup

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Create a policy statement that allows you to skip a module if the user is mwl jkh or des otherwise failure closes out completely.
What if you want to allow if someone is not in a group

A

auth [success=1 default=die pam_succeed_if.so user in mwl:jkh:des
notingroup

17
Q

We END on page 74, this feels like enough to go off of for now.

A

To Be Continued.