• Linux sssd 进程 ldap 客户端配置


    Linux sssd 进程 ldap 客户端配置

    标签(空格分隔): ldap


    authconfig

    authconfig命令解析:authconfig <集中式身份管理服务>
    面对多计算机的身份管理以及账户信息同步, 其解决方案并不是把信息存放在本地, 而是存放在一台提供验证服务的服务器上.
    凭借SSO, 用户输入密码进行一次性身份验证即可获得用于向其他服务进行身份验证的一种票据或cookie.

    集中式身份管理系统需要提供的服务;

    1. 账户信息, 包括用户名 目录位置 UID GID 组成员身份等信息,解决方案有:
      LDAP 轻量级目录访问协议
      NIS 网络信息服务
    2. 身份验证信息, 系统验证身份的方法 解决方法为:
      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开发和实现。

    应用原理
    在实际的应有场景中通常有三个角色,即:

    1. 需要访问服务的Client
    2. 提供服务的Application Server
    3. 提供安全认证的第三方Kerberos服务器KDC(Key Distribution Center)。

    authconfig

    一种打包了验证功能的服务, 集成了LDAP, kerberos的功能, 通过简单的几步就能实现 LDAP, kerberos,的数据库及服务器管理配置工作.

    1. 安装: yum install sssd authconfig-gtk krb5-workstation (authconfig-gtk ssh没有图形界面可使用 authconfig-tui代替, 改服务在authconfig中)
    2. 配置: authconfig-atk 或 authconfig-tui
    3. 用户信息(user account database)选择LDAP
    4. 认证方式(authentication method)选择kerberos
    5. 配置解析:
      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
    
  • 相关阅读:
    Give root password for maintenance(or press Control-D to continue)
    docker swarm 拉2副本 及磁盘映射
    删除 Docker私有仓库镜像文件
    docker swarm 从私有仓库拉取 创建2个docker副本
    mysqldump 备份导出数据排除某张表
    node递归属性目录结构
    MySql批量更新方法
    npm 发布包
    实例学习Backbone.js(一)
    node.js中log4js的使用
  • 原文地址:https://www.cnblogs.com/hit-zb/p/11882478.html
Copyright © 2020-2023  润新知