ORF反垃圾邮件系统

邮件服务器-邮件系统-邮件技术论坛(BBS)

 找回密码
 会员注册
查看: 22324|回复: 16
打印 上一主题 下一主题

[原创] Debian + samba + winbind + postfix + dovecot + 2003 AD的配置

[复制链接]
跳转到指定楼层
顶楼
发表于 2008-7-10 13:00:50 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
網絡環境 :
網段 10.136.74.0/24
網域名稱 XXX.COM.CN
域控 :WINDOWS 2003 Server,另DNS、WINS、DHCP均在此電腦,IP地址:10.136.74.64 电脑名称:dg-svr03
工作站: windowXP SP2 ,加入域,使用域帳號登陸

一台安裝 Debian 的LINUX服務器 mis-debian     IP: 10.136.74.3

目的:
將上述的LINUX服務器做為 文件服務器和邮件服务器,要求使用WINDOWS2003 的域帳號及密碼進行驗證來存取相關的文件、收发邮件(不需要在debian及samba中设置任何域用户帐号)。

安装相关的软件
使用apt-get indtall 方式安裝软件
  1. apt-get install samba winbind krb5-config krb5-user postfix dovecot-common dovecot-imapd dovecot-pop3d  squirrelmail
复制代码
安装过程中,系统会自动安装其它的一些依赖软件

为方便在WINDOWS中管理LINUX,又安装了ssh, 是否安装此软件,都不会对上面的软件有任何影响

  1. apt-get install ssh
复制代码

[ 本帖最后由 stdmis 于 2009-9-21 16:49 编辑 ]
沙发
 楼主| 发表于 2008-7-10 13:09:50 | 只看该作者

krb5 的配置與測試

vim /etc/krb5.conf
  1. [logging]
  2. default = FILE:/var/log/krb5libs.log
  3. kdc = FILE:/var/log/krb5kdc.log
  4. admin_server = FILE:/var/log/kadmind.log

  5. [libdefaults]
  6. default_realm = XXX.COM.CN

  7. [realms]
  8. XXX.COM.CN = {
  9. default_domain = XXX.COOM.CN
  10. kdc = 10.136.74.64:88
  11. admin_server = 10.136.74.64:749
  12. }

  13. [domain_realm]
  14. .kerberos.server = XXX.COM.CN
  15. .xxx.com.cn = XXX.COM.CN
复制代码

[ 本帖最后由 stdmis 于 2008-7-29 08:45 编辑 ]
藤椅
 楼主| 发表于 2008-7-10 21:28:43 | 只看该作者

配置 /etc/nsswitch.conf

vim /etc/nsswitch.conf

  1. passwd: files winbind
  2. group: files winbind
  3. shadow: files winbind

  4. hosts: files dns
  5. networks: files

  6. protocols: db files
  7. services: db files
  8. ethers: db files
  9. rpc: db files

  10. netgroup: nis
复制代码

[ 本帖最后由 stdmis 于 2008-7-29 08:49 编辑 ]
板凳
 楼主| 发表于 2008-7-10 22:14:46 | 只看该作者

Samba 的配置文件 /etc/samba/smb.conf

vim /etc/samba/smb.conf

  1. [global]
  2. idmap gid = 10000-20000
  3. domain master = no
  4. winbind use default domain = yes
  5. template shell = /bin/bash
  6. netbios name = mis-debian
  7. idmap uid = 10000-20000
  8. password server = 10.136.74.64
  9. template homedir = /home/%D/%U
  10. workgroup = XXX
  11. os level = 20
  12. security = domain
  13. preferred master = no
  14. winbind separator = +
  15. domain logons = no
  16. winbind enum groups = yes
  17. winbind enum users = yes
  18. display charset = utf8
  19. unix charset = utf8
  20. dos charset = utf8
  21. winbind refresh tickets = yes
  22. [homes]
  23. comment = %U 's Home Directories
  24. browseable = no
  25. writeable = yes
  26. valid users = %D/%U
  27. path = /home/%D/%U
  28. preexec = /home/XXX/buildhome %D %U %G
复制代码


