用OpenBSD搭建一个主域名控制器

OpenBSD FAQ中文版、PF指南中文版、OpenBSD用户手册...
回复
头像
leo
帖子: 2465
注册时间: 2010-01-21 3:27

用OpenBSD搭建一个主域名控制器

帖子 leo » 2011-05-04 9:16

原文链接:http://www.kernel-panic.it/openbsd/pdc/
感谢原作者的辛勤劳动和分享精神。
鉴于译者的水平,此译文仅供会员在JR社区进行交流探讨之用,如果您发现译文中有错误请指出,谢绝转载!
leo@JR

1. 介绍
一旦某个基于Windows的网络发展到拥有10多台计算机, 设置一个主域控制器来简单地集中管理用户、计算机、资源就成为了必须的方式。但是域名控制器必须由一台Windows计算机担任吗? 因此这就成为 全部基于 OpenBSD 服务器的网络 项目的最后一个话题。
当然不是! 再次强调一下, OpenBSD 可以在其它一些软件的协助下变成一个成熟的、安全可靠的域名控制器。所需的软件为:
OpenLDAP
[INDENT]一个开源轻型目录访问协议 (LDAP) 的实施方案;
[/INDENT]Samba
[INDENT]一个开源/自由的组件,它为所有使用 SMB/CIFS 协议的客户端提供了安全、稳定、快捷的文件和打印为服务, 这些客户端可以使用所有版本的 DOS 和 Windows, OS/2, Linux 以及其它很多的操作系统;
[/INDENT]IDX-smbldap-tools
[INDENT]一组 perl 脚本,可用于管理一个LDAP目录里的用户和组帐号;
[/INDENT]Bind (Berkeley Internet Name Domain)
[INDENT]一个开源软件,它为Internet提供域名 (DNS) 系统协议实施方案;
[/INDENT]Clam AntiVirus
[INDENT]一个Unix的开源的 (GPL) 反病毒工具包;
[/INDENT]Samba-vscan
[INDENT]一个Samba的概念型模块, 它使用 Samba 2.2.x/3.0 的 VFS (虚拟文件系统) 功能来实现一个实时的反病毒Samba访问;
[/INDENT]CUPS (通用UNIX打印系统)
[INDENT]一个基于标准的开源打印系统。
[/INDENT]我们在 前面的文档 中已经专门讨论了基于OpenBSD和DNS的Bind配置, 所以我们不会再深入这个话题。因此, 在这篇文档中, 我假设你已经建立了一个全功能的域名服务器,而且它可以正常解析那些将要连接到域控制器的客户端机器的域名。请注意,这是成功搭建主域控制器的基本条件, 因为 nmbd(8) 要依赖 DNS 来解析未注册的 NetBIOS 域名。

和前面一样,我们假设你很了解OpenBSD, 因为我们不会深入有关系统管理的话题,例如基本配置或者 packages/ports 的安装。

头像
leo
帖子: 2465
注册时间: 2010-01-21 3:27

回复: OpenBSD as a Primary Domain Controller

帖子 leo » 2011-05-05 9:29

2. OpenLDAP
OpenLDAP 是一个 轻型目录访问协议 的一个开源实施方案。 我们可以使用它来建立一个域用户、组和计算机的中央信息库, 并且可以让 Samba (和所有其它的 LDAP-aware 服务) 用此信息来进行认证和管理。

2.1 LDAP协议
轻型的目录访问协议 (LDAP) 是一个用来访问基于 X.500 目录服务的网络协议。一个这里所说的目录是一个经过特殊优化数据库,它便于读取、浏览、搜索和支持先进的过滤功能 ([OLDAP])。

和 Unix 文件系统以及 域名系统 类似, 这个数据库的结构类似于一棵分级的倒置的树, 树根在顶部; 例如:
图片
如上图所示, LDAP树的顶部的通常是基于域名的, 这样可以使用域名系统排列目录服务的布局。

在LDAP树内的每个节点被称为一个entry(leo: 这里可理解为词条或者项),每个entry 是唯一的且对应于它的 Distinguished Name (DN), 每个entry由自己的名称 (被称为Relative Distinguished Name, RDN, 通常有这个entry的属性派生), 逗号连接着它的父系的名称构成。例如, 下图中突出显示的 entry 的 DN :
图片

由序列 "uid=Danix", "ou=Users", "dc=kernel-panic" and "dc=it" 构成, 因此写作 "uid=Danix,ou=Users,dc=kernel-panic,dc=it" (请参阅 [RFC4514] 以了解详细的DN格式描述)。

一个 entry 由一组属性构成; 每条属性有一个名称 (或者类型) 以及一个或多个值。 这个entry的名称通常是一个助记字符串, 像 "dc" 代表 "Domain Component" 或者 "cn" 代表r "Common Name", 以及确定相应值的语法。ObjectClasses(目标类性) 定义了LDAP的entry的属性结构, 也就是说,一个特定 LDAP 的 entry 必须指定哪些属性是 must 、哪些属性是 may 。ObjectClasses 和属性都在Schemas里定义。
尽管 LDAP 是一个二进制协议, 但是可以将这些 entries 可以表示为人可以阅读的LDIF格式; 例如:

代码: 全选

dn: uid=danix,ou=Users,dc=kernel-panic,dc=it
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
objectClass: sambaSamAccount
cn: Daniele Mazzocchio
sn: Mazzocchio
givenName: Daniele
uid: Danix
uidNumber: 2000
gidNumber: 513
homeDirectory: /home/danix
loginShell: /bin/ksh
gecos: Daniele Mazzocchio
structuralObjectClass: inetOrgPerson
[ ... ]
LDAP查询可用URLs的形式来表示, 你可以通过此方式指定搜索和搜索查询范围并选择返回哪种属性。LDAP URL的查询语法是:

代码: 全选

ldap://[host[:port]]/[DN[?[attributes][?[scope][?[filter][?extensions]]]]]





这里大部分的URL子项是可选项:
  • host是要查询的LDAP服务器的域名或者IP地址;
  • port是LDAP服务器监听的网络端口 (默认是TCP 389端口);
  • DN是指 Distinguished Name(标识名),作为LDAP查询的基本目标 (默认是root DN);
  • attributes指定了从entries里返回哪些属性 (默认是全部属性);
  • scope是指搜索的范围。有效的范围是 "base" (默认) 代表搜索一个基本目标, "one" 代表对某一级的搜索, 而 "sub" 表示搜索子树;
  • filter代表在特定的搜索中应用到entries的搜索过滤 (默认为 "(objectClass=*)");
  • extensions表示对LDAP URL格式的扩展 (默认是没有扩展)。
