手册页部分 1: 用户命令

退出打印视图

更新时间: 2014 年 7 月
 
 

kmfcfg(1)

名称

kmfcfg - 密钥管理策略和插件配置实用程序

用法概要

kmfcfg subcommand [
option ...] 

描述

kmfcfg 命令允许用户配置密钥管理框架 (Key Management Framework, KMF) 策略数据库。KMF 策略数据库 (database, DB) 限制使用通过 KMF 框架管理的密钥和证书。

kmfcfg 提供在系统缺省数据库文件 /etc/security/kmfpolicy.xml 或用户定义数据库文件中列出、创建、修改、删除、导入和导出策略定义的能力。

对于插件配置,kmfcfg 允许用户显示插件信息、安装或卸载 KMF 插件以及修改插件选项。

子命令

子命令

支持以下子命令:

create

将新策略添加到策略数据库文件中。

create 子命令的格式如下:


create [dbfile=dbfile] policy=policyname
    [ignore-date=true|false]
    [ignore-unknown-eku=true|false]
    [ignore-trust-anchor=true|false]
    [ignore-cert-revoke-responder-timeout=true|false]
    [cert-revoke-responder-timeout=timeout in seconds]
    [trust-intermediate-cas=true|false]
    [max-cert-path-length=max length in cert path]
    [validity-adjusttime=adjusttime]
    [ta-name=trust anchor subject DN]
    [ta-name=trust anchor subject DN | search]
    [ta-serial=trust anchor serial number]
    [http-proxy=URL]
    [http-proxy-none=true|false]
    [ocsp-responder=URL]
    [ocsp-proxy=URL]
    [ocsp-use-cert-responder=true|false]
    [ocsp-response-lifetime=timelimit]
    [ocsp-ignore-response-sign=true|false]
    [ocsp-responder-cert-name=Issuer DN]
    [ocsp-responder-cert-serial=serial number]
    [crl-basefilename=basefilename | search]
    [crl-directory=directory]
    [crl-get-crl-uri=true|false]
    [crl-proxy=URL]
    [crl-ignore-crl-sign=true|false]
    [crl-ignore-crl-date=true|false]
    [bypass-ipsec-policy=true|false]
    [keyusage=digitalSignature|nonRepudiation
              |keyEncipherment | dataEncipherment |
              keyAgreement |keyCertSign |
              cRLSign | encipherOnly | decipherOnly],[...]
    [ekunames=serverAuth | clientAuth |
             codeSigning | emailProtection |
             ipsecEndSystem | ipsecTunnel |
             ipsecUser | timeStamping |
             OCSPSigning],[...]
    [ekuoids=OID,OID,OID...]
    [mapper-name=name of the mapper]
    [mapper-dir=dir where mapper library resides]
    [mapper-path=full pathname of mapper library]
    [mapper-options=mapper options]

create 子命令支持以下选项:

cert-revoke-responder-timeout:

以秒为单位设置等待 CRL 或 OCSP 响应者时的最大超时值。缺省值为 30 秒。最大超时值为 300 秒。

crl-basefilename=filename | search
crl-directory=directory

这两个属性用于指定 CRL 文件的位置。crl-basefilename 属性表示 CRL 文件的基文件名。crl-directory 属性表示 CRL 文件的目录,缺省为当前目录。当使用了值 search 而不是明确的 CRL 文件名时,KMF 将在指定的 CRL 目录下搜索所有有效的 CRL 文件,以查看要验证的证书是否已撤销。

如果 crl-get-crl-uri 属性设置为 true 并且没有指定 crl-basefilename,则高速缓存的 CRL 文件的 basefilename 是用于提取 CRL 文件的 URI 的基名。

如果 crl-get-crl-uri 属性设为 false,则需要指定 crl-basefilename 来指示一个输入 CRL 文件或指示由 search 值指明的 CRL 目录下的所有可能的 CRL 文件。缺省情况下,crl-get-crl-uri 的设置为 false

