only return password when given -v option
This commit is contained in:
parent
d85c9f998e
commit
469b9c9b89
|
@ -17,6 +17,7 @@ help()
|
||||||
echo ""
|
echo ""
|
||||||
echo " -h Print this help."
|
echo " -h Print this help."
|
||||||
echo " -u <username> Only return info about specified username, otherwise all usernames are returned."
|
echo " -u <username> Only return info about specified username, otherwise all usernames are returned."
|
||||||
|
echo " -v Verbose - include unencrypted passwords, if available."
|
||||||
echo " -c CVS - Output in cvs format, instead of tabbed table."
|
echo " -c CVS - Output in cvs format, instead of tabbed table."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,19 +39,25 @@ else
|
||||||
usernames=(`ls /home/`)
|
usernames=(`ls /home/`)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
output="uid username passwd jailed fpmmax"
|
if [[ -n $verbose ]]; then
|
||||||
|
output="uid username passwd jailed fpmmax"
|
||||||
|
else
|
||||||
|
output="uid username jailed fpmmax"
|
||||||
|
fi
|
||||||
|
|
||||||
for username in "${usernames[@]}"
|
for username in "${usernames[@]}"
|
||||||
do
|
do
|
||||||
userid=(`stat -c '%u' /home/$username`)
|
userid=(`stat -c '%u' /home/$username`)
|
||||||
if [[ -f /home/$username/.passwd ]]; then
|
if [[ -n $verbose ]]; then
|
||||||
password=(`awk -F : '{ print $2 }' /home/$username/.passwd`)
|
if [[ -f /home/$username/.passwd ]]; then
|
||||||
if [[ -f /root/.vhost.ini ]]; then
|
password=(`awk -F : '{ print $2 }' /home/$username/.passwd`)
|
||||||
vhost::set-opensslpass
|
if [[ -f /root/.vhost.ini ]]; then
|
||||||
password=`echo "$password" | openssl aes-256-cbc -d -a -pass pass:$opensslpass -pbkdf2`
|
vhost::set-opensslpass
|
||||||
|
password=`echo "$password" | openssl aes-256-cbc -d -a -pass pass:$opensslpass -pbkdf2`
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
password="(unknown)"
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
password="(unknown)"
|
|
||||||
fi
|
fi
|
||||||
shell=(`grep $username /etc/passwd|awk -F : '{ print $6 }'`)
|
shell=(`grep $username /etc/passwd|awk -F : '{ print $6 }'`)
|
||||||
if [[ $shell = "/usr/jails/$username/./home/$username" ]]; then
|
if [[ $shell = "/usr/jails/$username/./home/$username" ]]; then
|
||||||
|
@ -58,12 +65,17 @@ do
|
||||||
else
|
else
|
||||||
jailed="No"
|
jailed="No"
|
||||||
fi
|
fi
|
||||||
if [[ -f /etc/php/$phpVersion/fpm/pool.d/$username.conf ]]; then
|
|
||||||
fpmmax=(`grep pm.max_children /etc/php/$phpVersion/fpm/pool.d/$username.conf |awk -F = '{ gsub(/ /,""); print $2 }'`);
|
fpmmax=0
|
||||||
else
|
if [[ -f "/etc/php/$phpVersion/fpm/pool.d/$username.conf" ]]; then
|
||||||
fpmmax=0
|
fpmax=$(grep pm.max_children /etc/php/$phpVersion/fpm/pool.d/$username.conf | awk -F '=' '{ print $2 }' | tr -d ' ')
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n $verbose ]]; then
|
||||||
|
output="$output${NL}$userid $username $password $jailed $fpmmax"
|
||||||
|
else
|
||||||
|
output="$output${NL}$userid $username $jailed $fpmmax"
|
||||||
fi
|
fi
|
||||||
output="$output${NL}$userid $username $password $jailed $fpmmax"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ $cvs ]]; then
|
if [[ $cvs ]]; then
|
||||||
|
@ -71,4 +83,3 @@ if [[ $cvs ]]; then
|
||||||
else
|
else
|
||||||
echo "$output" | column -t
|
echo "$output" | column -t
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user