Update ADconnection.sh

This commit is contained in:
PierreGode 2020-03-25 09:52:29 +01:00 committed by GitHub
parent 20533daa1f
commit 913e713a01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -181,15 +181,35 @@ sudo echo "#entry_cache_user_timeout = 5400
#ad_enable_gc = False #ad_enable_gc = False
entry_cache_timeout = 600 entry_cache_timeout = 600
entry_cache_nowait_percentage = 75 " | sudo tee -a /etc/sssd/sssd.alternatives entry_cache_nowait_percentage = 75 " | sudo tee -a /etc/sssd/sssd.alternatives
sudo service sssd restart sudo service sssd restart
sleep 1 sleep 1
clear clear
usesasl=$( cat readfile | grep USESASL | awk '{print $3}')
if [ "$usesasl" = "yes" ]
then
sasl=$( cat readfile | grep LDAPS | awk '{print $3}' )
if [ "$sasl" = "null" ]
then
echo "You need to specify domaincontroller in readfile"
exit
else
echo "$sasl"
cacer=$( cat readfile | grep CACERT | awk '{print $3}' )
if ! ls $cacer
then echo "No root CA found, check your path to file"
else
echo "Applied config from readfile"
#sed -i "/krb5_realm = /a ldap_uri = $LdapsDC" /etc/sssd/sssd.conf
#sed -i "/krb5_realm = /a ldap_tls_cacert = $cacert" /etc/sssd/sssd.conf
echo "Applied config from readfile"
fi
fi
else
echo "For SASL put you company root-ca.cer in /usr/share/ca-certificates/root/ folder" echo "For SASL put you company root-ca.cer in /usr/share/ca-certificates/root/ folder"
read -r -p "Do you wish to use SASL (LDAPS) (y/n)?" yn read -r -p "Do you wish to use SASL (LDAPS) (y/n)?" yn
case $yn in case $yn in
[Yy]* ) [Yy]* )
if [ -f /usr/share/ca-certificates/root/*.cer ] if [ -f "/usr/share/ca-certificates/root/*.cer" ]
then then
cacert=$( ls /usr/share/ca-certificates/root/ | grep .cer | head -1 ) cacert=$( ls /usr/share/ca-certificates/root/ | grep .cer | head -1 )
echo "Type in address of your Domaincontroller: ex: dc01.com" echo "Type in address of your Domaincontroller: ex: dc01.com"
@ -221,6 +241,7 @@ fi;;
[Nn]* )echo "";; [Nn]* )echo "";;
* ) echo "Please answer yes or no.";; * ) echo "Please answer yes or no.";;
esac esac
fi
################################# Check ####################################### ################################# Check #######################################
if ! sudo service sssd restart if ! sudo service sssd restart
then then