diff --git a/domainjoin.sh b/domainjoin.sh index 2a440e7..343e721 100644 --- a/domainjoin.sh +++ b/domainjoin.sh @@ -34,14 +34,25 @@ elif [ "${OS}" == "CentOS" ]; then echo ${password} | realm join --user=${username} --computer-ou=OU=Servers ${domain} fi +# Get hostname +hostname=$(hostnamectl | awk '/Static hostname:/ {print $3}') -# set the sssd options -# don't require the full domain for the usernames -sed --in-place 's/^use_fully_qualified_names = True/use_fully_qualified_names = False/' /etc/sssd/sssd.conf -# set home directory to /home/ -sed --in-place 's/^fallback_homedir = \/home\/%u@%d/fallback_homedir = \/home\/%u/' /etc/sssd/sssd.conf -# change the provider to simple and then only allow the server admins to login -sed --in-place 's/^access_provider = ad/access_provider = simple\nsimple_allow_groups = Server Admins/' /etc/sssd/sssd.conf +# set the sssd options for our domain +cat < "/etc/sssd/conf.d/${netbiosname}.conf" +[domain/${domain}] +use_fully_qualified_names = False +fallback_homedir = /home/%u +access_provider = simple +simple_allow_groups = Domain Admins, Server Admins +ad_hostname = ${hostname}.${domain} +dyndns_update = true +dyndns_refresh_interval = 43200 +dyndns_update_ptr = true +dyndns_ttl = 3600 +EOF + +# make sure the permissions are correct +chmod 600 "/etc/sssd/conf.d/${netbiosname}.conf" # reboot sssd systemctl restart sssd