Linux安全网 - Linux操作系统_Linux 命令_Linux教程_Linux黑客

会员投稿 投稿指南 本期推荐: 强烈推荐:Ylmf OS 3.0 正式版发布附迅雷高 XP系统下硬盘安装Fedora 14图文教程
搜索:
您的位置: Linux安全网 > Linux入门 > » 正文

Linux 加入域的那些事儿!

来源: 未知 分享至:

说明:本文为LINUX加入WINDOWS域的具体情况作一些说明,关于如何加入到域,本文不再详述,仅提供一个配置样板,如果有不了解的,可以再查看相关文章。

650) this.width=650;\" width=\"77\" height=\"5\" style=\"position: absolute;left:-77px;top:-5px\" src=\"chrome://livemargins/skin/monitor-background-horizontal.png\" alt=\"\" /> 650) this.width=650;\" style=\"position: absolute;left:0;top:-5px;\" src=\"chrome://livemargins/skin/monitor-background-vertical.png\" alt=\"\" /> 650) this.width=650;\" style=\"position: absolute;left:1px;top:0;opacity:0.5;cursor:pointer\" onmouseout=\"this.style.opacity=0.5\" onmouseover=\"this.style.opacity=1\" src=\"chrome://livemargins/skin/monitor-play-button.png\" id=\"monitor-play-button\" alt=\"\" />*-====================-*
* Linux To Windows AD
*-====================-*

- 基本概念
* PDC - 主域控制器
* BDC - 备份域控制器
* KDC - 密钥颁发中心,Kerberos服务器
* PAM - 可插拨认证模块
* SRV - DNS服务资源记录
- 域模式
* PRC - LINUX以Windows2000/NT4样式加入到域中
* ADS - 活动目录,Windows2003,WindowsXP
* 混合 - 有最好的兼容性

- 软件包Sw
* Samba: yum install samba.* samba-common.* samba-winbind-client.*
* Winbind: yum install samba-winbind.*
* Samba4: yum install samba4.* ;A newer version of samba
* Kerberos5: yum install pam_krb5.* krb5-workstation.* krb5-libs.*
* ldconfig
* ldconfig -v | grep winbind
* ls /usr/lib/libnss_winbind.so

- 配置文件
- NSS: /etc/nsswitch.conf
; 指示系统如何查找系统配置文件
; ACTION=Modify
* password: files winbind
* group: files winbind

- Samba: /etc/smb.conf
; 与共享文件夹相关的配置
; DomainMode = ActiveDirectory
*-------------------------------*
[global]
  client use spnego = no
  server signing = auto
  workgroup = CAMPUS
# The SHORT-DOMAIN name of your domain, you need to modify
  wins support = yes
  wins server = 10.0.0.4
# Controller of the domain, You need to modify it to your own
  wins proxy = yes
  security = ADS
# or AD,ADS,domain, DOMAIN is the RPC mode
  acl compatibility = win2k
  idmap uid = 16777216-33554431
# Set based on your user count
  idmap gid = 16777216-33554431
  password server = 10.0.0.4
# Domain Controller
  map to guest = bad user
  guest ok = no
  realm = CAMPUS.COM
# You need to keep the same with file krb5.conf defined
# encrypt psswords = yes
# Encrypt PASS, not supported by some version of samba
  winbind use default domain = yes
# winbind separator = %
  template homedir = /home/%D/%U
  # A mode 777 should be set on /home/%D
  template shell = /bin/bash
[homes]
  comment = %S
  path =/home/%D/%S
  writeable = yes
  browsable = yes
; valid users = %S
  valid users = CAMPUS/%S
*-------------------------------*

* Kerberos: /etc/krb5.conf
*-------------------------------*
[logging]
  default = FILE:/var/log/krb5libs.log
  kdc = FILE:/var/log/krb5kdc.log
  admin_server = FILE:/var/log/kadmind.log
[libdefaults]
  default_realm = CAMPUS.COM
  dns_lookup_realm = false
  dns_lookup_kdc = false
[realms]
  CAMPUS.COM = {
  kdc = ADS.CAMPUS.COM:88
  admin_server = ADS.CAMPUS.COM:749
  default_domain = campus.com
}
# This is a REALMS to DOMAIN MAPPING, REALMS Format is uppercase
[domain_realm]
  .campus.com = CAMPUS.COM
  campus.com = CAMPUS.COM
# Build the mapping
[kdc]
  profile = /var/kerberos/krb5kdc/kdc.conf
[appdefaults]
  pam = {
  debug = false
  ticket_lifetime = 36000
  renew_lifetime = 36000
  forwardable = true
  krb4_convert = false
}
*-------------------------------*

* 重启samba: service smb restart
* 重启Winbind: service winbind restart
* 初始化KDC: net ads kerberos kinit
* 加域: net rpc join -S ADS.CAMPUS.COM -U Administrator%
* 查看信息: net rpc info; net ads testjoin; net ads
* 退域: net ads leave -S ADS.CAMPUS.COM -U Administrator%
* 查看用户信息: wbinfo -u, wbinfo -t
* 查看本机用户: getent passwd K-id, getent group K-id
* 获取SID: net rpc getsid -U Administrator% -I x.x.x.x
* NTLM-AUTH: ntlm_auth --username=$USER

