

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

# Amazon Inspector SBOM 產生器授權集合
<a name="sbom-generator-license-collection"></a>

 Amazon Inspector SBOM 產生器可協助追蹤軟體物料清單 (SBOM) 中的授權資訊。它會跨作業系統和程式設計語言，從支援的套件收集授權資訊。在產生的 SBOM 中使用標準化授權表達式，您可以了解授權義務。

## 收集授權資訊
<a name="w2aac37c29b5"></a>

**範例 命令**  
 下列範例示範如何從 目錄收集授權資訊。

```
./inspector-sbomgen directory --path /path/to/your/directory/ --collect-licenses
```

**SBOM 元件範例**  
 下列範例顯示所產生 SBOM 中的元件項目。

```
"components": [   
    {
      "bom-ref": "comp-2",
      "type": "application",
      "name": "sample-js-pkg",
      "version": "1.2.3",
      "licenses": [
        {
          "expression": "Apache-2.0 AND (MIT OR GPL-2.0-only)"
        }
      ],
      "purl": "pkg:npm/sample-js-pkg@1.2.3",
    }
  ]
```

## 支援的套件
<a name="w2aac37c29b7"></a>

 授權集合支援下列程式設計語言和作業系統套件。


| Target | 套件管理工具 | 授權資訊來源 | Type | 
| --- | --- | --- | --- | 
|  Alma Linux  | RPM |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/inspector/latest/user/sbom-generator-license-collection.html)  | 作業系統 | 
|  Amazon Linux  | RPM |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/inspector/latest/user/sbom-generator-license-collection.html)  | 作業系統 | 
|  CentOS  | RPM |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/inspector/latest/user/sbom-generator-license-collection.html)  | 作業系統 | 
|  Fedora  | RPM |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/inspector/latest/user/sbom-generator-license-collection.html)  | 作業系統 | 
|  OpenSUSE  | RPM |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/inspector/latest/user/sbom-generator-license-collection.html)  | 作業系統 | 
|  Oracle Linux  | RPM |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/inspector/latest/user/sbom-generator-license-collection.html)  | 作業系統 | 
|  Photon OS  | RPM |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/inspector/latest/user/sbom-generator-license-collection.html)  | 作業系統 | 
|  RHEL  | RPM |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/inspector/latest/user/sbom-generator-license-collection.html)  | 作業系統 | 
|  Rocky Linux  | RPM |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/inspector/latest/user/sbom-generator-license-collection.html)  | 作業系統 | 
|  SLES  | RPM |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/inspector/latest/user/sbom-generator-license-collection.html)  | 作業系統 | 
|  Alpine Linux  | APK | /lib/apk/db/installed | 作業系統 | 
|  Chainguard  | APK | /lib/apk/db/installed | 作業系統 | 
|  Debian  | DPKG | /usr/share/doc/\$1/copyright | 作業系統 | 
|  Ubuntu  | DPKG | /usr/share/doc/\$1/copyright | 作業系統 | 
|  Node.js  | Javascript | node\$1modules/\$1/package.json | 程式設計語言 | 
|  PHP  | Composer 套件 |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/inspector/latest/user/sbom-generator-license-collection.html)  | 程式設計語言 | 
|  Go  | Go | LICENSE | 程式設計語言 | 
|  Python  | Python/Egg/Wheel |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/inspector/latest/user/sbom-generator-license-collection.html)  | 程式設計語言 | 
|  Ruby  | RubyGem | \$1.gemspec | 程式設計語言 | 
|  Rust  | crate | Cargo.toml | 程式設計語言 | 

### 授權表達式標準化
<a name="w2aac37c29b7b7"></a>

 SPDX 授權表達式格式提供開放原始碼軟體中找到的授權條款的準確表示。Amazon Inspector SBOM 產生器會透過本節所述的規則，將所有授權資訊標準化為 SPDX 授權表達式。這些規則提供跨授權資訊的一致性和相容性。

**SPDX 短格式識別符映射**  
 所有授權名稱都會映射至 SPDX 短格式識別符。例如：`MIT License` 縮短為 `MIT`。

**多個授權組合**  
 您可以將多個授權與 `AND` 運算子合併。以下是示範如何格式化命令的範例命令。

```
MIT AND Apache-2.0
```

**自訂授權字首**  
 自訂授權的字首為 `LicenseRef`，例如 `LicenseRef-CompanyPrivate`。

**自訂例外狀況字首**  
 自訂例外狀況字首為 `AdditionRef-`，例如 `AdditionRef-CustomException`。