De acordo com as Leis 12.965/2014 e 13.709/2018, que regulam o uso da Internet e o tratamento de dados pessoais no Brasil, ao me inscrever na newsletter do portal DICAS-L, autorizo o envio de notificações por e-mail ou outros meios e declaro estar ciente e concordar com seus Termos de Uso e Política de Privacidade.
Colaboração: Anderson P. Almeida
Data de Publicação: 19 de junho de 2018
Configurar a autenticação com o SSSD (System Security Services Daemon) e LDAP (Testado no Ubuntu 16.04)
srv-adm
.
$ sudo apt-get install sssd libpam-sss libnss-sss
Para usar o sssd o arquivo deve estar conforme este exemplo a seguir:
passwd: compat sss
group: compat sss
shadow: compat sss
gshadow: files
hosts: files dns
networks: files
protocols: db files
services: db files sss
ethers: db files
rpc: db files
netgroup: nis sss
sudoers: files sss
[nss] filter_groups = root filter_users = root reconnection_retries = 3 [pam] reconnection_retries = 3 offline_credentials_expiration = 3 [sssd] config_file_version = 2 reconnection_retries = 3 sbus_timeout = 30 services = nss, pam domains = ldap debug_level = 5 [domain/ldap] chpass_provider = ldap auth_provider = ldap ldap_schema = rfc2307 id_provider = ldap enumerate = true cache_credentials = true offline_credentials_expiration = 3 ldap_uri = ldaps://ldap.exemplo.com
OBS: Pode-se adicionar filtros em ldap_user_search_base
e em
ldap_group_search_base
afim de restringir a lista entradas do LDAP.
Ex: Listar somente contas com determinado valor no atributo host
ldap_user_search_base = ou=usuarios,dc=exemplo,dc=com?one?(host=valor) ldap_user_search_base = ou=usuarios,dc=exemplo,dc=com ldap_group_search_base = ou=grupos,dc=exemplo,dc=com #Cert ldap_tls_cacert = /etc/ssl/certs/seucertificado.cer ldap_id_use_start_tls = true ldap_tls_reqcert = demand #Bind credentials ldap_default_bind_dn = uid=user,dc=exemplo,dc=com ldap_default_authtok_type = password ldap_default_authtok = suasenha #Grupos ldap_group_object_class = posixGroup ldap_group_name = cn ldap_group_number = gidNumber ldap_group_member = memberUid
$ sudo chown root:root /etc/sssd/sssd.conf $ sudo chmod 600 /etc/sssd/sssd.conf
Name: activate mkhomedir
Default: yes
Priority: 900
Session-Type: Additional
Session:
required pam_mkhomedir.so umask=0022 skel=/etc/skel
Lembrando que neste exemplo estamos utilizando o grupo srv-adm
*;*;%srv-adm;Al0000-2400;adm,cdrom,sudo,dip,plugdev,lpadmin,sambashare
Name: Assign local groups Default: yes Priority: 900 Auth-Type: Primary Auth: required pam_group.so use_first_pass
Para ativar a configuração execute pam-auth-update
e, se necessário, marque
as opções conforme abaixo:
│ PAM profiles to enable: │ │ │ │ [*] Pwquality password strength checking │ │ [*] activate mkhomedir │ │ [*] Assign local groups │ │ [*] Unix authentication │ │ [*] SSS authentication │ │ [*] Register user sessions in the systemd control group hierarchy │ │ [*] Create home directory on login │
sudo service sssd restart
Execute os comandos abaixo e verifique se as entradas do LDAP são listadas
$getent passwd $getent shadow $getent group
This policy contains information about your privacy. By posting, you are declaring that you understand this policy:
This policy is subject to change at any time and without notice.
These terms and conditions contain rules about posting comments. By submitting a comment, you are declaring that you agree with these rules:
Failure to comply with these rules may result in being banned from submitting further comments.
These terms and conditions are subject to change at any time and without notice.
Comentários