diff --git a/ADconnection.sh b/ADconnection.sh index 0456e31..c2f3710 100755 --- a/ADconnection.sh +++ b/ADconnection.sh @@ -843,6 +843,11 @@ else 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}' ) @@ -904,7 +909,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 @@ -915,7 +920,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) @@ -928,7 +933,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 @@ -961,7 +966,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 @@ -972,7 +977,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) @@ -984,7 +989,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 @@ -1007,10 +1012,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 @@ -1040,7 +1041,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 @@ -1051,7 +1052,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) @@ -1063,7 +1064,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 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