# list in decreasing verbosity (all caps).
# separate with $IFS explicitly, since we do some fancy footwork
# elsewhere.
- alllevels="DEBUG${IFS}INFO${IFS}ERROR"
+ alllevels="DEBUG${IFS}VERBOSE${IFS}INFO${IFS}ERROR"
# translate lowers to uppers in global log level
LOG_LEVEL=$(echo "$LOG_LEVEL" | tr "[:lower:]" "[:upper:]")
userID="$1"
- log info " checking keyserver $KEYSERVER... "
+ log verbose " checking keyserver $KEYSERVER... "
echo 1,2,3,4,5 | \
gpg --quiet --batch --with-colons \
--command-fd 0 --keyserver "$KEYSERVER" \
# if the gpg query return code is not 0, return 1
if [ "$?" -ne 0 ] ; then
- log info " no primary keys found."
+ log verbose " no primary keys found."
return 1
fi
lastKeyOK=
fingerprint=
- log info " primary key found: $keyid"
+ log verbose " primary key found: $keyid"
# if overall key is not valid, skip
if [ "$validity" != 'u' -a "$validity" != 'f' ] ; then
# output a line for the primary key
# 0 = ok, 1 = bad
if [ "$keyOK" -a "$uidOK" -a "$lastKeyOK" ] ; then
- log info " * acceptable primary key."
+ log verbose " * acceptable primary key."
if [ -z "$sshKey" ] ; then
log error " ! primary key could not be translated (not RSA or DSA?)."
else
# output a line for the sub key
# 0 = ok, 1 = bad
if [ "$keyOK" -a "$uidOK" -a "$lastKeyOK" ] ; then
- log info " * acceptable sub key."
+ log verbose " * acceptable sub key."
if [ -z "$sshKey" ] ; then
log error " ! sub key could not be translated (not RSA or DSA?)."
else
host="$1"
userID="ssh://${host}"
- log info "processing: $host"
+ log verbose "processing: $host"
nKeys=0
nKeysOK=0
# note if the known_hosts file was updated
if [ "$(file_hash "$KNOWN_HOSTS")" != "$fileCheck" ] ; then
- log info "known_hosts file updated."
+ log verbose "known_hosts file updated."
fi
# if an acceptable host was found, return 0
process_known_hosts() {
local hosts
- log info "processing known_hosts file..."
+ log verbose "processing known_hosts file..."
hosts=$(meat "$KNOWN_HOSTS" | cut -d ' ' -f 1 | grep -v '^|.*$' | tr , ' ' | tr '\n' ' ')
userID="$1"
- log info "processing: $userID"
+ log verbose "processing: $userID"
nKeys=0
nKeysOK=0
# note if the authorized_keys file was updated
if [ "$(file_hash "$AUTHORIZED_KEYS")" != "$fileCheck" ] ; then
- log info "authorized_keys file updated."
+ log verbose "authorized_keys file updated."
fi
# if an acceptable id was found, return 0
authorizedUserIDs="$1"
- log info "processing authorized_user_ids file..."
+ log verbose "processing authorized_user_ids file..."
if ! meat "$authorizedUserIDs" > /dev/null ; then
log error "no user IDs to process."
for uname in $unames ; do
# check all specified users exist
if ! getent passwd "$uname" >/dev/null ; then
- log info "----- unknown user '$uname' -----"
+ log verbose "----- unknown user '$uname' -----"
continue
fi
fi
fi
- log info "----- user: $uname -----"
+ log verbose "----- user: $uname -----"
# exit if the authorized_user_ids file is empty
if ! check_key_file_permissions "$uname" "$AUTHORIZED_USER_IDS" ; then
- log error "Improper permissions on authorized_user_ids file path."
+ log error "Improper permissions on path '$AUTHORIZED_USER_IDS'."
continue
fi
# check permissions on the authorized_keys file path
if ! check_key_file_permissions "$uname" "$RAW_AUTHORIZED_KEYS" ; then
- log error "Improper permissions on authorized_keys file path path."
+ log error "Improper permissions on path '$RAW_AUTHORIZED_KEYS'."
continue
fi
# add user-controlled authorized_keys file path if specified
if [ "$rawAuthorizedKeys" != '-' -a -s "$rawAuthorizedKeys" ] ; then
- log info "adding raw authorized_keys file... "
+ log verbose "adding raw authorized_keys file... "
cat "$rawAuthorizedKeys" >> "$AUTHORIZED_KEYS"
fi
EOF
)
- log info "generating server key..."
+ log verbose "generating server key..."
echo "$keyParameters" | gpg_host --batch --gen-key
# output the server fingerprint
fingerprint=$(fingerprint_server_key)
# export host ownertrust to authentication keyring
- log info "setting ultimate owner trust for server key..."
+ log verbose "setting ultimate owner trust for server key..."
echo "${fingerprint}:6:" | gpg_authentication "--import-ownertrust"
# translate the private key to ssh format, and export to a file