例如, 下面的 URL:

代码: 全选

ldap://ldap.kernel-panic.it/uid=Danix,ou=Users,dc=kernel-panic,dc=it
是指某一特定用户entry的所有属性, 而一个类似这样的URL:

代码: 全选

ldap:///dc=kernel-panic,dc=it?sn?sub?(givenName=Daniele)
是指 givename 是 "Daniele" 的所有 sn (surname、姓) 属性。更多的细节请参阅 [RFC4516].

2.2 安装和配置
我们已经讲了不少理论了, 现在开始实战! OpenLDAP可以通过 OpenBSD's packages and ports system 获取(note: unfortunately, the bdb flavor, providing support for the bdb and hdb backends, is marked as broken since OpenBSD 4.3); 下面是需要安装的packages清单:
  • cyrus-sasl-x.x.x.tgz
  • openldap-client-x.x.x.tgz
  • openldap-server-x.x.x.tgz
安装完毕后! OpenLDAP的配置文件储存在 /etc/openldap。客户端的配置包含在文件 ldap.conf(5) 里; 以下是一个配置文件范例:
文件 /etc/openldap/ldap.conf

代码: 全选

# URI of the LDAP server to which the LDAP library should connect
URI             ldap://ldap.kernel-panic.it
# The default base DN to use when performing LDAP operations
BASE            dc=kernel-panic,dc=it
 
# Size limit to use when performing searches
SIZELIMIT       12
# Time limit to use when performing searches
TIMELIMIT       15
# Never derefernce aliases
DEREF           never
slapd.conf(5) 文件提供了独立运行的LDAP进程 slapd(8C) 的配置信息:
文件 /etc/openldap/slapd.conf

代码: 全选

# Include the necessary schema files. core.schema is required by default, the
# other ones are needed for sambaSamAccount. The samba.schema file can be found
# here and must be copied in /etc/openldap/schema/.
include         /etc/openldap/schema/core.schema
include         /etc/openldap/schema/cosine.schema
include         /etc/openldap/schema/inetorgperson.schema
include         /etc/openldap/schema/nis.schema
include         /etc/openldap/schema/samba.schema
 
# Absolute path to the PID file
pidfile         /var/run/openldap/slapd.pid
# Absolute path to the file that will hold slapd's command line options
argsfile        /var/run/openldap/slapd.args
 
# Type of database backend
database        ldbm
# DN suffix of queries that will be passed to this backend database
suffix          "dc=kernel-panic,dc=it"
# Database directory
directory       /var/openldap-data
 
# The Distinguished Name of the administrator of this database
rootdn          "cn=Manager,dc=kernel-panic,dc=it"
# Password (or password hash) for the rootdn. Clear-text passwords are allowed
# but strongly discouraged; the password hash can be generated using the
# slappasswd(8C) command; e.g.:
# # slappasswd
# New password: <password>
# Re-enter new password: <password>
# {SSHA}d1bjQZEA43NFKNL7g48XjaNv/W6DG0fY
rootpw          {SSHA}d1bjQZEA43NFKNL7g48XjaNv/W6DG0fY
 
# Maintain indices on the most useful attributes to speed up searches made on
# the sambaSamAccount, posixAccount and posixGroup objectClasses
index   objectClass             eq
index   cn                      pres,sub,eq
index   sn                      pres,sub,eq
index   uid                     pres,sub,eq
index   displayName             pres,sub,eq
index   uidNumber               eq
index   gidNumber               eq
index   memberUid               eq
index   sambaSID                eq
index   sambaPrimaryGroupSID    eq
index   sambaDomainName         eq
index   default                 sub
 
# Access control configuration. The rootdn can always read and write everything
access to attrs=userpassword,sambaLMPassword,sambaNTPassword
    by anonymous auth
    by self write
    by * none
 
access to *
    by self write
    by * read
我们可以用 slaptest(8C) 命令检查 slapd.conf(5) 文件的有效性:

代码: 全选

# install -d -o _openldap /var/run/openldap
# slaptest -u
config file testing succeeded
#
这个 slapd.conf(5) 文件包含了root密码, 应该限制其访问权限:

代码: 全选

# chgrp _openldap /etc/openldap/slapd.conf
# chmod 640 /etc/openldap/slapd.conf
好了, 应该可以运行 slapd(8C) 了。初次运行时你可能像加上 "-d" 选项来开启debug模式。这样可以让进程保持在前台运行以便观察所有的出错信息:

代码: 全选

# /usr/local/libexec/slapd -4 -d 256 -u _openldap -g _openldap
[ ... ]
slapd starting
你可以通过运行 ldapsearch(1) 命令确保一切正常:

代码: 全选

# ldapsearch -x -b '' -s base '(objectclass=*)' namingContexts
# extended LDIF
#
# LDAPv3
# base <> with scope baseObject
# filter: (objectclass=*)
# requesting: namingContexts
#
 
#
dn:
namingContexts: dc=kernel-panic,dc=it
 
# search result
search: 2
result: 0 Success
 
# numResponses: 2
# numEntries: 1
#
如果一切正常, 我们就可以将 slapd(8C) 配置为随系统启动, 只要将下行和参数加入 /etc/rc.conf.local(8):
文件 /etc/rc.conf.local

代码: 全选

slapd_flags="-4 -u _openldap -g _openldap"
然后将下列命令加入到 /etc/rc.local(8):
文件 /etc/rc.local

代码: 全选

if [ "$slapd_flags" != "NO" -a -x /usr/local/libexec/slapd ]; then
    echo -n ' slapd'
    install -d -o _openldap /var/run/openldap
    /usr/local/libexec/slapd $slapd_flags
fi

2.3 LDAP over TLS/SSL
OpenLDAP内置了对 TLS/SSL 协议的支持,通过public-key加密为LDAP连接提供了完整性和保密性。启用 TLS/SSL 可以防止在网络上以明文的方式传输数据, 这样可以避免用户密码被窃听。

2.3.1 设置 PKI
TLS要靠public key证书进行认证,所以你需要先建立一套基本的 Public Key 框架 (PKI) 以便管理数字证书。首先是准备工作, 我们将创建一些保存证书的目录:

代码: 全选

# install -m 700 -d /etc/openldap/ssl/private
建立PKI的第一步是先用 openssl(1) 创建一个 CA 认证 (/etc/openldap/ssl/ca.crt) 和 private key (/etc/ssl/private/ca.key) :

代码: 全选