这两个属性只适用于基于文件的 CRL 插件。当前基于文件的 CRL 插件为 filepkcs11 Keystore。对于 nss Keystore,CRL 位置始终为 NSS 内部数据库。

crl-get-crl-uri=true | false

配置是否将动态提取和高速缓存 CRL 文件作为证书验证的一部分,使用来自证书的分发点扩展的 URI 信息。

此属性的缺省值为 false

crl-ignore-crl-date=true | false

如果 crl-ignore-crl-date 设置为 true,不会检查 CRL 的有效时间段。

此属性的缺省值为 false

crl-ignore-crl-sign=true | false

如果 crl-ignore-crl-sign 设置为 true ,不会检查 CRL 的签名。

此属性的缺省值为 false

http-proxy= URL

设置代理服务器名称和端口以便联系 CRL、OCSP 的服务器或下载证书。

端口号为可选。如果未指定端口号,则缺省值为 8080。crl-proxy 设置的一个示例为:crl-proxy=webcache.sfbay:8080

crl-proxy= URL

crl-get-crl-uri 设置为 true 时,设置代理服务器名称和端口以便动态检索 CRL 文件。此值优先于全局 http-proxy 值。

端口号为可选。如果未指定端口号,缺省值为 8080crl-proxy 设置的一个示例为:crl-proxy=webcache.sfbay:8080

dbfile=dbfile

添加新策略的 DB 文件。如果未指定,缺省值将是系统 KMF 策略数据库文件 /etc/security/kmfpolicy.xml

ekuoids=EKUOIDS

正在定义的策略所需的以逗号分隔的扩展密钥使用 OID 列表。OID 以点记法表示,例如 1.2.3.4ekuoids 设置的一个示例为:ekuoids=1.2.3.4,9.8.7.6.5

ekunames=EKUNAMES

正在定义的策略所需的以逗号分隔的扩展密钥使用名称列表。允许用于 EKUNAMES 的值列表为:serverAuthclientAuthcodeSigningemailProtectionipsecEndSystem ipsecTunnelipsecUsertimeStampingOCSPSigning

缺省情况下,OCSP、CRL、密钥使用和扩展密钥使用检查处于关闭状态。要启用其中任何一个,请为特定检查指定一个或多个属性。例如,如果设置了 ocsp-responder 属性,则会启用 OCSP 检查。如果设置了 ekuname 属性或 ekuoids 属性,则会启用扩展密钥使用检查。

ignore-cert-revoke-responder-timeout=true | false

定义 cert-revoke-responder-timeout 期满后的行为。缺省值为 false,意味着如果 cert-revoke-responder-timeout 中定义的时间到期,证书验证随即失败。否则,如果值为 true,则证书验证会绕过 CRL 和/或 OCSP 检查,继续沿着验证所需执行的一系列步骤朝下一步推进。

ignore-date=true | false

为此策略设置 "Ignore Date"(忽略日期)选项。缺省情况下此值为 false。如果指定了 true,策略会在评估证书有效性时忽略证书中定义的有效期。

ignore-unknown-eku=true | false

为策略设置 "Ignore Unknown EKU"(忽略未知 EKU)选项。缺省情况下此值为 false。如果为 true,策略会忽略扩展密钥使用扩展中任何无法识别的 EKU 值。

ignore-trust-anchor=true | false

为此策略设置 "Ignore Trust Anchor"(忽略信任锚)选项。缺省情况下此值为 false。如果指定了 true,策略不会在验证时使用信任锚证书验证主题证书的签名。

keyusage=KUVALUES

正在定义的策略所需的以逗号分隔的扩展密钥使用列表。允许的值列表为:digitalSignaturenonRepudiationkeyEnciphermentdataEnciphermentkeyAgreementkeyCertSign cRLSignencipherOnlydecipherOnly

max-cert-path-length=number

指定证书链中允许的最大证书长度。缺省值为 32。

ocsp-ignore-response-sign=true | false

