2018-02-26 03:15:05 -06:00
|
|
|
#!/bin/bash
|
|
|
|
# This program is a handler written for Apache mod_ssl's SSLPassPhraseDialog.
|
|
|
|
#
|
|
|
|
# If you'd like to write your custom binary providing passwords to mod_ssl,
|
|
|
|
# see the documentation of the aforementioned directive of the mod_ssl module.
|
|
|
|
|
|
|
|
USAGE="./ipa-pwdreader host:port RSA|DSA|ECC|number"
|
|
|
|
|
2018-09-19 07:35:57 -05:00
|
|
|
if [ "$#" -ne 2 ]; then
|
2018-02-26 03:15:05 -06:00
|
|
|
echo "Wrong number of arguments!" 1>&2
|
|
|
|
echo "$USAGE" 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-09-19 07:35:57 -05:00
|
|
|
fname=${1/:/-}-$2
|
|
|
|
pwdpath=/var/lib/ipa/passwds/$fname
|
2018-02-26 03:15:05 -06:00
|
|
|
|
2018-09-19 07:35:57 -05:00
|
|
|
# Make sure the values passed in do not contain path information
|
|
|
|
checkpath=$(/usr/bin/realpath -e ${pwdpath} 2>/dev/null)
|
|
|
|
|
|
|
|
if [ $pwdpath == "${checkpath}" ]; then
|
|
|
|
cat $pwdpath
|
|
|
|
else
|
|
|
|
echo "Invalid path ${pwdpath}" 1>&2
|
|
|
|
fi
|