Domínio: FUTURELAB.DCC.UFMG.BR
IP do Servidor (DC1): 192.168.7.130
Sistema Operacional Cliente: Ubuntu / Debian
Edite /etc/systemd/resolved.conf:
[Resolve] DNS=192.168.7.130 Domains=futurelab.dcc.ufmg.br DNSStubListener=no
O cliente deve apontar para o IP do DC1 para resolver o domínio e o Kerberos.
/etc/resolv.conf
nameserver 192.168.7.130 search futurelab.dcc.ufmg.br
/etc/hosts
127.0.0.1 localhost [IP_DO_CLIENTE] ps-[FINAL-IP].futurelab.dcc.ufmg.br ps-[FINAL-IP]
sudo apt update sudo apt install -y sssd-ad sssd-tools realmd adcli krb5-user ntpdate libpam-mount cifs-utils keyutils
sudo realm join -U Administrator -v 192.168.7.130
Edite o arquivo /etc/krb5.conf
[libdefaults] default_realm = FUTURELAB.DCC.UFMG.BR dns_lookup_realm = false dns_lookup_kdc = true rdns = false ticket_lifetime = 24h renew_lifetime = 7d forwardable = true [realms] FUTURELAB.DCC.UFMG.BR = { kdc = dc1.futurelab.dcc.ufmg.br admin_server = dc1.futurelab.dcc.ufmg.br default_domain = futurelab.dcc.ufmg.br } [domain_realm] .futurelab.dcc.ufmg.br = FUTURELAB.DCC.UFMG.BR futurelab.dcc.ufmg.br = FUTURELAB.DCC.UFMG.BR
Após o join, ajuste /etc/sssd/sssd.conf para usar nomes curtos (sem @dominio):
[domain/futurelab.dcc.ufmg.br] [sssd] domains = futurelab.dcc.ufmg.br config_file_version = 2 services = nss, pam [domain/futurelab.dcc.ufmg.br] default_shell = /bin/bash ad_server = dc1.futurelab.dcc.ufmg.br krb5_store_password_if_offline = True cache_credentials = True krb5_realm = FUTURELAB.DCC.UFMG.BR realmd_tags = manages-system joined-with-adcli id_provider = ad fallback_homedir = /home/%u ad_domain = futurelab.dcc.ufmg.br use_fully_qualified_names = False ldap_id_mapping = True access_provider = ad # Nomes curtos sem @dominio use_fully_qualified_names = False fallback_homedir = /home/%u # Permite login offline com credenciais em cache cache_credentials = true krb5_store_password_if_offline = true # Evita enumeração completa de usuários/grupos (melhora desempenho) enumerate = false # Timeouts para não travar no login ldap_network_timeout = 3 ldap_search_timeout = 5 ldap_opt_timeout = 5 # Cache de entradas e grupos entry_cache_timeout = 600 entry_cache_group_timeout = 3600 krb5_ccname_template = FILE:/tmp/krb5cc_%U krb5_server = dc1.futurelab.dcc.ufmg.br
sudo systemctl restart sssd
Edite /etc/security/pam_mount.conf.xml e adicione as linhas abaixo antes de </pam_mount>:
<!-- Monta a home do usuário via CIFS/Kerberos --> <volume user="*" fstype="cifs" server="dc1.futurelab.dcc.ufmg.br" path="%(USER)" mountpoint="/home/%(USER)" options="nosuid,nodev,sec=krb5,cruid=%(USERUID),mfsymlinks,noperm,dir_mode=0755,file_mode=0644,uid=%(USERUID),gid=%(USERGID),vers=3.0,cache=strict,actimeo=60,rsize=1048576,wsize=1048576,echo_interval=60,serverino" mkmountpoint="1" /> <!-- Bind mount do snap local (deve ser montado ANTES do acesso à home remota) --> <volume user="*" fstype="bind" path="/var/local/appconfig/%(USER)/snap" mountpoint="/home/%(USER)/snap" options="bind" mkmountpoint="1" />
Edite /etc/pam.d/common-session e coloque:
session optional pam_umask.so # and here are more per-package modules (the "Additional" block) session required pam_unix.so session optional pam_sss.so session optional pam_keyinit.so force revoke session optional pam_sss.so session optional pam_mount.so session optional pam_systemd.so
Redirecionar .cache, .config e .local para o disco local evita I/O remoto excessivo (especialmente pelo Nautilus).
Crie o arquivo /etc/profile.d/xdg-local.sh (aplicado a todos os usuários do domínio):
#!/bin/bash export XDG_CONFIG_HOME="/var/local/appconfig/$USER/.config" export XDG_CACHE_HOME="/var/local/appconfig/$USER/.cache" mkdir -p "$XDG_CONFIG_HOME" mkdir -p "$XDG_CACHE_HOME" # Redireciona symlinks na home remota para os diretórios locais if [ -d "/home/$USER" ]; then # .cache remoto → local if [ ! -L "/home/$USER/.cache" ]; then rm -rf "/home/$USER/.cache" 2>/dev/null ln -sfn "$XDG_CACHE_HOME" "/home/$USER/.cache" fi # .config remoto → local if [ ! -L "/home/$USER/.config" ]; then rm -rf "/home/$USER/.config" 2>/dev/null ln -sfn "$XDG_CONFIG_HOME" "/home/$USER/.config" fi # .local remoto → local (inclui recently-used.xbel, muito acessado pelo Nautilus) mkdir -p "/var/local/appconfig/$USER/.local/share" if [ ! -L "/home/$USER/.local" ]; then rm -rf "/home/$USER/.local" 2>/dev/null ln -sfn "/var/local/appconfig/$USER/.local" "/home/$USER/.local" fi fi export SNAP_USER_DATA="/var/local/appconfig/$USER/snap" export SNAP_USER_COMMON="/var/local/appconfig/$USER/snap/common" mkdir -p "$SNAP_USER_DATA" "$SNAP_USER_COMMON"
sudo mkdir -p /var/local/appconfig sudo chmod 777 /var/local/appconfig
sudo crontab -e
Adicione a seguinte linha
0 0 * * * find /var/local/appconfig -type f -mtime +7 -delete