如果该属性设置为 true,则不会验证 OCSP 响应的签名。此属性值缺省为 false

ocsp-proxy=URL

为 OCSP 设置代理服务器名称和端口。端口号为可选。如果未指定端口号,则缺省值为 8080。ocsp-proxy 设置的一个示例为:ocsp-proxy="webcache.sfbay:8080"

此值优先于全局 http-proxy 值。

ocsp-response-lifetime=timelimit

设置响应必须处于的有效时间段。timelimit 可由数字-day数字-hour数字-minute 数字-second 指定。 ocsp-response-lifetime 设置的一个示例为:ocsp-response-lifetime=6-hour

ocsp-responder-cert-name=IssuerDN
ocsp-responder-cert-serial= serialNumber

这两个属性表示 OCSP 响应者证书。ocsp-responder-cert-name 用于指定证书的签发者名称。有关示例,请参见 ta-name 选项。ocsp-responder-cert-serial 表示序列号,必须指定为十六进制值,例如 0x0102030405060708090a0b0c0d0e0f。如果 OCSP 响应者与证书的签发者不同,并且如果需要验证 OCSP 响应,应该提供 OCSP 响应者证书信息。

ocsp-responder=URL

设置 OCSP 响应者 URL 以便与 OCSP 验证方式一起使用。例如 ocsp-responder=http://ocsp.verisign.com/ocsp/status

ocsp-use-cert-responder=true | false

将此策略配置为始终使用证书自身中定义的响应者(如果可能)。

policy=policyname

要创建的策略记录。policyname 是必需的。

ta-name=trust anchor subject DN | search

ta-name 标识用于验证证书的信任锚。KMF 策略引擎不会执行完全 PKIX 路径验证,而只会将信任锚视为要验证的证书的父证书。

如果指定了显式“主题 DN”,它必须与 ta-serial 值结合,以便唯一地标识要使用的证书。此外,标识的证书必须可用于选择的 keystore 中。

如果使用了值 search 而不是显式主题和序列号,KMF 策略引擎会尝试查找与待验证证书的签发者名称匹配的证书并使用其进行验证。

如果使用 search,会忽略 ta-serial 值。

ta-serial=trust anchor serial number

如果将 ta-name 指定为显式主题名称,则此证书的序列号必须由 ta-serial 值指示。此序列号必须以十六进制格式表示,例如 ta-serial=0x01020a0b

trust-intermediate-cas true | false

如果此策略设为 trust intermediate,则信任链的根可以是一个中间 CA 证书。缺省情况下此值为 false。指定了 true 时,如果链未固定到某个 TA 证书,则证书验证将在部分链上进行。

validity-adjusttime=adjusttime

为证书有效期的两个端点设置调整时间。时间可由数字-day、数字-hour、数字-minute 或数字-second 指定。validity-adjusttime 设置的一个示例为:validity-adjusttime=6-hour。ta-name="Subject DN" ta-serial=serialNumber

这两个属性表示信任锚证书,用于查找 keystore 中的信任锚证书。ta-name 用于指定信任锚证书主题名称的标识名。例如,ta-name="O=Sun Microsystems Inc., \ OU=Solaris Security Technologies Group, \ L=Ashburn, ST=VA, C=US, CN=John Smith" TA 证书的序列号。它和“签发者 DN”一起用于查找 keystore 中的 TA 证书。必须将序列号指定为十六进制值,例如 0x0102030405060708090a0b0c0d0e。如果 ignore-trust-anchor 属性的值为 false,需要设置信任锚属性。

mapper-name=name
mapper-dir=directory
mapper-path=path
mapper-options=options

