Linux sssd 進程 ldap 客戶端配置
標簽(空格分隔): ldap
authconfig
authconfig命令解析:authconfig <集中式身份管理服務>
面對多計算機的身份管理以及賬戶信息同步, 其解決方案並不是把信息存放在本地, 而是存放在一台提供驗證服務的服務器上.
憑借SSO, 用戶輸入密碼進行一次性身份驗證即可獲得用於向其他服務進行身份驗證的一種票據或cookie.
集中式身份管理系統需要提供的服務;
- 賬戶信息, 包括用戶名 目錄位置 UID GID 組成員身份等信息,解決方案有:
LDAP 輕量級目錄訪問協議
NIS 網絡信息服務 - 身份驗證信息, 系統驗證身份的方法 解決方法為:
kerberos 僅提供SSO身份驗證服務, 可用於IPA服務器和Active Directory
LDAP 配合kerberos使用
<什么是LDAP?>
LDAP是一種支持TCP/IP的數據庫, 但與一般表型數據庫不同的是, LDAP是樹形結構的.
它也有服務端與客戶端, 服務端用於存儲數據, 客戶端用於存儲數據的增刪改查.
LDAP的據結構:(dn: cn , ou, dc), 可選的(o 組織, c 國家)略之
dn distinguished name區分名,就是完成的條目地址, 它是在一個目錄中總是唯一的
dc domain component 是數據的存放位置(相當於SQL的表), 常用寫法: dc=example, dc=com, 代表域example.com
ou organization unit 組織名, 代表數據的分組, 最多4級, 每級最長32個字符
cn common name, 代表數據的id, 一般為用戶名或服務器名
那么, 回答本章, LDAP負責的就是存放用戶的認證信息的數據庫了.
LDAP這種數據庫的特點是讀效率特高, 寫效率低.
<什么是kerberos?>
Kerberos簡單來說就是一個用於安全認證第三方協議,它采用了傳統的共享密鑰的方式,實現了在網絡環境不一定保證安全的環境下,client和server之間的 通信,適用於client/server模型,由MIT開發和實現。
應用原理
在實際的應有場景中通常有三個角色,即:
- 需要訪問服務的Client
- 提供服務的Application Server
- 提供安全認證的第三方Kerberos服務器KDC(Key Distribution Center)。
authconfig
一種打包了驗證功能的服務, 集成了LDAP, kerberos的功能, 通過簡單的幾步就能實現 LDAP, kerberos,的數據庫及服務器管理配置工作.
- 安裝: yum install sssd authconfig-gtk krb5-workstation (authconfig-gtk ssh沒有圖形界面可使用 authconfig-tui代替, 改服務在authconfig中)
- 配置: authconfig-atk 或 authconfig-tui
- 用戶信息(user account database)選擇LDAP
- 認證方式(authentication method)選擇kerberos
- 配置解析:
TLS: 一種加密協議,同ssh
LDAP server: LDAP的數據庫服務器
LDAP search base DN: 基礎搜索域如: dc=example,dc=com
Realm: kerberos域
KDCs: KDC服務器地址
Admin Servers: 管理服務器地址, 一般同上
CA Certificate: 證書下載 可輸入地址
3.1 直接使用authconfig的配置方法: 正式生效則把--test 改成--update 即可
authconfig \
--enableldap \
--enableldaptls \
--ldapserver='class.example.com' \
--ldapbasedn='dc=example,dc=com' \
--ldaploadcacert='http://classroom.example.com/pub/example-ca.crt' \
--enablekrb5 \
--krb5realm='EXAMPLE.COM'\
--krb5kdc='classroom.example.com' \
--krb5adminserver='classroom.example.com' \
--disablekrb5kdcdns \
--disablekrb5realmdns \
--test
/etc/sysconfig/authconfig
用於跟蹤是否啟用了特定的身份驗證機制。目前包括變量名為 USESHADOW, USEMD5,
USEKERBEROS, USELDAPAUTH, USESMBAUTH, USEWINBIND,USEWINBINDAUTH、USEHESIOD、
USENIS、USELDAP等其他
/etc/passwd
/etc/shadow
Used for shadow password support.
/etc/yp.conf
Configuration file for NIS support.
/etc/sysconfig/network
Another configuration file for NIS support.
/etc/ldap.conf
/etc/nss_ldap.conf
/etc/pam_ldap.conf
/etc/nslcd.conf
/etc/openldap/ldap.conf
用於配置 nss_ldap、pam_ldap、nslcd 和 OpenLDAP 庫。僅當經存在系統上的文件被更改。
/etc/krb5.conf 用於Kerberos 5.
/etc/hesiod.conf 用於配置Hesiod
/etc/samba/smb.conf 用於配置 winbind 身份驗證
/etc/nsswitch.conf 用於配置用戶信息服務
/etc/login.defs 用於配置用戶帳戶的參數 (常規用戶的最小UID, 密碼哈希算法)
/etc/pam.d/system-auth
用於系統服務的通用 PAM 配置,其中包括使用 include,指令只能被添加軟鏈接不能被添加硬鏈接
/etc/pam.d/system-auth-ac
包含系統服務的實際 PAM 配置, 並且是/etc/pam.d/system-auth的符號鏈接
如果創建了PAM的本地配置 (並symlinked從system-auth文件),該文件就會被包含在那里。
基本簡單用法
NAME
系統驗證資源配置的一個接口,authconfig-tui是簡單的圖形化配置界面,就好像setup一樣的。
SYNOPSIS
authconfig
[options] {--update|--updateall|--test|--probe|--restorebackup
<name>|--savebackup <name>|--restorelastbackup}
DESCRIPTION
authconfig提供了一個簡單的方式去配置 /etc/sysconfig/network去支持NIS功能,
也為/etc/passwd和/etc/shadow提供密碼策略方面的支持,
同時也支持Basic LDAP, Kerberos 5, 和Winbind 客戶端的配置。
--test參數的話,authconfig可以被除了root意外的用戶使用,任何改變都不會被保存
只會被打印出來,看下效果。
--update參數的話,就必須是root權限用戶,配置會被保存,僅僅修改的文件會被重新寫入
--updateall參數的話,同上,但是所有的配置文件都會被修改
--probe 使用DNS或者其他的方式來猜測當前主機的配置,如果找到就通過STDOUT輸出然后退出
--restorebackup --savebackup --restorelastbackup參數提供了保存和恢復被authconfg修改的
文件的可能,authconfig每次操作前也會自動備份配置文件信息,這個備份信息可以被
--restorelastbackup恢復
以下是一些options
如果指定了--nostart (這是安裝程序所做的), ypbind 或其他守護進程將不會啟動
或在程序執行后立即停止, 但只在啟動時啟用或停止。
--enablenis,--enableldap,--enablewinbind, 和--enablehesiod選項用於配置用戶的信息服務
/etc/nsswitch.conf, --enablecache 選項用於配置命名服務緩存,
--enableshadow,--enableldapauth,--enablekrb5, --enablewinbindauth 選項用於配置
認證功能通過/etc/pam.d/system-auth。
每一個--enable都對應一個--disable選項
用於存儲新密碼哈希值的算法可以由 --passalgo 選項指定, 它采用
下列可能的值作為參數: descrypt、bigcrypt、md5、sha256 和 sha512。
--enablelocauthorize 選項允許繞過檢查網絡認證服務的授權
--enablesysnetauth 允許這些服務對系統帳戶 (uid <500或者1000(centos7)) 進行身份驗證。
當配置設置允許用戶信息服務和身份驗證使用 SSSD 時, SSSD將自動使用,而不是老的服務,
SSSD 配置將被設置, 所以有一個使用連接服務所需的設置填充的默認域。
--enablesssd和--enablesss 選項強制添加SSSD到/etc/nsswitch.conf and /etc/pam.d/system-auth,
但它們不設置SSSD 配置文件中的域。 SSSD配置必須手動設置。允許的配置SSSD 服務的配給是:
LDAP為用戶信息(-enableldap)和任一LDAP(--enableldapauth),或 Kerberos(--enablekrb5)
進行身份驗證。
如果 SSSD不支持站點配置所需的舊式服務的某些功能,
通過在/etc/sysconfig/authconfig中設置 FORCELEGACY=yes , 可以強制使用舊式服務。
在手冊頁中提到的選項列表不是詳盡無遺的, 請參考 authconfig--help 完整的列表
authconfig--tui支持authconfig所有的選項,但它意味着--update作為默認操作。
它的窗口默認情況下包含"Cancel"按鈕。如果在運行時指定了--back選項,則顯示"Back"按鈕而不是
"Cancel".如果指定了"--kickstart",將不會看到交互式屏幕。程序將使用的值將由其他選項
(-passalgo,-enableshadow, 等等)指定。
對於namelist,您可以用單個名稱或逗號分隔的名稱列表替換。
對於namelist,您可以用單個名稱或逗號分隔的名稱列表替換。
以下是authconfig --help 的完整options
Options:
-h, --help show this help message and exit
--enableshadow, --useshadow
enable shadowed passwords by default
--disableshadow disable shadowed passwords by default
--enablemd5, --usemd5
enable MD5 passwords by default
--disablemd5 disable MD5 passwords by default
--passalgo=<descrypt|bigcrypt|md5|sha256|sha512>
hash/crypt algorithm for new passwords
--enablenis enable NIS for user information by default
--disablenis disable NIS for user information by default
--nisdomain=<domain> default NIS domain
--nisserver=<server> default NIS server
--enableldap enable LDAP for user information by default
--disableldap disable LDAP for user information by default
--enableldapauth enable LDAP for authentication by default
--disableldapauth disable LDAP for authentication by default
--ldapserver=<server>
default LDAP server hostname or URI
--ldapbasedn=<dn> default LDAP base DN
--enableldaptls, --enableldapstarttls
enable use of TLS with LDAP (RFC-2830)
--disableldaptls, --disableldapstarttls
disable use of TLS with LDAP (RFC-2830)
--enablerfc2307bis enable use of RFC-2307bis schema for LDAP user information lookups
--disablerfc2307bis disable use of RFC-2307bis schema for LDAP user information lookups
--ldaploadcacert=<URL>
load CA certificate from the URL
--enablesmartcard enable authentication with smart card by default
--disablesmartcard disable authentication with smart card by default
--enablerequiresmartcard
require smart card for authentication by default
--disablerequiresmartcard
do not require smart card for authentication by default
--smartcardmodule=<module>
default smart card module to use
--smartcardaction=<0=Lock|1=Ignore>
action to be taken on smart card removal
--enablefingerprint enable authentication with fingerprint readers by default
--disablefingerprint disable authentication with fingerprint readers by default
--enablekrb5 enable kerberos authentication by default
--disablekrb5 disable kerberos authentication by default
--krb5kdc=<server> default kerberos KDC
--krb5adminserver=<server>
default kerberos admin server
--krb5realm=<realm> default kerberos realm
--enablekrb5kdcdns enable use of DNS to find kerberos KDCs
--disablekrb5kdcdns disable use of DNS to find kerberos KDCs
--enablekrb5realmdns enable use of DNS to find kerberos realms
--disablekrb5realmdns
disable use of DNS to find kerberos realms
--enablewinbind enable winbind for user information by default
--disablewinbind disable winbind for user information by default
--enablewinbindauth enable winbind for authentication by default
--disablewinbindauth disable winbind for authentication by default
--smbsecurity=<user|server|domain|ads>
security mode to use for samba and winbind
--smbrealm=<realm> default realm for samba and winbind when security=ads
--smbservers=<servers>
names of servers to authenticate against
--smbworkgroup=<workgroup>
workgroup authentication servers are in
--smbidmaprange=<lowest-highest>, --smbidmapuid=<lowest-highest>, --smbidmapgid=<lowest-highest>
uid range winbind will assign to domain or ads users
--winbindseparator=<\>
the character which will be used to separate the domain and user part of winbind-created user names if winbindusedefaultdomain is not enabled
--winbindtemplatehomedir=</home/%D/%U>
the directory which winbind-created users will have as home directories
--winbindtemplateprimarygroup=<nobody>
the group which winbind-created users will have as their primary group
--winbindtemplateshell=</bin/false>
the shell which winbind-created users will have as their login shell
--enablewinbindusedefaultdomain
configures winbind to assume that users with no domain in their user names are domain users
--disablewinbindusedefaultdomain
configures winbind to assume that users with no domain in their user names are not domain users
--enablewinbindoffline
configures winbind to allow offline login
--disablewinbindoffline
configures winbind to prevent offline login
--winbindjoin=<Administrator>
join the winbind domain or ads realm now as this administrator
--enableipav2 enable IPAv2 for user information and authentication by default
--disableipav2 disable IPAv2 for user information and authentication by default
--ipav2domain=<domain>
the IPAv2 domain the system should be part of
--ipav2realm=<realm> the realm for the IPAv2 domain
--ipav2server=<servers>
the server for the IPAv2 domain
--enableipav2nontp do not setup the NTP against the IPAv2 domain
--disableipav2nontp setup the NTP against the IPAv2 domain (default)
--ipav2join=<account>
join the IPAv2 domain as this account
--enablewins enable wins for hostname resolution
--disablewins disable wins for hostname resolution
--enablepreferdns prefer dns over wins or nis for hostname resolution
--disablepreferdns do not prefer dns over wins or nis for hostname resolution
--enablehesiod enable hesiod for user information by default
--disablehesiod disable hesiod for user information by default
--hesiodlhs=<lhs> default hesiod LHS
--hesiodrhs=<rhs> default hesiod RHS
--enablesssd enable SSSD for user information by default with manually managed configuration
--disablesssd disable SSSD for user information by default (still used for supported configurations)
--enablesssdauth enable SSSD for authentication by default with manually managed configuration
--disablesssdauth disable SSSD for authentication by default (still used for supported configurations
--enableforcelegacy never use SSSD implicitly even for supported configurations
--disableforcelegacy use SSSD implicitly if it supports the configuration
--enablecachecreds enable caching of user credentials in SSSD by default
--disablecachecreds disable caching of user credentials in SSSD by default
--enablecache enable caching of user information by default (automatically disabled when SSSD is used)
--disablecache disable caching of user information by default
--enablelocauthorize local authorization is sufficient for local users
--disablelocauthorize
authorize local users also through remote service
--enablepamaccess check access.conf during account authorization
--disablepamaccess do not check access.conf during account authorization
--enablesysnetauth authenticate system accounts by network services
--disablesysnetauth authenticate system accounts by local files only
--enablemkhomedir create home directories for users on their first login
--disablemkhomedir do not create home directories for users on their first login
--nostart do not start/stop portmap, ypbind, and nscd
--test do not update the configuration files, only print new settings
--update, --kickstart
opposite of --test, update configuration files with changed settings
--updateall update all configuration files
--probe probe network for defaults and print them
--savebackup=<name> save a backup of all configuration files
--restorebackup=<name>
restore the backup of configuration files
--restorelastbackup restore the backup of configuration files saved before the previous configuration change
EG:
authconfig --enableldap --enableldapauth --ldapserver=127.0.0.1,127.0.0.2 --ldapbasedn=dc=hellobike,dc=com --updateall --enablemkhomedir --enablesssd --enablesssdauth --kickstart