#!/bin/bash # Name: report-ldap-config.sh # Description: Show all LDAP Configuration Settings # Last Updated: 2016-10-07 # Recent Changes:-Added usage and renamed ############################################################################################### ##### Customize These Variables ##### ## LDAP Connection Settings ## # Directory Manager User ldapUser='directory manager' # Directory Manager Password dmPass='password-here' # Server Hostname (FQDN) ldapHost='ipaserver.example.com' ##### End of Customize Variables ##### #===================================== # Functions; Main starts after #===================================== function show_usage { echo -e "\n==== Report: LDAP Configuration ====" echo -e "\nDescripton: Report all LDAP Configuration Settings." echo -e "\n--Usage--" echo -e "./report-ldap-config.sh [OPTIONS]" echo -e "\n-OPTIONS-" echo -e "-h => Display usage." echo -e "\n--Other Requirements--" echo -e "-> FreeIPA admin access." echo -e } #======================= # Get Script Arguments #======================= # Reset POSIX variable in case it has been used previously in this shell OPTIND=1 while getopts "h" opt; do case "${opt}" in h) # -h (help) argument show_usage exit 0 ;; *) # invalid argument show_usage exit 0 ;; esac done #================== # Main Starts Here #================== echo -e "\n>> Dumping LDAP Configuration settings..." ldapsearch -D "cn=${ldapUser}" -w ${dmPass} -p 389 -h ${ldapHost} -x -b cn=config "objectclass=nsslapdConfig"