

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# Amazon Inspector SBOM 產生器 SSL/TLS 憑證掃描
<a name="sbom-generator-ssl-tls-certificate-scans"></a>

 本節說明如何使用 Amazon Inspector SBOM 產生器清查 SSL/TLS 憑證。透過在預先定義的位置搜尋憑證，以及使用者提供的目錄，Sbomgen來庫存 SSL/TLS 憑證。此功能旨在讓使用者清查 SSL/TLS 憑證，以及識別過期的憑證。CA 憑證也會出現在輸出庫存中。

## 使用Sbomgen憑證掃描
<a name="w2aac37c29b5"></a>

 您可以使用 `--scanners certificates`引數啟用 SSL/TLS 憑證庫存收集。憑證掃描可以與任何其他掃描器結合使用。根據預設，不會啟用憑證掃描。

 會根據掃描的成品Sbomgen，搜尋不同位置的憑證。在所有情況下， Sbomgen都會嘗試在具有下列副檔名的檔案中擷取憑證。

```
.pem
.crt
.der
.p7b
.p7m
.p7s
.p12
.pfx
```

**localhost 成品類型**  
 如果已啟用憑證掃描器，且成品類型為 localhost，則 會以Sbomgen遞迴方式在 `/etc/*/ssl`、`/usr/local/*/ssl`、 `/opt/*/ssl/certs`和 中尋找憑證`/var/lib/*/certs`，其中 `*` 不是空的。無論命名了哪些目錄，都會以遞迴方式搜尋使用者提供的目錄。一般而言，CA/系統憑證不會放置在這些路徑中。這些憑證通常位於名為 `pki`、 `ca-certs`或 的資料夾中`CA`。它們也可能出現在預設的 localhost 掃描路徑中。

**目錄和容器成品**  
 掃描目錄或容器成品時， Sbomgen會搜尋位於成品上任何位置的憑證。

**憑證掃描命令範例**  
 以下包含憑證掃描命令範例。一個會產生僅包含本機目錄中憑證的 SBOM。另一個 會產生 SBOM，其中包含本機目錄中的憑證和 Debian、 Alpine和 Rhel套件。另一個 會產生 SBOM，其中包含常見憑證位置中找到的憑證。

```
# generate SBOM only containing certificates in a local directory
./inspector-sbomgen directory --path ./project/ --scanners certificates

# generate SBOM only containing certificates and Alpine, Debian, and Rhel OS packages in a local directory
./inspector-sbomgen directory --path ./project/ --scanners certificates,dpkg,alpine-apk,rhel-rpm

# generate SBOM only containing certificates, taken from common localhost certificate locations
./inspector-sbomgen localhost --scanners certificates
```

**檔案元件範例**  
 以下包含兩個憑證調查結果元件範例。當憑證過期時，您可以檢視識別過期日期的額外屬性。

```
{
      "bom-ref": "comp-2",
      "type": "file",
      "name": "certificate:expired.pem",
      "properties": [
            {
                "name": "amazon:inspector:sbom_generator:certificate_finding:IN-CERTIFICATE-001",
                "value": "expired:2015-06-06T11:59:59Z"
            },
            {
                "name": "amazon:inspector:sbom_generator:source_path",
                "value": "/etc/ssl/expired.pem"
            }
      ]
},
{
      "bom-ref": "comp-3",
      "type": "file",
      "name": "certificate:unexpired.pem",
      "properties": [
            {
                "name": "amazon:inspector:sbom_generator:source_path",
                "value": "/etc/ssl/unexpired.pem"
            }
      ]
}
```

**漏洞回應元件範例**  
 使用 `--scan-sbom`旗標執行 Amazon Inspector SBOM 產生器會將產生的 SBOM 傳送至 Amazon Inspector 以進行漏洞掃描。以下是漏洞回應元件的憑證調查結果範例。

```
{
    "advisories": [
        {
            "url": "https://aws.amazon.com/inspector/"
        },
        {
            "url": "https://docs.aws.amazon.com/wellarchitected/latest/security-pillar/sec_protect_data_transit_encrypt.html"
        }
    ],
    "affects": [
        {
            "ref": "comp-2"
        }
    ],
    "analysis": {
        "state": "in_triage"
    },
    "bom-ref": "vuln-1",
    "created": "2025-04-17T18:48:20Z",
    "cwes": [
        324,
        298
    ],
    "description": "Expired Certificate: The associated certificate(s) are no longer valid. Replace certificate in order to reduce risk.",
    "id": "IN-CERTIFICATE-001",
    "properties": [
        {
            "name": "amazon:inspector:sbom_scanner:priority",
            "value": "standard"
        },
        {
            "name": "amazon:inspector:sbom_scanner:priority_intelligence",
            "value": "unverified"
        }
    ],
    "published": "2025-04-17T18:48:20Z",
    "ratings": [
        {
            "method": "other",
            "severity": "medium",
            "source": {
                "name": "AMAZON_INSPECTOR",
                "url": "https://aws.amazon.com/inspector/"
            }
        }
    ],
    "source": {
        "name": "AMAZON_INSPECTOR",
        "url": "https://aws.amazon.com/inspector/"
    },
    "updated": "2025-04-17T18:48:20Z"
}
```