Go to main content

手册页部分 1:用户命令

退出打印视图

更新时间: 2022年7月27日 星期三
 
 

kmfcfg(1)

名称

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

用法概要

kmfcfg subcommand [option ...]

描述

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

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

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

子命令

支持以下子命令:

create

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

create 子命令的格式如下:

kmfcfg 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 | 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=timeout

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

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

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

If the crl-get-crl-uri attribute is set to true and the crl-basefilename is not specified, the basefilename for the cached CRL file is the basename of the URI used to fetch the CRL file.

If the crl-get-crl-uri attribute is set to false the crl-basefilename needs to be specified to indicate an input CRL file or all possible CRL files under a CRL directory by the search value.The setting for crl-get-crl-uri is false by default.

这两个属性只适用于基于文件的 CRL 插件。当前基于文件的 CRL 插件为 filepkcs11 Keystore。

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

crl-proxy=URL

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

端口号为可选。如果未指定端口号,缺省值为 8080。An example crl-proxy setting might be: crl-proxy=webcache.example.com:8080.

dbfile=dbfile

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

ekuoids=EKUOIDS

正在定义的策略所需的以逗号分隔的扩展密钥使用 OID 列表。OID 以点记法表示,例如 1.2.3.4。An example ekuoids setting might be: ekuoids=1.2.3.4,9.8.7.6.5.

ekunames=EKUNAMES

正在定义的策略所需的以逗号分隔的扩展密钥使用名称列表。The list of values allowed for EKUNAMES are: serverAuth, clientAuth, codeSigning, emailProtection, ipsecEndSystem, ipsecTunnel, ipsecUser, timeStamping, and OCSPSigning

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

http-proxy=URL

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

端口号为可选。如果未指定端口号,则缺省值为 8080。An example crl-proxy setting might be: crl-proxy=webcache.example.com:8080.

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

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

ignore-date=true | false

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

ignore-trust-anchor=true | false

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

ignore-unknown-eku=true | false

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

keyusage=KUVALUES

正在定义的策略所需的以逗号分隔的扩展密钥使用列表。The list of values allowed are: digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment, keyAgreement, keyCertSign, cRLSign, encipherOnly, decipherOnly

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

These four options support the certificate to name mapping. mapper-name provides the name of the mapper.For example, the name “cn” represents the mapper object kmf_mapper_cn.so.1. mapper-dir overrides the default mapper directory /lib/crypto. mapper-path specifies the full path to the mapper object. mapper-options is an ASCII-only string of a maximum of 255 bytes long.Its format is mapper specific but mappers are expected to accept a comma separated list of options, for example casesensitive,ignoredomain. mapper-path and mapper-name are mutually exclusive. mapper-dir can be set only if mapper-name is set. mapper-options can be set only if mapper-name or mapper-path is set.尝试使用上述任何一个不正确设置都会导致错误,且无法修改策略数据库。

max-cert-path-length=number

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

ocsp-ignore-response-sign=true | false

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

ocsp-proxy=URL

为 OCSP 设置代理服务器名称和端口。端口号为可选。如果未指定端口号,则缺省值为 8080。An example ocsp-proxy setting might be: ocsp-proxy="webcache.example.com:8080"

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

ocsp-response-lifetime=timelimit

设置响应必须处于的有效时间段。timelimit 可由数字-day数字-hour数字-minute 数字-second 指定。An example ocsp-response-lifetime setting might be:ocsp-response-lifetime=6-hour.

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

这两个属性表示 OCSP 响应者证书。ocsp-responder-cert-name 用于指定证书的签发者名称。有关示例,请参见 ta-name 选项。The ocsp-responder-cert-serial is for the serial number and must be specified as a hex value, for example, 0x0102030405060708090a0b0c0d0e0f.如果 OCSP 响应者与证书的签发者不同,并且如果需要验证 OCSP 响应,应该提供 OCSP 响应者证书信息。

ocsp-responder=URL

设置 OCSP 响应者 URL 以便与 OCSP 验证方式一起使用。For example, ocsp-responder=http://ocsp.example.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 指定。An example validity-adjusttime setting might be: validity-adjusttime=6-hour. ta-name="Subject DN" ta-serial=serialNumber

这两个属性表示信任锚证书,用于查找 keystore 中的信任锚证书。ta-name用于指定信任锚证书主题名称的标识名。For example, ta-name="O=Oracle Corporation, OU=Solaris Security Technologies Group, L=Ashburn, ST=VA, C=US, CN=John Smith".The ta-serial is to specify the serial number of the TA certificate.The serial number must be specified as a hex value, for example, 0x0102030405060708090a0b0c0d0e.它和“签发者 DN”一起用于查找 keystore 中的 TA 证书。The trust anchor attributes need to be set if the value of ignore-trust-anchor attribute is false.

delete

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

delete 子命令的格式如下:

kmfcfg delete [dbfile=dbfile] policy=policyname

delete 子命令支持以下选项:

dbfile=dbfile

从指定文件中读取策略定义。If dbfile is not specified, the default is the system KMF policy database file: /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 子命令的格式如下:

kmfcfg help
import

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

import 子命令的格式如下:

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

import 子命令支持以下选项:

dbfile=outdbfile

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

infile=inputdbfile

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

policy=policyname

要导入的策略记录。

list

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

list 子命令的格式如下:

kmfcfg list [dbfile=dbfile] [policy=policyname]

list 子命令支持以下选项:

dbfile=dbfile

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

policy=policyname

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

modify

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

modify 子命令的格式如下:

kmfcfg 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 子命令相同的许多选项。For descriptions of shared options, see the create subcommand.

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

crl-none=true | false

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

dbfile=[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 属性。

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 特权。如果没有此特权,仍将尽力尝试建立连接。

ocsp-none=true | false

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

policy=policyname

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

Plugin Subcommands

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

将插件安装到系统中。modulepath 字段指定 KMF 插件共享库目标文件的路径名。如果未将 pathname 指定为绝对路径名,共享库目标文件会假定为与 /lib/security/$ISA/ 相对。The ISA token is replaced by an implementation defined directory name which defines the pathname relative to the calling program's instruction set architecture.

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 dbfile=ipsec.xml policy=IPSEC \
ignore-trust-anchor=true \
ocsp-use-cert-responder=true \
keyusage=keyAgreement,keyEncipherment,dataEncipherment \
ekunames=ipsecTunnel,ipsecUser

退出状态

将返回以下退出值:

0

成功完成。

> 0

出现错误。

文件

/etc/security/kmfpolicy.xml

缺省系统策略数据库

属性

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

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

另请参见

attributes(7)

History

The bypass-ipsec-policy, cert-revoke-responder-timeout, http-proxy, http-proxy-none, ignore-cert-revoke-responder-timeout, max-cert-path-length, and trust-intermediate-cas attributes were added in Oracle Solaris 11.2.0.

The mapper-dir, mapper-name, mapper-path, and mapper-options attributes were added in Solaris 11.0.

Plugin support, including the install, list plugin, modify plugin, and uninstall subcommands, was added in Solaris 11.0.

The kmfcfg command and all other subcommands & attributes were added in Solaris 10 8/07 (Update 4).