vim /home/XXX/buildhome

  1. umask 0077
  2. if [ ! -d /home/$1/$2 ]; then
  3. mkdir /home/$1/$2
  4. chown $2 /home/$1/$2
  5. chgrp $3 /home/$1/$2
  6. fi
复制代码

[ 本帖最后由 stdmis 于 2008-7-29 08:53 编辑 ]
报纸
 楼主| 发表于 2008-7-10 23:24:48 | 只看该作者

Samba 加入 Win 2003 域并验证

使用下面的命令将Debian 加入到 Windows 2003域中
  1. net rpc join -S DG-SVR03.XXX.COM.CN -U administrator
复制代码

会出提示pasword:
输入Win2003域的管理员密码,成功会出现
Joined domain XXX

重新启动samab winbind

  1. /etc/init.d/samba restart
  2. /etc/init.d/winbind restart
复制代码
确认加入win2003域成功,可以
1.Win2003的域控计算机上,依次点击
开始所有程序系统管理工具
“Active Directory 使用者及计算机

在其中依次点点击
“xxx.com.cn"-- "computer",找到安装
debian的计算机名称
mis-debian

2.Debian中执行
  1. wbinfo -t  
复制代码


出现
checking the trust secret via RPC calls succeeded
说明主机信任已成功建立
执行
wbinfo -u 可列出debian中的用户和win2003 域中的用户信息

执行
wbinfo -g 可列出debian中的组和win2003 域中的组信息

3.在Debian中执行
getent  group 可列出debian中组和win 2003 域中的组信息
getent  passwd 可列出debian中账号和win2003域中的账号信息

[ 本帖最后由 stdmis 于 2008-8-11 17:14 编辑 ]
地板
 楼主| 发表于 2008-7-29 09:02:02 | 只看该作者

postfix相关的配置

vim /etc/postfix/main.cf

  1. smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
  2. biff = no
  3. append_dot_mydomain = no
  4. smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
  5. smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
  6. smtpd_use_tls=yes
  7. smtpd_tls_session_cache_database = btree{queue_directory}/smtpd_scache
  8. smtp_tls_session_cache_database = btree{queue_directory}/smtp_scache
  9. myhostname = mis-debian.dgalltop.com.cn
  10. alias_maps = hash:/etc/aliases
  11. alias_database = hash:/etc/aliases
  12. myorigin = /etc/mailname
  13. mydestination = dgalltop.com.cn, debian.dgalltop.com.cn, localhost, localhost.localdomain, localhost
  14. relayhost =
  15. mynetworks = 10.136.74.0/24, 127.0.0.0/8
  16. recipient_delimiter = +
  17. inet_interfaces = all
  18. smtpd_sasl_auth_enable = yes
  19. smtpd_sasl_local_domain =
  20. smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
  21. smtpd_sasl_security_options = noanonymous
  22. home_mailbox = Maildir/
复制代码
vim /etc/postfix/master.cf
找到下面这句
  1. smtp      inet  n       -       -       -       -       smtpd
复制代码
改成
  1. smtp      inet  n       -       n       -       -       smtpd
复制代码
新增文件
vim /etc/postfix/sasl/smtpd.conf

  1. log_level: 3   
  2. pwcheck_method: saslauthd
  3. mech_list: PLAIN LOGIN
复制代码

[ 本帖最后由 stdmis 于 2008-8-11 17:21 编辑 ]
7
 楼主| 发表于 2008-7-29 09:02:42 | 只看该作者

dovecot相关的配置

vim /etc/dovecot/dovecot.conf

  1. protocols = imap pop3
  2. listen = *
  3. disable_plaintext_auth = no
  4. log_timestamp = "%Y-%m-%d %H:%M:%S "
  5. login_dir = /var/run/dovecot/login
  6. mail_location =maildir:~/Maildir
  7. mail_extra_groups = mail
  8. protocol imap {
  9. }
  10. protocol pop3 {
  11.   pop3_uidl_format = %08Xu%08Xv
  12. }
  13. auth default {
  14.   mechanisms = plain
  15.   passdb pam {
  16.   }
  17.   userdb passwd {
  18.   }
  19.   user = root
  20.   socket listen {
  21.     client {
  22.       mode = 0660
  23.       user = postfix
  24.       group = postfix
  25.     }
  26.   }
  27. }