# openssl req -days 3650 -nodes -new -x509 -keyout /etc/ssl/private/ca.key \
> -out /etc/openldap/ssl/ca.crt
[ ... ]
Country Name (2 letter code) []: IT
State or Province Name (full name) []: Italy
Locality Name (eg, city) []: Milan
Organization Name (eg, company) []: Kernel Panic Inc.
Organizational Unit Name (eg, section) []: LDAP CA
Common Name (eg, fully qualified host name) []: ca.lan.kernel-panic.it
Email Address []: <enter>
#
接下来是为服务器创建 private key (/etc/openldap/ssl/private/server.key) 和 Certificate Signing Request (认证签名请求,/etc/openldap/ssl/private/server.csr) :

代码: 全选

# openssl req -days 3650 -nodes -new -keyout /etc/openldap/ssl/private/server.key \
> -out /etc/openldap/ssl/private/server.csr
[ ... ]
Country Name (2 letter code) []: IT
State or Province Name (full name) []: Italy
Locality Name (eg, city) []: Milan
Organization Name (eg, company) []: KP Inc.
Organizational Unit Name (eg, section) []: LDAP Server
Common Name (eg, fully qualified host name) []: ldap.kernel-panic.it
Email Address []: <enter>
 
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: <enter>
An optional company name []: <enter>
#
最后, CA将由签名请求生成签名认证:

代码: 全选

# openssl x509 -req -days 3650 -in /etc/openldap/ssl/private/server.csr \
> -out /etc/openldap/ssl/server.crt -CA /etc/openldap/ssl/ca.crt \
> -CAkey /etc/ssl/private/ca.key -CAcreateserial
Signature ok
subject=/C=IT/ST=Italy/L=Milan/O=Kernel Panic Inc./OU=LDAP Server/CN=ldap.kernel-panic.it
Getting CA Private Key
#
你可以通过重新最后两步生成客户端认证:

代码: 全选

# openssl req -days 3650 -nodes -new -keyout /etc/openldap/ssl/private/client.key \
> -out /etc/openldap/ssl/private/client.csr
[ ... ]
Country Name (2 letter code) []: IT
State or Province Name (full name) []: Italy
Locality Name (eg, city) []: Milan
Organization Name (eg, company) []: KP Inc.
Organizational Unit Name (eg, section) []: LDAP Client
Common Name (eg, fully qualified host name) []: ldap.kernel-panic.it
Email Address []: <enter>
 
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: <enter>
An optional company name []: <enter>
# openssl x509 -req -days 3650 -in /etc/openldap/ssl/private/client.csr \
> -out /etc/openldap/ssl/client.crt -CA /etc/openldap/ssl/ca.crt \
> -CAkey /etc/ssl/private/ca.key
Signature ok
subject=/C=IT/ST=Italy/L=Milan/O=Kernel Panic Inc./OU=LDAP Client/CN=ldap.kernel-panic.it
Getting CA Private Key
#
扫尾工作, 我们要限制 private keys 的访问权:

代码: 全选

# chown -R _openldap:_openldap /etc/openldap/ssl/private
# chmod 600 /etc/openldap/ssl/private/*

2.3.2 OpenLDAP 配置
要配置TLS的 slapd(8C) 进程,你只需在 slapd.conf(5) 文件里的 rootpw 参数后面添加几行内容, 包含接受的CipherSuite以及认证的路径:
文件 /etc/openldap/slapd.conf

代码: 全选

# TLS configuration
TLSCipherSuite         HIGH:MEDIUM:+SSLv3
TLSCACertificateFile   /etc/openldap/ssl/ca.crt
TLSCertificateFile     /etc/openldap/ssl/server.crt
TLSCertificateKeyFile  /etc/openldap/ssl/private/server.key
关于客户端的文件 ldap.conf(5), 你必须将方案从 URI 修改为 "ldaps" ,而且还要指出CA证书的路径和接受的 cipher suites:
文件 /etc/openldap/ldap.conf

代码: 全选

[ ... ]
URI              ldaps://ldap.kernel-panic.it
 
# TLS configuration
TLS_CACERT       /etc/openldap/ssl/ca.crt
TLS_CIPHER_SUITE HIGH:MEDIUM:+SSLv3
最后一步是给 slapd(8C) 命令添加选项 "-h ldaps:///" 以确保进程只监听来自端口636上的TCP通讯,这些通讯是经过TLS加密的LDAP数据:
文件 /etc/rc.conf.local

代码: 全选

# Only listen for LDAP over TLS (port 636)
slapd_flags="-4 -u _openldap -g _openldap -h ldaps:///"
然后重新启动 slapd(8C)

头像
leo
帖子: 2465
注册时间: 2010-01-21 3:27

回复: OpenBSD as a Primary Domain Controller

帖子 leo » 2011-05-05 10:04

3. 一些有关Samba的讨论
Samba 是一组始于1992年的开源软件, 它为所有使用SMB/CIFS的客户端提供了安全、稳定和快捷的文件及打印服务,这些客户端可以是 DOS 或 Windows, OS/2, Linux 以及很多其它系统。Samba可以让OpenBSD服务器变成一个主域名控制器和文件服务器, 而且可以与基于Windows的客户端主机进行通讯。

3.1 安装和配置
我们可以通过预编译的packages安装大部分所需软件:
  • libiconv-x.x.x.tgz
  • popt-x.x.tgz
  • gettext-x.x.tgz
  • pcre-x.x.tgz
  • glib2-x.x.x.tgz
  • desktop-file-utils-x.x.tgz
  • xdg-utils-x.x.x.tgz
  • jpeg-x.tgz
  • png-x.x.x.tgz
  • tiff-x.x.x.tgz
  • gdbm-x.x.x.tgz
  • libdaemon-x.x.tgz
  • lzo-x.x.tgz
  • libgpg-error-x.x.tgz
  • libgcrypt-x.x.x.tgz
  • libtasn1-x.x.tgz
  • gnutls-x.x.x.tgz
  • dbus-x.x.x.tgz
  • avahi-x.x.x.tgz
  • cups-x.x.x.tgz
  • libutf8-x.x.tgz
不过,我们需要从port手动编译Samba, 因为 antivirus module 需要Samba的源代码才可以成功编译 (自然,如果你不需要支持病毒扫描也可以直接安装预编译的package, 也就是samba-x.x.x-cups-ldap.tgz)。

代码: 全选

