This commit is contained in:
deathbybandaid 2022-03-08 09:08:06 -05:00
parent f309d42259
commit d438c74242

View File

@ -7,14 +7,14 @@ echo "Checking IPA Realm Join Status"
# TODO setup /etc/hosts with FQDN and FreeIPA servers # TODO setup /etc/hosts with FQDN and FreeIPA servers
echo "Checking if system already contains Membership to FreeIPA Realm" echo "* Checking if system already contains Membership to FreeIPA Realm"
realm_join=0 realm_join=0
if [[ ! -f /var/lib/ipa-client/sysrestore/sysrestore.state ]] if [[ ! -f /var/lib/ipa-client/sysrestore/sysrestore.state ]]
then then
echo "$HOSTNAME appears to not be joined to FreeIPA Server Realm" echo "** $HOSTNAME appears to not be joined to FreeIPA Server Realm"
realm_join=1 realm_join=1
else else
echo "$HOSTNAME appears to already be joined to FreeIPA Server Realm" echo "** $HOSTNAME appears to already be joined to FreeIPA Server Realm"
fi fi
## FreeIPA Realm Join ## FreeIPA Realm Join
@ -23,17 +23,17 @@ if [ "$realm_join" == 1 ]; then
then then
if [[ $HOSTNAME == *template* ]]; then if [[ $HOSTNAME == *template* ]]; then
echo "Hostname $HOSTNAME contains the word 'template', skipping realm joining" echo "** Hostname $HOSTNAME contains the word 'template', skipping realm joining"
realm_join=0 realm_join=0
fi fi
if [ "$realm_join" == 1 ]; then if [ "$realm_join" == 1 ]; then
echo "Setting up ipa-client to join FreeIPA Server Realm" echo "** Setting up ipa-client to join FreeIPA Server Realm"
freeipa_admin=$(whiptail --passwordbox "Please enter the user authorized to join FreeIPA realm: $freeipa_admin" 8 78 --title "FreeIPA Admin User Prompt" 3>&1 1>&2 2>&3) freeipa_admin=$(whiptail --passwordbox "Please enter the user authorized to join FreeIPA realm: $freeipa_admin" 8 78 --title "FreeIPA Admin User Prompt" 3>&1 1>&2 2>&3)
freeipa_password=$(whiptail --passwordbox "Please enter the password for the FreeIPA admin user: $freeipa_admin" 8 78 --title "FreeIPA Password Prompt" 3>&1 1>&2 2>&3) freeipa_password=$(whiptail --passwordbox "Please enter the password for the FreeIPA admin user: $freeipa_admin" 8 78 --title "FreeIPA Password Prompt" 3>&1 1>&2 2>&3)
ipa-client-install --mkhomedir --no-ntp --principal="$freeipa_admin" --password="$freeipa_password" --enable-dns-updates --unattended ipa-client-install --mkhomedir --no-ntp --principal="$freeipa_admin" --password="$freeipa_password" --enable-dns-updates --unattended
fi fi
else else
echo "Skipping realm joining" echo "** Skipping realm joining"
fi fi
fi fi