-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pam: trigger pam_authenticate on login (#3966)
* pam: trigger pam_authenticate on login This will trigger any "auth" PAM modules configured on the system for teleport. For example, Duo 2FA prompt on each connection. The module will be able to interact with the user (e.g. print prompts). Also, make PAM env var propagation consistent for port forwarding sessions. Fixes #3929 * Revamp PAM testing stack - update PAM policies and module for "auth" step - use pam_teleport.so from the repo directory instead of guessing OS-specific global path - add tests covering all failure scenarios and generally refactor PAM tests * Build pam_teleport.so during buildbox build inside docker This removes the need for libpam-devel on the host and reliably compiles pam_teleport.so in our CI pipeline. As part of this, combine build.assets/pam/ and modules/pam_teleport to avoid the need to sync them.
- Loading branch information
Andrew Lytvynov
authored
Jul 10, 2020
1 parent
3034a59
commit 78c2a31
Showing
27 changed files
with
220 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
./teleport | ||
./tctl | ||
/teleport | ||
/tctl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
UNAME := $(shell uname -s) | ||
|
||
# PAM_POLICY_PATH is where the PAM policy for PAM-aware applications is | ||
# defined. | ||
PAM_POLICY_PATH = /etc/pam.d/ | ||
|
||
PAM_MODULE_PATH_ESCAPED = $(shell pwd | sed 's/\//\\\//g') | ||
|
||
# LD and LD_FLAGS controls the linker and linker flags to use and are | ||
# determined by the OS. | ||
LD = ld | ||
LD_FLAGS = -lpam --shared -x | ||
ifeq ($(UNAME),Darwin) | ||
LD = clang | ||
LD_FLAGS = -lpam -shared | ||
endif | ||
|
||
all: pam_teleport.so | ||
|
||
install: pam_teleport.so | ||
# Copy all PAM policy files over to /etc/pam.d | ||
for file in $(shell ls policy/); do \ | ||
# Replace the module path in these files with the absolute path to \ | ||
# pam_teleport.so in current directory. That way we don't depend on the \ | ||
# OS-specific PAM module locations. \ | ||
sh -c "sed 's/pam_teleport.so/$(PAM_MODULE_PATH_ESCAPED)\/pam_teleport.so/' policy/$${file} >$(PAM_POLICY_PATH)$${file}"; \ | ||
done | ||
|
||
pam_teleport.so: pam_teleport.o | ||
$(LD) $(LD_FLAGS) -o pam_teleport.so pam_teleport.o | ||
chmod 644 pam_teleport.so | ||
|
||
pam_teleport.o: clean pam_teleport.c | ||
gcc -fPIC -c pam_teleport.c | ||
|
||
clean: | ||
rm -f pam_teleport.o pam_teleport.so |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
account required pam_teleport.so echo | ||
auth required pam_teleport.so 1 | ||
session required pam_teleport.so 1 |
1 change: 1 addition & 0 deletions
1
...pam_teleport/policy/teleport-acct-failure → ...d.assets/pam/policy/teleport-acct-failure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
account required pam_teleport.so 0 | ||
auth required pam_teleport.so 1 | ||
session required pam_teleport.so 1 |
1 change: 1 addition & 0 deletions
1
build.assets/pam/teleport-success → ...d.assets/pam/policy/teleport-auth-failure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
account required pam_teleport.so 1 | ||
auth required pam_teleport.so 0 | ||
session required pam_teleport.so 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
account required pam_teleport.so 1 | ||
auth required pam_teleport.so 1 | ||
session required pam_teleport.so set_env foo=bar |
1 change: 1 addition & 0 deletions
1
build.assets/pam/teleport-session-failure → ...ssets/pam/policy/teleport-session-failure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
account required pam_teleport.so 1 | ||
auth required pam_teleport.so 1 | ||
session required pam_teleport.so 0 |
1 change: 1 addition & 0 deletions
1
modules/pam_teleport/policy/teleport-success → build.assets/pam/policy/teleport-success
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
account required pam_teleport.so 1 | ||
auth required pam_teleport.so 1 | ||
session required pam_teleport.so 1 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.