# cd /usr/ports/net/samba
# env FLAVOR="cups ldap" make install
[ ... ]
多数的Samba配置任务通过 /etc/samba/smb.conf(5) 文件完成。 它是一个INI格式的文件, 由多个区块构成, 每个区块以一个共享资源的名称开始 (除了参数 "[global]" ) 并包含不定的参数, 形式为 "name = value"。每个参数都有一个默认值,如果该参数被省略,就意味着Samba会保留该参数的默认值。有三个特殊的区块:
[global]
[INDENT]定义全局参数以及其它区块的默认参数;
[/INDENT][homes]
[INDENT]运行为在服务器运行时为正在连接的用户创建home目录;
[/INDENT][printers]
[INDENT]允许用户连接所有在 /etc/printcap(5) 里列出的本地打印机。
[/INDENT]以分号 (";") 或哈希符 ("#") 起始的行被认为是注释内容; 反斜杠 ("\")代表参数可以应用在多行上。下面是一个简单的配置文件:
文件 /etc/samba/smb.conf

代码: 全选

################################################################################
# Parameters in the [global] section apply to the server as a whole, or are    #
# defaults for sections that do not specifically define certain items          #
################################################################################
[global]
# Domain name to use
    workgroup = KERNEL-PANIC
# String that will appear in browse lists next to the machine name
    server string = Samba Server
# Set the Samba server to user-level security (more details on security modes
# can be found here)
    security = user
# List of hosts permitted to access Samba services
    hosts allow = 172.16.0. 127.
# Negotiate encrypted passwords with the clients
    encrypt passwords = yes
 
# Use a separate log file for each machine that connects
    log file = /var/log/samba/smbd.%m
# Maximum size, in KB, of the log files
    max log size = 1024
 
# Select the backend(s) to retrieve and store passwords with. The LDAP URL is
# optional and defaults to 'ldap://localhost' (set the URI scheme to 'ldaps' if
# you're using LDAP over TLS/SSL)
    passdb backend = ldapsam:ldap://ldap.kernel-panic.it
# Avoid substituting %-macros in the passdb fields
    passdb expand explicit = no
# File containing the mapping of Samba users to local Unix users
    username map = /etc/samba/smbusers
 
# This socket option should give better performance
    socket options = TCP_NODELAY
 
# Allow nmbd(8) to try to become the local master browser
    local master = yes
# Tell Samba to be the Domain Master Browser for its workgroup
    domain master = yes
# A domain controller must have the 'os level' set at or above a value of 32
    os level = 33
# Make nmbd(8) force a local browser election on startup, also giving it a
# slightly higher chance of winning the election
    preferred master = yes
# A domain controller must provide the network logon service
    domain logons = yes
# Uncomment the following parameter to disable roaming profiles
#    logon path =
# Name of an (optional) logon script (you can make it user-specific with '%U').
# The script must be in DOS format
    logon script = netlogon.bat
 
# Make nmbd(8) act as a WINS server
    wins support = yes
# Try to resolve NetBIOS names via DNS lookups
    dns proxy = yes
 
# LDAP options
    ldap suffix = dc=kernel-panic,dc=it
    ldap machine suffix = ou=Computers
    ldap user suffix = ou=Users
    ldap group suffix = ou=Groups
    ldap idmap suffix = ou=Idmap
    ldap admin dn = cn=Manager,dc=kernel-panic,dc=it
    ldap ssl = no
    ldap passwd sync = Yes
 
# Range of user and group ids allocated for mapping UNIX users to NT user SIDs
    idmap uid = 2000-4000
    idmap gid = 2000-4000
 
# Scripts to run when managing users with remote RPC (NT) tools
    add user script = /usr/local/sbin/smbldap-useradd -a -g 512 -m %u
    add group script = /usr/local/sbin/smbldap-groupadd %g
    add machine script = /usr/local/sbin/smbldap-useradd -w -g 515 %u
    delete user script = /usr/local/sbin/smbldap-userdel -r %u
    delete user from group script = /usr/local/sbin/smbldap-groupmod -x %u %g
    delete group script = /usr/local/sbin/smbldap-groupdel -r %g
 
 
################################################################################
# Users' home directories. If no path is specified, the path is set to the     #
# (Unix) user's home directory (tipically '/home/<username>')                  #
################################################################################
[homes]
    comment = Home Directories
    browseable = no
    writable = yes
 
 
################################################################################
# The netlogon service allows you to specify the path to the logon scripts     #
################################################################################
[netlogon]
    comment = Share for logon scripts
    path = /var/netlogon
    read only = yes
    write list = @"Domain Admins"
    browseable = no
 
 
################################################################################
# Shares definitions. The name of a section corresponds to the name of the     #
# shared resource. The following are just some examples, feel free to modify   #
# them according to your needs.                                                #
################################################################################
 
# A temporary directory for people to share files
[tmp]
    comment = Temporary file space
    path = /tmp
    read only = no
    public = yes
 
# A publicly accessible directory, but read only, except for people in the
# "staff" group
[public]
    comment = Public Stuff
    path = /home/samba
    public = yes
    writable = yes
    write list = @staff
 
# Define a share accessible only to a selected group of users. This directory
# should be writable by both users and should have the sticky bit set on it to
# prevent abuse
[myshare]
    comment = Mary's and Fred's stuff
    path = /usr/somewhere/shared
    valid users = mary fred
    public = no
    writable = yes
    create mask = 0660
    directory mask = 1770
 
# A service pointing to a different directory for each user that connects.
# %U gets replaced with the user name (in lower case) that is connecting
[private]
    comment = User data
    path = /var/data/%U
    valid users = %U
    public = no
    writable = yes
现在我们需要创建一个将Samba用户映射为本地Unix用户的文件, 为 /etc/samba/smbusers。特别是, 我们需要将域管理员映射为 root, 这样可以赋予他管理这个域的权限。
文件 /etc/samba/smbusers

代码: 全选

root = administrator
我们可以通过 testparm(1) 命令来测试配置:

代码: 全选

# testparm
Load smb config files from /etc/samba/smb.conf
Processing section "[homes]"
Processing section "[tmp]"
Processing section "[public]"
Processing section "[myshare]"
Processing section "[private]"
Loaded services file OK.
Server role: ROLE_DOMAIN_PDC
Press enter to see a dump of your service definitions
[...]
最后的步骤是告诉Samba使用的密码要绑定到 LDAP 服务器上 (也就是 slapd.conf(5) 里没有经过加密的 rootpw 参数的具体值)。Samba会将这个密码保存在 /etc/samba/secrets.tdb 里:

代码: 全选

# smbpasswd -w <password>
Setting stored password for "cn=Manager,dc=kernel-panic,dc=it" in secrets.tdb
现在我们通过在 /etc/rc.conf.local(8) 文件里添加一些变量来让Samba随系统启动:
文件 /etc/rc.conf.local

代码: 全选

smbd_flags="-D"
nmbd_flags="-D"
以及在 /etc/rc.local(8) 里添加一些相应的命令:
文件 /etc/rc.local

代码: 全选

if [ "$smbd_flags" != "NO" -a -x /usr/local/libexec/smbd ]; then
    echo -n ' smbd'
    /usr/local/libexec/smbd $smbd_flags
fi
 
if [ "$nmbd_flags" != "NO" -a -x /usr/local/libexec/nmbd ]; then
    echo -n ' nmbd'
    /usr/local/libexec/nmbd $nmbd_flags
fi
最后, 尽管在LDAP数据库进驻系统前它没有用处, 我们仍可以启动Samba。

代码: 全选

# mkdir /var/log/samba
# /usr/local/libexec/smbd -D
# /usr/local/libexec/nmbd -D

头像
leo
帖子: 2465
注册时间: 2010-01-21 3:27

回复: OpenBSD as a Primary Domain Controller

帖子 leo » 2011-05-05 10:15

4. The IDX-smbldap-tools
Smbldap-tools 是保存在LDAP目录下用于管理用户、组帐号的一组perl脚本。这些脚本可以轻松完成日常用户管理的大部分任务, 我们可以向管理常规系统用户那样,轻松地进行的LDAP内部、Samba的用户管理。
请注意, 尽管Samba帐号信息会保存在LDAP里, smbd(8) 仍旧会通过调用标准的C库(例如 getpwnam() ,参阅 文档)来获取Unix帐号信息, 这些C库并不提供对LDAP的原生支持。这意味着我们需要配置 ypldap(8) 进程, 让它充当一个 LDAP 和 OpenBSD的认证之间的接口。

4.1 配置

smbldap-tools需要安装很多perl模块:
  • p5-Jcode-x.x.tgz
  • p5-Unicode-String-x.x.tgz
  • p5-Unicode-Map8-x.x.tgz
  • p5-Unicode-Map-x.x.tgz
  • p5-Unicode-MapUTF8-x.x.tgz
  • p5-Convert-ASN1-x.x.tgz
  • p5-Digest-SHA1-x.x.tgz
  • p5-Digest-HMAC-x.x.tgz
  • p5-GSSAPI-x.x.tgz
  • p5-Authen-SASL-x.x.tgz
  • p5-Net-SSLeay-x.x.tgz
  • p5-IO-Socket-SSL-x.x.tgz
  • p5-XML-Parser-x.x.tgz
  • p5-XML-SAX-Writer-x.x.tgz
  • p5-XML-SAX-x.x.tgz
  • p5-XML-NamespaceSupport-x.x
  • p5-Text-Iconv-x.x
  • p5-XML-Filter-BufferText-x.x
  • p5-URI-x.x.tgz
  • p5-ldap-x.x.tgz
  • p5-Crypt-SmbHash-x.x.tgz
  • smbldap-tools-x.x.x.tgz
文件 /etc/smbldap-tools/smbldap_bind.conf 包含了连接LDAP服务器的所需参数; 它们应该匹配 /etc/openldap/slapd.conf 文件里的参数。请确认此文件的权限 (600) 以保护非认证访问无法获取密码。
文件 /etc/smbldap-tools/smbldap_bind.conf

代码: 全选

slaveDN="cn=Manager,dc=kernel-panic,dc=it"
slavePw="password"
masterDN="cn=Manager,dc=kernel-panic,dc=it"
masterPw="password"
在编译下一个配置文件前, 我们需要为进程取回 SID :

代码: 全选

# net getlocalsid
SID for domain SAMBA is: S-1-5-21-2855447605-3248580512-2157288933
你可以在 /etc/smbldap-tools/smbldap.conf 文件里设置任何人都可以读取的全局参数。
文件 /etc/smbldap-tools/smbldap.conf

代码: 全选

# SID and domain name
SID="S-1-5-21-2855447605-3248580512-2157288933"
sambaDomain="KERNEL-PANIC"
 
# LDAP servers and ports (if you're using LDAP over TLS/SSL, set the URI schemes
# to 'ldaps' and the ports to '636')
slaveLDAP="ldap://ldap.kernel-panic.it"
slavePort="389"
masterLDAP="ldap://ldap.kernel-panic.it"
masterPort="389"
 
# TLS configuration (set ldapTLS to '1' to enable TLS)
ldapTLS="0"
verify="none"
cafile="/etc/openldap/ssl/ca.crt"
clientcert="/etc/openldap/ssl/client.crt"
clientkey="/etc/openldap/ssl/private/client.key"
 
# LDAP configuration
suffix="dc=kernel-panic,dc=it"
usersdn="ou=Users,${suffix}"
computersdn="ou=Computers,${suffix}"
groupsdn="ou=Groups,${suffix}"
idmapdn="ou=Idmap,${suffix}"
sambaUnixIdPooldn="sambaDomainName=KERNEL-PANIC,${suffix}"
scope="sub"
hash_encrypt="SSHA"
crypt_salt_format="%s"
 
# Unix accounts configuration
userLoginShell="/bin/ksh"
userHome="/home/%U"
userHomeDirectoryMode="700"
userGecos="System User"
defaultUserGid="513"
defaultComputerGid="515"
skeletonDir="/etc/skel"
defaultMaxPasswordAge="45"
 
# Samba configuration
userSmbHome=""
userProfile=""
userHomeDrive="H:"
userScript="logon.bat"
mailDomain="kernel-panic.it"
 
# smbldap-tools configuration
with_smbpasswd="0"
smbpasswd="/usr/local/bin/smbpasswd"
with_slappasswd="0"
slappasswd="/usr/local/sbin/slappasswd"

4.2 安装 LDAP 数据库
现在我么你可以通过在数据库内插入一些基本的entries来构建LDAP树的框架; smbldap-populate 脚本将替我们完成所有的任务:

代码: 全选

# /usr/local/sbin/smbldap-populate
Populating LDAP directory for domain KERNEL-PANIC (S-1-5-21-2855447605-3248580512-2157288933)
(using builtin directory structure)
 
adding new entry: dc=kernel-panic,dc=it
adding new entry: ou=Users,dc=kernel-panic,dc=it
adding new entry: ou=Groups,dc=kernel-panic,dc=it
adding new entry: ou=Computers,dc=kernel-panic,dc=it
adding new entry: ou=Idmap,dc=kernel-panic,dc=it
adding new entry: uid=root,ou=Users,dc=kernel-panic,dc=it
adding new entry: uid=nobody,ou=Users,dc=kernel-panic,dc=it
adding new entry: cn=Domain Admins,ou=Groups,dc=kernel-panic,dc=it
adding new entry: cn=Domain Users,ou=Groups,dc=kernel-panic,dc=it
adding new entry: cn=Domain Guests,ou=Groups,dc=kernel-panic,dc=it
adding new entry: cn=Domain Computers,ou=Groups,dc=kernel-panic,dc=it
adding new entry: cn=Administrators,ou=Groups,dc=kernel-panic,dc=it
adding new entry: cn=Account Operators,ou=Groups,dc=kernel-panic,dc=it
adding new entry: cn=Print Operators,ou=Groups,dc=kernel-panic,dc=it
adding new entry: cn=Backup Operators,ou=Groups,dc=kernel-panic,dc=it
adding new entry: cn=Replicators,ou=Groups,dc=kernel-panic,dc=it
adding new entry: sambaDomainName=KERNEL-PANIC,dc=kernel-panic,dc=it
 
Please provide a password for the domain root:
Changing UNIX and samba passwords for root
New password: <admin_passwd>
Retype new password: <admin_passwd>
#
上述命令的最后的步骤并非真的修改了Unix的root帐号密码: 它只是为LDAP的域管理员设置了密码。你可以通过 ldapsearch(1) 命令来测试一下这个包含了基本Entries的数据库; 你可以运行如下的命令来获取一份LDAP数据库内的用户定义的 LDIF dump :

代码: 全选

# ldapsearch -x -LL -b 'ou=Users,dc=kernel-panic,dc=it' -s sub
version: 1
 
dn: ou=Users,dc=kernel-panic,dc=it
objectClass: top
objectClass: organizationalUnit
ou: Users
 
[ ... ]
除了 smbldap-populate 创建的默认组,你可能还想定义额外的组, 例如:

代码: 全选

# smbldap-groupadd -g 1500 Accounting
[ ... ]
现在我们需要为每台计算机创建一个用于连接Samba的特定用户 (每个用户名结尾处的符号 "$" 是强制性的):

代码: 全选

# smbldap-useradd -w -u 3000 computer1$
# smbldap-useradd -w -u 3001 computer2$
[ ... ]
最后, 我们可以创建实际的Samba用户; 每个用户将有自己的home目录,这个目录将在登录时自动连接为驱动器 H: :

代码: 全选

# smbldap-useradd -a -u 2000 -g 512 -G 513 -N Daniele -S Mazzocchio \
> -c "Daniele Mazzocchio" danix
# smbpasswd -a danix
New SMB password: password
Retype new SMB password: password
#
现在我们可以 (重新)启动 Samba 程序:

代码: 全选

# pkill .mbd
# /usr/local/libexec/smbd -D
# /usr/local/libexec/nmbd -D
别忘了为Samba共享分配适当的权限和属性。

4.3 配置 ypldap(8)
YP(8) 是一个 Sun Microsystems 开发的原生目录服务, 它的历史比LDAP长, 它允许通过网络管理 password, group 和 hosts 文件entries。从4.5开始, OpenBSD 提供了一个额外的 YP 进程, ypldap(8), 它在后台使用LDAP替代传统的 db(3) 数据库。
因为 YP 是唯一的可以通过标准C库函数进行访问的目录服务(这些函数包括 getpwent(3), getgrent(3), gethostbyname(3) 等等,参阅 [FAQ10]), 它可以作为一个 smbd(8) 使用的系统认证程序和 LDAP 目录之间的接口。
作为配置 YP 子系统的第一个步骤, 我们将设置主机的 YP 进程, 该进程是一个可以识别主机的任意字符串,这些主机通过YP (与Samba或者DNS无关) 共享或部分共享它们的系统配置数据;一台主机的YP进程用 domainname(1) 来设置,可以通过将其植入文件 /etc/defaultdomain(5) 的方法使其随系统启动:

代码: 全选

# domainname kernel-panic.it
# echo "kernel-panic.it" > /etc/defaultdomain
在初始化 YP 服务器之前, 你可能向编辑一下 /var/yp/Makefile.yp ,这样就可以只创建所需的 YP 映射, 方式是修改这里的目标 "all" :
文件 /var/yp/Makefile.yp

代码: 全选

all: passwd group netid

现在我们已经要通过 ypinit(8) 命令将 YP 服务器初始化为一个 master:

代码: 全选

# ypinit -m
Server Type: MASTER Domain: kernel-panic.it
 
Creating an YP server will require that you answer a few questions.
Questions will all be asked at the beginning of the procedure.
 
Do you want this procedure to quit on non-fatal errors? [y/n: n] <Enter>
 
Ok, please remember to go back and redo manually whatever fails.
If you don't, something might not work.
 
At this point, we have to construct a list of this domain's YP servers.
smb.kernel-panic.it is already known as master server.
Please continue to add any slave servers, one per line. When you are
done with the list, type a <control D>.
        master server   :  smb.kernel-panic.it
        next host to add:  ^D
The current list of NIS servers looks like this:
 
smb.kernel-panic.it
 
Is this correct?  [y/n: y] <Enter>
Building /var/yp/kernel-panic.it/ypservers...
smb.kernel-panic.it has been setup as an YP master server.
Edit /var/yp/kernel-panic.it/Makefile to suit your needs.
After that, run 'make' in /var/yp.
#
ypldap(8) 的默认配置文件是 /etc/ypldap.conf(5), 这个文件包含三个部分(区块): macros, 全局设置和一个或者多个目录的声明。下面是一个配置文件:
文件 /etc/ypldap.conf

代码: 全选

# Macros
# Optional macros go here...
 
# Global settings
domain       "kernel-panic.it"
interval     3600
# Specify the maps that ypldap should provide
provide map  "passwd.byname"
provide map  "passwd.byuid"
provide map  "group.byname"
provide map  "group.bygid"
 
# Directory declaration
directory "ldap.kernel-panic.it" {
    binddn    "cn=Manager,dc=kernel-panic,dc=it"
    bindcred  "password"
    basedn    "ou=Users,dc=kernel-panic,dc=it"
 
    # passwd maps configuration
    passwd filter "(objectClass=posixAccount)"
 
    attribute name maps to "uid"
    fixed attribute passwd "*"
    attribute uid maps to "uidNumber"
    attribute gid maps to "gidNumber"
    attribute gecos maps to "gecos"
    attribute home maps to "homeDirectory"
    # LDAP users are not interactive system users
    fixed attribute shell "/sbin/nologin"
    fixed attribute change "0"
    fixed attribute expire "0"
    fixed attribute class "default"
 
    # group maps configuration
    group filter "(objectClass=posixGroup)"
 
    attribute groupname maps to "cn"
    fixed attribute grouppasswd "*"
    attribute groupgid maps to "gidNumber"
    list groupmembers maps to "memberUid"
}
因为其包含了敏感信息, 文件 ypldap.conf(5) 的权限应限制为600; 这里 ypldap(8) 的 “-n” 标签允许你检查配置文件爱你的有效性:

代码: 全选

# chmod 600 /etc/ypldap.conf
# ypldap -n
configuration OK
要真正让系统包含YP进程的用户和组帐号, 我们需要在 passwd(5)group(5) 文件里添加默认的 YP markers :

代码: 全选

# echo "+:*::::::::" >> /etc/master.passwd
# pwd_mkdb -p /etc/master.passwd
# echo "+:*::" >> /etc/group

现在我们已经准备好了所有的进程! YP 使用 RPC(3) 来联系客户端, 所以需要为它启用 portmap(8) 进程。 同时 ypbind(8) 进程还为服务器提供自己的映射。

代码: 全选

# portmap
# ypldap
# ypbindEnabling yp client subsystem.
To disable: kill ypbind and remove /var/yp/binding
#

你可以通过 getent(1) 命令测试系统系统是否从YP目录上正确获取了用户信息:

代码: 全选

# getent passwd
[ ... ]
danix:*:2000:512:Daniele Mazzocchio:/home/danix:/sbin/nologin
#
要让其随系统启动, 在 /etc/rc.conf.local(8) 文件里加上如下的内容:
文件 /etc/rc.conf.local

代码: 全选

portmap=YES
ypldap_flags=""
/etc/rc(8) 里注释掉下列内容(这会启动 ypserv(8) 来代替 ypldap(8)):
文件 /etc/rc

代码: 全选

#        if [ -d /var/yp/`domainname` ]; then
#                # YP server capabilities needed...
#                echo -n ' ypserv';              ypserv ${ypserv_flags}
#                #echo -n ' ypxfrd';             ypxfrd
#        fi
 
#        if [ -d /var/yp/binding ]; then
#                # YP client capabilities needed...
#                echo -n ' ypbind';              ypbind
#        fi
然后添加将下列命令添加到 /etc/rc.local(8), 紧跟在 slapd(8C) 后面添加:
/etc/rc.local

代码: 全选

if [ -d /var/yp/$(domainname) ]; then
    echo -n ' ypldap'
    ypldap ${ypldap_flags}
    # Wait 5 seconds to fully initialize ypldap before starting ypbind
    sleep 5
fi
 
if [ -d /var/yp/binding ]; then
    echo -n ' ypbind'
    ypbind
fi
好了, 到此为止我们就有了一个全功能的主域控制器了: 下面我们开始为新的主域控制器 添加计算机 并作所需的测试! 下面我们将讨论一些可能对你十分有用的额外特性: 防病毒支持打印机共享

头像
leo
帖子: 2465
注册时间: 2010-01-21 3:27

回复: OpenBSD as a Primary Domain Controller

帖子 leo » 2011-05-05 10:18

5. 用Samba-vscan防范病毒
我们现在已近有了一个全功能的file server和主域控制器。不过, 不过你可能会为其添加一些额外的功能,例如支持实时病毒检测和隔离。
Samba-vscan 是一个Samba的proof-of-concept模块, 它使用 Samba 2.2.x/3.0 的 VFS (虚拟文件系统) 特性才实现 Samba 的实时反病毒功能。 Samba-vscan 目前支持集中防病毒软件, 包括 ClamAV, 我们将其作为后端的反病毒引擎。
我们已经在 前面 讨论过 ClamAV 的安装和配置 , 所以这里就不多费唇舌了,我们这里假设你已经在文件服务器本身或另一台机器上运行了 clamd 进程。


编译 Samba-vscan 前线需要安装下列packages:
  • autoconf-2.61p3.tgz
  • libmagic-x.x.tgz
  • gmake-x.x.tgz
  • bzip2-x.x.x.tgz
首先, 我们需要 "make proto" Samba 端口; 因此, 进入目录 /usr/ports/obj/samba/w-samba-x.x.x-cups-ldap/samba-x.x.x/source/ 并编辑文件 autogen.sh , 将initial注释后的最前面的内容替换为:
文件 /usr/ports/obj/samba/w-samba-x.x.x-cups-ldap/samba-x.x.x/source/autogen.sh

代码: 全选

TESTAUTOHEADER="autoheader-2.61"
TESTAUTOCONF="autoconf-2.61"

然后, 在这个目录里运行:

代码: 全选

# ./autogen.sh
[ ... ]
# ./configure
[ ... ]
# make proto
[ ... ]

现在就可以 下载, 提取和编译 Samba-vscan 了:

代码: 全选

# tar -zxvf samba-vscan-x.x.x.tar.gz
[ ... ]
# cd samba-vscan-x.x.x/
# env LDFLAGS=-L/usr/local/lib/ CPPFLAGS=-I/usr/local/include/ ./configure \
>   --with-samba-source=/usr/ports/obj/samba/w-samba-x.x.x-cups-ldap/samba-x.x.x/source/
[ ... ]
# gmake clamav
[ ... ]
# cp vscan-clamav.so /usr/local/lib/samba/vfs/
# cp clamav/vscan-clamav.conf /etc/samba/
Samba-vscan (带有 ClamAV 支持) 的配置文件是 /etc/samba/vscan-clamav.conf:
文件 /etc/samba/vscan-clamav.conf

代码: 全选

[samba-vscan]
max file size = 10485760
verbose file logging = no
 
scan on open = yes
scan on close = yes
 
deny access on error = no
deny access on minor error = no
 
send warning message = yes
infected file action = nothing
quarantine directory  = /var/clamav/quarantine/
quarantine prefix = vir-
 
max lru files entries = 100
lru file entry lifetime = 5
exclude file types =
scan archives = yes
 
clamd socket name = /var/clamav/clamd.sock
libclamav max files in archive = 1000
libclamav max archived file size = 10485760
libclamav max recursion level = 5
最后的步骤是更新Samba配置以包含反病毒支持,方法是将下列几行加入到你想进行病毒防护的每个共享区块里, 或者如果你想保护所有的共享内容,可以将加到 [global] 区块里。
文件 /etc/samba/smb.conf

代码: 全选

vfs object = vscan-clamav 
vscan-clamav: config-file = /etc/samba/vscan-clamav.conf
and reload Samba configuration:

代码: 全选

# pkill -HUP smbd

头像
leo
帖子: 2465
注册时间: 2010-01-21 3:27

回复: OpenBSD as a Primary Domain Controller

帖子 leo » 2011-05-05 10:24

6. 用CUPS实现打印机共享
通用Unix打印系统 (CUPS) 是一个打印软件,它为基于Unix的系统提供了轻巧的打印层。它可以让系统变成一台打印服务器并向Samba提供共享的打印机; 尽管不是很难,但是请认真按照这些步骤通过 cupsaddsmb(8) 命令将打印机输出给Samba。
你应该已经安装了 CUPS ,因为它是Samba的依赖包。我们这里不涉及有关 CUPS 的配置问题, 请自行参阅 这里 。下面的配置仅适用于我自己的打印机 (一台 Dell 1600n Laser printer), 请读者根据自己的情况进行配置。
打印机的定义在配置文件 /etc/cups/printers.conf(5) 里:
文件 /etc/cups/printers.conf

代码: 全选

<DefaultPrinter dp1600n>
    Info         Dell Laser Printer 1600n
    Location     Room 123
    DeviceURI    ipp://prn1.lan.kernel-panic.it/
    State        Idle
    StateMessage Printer is idle
    Accepting    Yes
</Printer>


6.1 获取驱动文件


现在我们必须获取正确的驱动文件。 首先, 我们需要从Adobe站点的Windows的通用PostScript打印机驱动程序。你可以从 这里 下载: 请选择自己的语言并将驱动安装在一台 Windows 主机上。安装完成后, 你应该在 C:\WINDOWS\system32\spool\drivers\w32x86\3 目录内发现如下的文件:
  • PS5UI.DLL
  • PSCRIPT.HLP
  • PSCRIPT.NTF
  • PSCRIPT5.DLL
现在在file server上创建目录 /usr/local/share/cups/drivers:

代码: 全选

# mkdir /usr/local/share/cups/drivers/
并将上述文件拷贝进去 (警告: 在 file server 上, 驱动文件的名字必须是小写的!)。
接下来, 我们需要 下载 Windows CUPS 驱动,然后提取并拷贝到驱动目录:

代码: 全选

# tar -zxvf cups-windows-6.0-source.tar.gz
[ ... ]
# cd cups-windows-6.0/i386
# cp cups6.ini cupsui6.dll cupsps6.dll /usr/local/share/cups/drivers/
最后你需要获取的是对应和你打印机的 PPD 文件。幸运的是, 如果你无法在你的打印机随机光盘上找到这个文件, Easy Software Products 提供了大量的常用打印机的 PPD 文件。 下载 Linux 文件 (portable格式), 提取它, 将对应你自己的打印机的 PPD 文件拷贝到 /etc/cups/ppd/; 例如:

代码: 全选

# tar -zxvf printpro-4.5.12-linux-intel.tar.gz
[ ... ]
# tar -zxvf printpro-dell.ss
[ ... ]
# gunzip -o /etc/cups/ppd/dp1600n.ppd usr/share/cups/model/en/dp1600n.ppd.gz
请注意,确保 PPD 文件的名字 ("dp1600n") 与 /etc/cups/printers.conf(5) (加上 ".ppd" 扩展名) 里定义的打印机名完全一致。如果这两者不同, 你会在后面运行 cupsaddsmb(8) 命令时出现问题。

6.2 输出打印机到Samba
现在哦我们可以通过在 [global] 区块里添加一些选项以及定义一些额外的区块来执行Samba配置更新:
文件 /etc/samba/smb.conf

代码: 全选

[global]
    [ ... ]
 
    load printers = yes
    printing = cups
    printcap name = cups
    show add printer wizard = Yes
    use client driver = No
 
[dp1600n]
    comment = Dell Laser MFP 1600n
# Users must have write access to the spool directory
    valid users = root @DomainUsers
    path = /var/spool/samba/printing
    printer = dp1600n
    public = no
    writable = no
    printable = yes
 
[print$]
    comment = Printer Drivers
    path = /etc/samba/drivers
    browseable = no
    guest ok = no
    read only = yes
    write list = root
打印机的认证用户必须对这里的目录 spool 具有写权限以及具有 sticky-bit set; 例如:

代码: 全选

# chgrp 513 /var/spool/samba/printing
# chmod 1770 /var/spool/samba/printing
现在哦我们可以启动 cupsd(8) 进程并重新导入Samba配置:

代码: 全选

# /usr/local/sbin/cupsd
# pkill -HUP smbd
好l, 我们最后可以运行 cupsaddsmb(8) 命令了, 这个命令才是真正将打印机输出给 samba:

代码: 全选

# mkdir /etc/samba/drivers
# cupsaddsmb -H localhost -U root -v -a
[ ... ]
Printer Driver dp1600n successfully installed.
[ ... ]
Succesfully set dp1600n to driver dp1600n.
 
#
如果一切正常, 现在你应该在新的 /etc/samba/drivers/W32X86/3 目录内找到 PostScript 驱动程序和 PPD 文件:

代码: 全选

# ls -l /etc/samba/drivers/W32X86/3/
total 2884
-rwxr--r--  1 root  wheel   25729 Feb 28 01:55 dp1600n.ppd
-rwxr--r--  1 root  wheel  129024 Feb 28 01:49 ps5ui.dll
-rwxr--r--  1 root  wheel   26038 Feb 28 01:55 pscript.hlp
-rwxr--r--  1 root  wheel  792644 Feb 28 01:55 pscript.ntf
-rwxr--r--  1 root  wheel  455168 Feb 28 01:49 pscript5.dll
#
最后的步骤是让 cupsd(8) 随系统启动, 你只需将下列行加入 /etc/rc.local 文件, b要在启动Samba前:
文件 /etc/rc.local

代码: 全选

if [ -x /usr/local/sbin/cupsd ]; then
    echo -n ' cupsd'
    /usr/local/sbin/cupsd
fi

头像
leo
帖子: 2465
注册时间: 2010-01-21 3:27

回复: OpenBSD as a Primary Domain Controller

帖子 leo » 2011-05-05 10:25

7. Appendix

Special thanks to Michael Cooter for motivating me to write this document and for his useful suggestions and comments.
7.1 References
7.2 Bibliography

回复

在线用户

正浏览此版面之用户: 没有注册用户 和 24 访客