mirror of
https://github.com/PierreGode/Linux-Active-Directory-join-script.git
synced 2025-12-21 16:50:13 +01:00
Update ADconnection.sh
This commit is contained in:
parent
edeb4feaf3
commit
169bc24c02
@ -48,7 +48,7 @@ clear
|
|||||||
read -p "${RED_TEXT}"'Do you wish to enable SSH login.group.allowed'"${END}""${NUMBER}"'(y/n)?'"${END}" yn
|
read -p "${RED_TEXT}"'Do you wish to enable SSH login.group.allowed'"${END}""${NUMBER}"'(y/n)?'"${END}" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) sudo echo "Cheking if there is any previous configuration"
|
[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
|
then
|
||||||
echo "Files seems already to be modified, skipping..."
|
echo "Files seems already to be modified, skipping..."
|
||||||
else
|
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
|
read -p "${RED_TEXT}"'Do you wish to give users on this machine sudo rights?'"${END}""${NUMBER}"'(y/n)?'"${END}" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) sudo echo "Cheking if there is any previous configuration"
|
[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
|
then
|
||||||
echo ""
|
echo ""
|
||||||
echo "The Sudoers file seems already to be modified, skipping..."
|
echo "The Sudoers file seems already to be modified, skipping..."
|
||||||
@ -165,7 +165,7 @@ if [ $states = 12 ]
|
|||||||
then
|
then
|
||||||
echo "Sudoers not configured... skipping"
|
echo "Sudoers not configured... skipping"
|
||||||
else
|
else
|
||||||
if [ -f /etc/sudoers.d/sudoers ]
|
if [ -f /etc/sudoers.d/sudoers 2> /dev/null ]
|
||||||
then
|
then
|
||||||
echo Checking sudoers file.. "${INTRO_TEXT}"OK"${END}"
|
echo Checking sudoers file.. "${INTRO_TEXT}"OK"${END}"
|
||||||
else
|
else
|
||||||
@ -179,7 +179,7 @@ else
|
|||||||
echo Checking sudoers users.. "${RED_TEXT}"FAIL"${END}"
|
echo Checking sudoers users.. "${RED_TEXT}"FAIL"${END}"
|
||||||
fi
|
fi
|
||||||
homedir=$(cat /etc/pam.d/common-session | grep homedir | grep 0022 | cut -d '=' -f3)
|
homedir=$(cat /etc/pam.d/common-session | grep homedir | grep 0022 | cut -d '=' -f3)
|
||||||
if [ $homedir = 0022 ]
|
if [ $homedir = 0022 2> /dev/null ]
|
||||||
then
|
then
|
||||||
echo Checking PAM configuration.. "${INTRO_TEXT}"OK"${END}"
|
echo Checking PAM configuration.. "${INTRO_TEXT}"OK"${END}"
|
||||||
else
|
else
|
||||||
@ -190,7 +190,7 @@ then
|
|||||||
echo "Disabled SSH login.group.allowed"
|
echo "Disabled SSH login.group.allowed"
|
||||||
else
|
else
|
||||||
cauth=$(cat /etc/pam.d/common-auth | grep required | grep onerr | grep allow | cut -d '=' -f4 | awk '{print $1}')
|
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
|
then
|
||||||
echo Checking PAM auth configuration.. "${INTRO_TEXT}"OK"${END}"
|
echo Checking PAM auth configuration.. "${INTRO_TEXT}"OK"${END}"
|
||||||
else
|
else
|
||||||
@ -252,7 +252,7 @@ clear
|
|||||||
sudo echo "${RED_TEXT}"Installing pakages do no abort!......."${INTRO_TEXT}"
|
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 realmd adcli sssd -y
|
||||||
sudo apt-get -qq install ntp -y
|
sudo apt-get -qq install ntp -y
|
||||||
sudo apt-get install -f -y
|
sudo apt-get -qq install -f -y
|
||||||
clear
|
clear
|
||||||
sudo dpkg -l | grep realmd
|
sudo dpkg -l | grep realmd
|
||||||
if [ $? = 0 ]
|
if [ $? = 0 ]
|
||||||
@ -293,7 +293,7 @@ if [ "$var" -eq "14" ]
|
|||||||
then
|
then
|
||||||
echo "Installing additional dependencies"
|
echo "Installing additional dependencies"
|
||||||
sudo apt-get -qq install -y realmd sssd sssd-tools samba-common krb5-user
|
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
|
clear
|
||||||
echo "${INTRO_TEXT}"Detecting Ubuntu $var"${END}"
|
echo "${INTRO_TEXT}"Detecting Ubuntu $var"${END}"
|
||||||
sudo echo "${INTRO_TEXT}"Realm=$DOMAIN"${INTRO_TEXT}"
|
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 realmd adcli sssd -y
|
||||||
sudo apt-get -qq install ntp -y
|
sudo apt-get -qq install ntp -y
|
||||||
sudo apt-get -qq install -y sssd-tools samba-common krb5-user
|
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
|
clear
|
||||||
sudo dpkg -l | grep realmd
|
sudo dpkg -l | grep realmd
|
||||||
if [ $? = 0 ]
|
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
|
read -p "${RED_TEXT}"'Do you wish to enable SSH login.group.allowed'"${END}""${NUMBER}"'(y/n)?'"${END}" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) sudo echo "Cheking if there is any previous configuration"
|
[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
|
then
|
||||||
echo "Files seems already to be modified, skipping..."
|
echo "Files seems already to be modified, skipping..."
|
||||||
else
|
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
|
read -p "${RED_TEXT}"'Do you wish to give users on this machine sudo rights?'"${END}""${NUMBER}"'(y/n)?'"${END}" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) sudo echo "Cheking if there is any previous configuration"
|
[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
|
then
|
||||||
echo ""
|
echo ""
|
||||||
echo "Sudoersfile seems already to be modified, skipping..."
|
echo "Sudoersfile seems already to be modified, skipping..."
|
||||||
@ -474,7 +474,7 @@ echo Realm configured?.. "${RED_TEXT}"FAIL"${END}"
|
|||||||
else
|
else
|
||||||
echo Realm configured?.. "${INTRO_TEXT}"OK"${END}"
|
echo Realm configured?.. "${INTRO_TEXT}"OK"${END}"
|
||||||
fi
|
fi
|
||||||
if [ -f /etc/sudoers.d/sudoers ]
|
if [ -f /etc/sudoers.d/sudoers 2> /dev/null ]
|
||||||
then
|
then
|
||||||
echo Checking sudoers file.. "${INTRO_TEXT}"OK"${END}"
|
echo Checking sudoers file.. "${INTRO_TEXT}"OK"${END}"
|
||||||
else
|
else
|
||||||
@ -488,14 +488,14 @@ else
|
|||||||
echo Checking sudoers users.. "${RED_TEXT}"FAIL"${END}"
|
echo Checking sudoers users.. "${RED_TEXT}"FAIL"${END}"
|
||||||
fi
|
fi
|
||||||
homedir=$(cat /etc/pam.d/common-session | grep homedir | grep 0022 | cut -d '=' -f3)
|
homedir=$(cat /etc/pam.d/common-session | grep homedir | grep 0022 | cut -d '=' -f3)
|
||||||
if [ $homedir = 0022 ]
|
if [ $homedir = 0022 2> /dev/null ]
|
||||||
then
|
then
|
||||||
echo Checking PAM configuration.. "${INTRO_TEXT}"OK"${END}"
|
echo Checking PAM configuration.. "${INTRO_TEXT}"OK"${END}"
|
||||||
else
|
else
|
||||||
echo Checking PAM configuration.. "${RED_TEXT}"FAIL"${END}"
|
echo Checking PAM configuration.. "${RED_TEXT}"FAIL"${END}"
|
||||||
fi
|
fi
|
||||||
cauth=$(cat /etc/pam.d/common-auth | grep required | grep onerr | grep allow | cut -d '=' -f4 | cut -d 'f' -f1)
|
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
|
then
|
||||||
echo Checking PAM auth configuration.. "${INTRO_TEXT}"OK"${END}"
|
echo Checking PAM auth configuration.. "${INTRO_TEXT}"OK"${END}"
|
||||||
else
|
else
|
||||||
@ -531,16 +531,16 @@ export whoami
|
|||||||
whoamis=$( whoami )
|
whoamis=$( whoami )
|
||||||
admins=$( cat /etc/passwd | grep home | grep bash | cut -d ':' -f1 )
|
admins=$( cat /etc/passwd | grep home | grep bash | cut -d ':' -f1 )
|
||||||
sudo echo "${RED_TEXT}"Installing pakages do no abort!......."${INTRO_TEXT}"
|
sudo echo "${RED_TEXT}"Installing pakages do no abort!......."${INTRO_TEXT}"
|
||||||
sudo apt-get update
|
sudo apt-get -qq update
|
||||||
sudo apt-get install libsss-sudo -y
|
sudo apt-get -qq install libsss-sudo -y
|
||||||
sudo apt-get install adcli -y
|
sudo apt-get -qq install adcli -y
|
||||||
sudo apt-get install realmd adcli sssd -y
|
sudo apt-get -qq install realmd adcli sssd -y
|
||||||
sudo apt-get install ntp -y
|
sudo apt-get -qq install ntp -y
|
||||||
sudo apt-get install policykit-1 -y
|
sudo apt-get -qq install policykit-1 -y
|
||||||
sudo mkdir -p /var/lib/samba/private
|
sudo mkdir -p /var/lib/samba/private
|
||||||
sudo apt-get -qq install realmd adcli sssd -y
|
sudo apt-get -qq install realmd adcli sssd -y
|
||||||
sudo apt-get -qq install ntp -y
|
sudo apt-get -qq install ntp -y
|
||||||
sudo apt-get install -f -y
|
sudo apt-get -qq install -f -y
|
||||||
clear
|
clear
|
||||||
sudo dpkg -l | grep realmd
|
sudo dpkg -l | grep realmd
|
||||||
if [ $? = 0 ]
|
if [ $? = 0 ]
|
||||||
@ -607,15 +607,15 @@ echo "$admins ALL=(ALL:ALL) ALL | tee -a /etc/sudoers.d/admin"
|
|||||||
fi
|
fi
|
||||||
clear
|
clear
|
||||||
sudo echo "${RED_TEXT}"Installing pakages do no abort!......."${INTRO_TEXT}"
|
sudo echo "${RED_TEXT}"Installing pakages do no abort!......."${INTRO_TEXT}"
|
||||||
sudo apt-get update
|
sudo apt-get -qq update
|
||||||
sudo apt-get install libsss-sudo -y
|
sudo apt-get -qq install libsss-sudo -y
|
||||||
sudo apt-get install realmd adcli sssd -y
|
sudo apt-get -qq install realmd adcli sssd -y
|
||||||
sudo apt-get install ntp -y
|
sudo apt-get -qq install ntp -y
|
||||||
sudo apt-get install policykit-1 -y
|
sudo apt-get -qq install policykit-1 -y
|
||||||
sudo mkdir -p /var/lib/samba/private
|
sudo mkdir -p /var/lib/samba/private
|
||||||
sudo apt-get -qq install realmd adcli sssd -y
|
sudo apt-get -qq install realmd adcli sssd -y
|
||||||
sudo apt-get -qq install ntp -y
|
sudo apt-get -qq install ntp -y
|
||||||
sudo apt-get install -f
|
sudo apt-get -qq install -f
|
||||||
clear
|
clear
|
||||||
sudo dpkg -l | grep realmd
|
sudo dpkg -l | grep realmd
|
||||||
if [ $? = 0 ]
|
if [ $? = 0 ]
|
||||||
@ -779,7 +779,7 @@ echo Realm configured?.. "${RED_TEXT}"FAIL"${END}"
|
|||||||
else
|
else
|
||||||
echo Realm configured?.. "${INTRO_TEXT}"OK"${END}"
|
echo Realm configured?.. "${INTRO_TEXT}"OK"${END}"
|
||||||
fi
|
fi
|
||||||
if [ -f /etc/sudoers.d/admins ]
|
if [ -f /etc/sudoers.d/admins 2> /dev/null ]
|
||||||
then
|
then
|
||||||
echo Checking sudoers file.. "${INTRO_TEXT}"OK"${END}"
|
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')
|
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}"
|
echo Checking sudoers users.. "${RED_TEXT}"FAIL"${END}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ -f /etc/sudoers.d/sudoers ]
|
if [ -f /etc/sudoers.d/sudoers 2> /dev/null ]
|
||||||
then
|
then
|
||||||
echo Checking sudoers file.. "${INTRO_TEXT}"OK"${END}"
|
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')
|
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
|
||||||
fi
|
fi
|
||||||
homedir=$(cat /etc/pam.d/common-session | grep homedir | grep 0022 | cut -d '=' -f3)
|
homedir=$(cat /etc/pam.d/common-session | grep homedir | grep 0022 | cut -d '=' -f3)
|
||||||
if [ $homedir = 0022 ]
|
if [ $homedir = 0022 2> /dev/null ]
|
||||||
then
|
then
|
||||||
echo Checking PAM configuration.. "${INTRO_TEXT}"OK"${END}"
|
echo Checking PAM configuration.. "${INTRO_TEXT}"OK"${END}"
|
||||||
else
|
else
|
||||||
echo Checking PAM configuration.. "${RED_TEXT}"FAIL"${END}"
|
echo Checking PAM configuration.. "${RED_TEXT}"FAIL"${END}"
|
||||||
fi
|
fi
|
||||||
cauth=$(cat /etc/pam.d/common-auth | grep required | grep onerr | grep allow | cut -d '=' -f4 | cut -d 'f' -f1)
|
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
|
then
|
||||||
echo Checking PAM auth configuration.. "${INTRO_TEXT}"OK"${END}"
|
echo Checking PAM auth configuration.. "${INTRO_TEXT}"OK"${END}"
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user