第 6 章 setpin (为实体生成唯一 PIN)
6.1. setpin 命令
6.1.1. 编辑 setpin.conf 配置文件
setpin.conf
来存储其一些所需选项。在运行 setpin 前,修改此文件以反映目录信息,并通过执行以下操作将 setpin 工具设置为使用该文件:
- 打开
setpin.conf
文件。cd /usr/lib/pki/native-tools vi setpin.conf
- 编辑文件中的目录参数,以匹配目录安装信息。
#------- Enter the hostname of the LDAP server host=localhost #------- Enter the port number of the LDAP server port=389 #------- Enter the DN of the Directory Manager user binddn=CN=Directory Manager #------- Enter the password for the Directory manager user bindpw= # Enter the DN and password for the new pin manager user pinmanager=cn=pinmanager,dc=example,dc=com pinmanagerpwd= # Enter the base over which this user has the power # to remove pins basedn=ou=people,dc=example,dc=com ## This line switches setpin into setup mode. ## Please do not change it. setup=yes
- 运行 setpin,并将选项文件设置为
setpin.conf
。setpin optfile=/usr/lib/pki/native-tools/setpin.conf
6.1.2. 语法
setpin
host=host_name
[
port=port_number
]
binddn=user_id
[
bindpw=bind_password
]
filter="LDAP_search_filter"
[
basedn=LDAP_base_DN
] [[
length=PIN_length
] | [
minlength=minimum_PIN_length
] | [
maxlength=maximum_PIN_length
]] [
gen=character_type
] [
case=upperonly
] [
hash=algorithm
] [
saltattribute=LDAP_attribute_to_use_for_salt_creation
] [
input=file_name
] [
output=file_name
] [
write
] [
clobber
] [
testpingen=数量
] [
debug
] [
optfile=file_name
] [
setup
[
pinmanager=pinmanager_user
]
[
pinmanagerpwd=pinmanager_password
]
]
选项 | 描述 |
---|---|
host | 必需。指定要连接的 LDAP 目录。根据如何配置 DNS 和网络,这可以是机器名称、完全限定域名或 IPv4 或 IPv6 地址。 |
端口 | 指定要绑定到的 LDAP 目录端口。默认端口号是默认的 LDAP 端口 389。 |
binddn | 必需。指定 PIN Generator 绑定到 LDAP 目录的用户。此用户帐户必须具有目录的读/写权限。 |
bindpw | 提供 binddn 选项中设置的用户 ID 的密码。如果命令行中未提供绑定密码,工具会提示它。 |
filter | 必需。在应该生成 PIN 的目录中为这些 DN 设置搜索过滤器。 |
basedn | 指定要搜索 DN 的基本 DN。如果没有指定此参数,则过滤器会从 root 搜索。 |
length | 指定 PIN 必须包含的确切数字;默认值为 6。不要与 minlength 或 maxlength 一起使用。 |
MinLength | 设置生成的 PIN 的最小长度。如果与 maxlength 一起使用,这会设置 PIN 长度范围的较低结尾。不要以 长度 使用。 |
maxlength | 设置生成的 PIN 的最大长度。如果与 minlength 一起使用,这会设置 PIN 长度范围的上限。不要以 长度 使用。 |
gen | 指定 PIN 的字符类型。密码中的字符可以从字母字符(RNG-alpha)、字母数字字符(RNG-alphanum)或任何可打印 ASCII 字符(Printableascii)组成。 |
问题单 | 将字符的大小限制为仅限大写;否则情况是混合的。将字母字符限制为大写可显著减少密码空间的整体组合。使用 gen 的用例。 |
hash |
指定消息摘要算法,在将 PIN 保存到身份验证目录前对其进行哈希。
注意
这应该设置为 none (不哈希 PIN),因为目录服务器可能会对传入的散列密码有限制。
默认值为 sha1,它会生成一个 160 位消息摘要。md5 生成 128 位消息摘要。none 不会哈希 PIN。
|
saltattribute | 指定用于创建 salt 的 LDAP 属性。这必须设置为 dn 。如果设置了属性,该工具会将属性值与每个 PIN 集成,并将生成的字符串与哈希例程哈希处理。详情请查看 第 6.2.3 节 “PIN 如何保存在目录中”。
如果
hash 值设置为 none,则忽略此属性,这是推荐的设置。
|
输入 | 指定包含要处理的 DN 列表的文件。如果使用此选项,该工具会将过滤的 DN 与输入文件中的 DN 进行比较,并仅为这些 DN 生成 PIN。 |
output | 指定在 setpin 时写入 PIN 的文件的绝对路径。如果没有设置文件,则会将输出写入标准输出。无论是否设置了输出文件,所有错误消息都会定向到标准错误。 |
write | 设置工具是否应该将 PIN 写入目录。如果指定,则 PIN 会在生成时写入目录中。否则,该工具不会对该目录进行任何更改。如果要检查 PIN,则不要将 PIN 写入目录。可以在输出文件中查看 PIN,以确保它们被分配给正确的用户,并使其符合长度和字符限制。如需更多信息,请参阅 第 6.2.2 节 “输出文件”。 |
clobber | 覆盖预先存在的 PIN (若有)与 DN 关联的。如果没有使用这个选项,则任何现有 PIN 都会保留在目录中。 |
testpingen | 测试 PIN-generation 模式。count 设置为测试生成的 PIN 总数。 |
debug | 将调试信息写入标准错误。如果指定了 debug=attrs,该工具会写入目录中每个条目的更多详细信息。 |
optfile | 将工具设置为从文件中读取选项(每行一个)。这允许将所有参数放在文件中,而不是在命令行中输入参数。一个配置文件 setpin.conf 位于 /usr/lib/pki/native-tools 目录中。 |
setup | 切换到 setup 模式,它允许工具添加到目录 schema。 |
pinmanager | 指定 PIN 管理器用户,该用户有权为基于指定删除 PIN。与 setup 选项一起使用。 |
pinmanagerpwd | 提供 PIN 管理器用户的密码。与 setup 选项一起使用。 |
6.1.3. 使用方法
setpin.conf
文件的 optfile 选项运行 setpin 命令。
setpin optfile=/usr/lib/pki/native-tools/setpin.conf
vim /usr/lib/pki/native-tools/setpin.conf setup=no
setpin host=csldap port=389 binddn="CN=directory manager" bindpw=password filter="(cn=*)" basedn="dc=example,dc=com" clobber write hash=none