这四个选项支持证书到名称映射。mapper-name 提供映射器的名称。例如,cn 名称表示映射器目标文件 kmf_mapper_cn.so.1 mapper-dir 覆盖缺省映射器目录 /lib/crypto 。mapper-path 指定映射器目标文件的全路径。mapper-options 是最长为 255 字节的仅 ASII 字符串。它的格式是映射器特定的,但映射器会接受以逗号分隔的选项列表,例如 casesensitive,ignoredomainmapper-path mapper-name 互斥。只有设置了 mapper-name 才能设置 mapper-dir。只有设置了 mapper-namemapper-path 才能设置 mapper-options。尝试使用上述任何一个不正确设置都会导致错误,且无法修改策略数据库。

delete

删除与指定策略名称匹配的任何策略。无法删除系统缺省策略 (default)。

delete 子命令的格式如下:


delete [dbfile=dbfile] policy=policyname

delete 子命令支持以下选项:

dbfile=dbfile

从指定文件中读取策略定义。如果未指定 dbfile,缺省值将是系统 KMF 策略数据库文件:/etc/security/kmfpolicy.xml

policy=policyname

要删除的策略的名称。如果使用系统数据库,则需要 policyname

export

将策略从一个策略数据库文件导出到另一个策略数据库文件。

export 子命令的格式如下:


kmfcfg export policy=policyname outfile=newdbfile
 [dbfile=dbfile]


export 子命令支持以下选项:

dbfile=dbfile

从中读取导出策略的 DB 文件。如果未指定 dbfile,缺省值将是系统 KMF 策略数据库文件:/etc/security/kmfpolicy.xml

outfile=outputdbfile

在其中存储导出策略的 DB 文件。

policy=policyname

要导出的策略记录。

help

显示关于 kmfcfg 命令的帮助。

help 子命令的格式如下:


help

import

将策略从一个策略数据库文件导入到另一个策略数据库文件。

import 子命令的格式如下:


kmfcfg import policy=policyname infile=inputdbfile
 [dbfile=dbfile]

import 子命令支持以下选项:

policy=policyname

要导入的策略记录。

infile=inputdbfile

要从中读取策略的 DB 文件。

dbfile=outdbfile

添加新策略的 DB 文件。如果未指定,缺省值将是系统 KMF 策略数据库文件 /etc/security/kmfpolicy.xml

list

如果不指定参数,将列出缺省系统数据库中的所有策略定义。

list 子命令的格式如下:


list [dbfile=dbfile] [policy=policyname]

list 子命令支持以下选项:

dbfile=dbfile

从指定文件读取策略定义。如果未指定,缺省值将是系统 KMF 策略数据库文件 /etc/security/kmfpolicy.xml

policy=policyname

只显示指定策略的策略定义。

modify

修改与指定名称匹配的任何策略。无法修改系统缺省策略 (default)。

modify 子命令的格式如下:

modify [dbfile=dbfile] policy=policyname

    [ignore-date=true|false]
    [ignore-unknown-eku=true|false]
    [ignore-trust-anchor=true|false]
    [ignore-cert-revoke-responder-timeout=true|false]
    [cert-revoke-responder-timeout=timeout in seconds]
    [trust-intermediate-cas=true|false]
    [max-cert-path-length=max length in cert path]
    [validity-adjusttime=adjusttime]
    [ta-name=trust anchor subject DN]
    [ta-serial=trust anchor serial number]
    [http-proxy=URL]
    [http-proxy-none=true|false]
    [ocsp-responder=URL]
    [ocsp-proxy=URL]
    [ocsp-use-cert-responder=true|false]
    [ocsp-response-lifetime=timelimit]
    [ocsp-ignore-response-sign=true|false]
    [ocsp-responder-cert-name=Issuer DN]
    [ocsp-responder-cert-serial=serial number]
    [ocsp-none=true|false]
    [crl-basefilename=basefilename | search]]
    [crl-directory=directory]
    [crl-get-crl-uri=true|false]
    [crl-proxy=URL]
    [crl-ignore-crl-sign=true|false]
    [crl-ignore-crl-date=true|false]
    [crl-none=true|false]
    [bypass-ipsec-policy=true|false]
    [keyusage=digitalSignature| nonRepudiation
              |keyEncipherment | dataEncipherment |
              keyAgreement |keyCertSign |
              cRLSign | encipherOnly | decipherOnly],[...]
    [keyusage-none=true|false]
    [ekunames=serverAuth | clientAuth |
             codeSigning | emailProtection |
             ipsecEndSystem | ipsecTunnel |
             ipsecUser | timeStamping |
             OCSPSigning],[...]
    [ekuoids=OID,OID,OID]
    [eku-none=true|false]
    [mapper-name=name of the mapper]
    [mapper-dir=dir where mapper library resides]
    [mapper-path=full pathname of mapper library]
    [mapper-options=mapper options]

