From c18ad24f86a1e27a2b40178d186d2d9e7905f84f Mon Sep 17 00:00:00 2001 From: PierreGode <8579922+PierreGode@users.noreply.github.com> Date: Wed, 23 Aug 2023 12:52:02 +0200 Subject: [PATCH 1/3] Update ADconnection.sh --- ADconnection.sh | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/ADconnection.sh b/ADconnection.sh index cecb880..1729921 100755 --- a/ADconnection.sh +++ b/ADconnection.sh @@ -857,6 +857,7 @@ else clear sudo echo "${INTRO_TEXT}packages installed${END}" fi +pointtoou=$( sudo grep OUSPECIFIED readfile | awk '{print $3}' ) echo "hostname is $myhost" echo "Looking for Realms.. please wait" REALM=$( sudo grep DOMAIN readfile | awk '{print $3}' ) @@ -918,7 +919,7 @@ fi encrypt=$( sudo grep ENCRYPTEDPASSWD readfile | awk '{print $3}' ) if [ "$encrypt" = "null" ] || [ "$encrypt" = "no" ] then - if ! sudo realm join --verbose --user="$ADMIN" "$DOMAIN" --install=/ + if ! sudo realm join --verbose --user="$ADMIN" "$DOMAIN" "$OUSPECIFIED" --install=/ then echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}" exit @@ -929,7 +930,7 @@ then if [ -f private_key.pem ] && [ -f public_key.pem ] then 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 echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}" enc=$(null) @@ -942,7 +943,7 @@ then fi else echo "No readfile" - if ! sudo realm join --verbose --user="$ADMIN" "$DOMAIN" --install=/ + if ! sudo realm join --verbose --user="$ADMIN" "$DOMAIN" "$OUSPECIFIED" --install=/ then echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}" exit @@ -975,7 +976,7 @@ fi encrypt=$( sudo grep ENCRYPTEDPASSWD readfile | awk '{print $3}' ) if [ "$encrypt" = "null" ] || [ "$encrypt" = "no" ] then - if ! sudo realm join --verbose --user="$ADMIN" "$DOMAIN" --install=/ + if ! sudo realm join --verbose --user="$ADMIN" "$DOMAIN" "$OUSPECIFIED"--install=/ then echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}" exit @@ -986,7 +987,7 @@ then if [ -f private_key.pem ] && [ -f public_key.pem ] then 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 echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}" enc=$(null) @@ -998,7 +999,7 @@ then exit fi else - if ! sudo realm join --verbose --user="$ADMIN" "$DOMAIN" --install=/ + if ! sudo realm join --verbose --user="$ADMIN" "$DOMAIN" "$OUSPECIFIED" --install=/ then echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}" exit @@ -1021,10 +1022,6 @@ sudo apt-get update #sudo apt install adcli -y else 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 apt-get update #sudo apt-get --only-upgrade install adcli @@ -1054,7 +1051,7 @@ fi encrypt=$( sudo grep ENCRYPTEDPASSWD readfile | awk '{print $3}' ) if [ "$encrypt" = "null" ] || [ "$encrypt" = "no" ] then - if ! sudo realm join --verbose --user="$ADMIN" "$DOMAIN" --install=/ + if ! sudo realm join --verbose --user="$ADMIN" "$DOMAIN" "$OUSPECIFIED"--install=/ then echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}" exit @@ -1065,7 +1062,7 @@ then if [ -f private_key.pem ] && [ -f public_key.pem ] then 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 echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}" enc=$(null) @@ -1077,7 +1074,7 @@ then exit fi else - if ! sudo realm join --verbose --user="$ADMIN" "$DOMAIN" --install=/ + if ! sudo realm join --verbose --user="$ADMIN" "$DOMAIN" "$OUSPECIFIED"--install=/ then echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}" exit From ac282e9d515694c0269b2478942b78c41b14b4f0 Mon Sep 17 00:00:00 2001 From: PierreGode <8579922+PierreGode@users.noreply.github.com> Date: Wed, 23 Aug 2023 12:54:59 +0200 Subject: [PATCH 2/3] Update readfile --- readfile | 1 + 1 file changed, 1 insertion(+) diff --git a/readfile b/readfile index 46304fb..6ad0540 100644 --- a/readfile +++ b/readfile @@ -1,6 +1,7 @@ # "null" is for manual setup and will result in promts. misconfuguration will result in skipping that config and giving promts. ################ Config #################### 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 #################### USESASL = null # yes or no to use SASL LDAPS = null # Address of domaincontroller From 44832a24c3660ceaece0f037e94d082218c65572 Mon Sep 17 00:00:00 2001 From: PierreGode <8579922+PierreGode@users.noreply.github.com> Date: Wed, 23 Aug 2023 12:58:08 +0200 Subject: [PATCH 3/3] Update ADconnection.sh --- ADconnection.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ADconnection.sh b/ADconnection.sh index 1729921..c4768f1 100755 --- a/ADconnection.sh +++ b/ADconnection.sh @@ -858,6 +858,10 @@ clear sudo echo "${INTRO_TEXT}packages installed${END}" fi pointtoou=$( sudo grep OUSPECIFIED readfile | awk '{print $3}' ) + if [ "$pointtoou" = "null" ] + then + pointtoou=$(echo="" ) + fi echo "hostname is $myhost" echo "Looking for Realms.. please wait" REALM=$( sudo grep DOMAIN readfile | awk '{print $3}' )