创建或更新安全概要文件
作用
创建或更新安全概要文件。端点使用安全概要文件来定义此端点的传输层安全性 (TLS) 和认证方法。URI
使用具有以下 IBM® IoT MessageSight 配置 URI 的 IBM IoT MessageSight REST API POST 方法:
http://<admin-endpoint-IP:Port>/ima/v1/configuration/
对象配置数据
使用以下模式在 POST 方法的有效内容中提供 SecurityProfile 对象配置数据。Content-type 设置为 application/json:
{
"SecurityProfile": {
"<NameOfSecurityProfile>": {
"TLSEnabled": true|false,
"MinimumProtocolMethod": "string",
"UseClientCertificate": true|false,
"UsePasswordAuthentication": true|false,
"AllowNullPassword": true|false,
"Ciphers": "string",
"CertificateProfile": "string",
"UseClientCipher": true|false,
"LTPAProfile": "string",
"OAuthProfile": "string"
}
}
}
其中:- NameOfSecurityProfile
- 这是必需属性。
- 指定证书文件的名称。
- 名称的最大长度为 32 个字母数字字符。第一个字符一定不能是数字。
- 创建概要文件之后,该名称将无法更改。
- TLSEnabled: true|false
- 指定在使用安全概要文件的端点上是 (true) 否 (false) 使用 TLS。
- 缺省值为 true。
- 如果 TLSEnabled 为 true,那么必须先创建要与此安全概要文件一起使用的证书文件。
- MinimumProtocolMethod
- 指定在客户机连接到 IBM IoT MessageSight 时允许的最低协议级别。
- 该值可以是下列任一值:
- TLSv1
- TLSv1.1
- TLSv1.2
- UseClientCertificate: true|false
- 指定 true 以使用客户机证书认证,指定 false 则不使用。
- 缺省值为 false。
- UsePasswordAuthentication: true|false
- 指定是 (true) 否 (false) 认证用户标识和密码。
- 缺省值为 true。
- AllowNullPassword: true|false
- 指定允许 (true) 还是不允许 (false) 认证 NULL 或空密码。
- 如果指定此选项,那么 UsePasswordAuthentication 必须设置为 true。
- 缺省值为 false。
- 密码
- 指定安全策略所使用的加密算法。
- 该值可以是下列任一值:
- Best
- 服务器和客户机所支持的最安全的密码。
- Medium
- 服务器和客户机所支持的最快的高安全性密码。
- Fast
- 服务器和客户机所支持的最快的中等安全性密码或高安全性密码。
- 缺省值为 Fast。
- CertificateProfile
- 指定要与此安全概要文件一起使用的证书文件的名称。当 TLSEnabled 为 true 时,证书文件必须存在且是必需的。
- UseClientCipher: true|false
- 指定在客户机连接到 IBM IoT MessageSight 时是 (true) 否 (false) 使用该客户机的密码设置。
- 缺省值为 false。
- LTPAProfile
- 指定要与该安全概要文件一起使用的 LTPA 概要文件。LTPA 概要文件必须存在。
- 如果指定此选项,那么 UsePasswordAuthentication 必须设置为 true。如果在命令中省略 UsePasswordAuthentication 参数,那么会自动将其设置为 true。
- 如果已指定 LTPA 概要文件,那么不能在同一安全概要文件中指定 OAuth 概要文件。
- OAuthProfile
- 指定要与该安全概要文件一起使用的 OAuth 概要文件。OAuth 概要文件必须存在。
- 如果指定此选项,那么 UsePasswordAuthentication 必须设置为 true。如果在命令中省略 UsePasswordAuthentication 参数,那么会自动将其设置为 true。
- 如果已指定 OAuth 概要文件,那么您不能在同一安全概要文件中指定 LTPA 概要文件。
用法说明
- 必须按照所示情况使用首字母大写和双引号。
相关的 REST 管理 API
示例
以下示例无法创建安全概要文件,因为在启用 TLS 时未提供证书文件:curl -X POST \
-H 'Content-Type: application/json' \
-d '{
"SecurityProfile": {
"KCSecProfile": {
}
}
}
' \
http://127.0.0.1:9089/ima/v1/configuration/
POST 方法的响应示例:
以下示例通过将 TLSEnabled 设置为 false 来创建安全概要文件,而无需提供证书文件:{
"Version": "v1",
"Code": "CWLNA0186",
"Message": "The certificate profile must be set if TLSEnabled is true."
}
curl -X POST \
-H 'Content-Type: application/json' \
-d '{
"SecurityProfile": {
"KCSecProfile": {
"TLSEnabled":false
}
}
}
' \
http://127.0.0.1:9089/ima/v1/configuration/
POST 方法的响应示例:
{
"Version": "v1",
"Code": "CWLNA6011",
"Message": "The requested configuration change has completed successfully."
}