Bug 112794 - [patch] [request] pam_exec(8): allow pam_exec to export PAM_AUTHTOK as a environmental variable
Summary: [patch] [request] pam_exec(8): allow pam_exec to export PAM_AUTHTOK as a envi...
Status: Closed Not Accepted
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 6.2-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Dag-Erling Smørgrav
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-19 20:10 UTC by kitsune
Modified: 2014-07-14 12:44 UTC (History)
1 user (show)

See Also:


Attachments
pam_exec.8.diff (207 bytes, patch)
2007-05-19 20:10 UTC, kitsune
no flags Details | Diff
file.diff (246 bytes, patch)
2007-05-19 20:10 UTC, kitsune
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description kitsune 2007-05-19 20:10:02 UTC

This modifies pam_exec to export PAM_AUTHTOK. This is the password that
has been passed to pam. My reasons for starting work on this is things
that require a password to perform can happen. My purpose for creating
this to allow mounting of a users samba home directory from a script
using pam_exec. In regards to mount_smbfs, I will be needing to do some
work to allow a password to be specified by a specified enviromental variable.

This includes a updated for the man file as well that notes the new
environmental variable.

tested on releng_6, but should work perfectly well on 7 as what is being
changed is exactly the same on both versions....

How-To-Repeat: 

1: don't apply patch yet...
2:
3: touch /etc/pam.d/test
4: do what ever to the test servuce, but make sure it has this line "auth            sufficient      pam_exec.so             /tmp/pam-test"
5: put this in /tmp/pam-test
#!/bin/sh

/usr/bin/env > /tmp/pam-test
6: download http://vvelox.net/src/perl/pam-pwcheck
7: setenv PAMPWCHECKuser user
8: setenv PAMPWCHECKpass password
9: ./pam-pwcheck -s test
10 cat /tmp/pam-test and notice PAM_AUTHTOK is not present
11: apply diffs
12: rerun 9 and notice /tmp/pam-test now contains PAM_AUTHTOK=password
13: enjoy
Comment 1 Dag-Erling Smørgrav freebsd_committer freebsd_triage 2014-07-14 12:44:54 UTC
Passing authentication tokens through environment variables or command line arguments is considered poor security practice.  It would be a better idea to add an option that tells pam_exec(8) to pipe PAM_AUTHTOK and / or PAM_OLDAUTHTOK to the program's standard input.