forked from aad-for-linux/pam_aad
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Includes dlopentest from neverrend Closes: CyberNinjas/pam_aad#9
- Loading branch information
Showing
8 changed files
with
430 additions
and
5 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
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,12 @@ | ||
FROM cyberninjas/pam_aad:latest | ||
|
||
RUN apt update && apt install -y \ | ||
gdb \ | ||
openssh-server \ | ||
pamtester \ | ||
strace \ | ||
syslog-ng \ | ||
vim | ||
|
||
WORKDIR /usr/src/pam_aad | ||
CMD ["make", "-eC", "test"] |
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,9 @@ | ||
PAMDIR = "${PREFIX}/lib/security" | ||
|
||
all: dlopen | ||
|
||
dlopentest: | ||
${CC} ${CFLAGS} ${LDFLAGS} -fPIE -fstack-protector -Wall -o $@ $@.c -ldl | ||
|
||
dlopen: dlopentest | ||
./dlopentest "${PAMDIR}/pam_aad.so" |
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,35 @@ | ||
/* | ||
* This test ensures the integrity of the compiled PAM module, | ||
* by attempting to dlopen the module, and checking for the | ||
* required symbols needed for a PAM module. | ||
*/ | ||
#include <dlfcn.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
int main(int argc, const char *argv[]) | ||
{ | ||
if (argc != 2) { | ||
printf("Usage: ./dlopentest <path_to_pam_module>\n"); | ||
exit(1); | ||
} | ||
|
||
void *libhandle = dlopen(argv[1], RTLD_NOW); | ||
if (libhandle == NULL) { | ||
printf("%s", dlerror()); | ||
exit(1); | ||
} | ||
void *sym = dlsym(libhandle, "pam_sm_authenticate"); | ||
if (sym == NULL) { | ||
printf("%s", dlerror()); | ||
exit(1); | ||
} | ||
sym = dlsym(libhandle, "pam_sm_setcred"); | ||
if (sym == NULL) { | ||
printf("%s", dlerror()); | ||
exit(1); | ||
} | ||
dlclose(libhandle); | ||
|
||
return EXIT_SUCCESS; | ||
} |
Oops, something went wrong.