Go to main content

Oracle® ZFS Storage Appliance RESTful API 指南,发行版 OS8.8.x

退出打印视图

更新时间: 2021 年 8 月
 
 

列出证书

以下请求列出了主机上所有系统证书的属性,并列出了 default 属性的值。

请求示例:

GET /api/setting/v2/certificates/system HTTP/1.1
Host: alice.example.com:215
Authorization: Basic Tm8gcGVla2luZyE=
Accept: application/json

结果示例:

以下示例中的第一个证书是自动生成的常规证书(基于域或 IP 地址)。第二个证书是基于设备序列号 (Appliance Serial Number, ASN) UUID 自动生成的证书。

在此结果的末尾,default 属性的值显示自动选择了系统默认证书。

HTTP/1.1 200 OK
Date: Sat, 08 May 2021 00:37:21 GMT
Content-Type: application/json; charset=utf-8
X-Zfssa-Api-Version: 2.0
X-Zfssa-Setting-Api: 2.0
Content-Length: 1975

{
    "certificates": [
        {
            "uuid": "system-cert1-uuid",
            "type": "cert",
            "data": {
                "subject": [
                    {
                        "countryName": "US"
                    },
                    {
                        "stateOrProvinceName": "CA"
                    },
                    {
                        "localityName": "Exampleton"
                    },
                    {
                        "organizationName": "Example Corp, Inc"
                    },
                    {
                        "commonName": "alice.example.com"
                    }
                ],
                "issuer": [
                    {
                        "countryName": "US"
                    },
                    {
                        "stateOrProvinceName": "AK"
                    },
                    {
                        "localityName": "Trustville"
                    },
                    {
                        "organizationName": "Totally Trustworthy Certificates, Inc"
                    },
                    {
                        "commonName": "Most Trusted Certificate"
                    }
                ],
                "serialNumber": "64",
                "validity": {
                    "notBefore": "20210520T21:08:27",
                    "notAfter": "20220520T21:08:27"
                },
                "extensions": {
                    "basicConstraints": {
                        "value": [
                            {
                                "CA": false
                            }
                        ]
                    },
                    "subjectKeyIdentifier": {
                        "value": "subjectKeyIdentifier"
                    },
                    "authorityKeyIdentifier": {
                        "value": [
                            {
                                "keyid": "authorityKeyIdentifier"
                            }
                        ]
                    },
                    "subjectAltName": {
                        "value": [
                            {
                                "DNS": "alice.example.com"
                            },
                            {
                                "IP": "alice.example.com-ipaddr"
                            }
                        ]
                    }
                }
            },
            "sha1fingerprint": "sha1fingerprint",
            "href": "/api/setting/v2/certificates/system/system-cert1-uuid"
        },
        {
            "uuid": "system-cert2-uuid",
            "type": "cert",
            "asn": "8bf7f9bc-8b3a-4064-e59f-bf09e3dba275",
            "data": {
                "subject": [
                    {
                        "commonName": "8bf7f9bc-8b3a-4064-e59f-bf09e3dba275"
                    }
                ],
                "issuer": [
                    {
                        "commonName": "8bf7f9bc-8b3a-4064-e59f-bf09e3dba275"
                    }
                ],
                "serialNumber": "59:8A:73:7B:00:00:00:07",
                "validity": {
                    "notBefore": "20060215T18:00:00",
                    "notAfter": "20380119T03:14:07"
                },
                "extensions": {
                    "nsComment": {
                        "value": "Automatically generated"
                    },
                    "subjectAltName": {
                        "critical": true,
                        "value": [
                            {
                                "DirName": "8bf7f9bc-8b3a-4064-e59f-bf09e3dba275"
                            }
                        ]
                    }
                }
            },
            "sha1fingerprint": "sha1fingerprint",
            "href": "/api/setting/v2/certificates/system/system-cert2-uuid"
        }
    ],
    "default": "auto"
}

以下请求列出了指定的 trusted-cert1-uuid 可信证书的属性。

请求示例:

GET /api/setting/v2/certificates/trusted/trusted-cert1-uuid HTTP/1.1
Host: alice.example.com:215
Authorization: Basic Tm8gcGVla2luZyE=
Accept: application/json

结果示例:

HTTP/1.1 200 OK
Date: Sat, 08 May 2021 00:37:57 GMT
Content-Length: 984
Content-Type: application/json; charset=utf-8
X-Zfssa-Setting-Api: 2.0
X-Zfssa-Api-Version: 2.0

{
    "certificate": {
        "uuid": "trusted-cert1-uuid",
        "type": "cert_ca",
        "data": {
            "subject": [
                {
                    "countryName": "US"
                },
                {
                    "stateOrProvinceName": "AK"
                },
                {
                    "localityName": "Trustville"
                },
                {
                    "organizationName": "Totally Trustworthy Certificates, Inc"
                },
                {
                    "commonName": "Most Trusted Certificate"
                }
            ],
            "issuer": [
                {
                    "countryName": "US"
                },
                {
                    "stateOrProvinceName": "AK"
                },
                {
                    "localityName": "Trustville"
                },
                {
                    "organizationName": "Totally Trustworthy Certificates, Inc"
                },
                {
                    "commonName": "Most Trusted Certificate"
                }
            ],
            "serialNumber": "83:F7:79:02:5F:44:4D:60",
            "validity": {
                "notBefore": "20210316T17:28:37",
                "notAfter": "20210415T17:28:37"
            },
            "extensions": {
                "subjectKeyIdentifier": {
                    "value": "subjectKeyIdentifier"
                },
                "authorityKeyIdentifier": {
                    "value": [
                        {
                            "keyid": "authorityKeyIdentifier"
                        }
                    ]
                },
                "basicConstraints": {
                    "value": [
                        {
                            "CA": true
                        }
                    ]
                }
            }
        },
        "sha1fingerprint": "sha1fingerprint",
        "services": [
            "ldap",
            "cloud"
        ],
        "href": "/api/setting/v2/certificates/trusted/trusted-cert1-uuid"
    }
}