modify 子命令支持与 create 子命令相同的许多选项。有关共享选项的说明,请参见 create 子命令。

modify 子命令支持以下唯一选项:

crl-none=true | false

如果 crl-none 设置为 true,将禁用 CRL 检查。如果此属性设置为 true,则无法设置其他 CRL 属性。

dfile=[dbfile ]

要修改策略的数据库文件。如果未指定,缺省值将是系统 KMF 策略数据库文件 /etc/security/kmfpolicy.xml

eku-none=true | false

如果 eku-none 设置为 true,将禁用扩展密钥使用检查。如果 eku-none 设置为 true,无法同时设置扩展密钥使用属性 ekunameekuoids

keyusage-none=true | false

如果 keyusage-none 设置为 true,将禁用密钥使用检查。

如果此属性设置为 true,无法同时设置 keyusage 属性。

ocsp-none=true | false

如果 ocsp-none 设置为 true,将禁用 OCSP 检查。如果此属性设置为 true,不会同时设置任何其他 OCSP 属性。

http-proxy-none=true | false

如果 http-proxy-none 设置为 true,则全局 http-proxy 重置为无代理。

bypass-ipsec-policy=true | false

如果 bypass-ipsec-policy 设置为 true,则 KMF 指示的网络连接将尝试绕过全局 IPsec 策略。此操作需要 sys_ip_config 特权。如果没有此特权,仍将尽力尝试建立连接。

policy=policyname

要修改的策略的名称。policyname 是必需的。无法修改系统 KMF 策略数据库中的 default 策略。

mapper-name=name
mapper-dir=directory
mapper-path=path
mapper-options=options

有关更多信息,请参见 create 子命令。

插件子命令

install keystore=keystore_name modulepath=pathname\ [option=option_str]

将插件安装到系统中。modulepath 字段指定 KMF 插件共享库目标文件的路径名。如果未将 pathname 指定为绝对路径名,共享库目标文件会假定为与 /lib/security/$ISA/ 相对。ISA 标记会由实施定义的目录名称替换,该名称可定义相对于调用程序指令集体系结构的路径名。

list plugin

显示 KMF 插件信息。

不使用 plugin 关键字,kmfcfg list 会如“子命令”部分所述显示策略信息。

modify plugin keystore=keystore_name option=option_str

修改 plugin 选项。plugin 选项是由插件定义的,并且由此插件专门解释,因此此命令接受任何选项字符串。

不使用 plugin 关键字,kmfcfg modify 会如“子命令”部分所述更新策略配置。

uninstall keystore=keystore_name

卸载具有 keystore_name 的插件。

示例

示例 1 创建新策略

以下示例会在系统数据库中创建一个名为 IPSEC 的新策略:


$ kmfcfg create IPSEC \
ignore-trust-anchor=true \
ocsp-use-cert-responder=true \
keyusage=keyAgreement,keyEncipherment,dataEncipherment \
ekuname=ipsecTunnel,ipsecUser

退出状态

将返回以下退出值:

0

成功完成。

>0

出现错误。

文件

/etc/security/kmfpolicy.xml

缺省系统策略数据库

属性

有关下列属性的说明,请参见 attributes(5)

属性类型
属性值
可用性
system/core-os
接口稳定性
Uncommitted(未确定)

另请参见

attributes(5)