Merge pull request #35 from PierreGode/dev

Added OUSPECIFIED = Insert OU to join object to like: --computer-ou=OU=Clients,OU=Computers,DC=domain,DC=com
This commit is contained in:
PierreGode 2023-12-01 10:20:10 +01:00 committed by GitHub
commit 96e74aa4e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 13 deletions

View File

@ -843,6 +843,11 @@ else
clear clear
sudo echo "${INTRO_TEXT}packages installed${END}" sudo echo "${INTRO_TEXT}packages installed${END}"
fi fi
pointtoou=$( sudo grep OUSPECIFIED readfile | awk '{print $3}' )
if [ "$pointtoou" = "null" ]
then
pointtoou=$(echo="" )
fi
echo "hostname is $myhost" echo "hostname is $myhost"
echo "Looking for Realms.. please wait" echo "Looking for Realms.. please wait"
REALM=$( sudo grep DOMAIN readfile | awk '{print $3}' ) REALM=$( sudo grep DOMAIN readfile | awk '{print $3}' )
@ -904,7 +909,7 @@ fi
encrypt=$( sudo grep ENCRYPTEDPASSWD readfile | awk '{print $3}' ) encrypt=$( sudo grep ENCRYPTEDPASSWD readfile | awk '{print $3}' )
if [ "$encrypt" = "null" ] || [ "$encrypt" = "no" ] if [ "$encrypt" = "null" ] || [ "$encrypt" = "no" ]
then then
if ! sudo realm join --verbose --user="$ADMIN" "$DOMAIN" --install=/ if ! sudo realm join --verbose --user="$ADMIN" "$DOMAIN" "$OUSPECIFIED" --install=/
then then
echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}" echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}"
exit exit
@ -915,7 +920,7 @@ then
if [ -f private_key.pem ] && [ -f public_key.pem ] if [ -f private_key.pem ] && [ -f public_key.pem ]
then then
enc=$(sudo openssl pkeyutl -decrypt -inkey private_key.pem -in encrypted.dat ) enc=$(sudo openssl pkeyutl -decrypt -inkey private_key.pem -in encrypted.dat )
if ! echo $enc | sudo realm join -v -U "$ADMIN" "$DOMAIN" --install=/ if ! echo $enc | sudo realm join -v -U "$ADMIN" "$DOMAIN" "$OUSPECIFIED" --install=/
then then
echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}" echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}"
enc=$(null) enc=$(null)
@ -928,7 +933,7 @@ then
fi fi
else else
echo "No readfile" echo "No readfile"
if ! sudo realm join --verbose --user="$ADMIN" "$DOMAIN" --install=/ if ! sudo realm join --verbose --user="$ADMIN" "$DOMAIN" "$OUSPECIFIED" --install=/
then then
echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}" echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}"
exit exit
@ -961,7 +966,7 @@ fi
encrypt=$( sudo grep ENCRYPTEDPASSWD readfile | awk '{print $3}' ) encrypt=$( sudo grep ENCRYPTEDPASSWD readfile | awk '{print $3}' )
if [ "$encrypt" = "null" ] || [ "$encrypt" = "no" ] if [ "$encrypt" = "null" ] || [ "$encrypt" = "no" ]
then then
if ! sudo realm join --verbose --user="$ADMIN" "$DOMAIN" --install=/ if ! sudo realm join --verbose --user="$ADMIN" "$DOMAIN" "$OUSPECIFIED"--install=/
then then
echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}" echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}"
exit exit
@ -972,7 +977,7 @@ then
if [ -f private_key.pem ] && [ -f public_key.pem ] if [ -f private_key.pem ] && [ -f public_key.pem ]
then then
enc=$(sudo openssl pkeyutl -decrypt -inkey private_key.pem -in encrypted.dat ) enc=$(sudo openssl pkeyutl -decrypt -inkey private_key.pem -in encrypted.dat )
if ! echo $enc | sudo realm join -v -U "$ADMIN" "$DOMAIN" --install=/ if ! echo $enc | sudo realm join -v -U "$ADMIN" "$DOMAIN" "$OUSPECIFIED"--install=/
then then
echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}" echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}"
enc=$(null) enc=$(null)
@ -984,7 +989,7 @@ then
exit exit
fi fi
else else
if ! sudo realm join --verbose --user="$ADMIN" "$DOMAIN" --install=/ if ! sudo realm join --verbose --user="$ADMIN" "$DOMAIN" "$OUSPECIFIED" --install=/
then then
echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}" echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}"
exit exit
@ -1007,10 +1012,6 @@ sudo apt-get update
#sudo apt install adcli -y #sudo apt install adcli -y
else else
echo"" echo""
echo "Fixing krb5.keytab: Bad encryption type for ubuntu 19.10 - 20.04"
echo ""
echo "To avoid encryption error with adcli please accept PPA below for an adcli update"
echo ""
#sudo add-apt-repository ppa:aroth/ppa #sudo add-apt-repository ppa:aroth/ppa
sudo apt-get update sudo apt-get update
#sudo apt-get --only-upgrade install adcli #sudo apt-get --only-upgrade install adcli
@ -1040,7 +1041,7 @@ fi
encrypt=$( sudo grep ENCRYPTEDPASSWD readfile | awk '{print $3}' ) encrypt=$( sudo grep ENCRYPTEDPASSWD readfile | awk '{print $3}' )
if [ "$encrypt" = "null" ] || [ "$encrypt" = "no" ] if [ "$encrypt" = "null" ] || [ "$encrypt" = "no" ]
then then
if ! sudo realm join --verbose --user="$ADMIN" "$DOMAIN" --install=/ if ! sudo realm join --verbose --user="$ADMIN" "$DOMAIN" "$OUSPECIFIED"--install=/
then then
echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}" echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}"
exit exit
@ -1051,7 +1052,7 @@ then
if [ -f private_key.pem ] && [ -f public_key.pem ] if [ -f private_key.pem ] && [ -f public_key.pem ]
then then
enc=$(sudo openssl pkeyutl -decrypt -inkey private_key.pem -in encrypted.dat ) enc=$(sudo openssl pkeyutl -decrypt -inkey private_key.pem -in encrypted.dat )
if ! echo $enc | sudo realm join -v -U "$ADMIN" "$DOMAIN" --install=/ if ! echo $enc | sudo realm join -v -U "$ADMIN" "$DOMAIN" "$OUSPECIFIED"--install=/
then then
echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}" echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}"
enc=$(null) enc=$(null)
@ -1063,7 +1064,7 @@ then
exit exit
fi fi
else else
if ! sudo realm join --verbose --user="$ADMIN" "$DOMAIN" --install=/ if ! sudo realm join --verbose --user="$ADMIN" "$DOMAIN" "$OUSPECIFIED"--install=/
then then
echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}" echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}"
exit exit

View File

@ -1,6 +1,7 @@
# "null" is for manual setup and will result in promts. misconfuguration will result in skipping that config and giving promts. # "null" is for manual setup and will result in promts. misconfuguration will result in skipping that config and giving promts.
################ Config #################### ################ Config ####################
DOMAIN = null # Insert domain name ex:domain.com leave null for autodiscover ( promt ) DOMAIN = null # Insert domain name ex:domain.com leave null for autodiscover ( promt )
OUSPECIFIED = null # Insert OU to join object to like: --computer-ou=OU=Clients,OU=Computers,DC=domain,DC=com
################ ldaps config #################### ################ ldaps config ####################
USESASL = null # yes or no to use SASL USESASL = null # yes or no to use SASL
LDAPS = null # Address of domaincontroller LDAPS = null # Address of domaincontroller