
echo " -u field-name"
echo " Specifies the field used to search for user names in the LDAP"
echo " directory. Default is 'uid'."
echo " -s field-name"
echo " Sepcifies the field used to lookup the user's login shell in the"
echo " LDAP server's user object. Default is 'loginShell'."
echo " -n"
echo " Run this script as a dry run, listing the users and shells it wants"
echo " to add, but not actually adding them."
echo ""
echo "This command searches the specified LDAP directory for users and adds"
echo "them to the Urika GX authorized users list, each as a relaxed mode"
echo "user with a physical node login shell matching the login shell"
echo "configured in the LDAP directory."
echo ""
echo "Example:"
echo ""
echo " The following example command will import users (in dry-run mode) from"
echo " the LDAP server at cfdcg02.us.cray.com using the table with the DN"
echo " 'ou=people,dc=datacenter,dc=cray,dc=com' assuming that the field name"
echo " for the user name is the default ('uid') and the field name for login"
echo " shell is the default ('loginShell'):"
echo ""
echo " ./import_users_from_openldap.sh -h cfdcg02.us.cray.com -b
"ou=people,dc=datacenter,dc=cray,dc=com" -n"
) >&2
exit 1
}
# Option Processing
dry_run=""
host=""
base_dn=""
user_dn=""
passwd=""
port=""
search_dn=""
user_field=""
shell_field=""
remove_flag=""
OPTIONS=$(getopt -o h:p:b:u:s:nr -n 'import_users_from_openldap.sh' -- "$@")
if [ $? -ne 0 ]; then
usage
fi
eval set -- "$OPTIONS"
while true ; do
case "$1" in
-h)
host="${2}"
shift;shift;;
-r)
remove_flag='yes'
shift;;
-p)
port="${2}"
shift;shift;;
-b)
search_dn="${2}"
shift;shift;;
-u)
user_field="${2}"
shift;shift;;
-s)
shell_field="${2}"
shift;shift;;
-n)
dry_run="yes"
shift;;
--) shift; break;;
*) usage; exit 1 ;;
esac
done
if [ -z "${host}" ]; then
Security
S3016
211