2018年7月30日 星期一

CentOS7 使用 sssd + windows ad 認證

安裝相關軟體
yum -y install krb5-workstation realmd sssd oddjob oddjob-mkhomedir adcli samba-common oddjob oddjob-mkhomedir sssd samba-common-tools

開啟相關服務
systemctl enable realm
systemctl start realm

加入網域
realm discover domainname
realm join domainname

realm 相關指令
查詢 AD 相關資訊
realm discover domain
realm list

加入網域
realm join domain --user administrator

退出網域
realm leave domain --user administrator

網域限制可登入的使用者:
realm permit --all  #允許任何帳號登入
realm deny --all    #拒絕任何帳號登入
realm permit user@domain      #允許使用UPN格式的 user 帳號登入
realm permit domain\\User2  #允許使用SAM格式的 user2 帳號登入
realm permit --withdraw user@domain     #從主機刪除可登入的帳號
realm permit -g mis   #mis 群組可登入主機

查詢使用者帳號資訊
id user\\donain
getent passwd
getent group

相關設定檔案
/etc/sssd/sssd.conf
/etc/nsswitch.conf
/etc/pam.d/fingerprint-auth
/etc/pam.d/fingerprint-auth-ac
/etc/pam.d/password-auth
/etc/pam.d/password-auth-ac
/etc/pam.d/system-auth
/etc/pam.d/system-auth-ac
/etc/pam.d/smartcard-auth
/etc/pamd./smartcard-auth-ac

/etc/sssd/sssd.conf  設定檔
[sssd]
domains = ad.example
config_file_version = 2
services = nss, pam

[domain/tw.example]
ad_domain = ad.example
krb5_realm = AD.EXAMPLE
realmd_tags = manages-system joined-with-samba
cache_credentials = True
id_provider = ad
krb5_store_password_if_offline = True
default_shell = /bin/bash
ldap_id_mapping = True
use_fully_qualified_names = False    #登入時,不需輸入網域
fallback_homedir = /home/%d/%u       #自動建立的 home 目錄不會加上 @DomainName
enumerate = True                     #可 使用 getent 查詢帳號資訊
access_provider = ad

相關指令

沒有留言: