Skip to content

Commit

Permalink
🐛 Explicitly use /usr/sbin/realm as this might not be in PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
jemrobinson committed Aug 25, 2022
1 parent 331be6b commit 86da7df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ write_files:
content: |
#! /bin/bash
echo ">=== Waiting for realm availability... ===<"
while [ "$(realm discover {{shm.domain.fqdnLower}} 2> /dev/null | grep server-software | awk '{print $2}')" != "active-directory" ]; do sleep 1; done
while [ "$(/usr/sbin/realm discover {{shm.domain.fqdnLower}} 2> /dev/null | grep server-software | awk '{print $2}')" != "active-directory" ]; do sleep 1; done
echo ">=== Joining domain '{{shm.domain.fqdnLower}}'... ===<"
echo "/opt/configuration/join_domain.sh '{{shm.domain.fqdnLower}}' '{{shm.domain.ous.linuxServers.path}}' '{{shm.users.computerManagers.linuxServers.samAccountName}}' '{{srd.hostname}}'"
/opt/configuration/join_domain.sh "{{shm.domain.fqdnLower}}" "{{shm.domain.ous.linuxServers.path}}" "{{shm.users.computerManagers.linuxServers.samAccountName}}" "{{srd.hostname}}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ VM_HOSTNAME=$4

# Ensure that /etc/resolv.conf has the correct settings
echo "Ensuring that /etc/resolv.conf has the correct settings..."
cp /etc/systemd/resolved.conf /tmp/resolved.conf
sed -i -e "s/^[#]DNS=.*/DNS=/" -e "s/^[#]FallbackDNS=.*/FallbackDNS=/" -e "s/^[#]Domains=.*/Domains=${DOMAIN_FQDN_LOWER}/" /etc/systemd/resolved.conf
ln -rsf /run/systemd/resolve/resolv.conf /etc/resolv.conf
cmp /etc/systemd/resolved.conf /tmp/resolved.conf || systemctl restart systemd-resolved
rm /tmp/resolved.conf
systemctl restart systemd-resolved

# Check that hostname is correct
echo "Ensuring that hostname is correct..."
Expand Down Expand Up @@ -51,8 +49,8 @@ fi

# Join realm - creating the SSSD config if it does not exist
echo "Joining realm '${DOMAIN_FQDN_LOWER}'..."
realm leave 2> /dev/null
cat /etc/domain-join.secret | realm join --verbose --computer-ou="${DOMAIN_JOIN_OU}" -U ${DOMAIN_JOIN_USER} ${DOMAIN_FQDN_LOWER} --install=/ 2>&1
/usr/sbin/realm leave 2> /dev/null
cat /etc/domain-join.secret | /usr/sbin/realm join --verbose --computer-ou="${DOMAIN_JOIN_OU}" -U "${DOMAIN_JOIN_USER}" "${DOMAIN_FQDN_LOWER}" --install=/ 2>&1

# Update SSSD settings
echo "Updating SSSD settings..."
Expand Down

0 comments on commit 86da7df

Please sign in to comment.