Update ADconnection.sh

This commit is contained in:
PierreGode 2018-06-14 08:53:52 +02:00 committed by GitHub
parent edeb4feaf3
commit 169bc24c02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,7 +48,7 @@ clear
read -p "${RED_TEXT}"'Do you wish to enable SSH login.group.allowed'"${END}""${NUMBER}"'(y/n)?'"${END}" yn
case $yn in
[Yy]* ) sudo echo "Cheking if there is any previous configuration"
if [ -f /etc/ssh/login.group.allowed ]
if [ -f /etc/ssh/login.group.allowed 2> /dev/null ]
then
echo "Files seems already to be modified, skipping..."
else
@ -81,7 +81,7 @@ echo ""
read -p "${RED_TEXT}"'Do you wish to give users on this machine sudo rights?'"${END}""${NUMBER}"'(y/n)?'"${END}" yn
case $yn in
[Yy]* ) sudo echo "Cheking if there is any previous configuration"
if [ -f /etc/sudoers.d/sudoers ]
if [ -f /etc/sudoers.d/sudoers 2> /dev/null ]
then
echo ""
echo "The Sudoers file seems already to be modified, skipping..."
@ -165,7 +165,7 @@ if [ $states = 12 ]
then
echo "Sudoers not configured... skipping"
else
if [ -f /etc/sudoers.d/sudoers ]
if [ -f /etc/sudoers.d/sudoers 2> /dev/null ]
then
echo Checking sudoers file.. "${INTRO_TEXT}"OK"${END}"
else
@ -179,7 +179,7 @@ else
echo Checking sudoers users.. "${RED_TEXT}"FAIL"${END}"
fi
homedir=$(cat /etc/pam.d/common-session | grep homedir | grep 0022 | cut -d '=' -f3)
if [ $homedir = 0022 ]
if [ $homedir = 0022 2> /dev/null ]
then
echo Checking PAM configuration.. "${INTRO_TEXT}"OK"${END}"
else
@ -190,7 +190,7 @@ then
echo "Disabled SSH login.group.allowed"
else
cauth=$(cat /etc/pam.d/common-auth | grep required | grep onerr | grep allow | cut -d '=' -f4 | awk '{print $1}')
if [ $cauth = allow ]
if [ $cauth = allow 2> /dev/null ]
then
echo Checking PAM auth configuration.. "${INTRO_TEXT}"OK"${END}"
else
@ -252,7 +252,7 @@ clear
sudo echo "${RED_TEXT}"Installing pakages do no abort!......."${INTRO_TEXT}"
sudo apt-get -qq install realmd adcli sssd -y
sudo apt-get -qq install ntp -y
sudo apt-get install -f -y
sudo apt-get -qq install -f -y
clear
sudo dpkg -l | grep realmd
if [ $? = 0 ]
@ -293,7 +293,7 @@ if [ "$var" -eq "14" ]
then
echo "Installing additional dependencies"
sudo apt-get -qq install -y realmd sssd sssd-tools samba-common krb5-user
sudo apt-get install -f -y
sudo apt-get -qq install -f -y
clear
echo "${INTRO_TEXT}"Detecting Ubuntu $var"${END}"
sudo echo "${INTRO_TEXT}"Realm=$DOMAIN"${INTRO_TEXT}"
@ -352,7 +352,7 @@ sudo echo "${RED_TEXT}"Installing pakages do no abort!......."${INTRO_TEXT}"
sudo apt-get -qq install realmd adcli sssd -y
sudo apt-get -qq install ntp -y
sudo apt-get -qq install -y sssd-tools samba-common krb5-user
sudo apt-get install -f -y
sudo apt-get -qq install -f -y
clear
sudo dpkg -l | grep realmd
if [ $? = 0 ]
@ -410,7 +410,7 @@ clear
read -p "${RED_TEXT}"'Do you wish to enable SSH login.group.allowed'"${END}""${NUMBER}"'(y/n)?'"${END}" yn
case $yn in
[Yy]* ) sudo echo "Cheking if there is any previous configuration"
if [ -f /etc/ssh/login.group.allowed ]
if [ -f /etc/ssh/login.group.allowed 2> /dev/null ]
then
echo "Files seems already to be modified, skipping..."
else
@ -444,7 +444,7 @@ echo ""
read -p "${RED_TEXT}"'Do you wish to give users on this machine sudo rights?'"${END}""${NUMBER}"'(y/n)?'"${END}" yn
case $yn in
[Yy]* ) sudo echo "Cheking if there is any previous configuration"
if [ -f /etc/sudoers.d/sudoers ]
if [ -f /etc/sudoers.d/sudoers 2> /dev/null ]
then
echo ""
echo "Sudoersfile seems already to be modified, skipping..."
@ -474,7 +474,7 @@ echo Realm configured?.. "${RED_TEXT}"FAIL"${END}"
else
echo Realm configured?.. "${INTRO_TEXT}"OK"${END}"
fi
if [ -f /etc/sudoers.d/sudoers ]
if [ -f /etc/sudoers.d/sudoers 2> /dev/null ]
then
echo Checking sudoers file.. "${INTRO_TEXT}"OK"${END}"
else
@ -488,14 +488,14 @@ else
echo Checking sudoers users.. "${RED_TEXT}"FAIL"${END}"
fi
homedir=$(cat /etc/pam.d/common-session | grep homedir | grep 0022 | cut -d '=' -f3)
if [ $homedir = 0022 ]
if [ $homedir = 0022 2> /dev/null ]
then
echo Checking PAM configuration.. "${INTRO_TEXT}"OK"${END}"
else
echo Checking PAM configuration.. "${RED_TEXT}"FAIL"${END}"
fi
cauth=$(cat /etc/pam.d/common-auth | grep required | grep onerr | grep allow | cut -d '=' -f4 | cut -d 'f' -f1)
if [ $cauth = allow ]
if [ $cauth = allow 2> /dev/null ]
then
echo Checking PAM auth configuration.. "${INTRO_TEXT}"OK"${END}"
else
@ -531,16 +531,16 @@ export whoami
whoamis=$( whoami )
admins=$( cat /etc/passwd | grep home | grep bash | cut -d ':' -f1 )
sudo echo "${RED_TEXT}"Installing pakages do no abort!......."${INTRO_TEXT}"
sudo apt-get update
sudo apt-get install libsss-sudo -y
sudo apt-get install adcli -y
sudo apt-get install realmd adcli sssd -y
sudo apt-get install ntp -y
sudo apt-get install policykit-1 -y
sudo apt-get -qq update
sudo apt-get -qq install libsss-sudo -y
sudo apt-get -qq install adcli -y
sudo apt-get -qq install realmd adcli sssd -y
sudo apt-get -qq install ntp -y
sudo apt-get -qq install policykit-1 -y
sudo mkdir -p /var/lib/samba/private
sudo apt-get -qq install realmd adcli sssd -y
sudo apt-get -qq install ntp -y
sudo apt-get install -f -y
sudo apt-get -qq install -f -y
clear
sudo dpkg -l | grep realmd
if [ $? = 0 ]
@ -607,15 +607,15 @@ echo "$admins ALL=(ALL:ALL) ALL | tee -a /etc/sudoers.d/admin"
fi
clear
sudo echo "${RED_TEXT}"Installing pakages do no abort!......."${INTRO_TEXT}"
sudo apt-get update
sudo apt-get install libsss-sudo -y
sudo apt-get install realmd adcli sssd -y
sudo apt-get install ntp -y
sudo apt-get install policykit-1 -y
sudo apt-get -qq update
sudo apt-get -qq install libsss-sudo -y
sudo apt-get -qq install realmd adcli sssd -y
sudo apt-get -qq install ntp -y
sudo apt-get -qq install policykit-1 -y
sudo mkdir -p /var/lib/samba/private
sudo apt-get -qq install realmd adcli sssd -y
sudo apt-get -qq install ntp -y
sudo apt-get install -f
sudo apt-get -qq install -f
clear
sudo dpkg -l | grep realmd
if [ $? = 0 ]
@ -779,7 +779,7 @@ echo Realm configured?.. "${RED_TEXT}"FAIL"${END}"
else
echo Realm configured?.. "${INTRO_TEXT}"OK"${END}"
fi
if [ -f /etc/sudoers.d/admins ]
if [ -f /etc/sudoers.d/admins 2> /dev/null ]
then
echo Checking sudoers file.. "${INTRO_TEXT}"OK"${END}"
grouPs=$(cat /etc/sudoers.d/admins | grep -i $myhost | cut -d '%' -f2 | cut -d '=' -f1 | sed -e 's/\<ALL\>//g')
@ -790,7 +790,7 @@ grouPs=$(cat /etc/sudoers.d/admins | grep -i $myhost | cut -d '%' -f2 | cut -d
echo Checking sudoers users.. "${RED_TEXT}"FAIL"${END}"
fi
else
if [ -f /etc/sudoers.d/sudoers ]
if [ -f /etc/sudoers.d/sudoers 2> /dev/null ]
then
echo Checking sudoers file.. "${INTRO_TEXT}"OK"${END}"
grouPs1=$(cat /etc/sudoers.d/sudoers | grep -i $myhost | cut -d '%' -f2 | cut -d '=' -f1 | sed -e 's/\<ALL\>//g')
@ -805,14 +805,14 @@ echo Checking sudoers file.. "${RED_TEXT}"FAIL not configured"${END}"
fi
fi
homedir=$(cat /etc/pam.d/common-session | grep homedir | grep 0022 | cut -d '=' -f3)
if [ $homedir = 0022 ]
if [ $homedir = 0022 2> /dev/null ]
then
echo Checking PAM configuration.. "${INTRO_TEXT}"OK"${END}"
else
echo Checking PAM configuration.. "${RED_TEXT}"FAIL"${END}"
fi
cauth=$(cat /etc/pam.d/common-auth | grep required | grep onerr | grep allow | cut -d '=' -f4 | cut -d 'f' -f1)
if [ $cauth = allow ]
if [ $cauth = allow 2> /dev/null ]
then
echo Checking PAM auth configuration.. "${INTRO_TEXT}"OK"${END}"
else