- 通过AD认证SSH
* 用户名如下: ADU/admin/DOMAINNAME => root/admin/CAMPUS
* 如果只进行网络认证,仅用户名也可以登录如 ssh imwk2011@SYS
* PAM认证文件,仅网络认证
*-------------------------------*
#%PAM-1.0
#AUTHENTICATION
auth          sufficient     pam_winbind.so
#AM
account       sufficient     pam_winbind.so
#SM
session       required       pam_limits.so
session       required       pam_mkhomedir.so
session       optional       pam_console.so
*-------------------------------*

- 总结#LINUX ADS#部署过程
* 安装软件包
* 依次对配置文件进行修改
  /etc/nsswitch.conf
  /etc/samba/smb.conf
  /etc/krb5.conf
* 模板见上,修改的重要地方已标出
- 排错
* 检查服务是否正常运行
* 检查配置文件是否正确
* 检查日志
* 检查DNS设置: 应该为Windows域主DNS
* 检查防火墙配置与SELINUX配置

# 调错
* "BAD SIG"
  注释掉smb.conf中的"client use spnego = no"选项
* “DNS UPDATE FAILED”
  检查DNS设定
  检查DNS上的更新权限
* nsupdate
> Server x.x.x.x
> Add CMS.CAMPUS.COM 10 A 10.0.0.2
> Send
* Kerberos 密钥初始化问题
  kinit xxx@CAMPUS.COM ;申请用户xxx在域CAMPUS中的票据
  时钟问题,域控与客户端时钟差距过大
  密码问题,用户或者密码错误
  域名问题,KINIT找不到域控制器,也即KDC,注意检查DNS配置
* PAM模块中的认证问题
  使用 tail -f /var/log/secure 追踪其认证问题
  确认在"smb.conf"文件中打开"winbind use default domain=yes"选项,系统会自动传入域名
* 加域并不需要SMB服务运行,WINBIND需要"smb.conf"文件
* 旧的主机(含LINUX、UNIX等)登录域的用户名为: CAMPUScc,前为域名,后为用户名

# 数据查询
* net ads search \'(objectCategory=group)\' sAMAccountName ;查询系统组
* net ads search \'(objectCategory=user) sAMAccountName ;查询用户
* net ads search \'(sAMAccountName=cc)\' ;查询用户CC相关信息
* ldapsearch -x -b "dc=CAMPUS,dc=COM" -D "CAMPUScc" -w "PASSWD" -h ADS.CAMPUS.COM
# 常用数据结构
* 用户: "CN=users,DC=CAMPUS,DC=COM"
* 计算机: "CN=Computers,DC=CAMPUS,DC=COM"
* 组织单位: "OU=GRPS,DC=CAMPUS,DC=COM"



# 认证
* wbinfo -a USER%PASS
* wbinfo -K USER%PASS
* wbinfo -m
* ntlm_auth --username=CC










 

*-====================-*
* Linux To Windows AD
*-====================-*

- 基本概念
* PDC - 主域控制器
* BDC - 备份域控制器
* KDC - 密钥颁发中心,Kerberos服务器
* PAM - 可插拨认证模块
* SRV - DNS服务资源记录

- 域模式
* PRC - LINUX以Windows2000/NT4样式加入到域中
* ADS - 活动目录,Windows2003,WindowsXP
* 混合 - 有最好的兼容性

- 软件包Sw
* Samba: yum install samba.* samba-common.* samba-winbind-client.*
* Winbind: yum install samba-winbind.*
* Samba4: yum install samba4.* ;A newer version of samba
* Kerberos5: yum install pam_krb5.* krb5-workstation.* krb5-libs.*

* ldconfig
* ldconfig -v | grep winbind
* ls /usr/lib/libnss_winbind.so

- 配置文件
- NSS: /etc/nsswitch.conf ;指示系统如何查找系统配置文件
; 修改以下内容

password: files winbind
group: files winbind

- Samba: /etc/smb.conf
; 与共享文件夹相关的配置

 [global]
  client use spnego = no
  server signing = auto
  workgroup = CAMPUS
# The SHORT-DOMAIN name of your domain, you need to modify
  wins support = yes
  wins server = 10.0.0.4
# Controller of the domain, You need to modify it to your own
  wins proxy = yes
  security = ADS
# or AD,ADS,domain, DOMAIN is the RPC mode
  acl compatibility = win2k
  idmap uid = 16777216-33554431
# Set based on your user count
  idmap gid = 16777216-33554431
  password server = 10.0.0.4
# Domain Controller
  map to guest = bad user
  guest ok = no
  realm = CAMPUS.COM
# You need to keep the same with file krb5.conf defined
# encrypt psswords = yes
# Encrypt PASS, not supported by some version of samba
  winbind use default domain = yes
# winbind separator = %
  template homedir = /home/%D/%U
  # A mode 777 should be set on /home/%D
  template shell = /bin/bash
[homes]
  comment = %S
  path =/home/%D/%S
  writeable = yes
  browsable = yes
; valid users = %S
  valid users = CAMPUS%S

Tags:
分享至:
最新图文资讯
1 2 3 4 5 6
验证码:点击我更换图片 理智评论文明上网,拒绝恶意谩骂 用户名:
关于我们 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 发展历史