复制代码

[ 本帖最后由 stdmis 于 2008-7-29 15:40 编辑 ]
8
 楼主| 发表于 2008-7-29 09:03:23 | 只看该作者

PAM及SASL相关的配置

网上相当多的资料都是说要修改/etc/pam.d/smtp  dovecot  login的內容,不过我的本意是使用ad帐号进行验证,基本不打算在Debian上添加帐号,所以就直接修改了/etc/pam.d/common-auth common-account common-session

vim /etc/pam.d/common-auth

  1. auth sufficient  pam_winbind.so krb5_auth Krb5_ccache_type=FILE
  2. auth  sufficient pam_unix.so use_first_pass nullok_secure
  3. auth  required pam_deny.so
复制代码
vim /etc/pam.d/common-account

  1. account  sufficient pam_winbind.so use_first_pass cached_login
  2. account  required pam_unix.so
复制代码
vim /etc/pam.d/common-session

  1. session  required  pam_unix.so
  2. session  required  pam_mkhomedir.so umask=0022 skel=/etc/skel
复制代码
刪除/var/run/saslauthd
  1. rm -R /var/run/saslauthd
复制代码
新建 /var/spool/postfix/var/run/saslauthd
  1. mkdir -p /var/spool/postfix/var/run/saslauthd
复制代码
建立连接
  1. ln -s /var/spool/postfix/var/run/saslauthd/ /var/run/saslauthd
复制代码
vim /etc/default/saslauthd

  1. START=yes
  2. MECHANISMS="pam"
复制代码
重新启动 saslauthd
  1. /etc/init.d/saslauthd restart
复制代码


[ 本帖最后由 stdmis 于 2008-7-29 20:23 编辑 ]
9
 楼主| 发表于 2008-7-29 09:04:09 | 只看该作者

squirrelmail相关的配置

使用命令
  1. squirrelmail-configure
复制代码

进行相应的配置,主要是第二项 Server Settings

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings
General
-------
1.  Domain                 : xxx.com.cn
2.  Invert Time            : false
3.  Sendmail or SMTP       : SMTP
A.  Update IMAP Settings   : 10.136.74.3:143 (other)
B.  Update SMTP Settings   : 10.136.74.3:25
R   Return to Main Menu
C   Turn color on
S   Save data
Q   Quit
Command >>


修改 apache2 配置文件 /etc/apache2/apache2.conf,插入下面的行
Include /etc/squirrelmail/apache.conf

建立一个连接
  1. ln -s /usr/share/squirrelmail/ /var/www/squirrelmail
复制代码


重新启动 apache2 :
  1. /etc/init.d/apache2 restart
复制代码


打开浏览器,输入http://10.136.74.3/squirrelmail 就可以使用Webmail 收发邮件了。

[ 本帖最后由 stdmis 于 2008-7-29 20:14 编辑 ]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?会员注册

x
10
 楼主| 发表于 2008-7-29 09:04:52 | 只看该作者

其它相关事项

说明:
上面的配置文件中有些参数值的配置并不是必需的,有些本来就是缺省值,所以是否存在对结果没有影响。

[ 本帖最后由 stdmis 于 2008-7-29 20:21 编辑 ]
您需要登录后才可以回帖 登录 | 会员注册

本版积分规则

小黑屋|手机版|Archiver|邮件技术资讯网

GMT+8, 2024-5-4 12:53

Powered by Discuz! X3.2

© 2001-2016 Comsenz Inc.

本论坛为非盈利中立机构,所有言论属发表者个人意见,不代表本论坛立场。内容所涉及版权和法律相关事宜请参考各自所有者的条款。
如认定侵犯了您权利,请联系我们。本论坛原创内容请联系后再行转载并务必保留我站信息。此声明修改不另行通知,保留最终解释权。
*本论坛会员专属QQ群:邮件技术资讯网会员QQ群
*本论坛会员备用QQ群:邮件技术资讯网备用群

快速回复 返回顶部 返回列表