Update ADconnection.sh

This commit is contained in:
PierreGoude 2017-01-26 11:47:02 +01:00 committed by GitHub
parent 579093548e
commit 746cc401fe

View File

@ -7,7 +7,6 @@
# # # #
##################################################################################################################### #####################################################################################################################
# ~~~~~~~~~~ Environment Setup ~~~~~~~~~~ # # ~~~~~~~~~~ Environment Setup ~~~~~~~~~~ #
NORMAL=`echo "\033[m"` NORMAL=`echo "\033[m"`
MENU=`echo "\033[36m"` #Blue MENU=`echo "\033[36m"` #Blue
@ -131,9 +130,7 @@ sed -i -e 's/use_fully_qualified_names = True/use_fully_qualified_names = False/
echo "override_homedir = /home/%d/%u" >> /etc/sssd/sssd.conf echo "override_homedir = /home/%d/%u" >> /etc/sssd/sssd.conf
eof eof
} }
####################### Setup for Ubuntu 14 server ####################################### ####################### Setup for Ubuntu 14 server #######################################
ubuntuserver14(){ ubuntuserver14(){
sudo wget http://download.beyondtrust.com/PBISO/8.0.1/linux.deb.x64/pbis-open-8.0.1.2029.linux.x86_64.deb.sh sudo wget http://download.beyondtrust.com/PBISO/8.0.1/linux.deb.x64/pbis-open-8.0.1.2029.linux.x86_64.deb.sh
sudo chmod 777 pbis-open-8.0.1.2029.linux.x86_64.deb.sh sudo chmod 777 pbis-open-8.0.1.2029.linux.x86_64.deb.sh
@ -184,52 +181,37 @@ sudo cat /etc/sudoers | grep $Group
echo "In SSH allow file..." echo "In SSH allow file..."
sudo cat /etc/ssh/login.group.allowed | grep $Group sudo cat /etc/ssh/login.group.allowed | grep $Group
echo "If this is wrong DO NOT REBOOT and contact sysadmin" echo "If this is wrong DO NOT REBOOT and contact sysadmin"
} }
####################### Setup for Debian client ####################################### ####################### Setup for Debian client #######################################
# This script should join Debian Jessie (8) to an Active Directory domain. # This script should join Debian Jessie (8) to an Active Directory domain.
debianclient(){ debianclient(){
export HOSTNAME export HOSTNAME
myhost=$( hostname ) myhost=$( hostname )
sudo apt-get update sudo apt-get update
sudo apt-get install libsss-sudo -y sudo apt-get install libsss-sudo -y
sudo apt-get install realmd adcli sssd -y sudo apt-get install realmd adcli sssd -y
sudo apt-get install ntp -y sudo apt-get install ntp -y
sudo mkdir -p /var/lib/samba/private sudo mkdir -p /var/lib/samba/private
clear clear
echo "Please enter the domain you wish to join: " echo "Please enter the domain you wish to join: "
read DOMAIN read DOMAIN
echo "Please enter Your domains NetBios name" echo "Please enter Your domains NetBios name"
read NetBios read NetBios
echo "Please enter a domain admin login to use: " echo "Please enter a domain admin login to use: "
read ADMIN read ADMIN
sudo realm join --user=$ADMIN $DOMAIN sudo realm join --user=$ADMIN $DOMAIN
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "AD join failed. Please run 'journalctl -xn' to determine why." echo "AD join failed. Please run 'journalctl -xn' to determine why."
exit 1 exit 1
fi fi
sudo systemctl enable sssd sudo systemctl enable sssd
sudo systemctl start sssd sudo systemctl start sssd
echo "session required pam_mkhomedir.so skel=/etc/skel/ umask=0022" | sudo tee -a /etc/pam.d/common-session echo "session required pam_mkhomedir.so skel=/etc/skel/ umask=0022" | sudo tee -a /etc/pam.d/common-session
# configure sudo # configure sudo
echo "Please enter new user without @mydomain" echo "Please enter new user without @mydomain"
read newuser read newuser
echo "%domain\ admins@$DOMAIN ALL=(ALL) ALL" | sudo tee -a /etc/sudoers.d/domain_admins echo "%domain\ admins@$DOMAIN ALL=(ALL) ALL" | sudo tee -a /etc/sudoers.d/domain_admins
sudo echo "$newuser"'@'"$DOMAIN"" ALL=(ALL:ALL) ALL" >> /etc/sudoers sudo echo "$newuser"'@'"$DOMAIN"" ALL=(ALL:ALL) ALL" >> /etc/sudoers
while true; do while true; do
read -p 'Do you want to Reboot now? (y/n)?' yn read -p 'Do you want to Reboot now? (y/n)?' yn
case $yn in case $yn in
@ -290,10 +272,7 @@ sed -i -e 's/use_fully_qualified_names = True/use_fully_qualified_names = False/
echo "override_homedir = /home/%d/%u" >> /etc/sssd/sssd.conf echo "override_homedir = /home/%d/%u" >> /etc/sssd/sssd.conf
eof eof
} }
############################### Reauth ########################################## ############################### Reauth ##########################################
Reauthenticate14(){ Reauthenticate14(){
echo "Reauth for Likewise only!" echo "Reauth for Likewise only!"
echo "Type domain" echo "Type domain"