> For the complete documentation index, see [llms.txt](https://coky-t.gitbook.io/owasp-devsecops-guideline-ja/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://coky-t.gitbook.io/owasp-devsecops-guideline-ja/v0.3/2-purosesu-process/2-3-birudo-build/2-3-4-infastructure-as-code-sekyuriti-infrastructure-as-code-security/2-3-1-3-infastructure-as-code-scanning.md).

# 2-3-1-3-Infastructure as Code スキャン (Infastructure-as-Code-Scanning)

IaC スキャンとはインフラストラクチャのセットアップと管理に使われるコードをチェックすることを意味します。このコードは、Terraform や Ansible などのツールで記述され、サーバー、ネットワーク、インフラストラクチャのその他の部分をどのように作成するかを定義します。IaC スキャンの目的はインフラストラクチャをデプロイする前の早期にセキュリティの問題や間違いを発見することです。こうすることで、チームは最初からインフラストラクチャがセキュリティルールや会社のポリシーに従っていることを確認できます。このようなチェックはコードが実際のシステムで使用される前に、開発プロセスの一環として行われます。

開発チームが Terraform を使用して AWS のクラウドリソースのプロビジョニングを自動化するシナリオを考えてみましょう。簡略化した例を以下に示します。

```terraform
# Terraform script to create an S3 bucket

provider "aws" {
  region = "us-east-1"
}

resource "aws_s3_bucket" "example_bucket" {
  bucket = "example-bucket"
  acl    = "public-read"
}
```

この例では、Terraform スクリプトは "example-bucket" という名前の S3 バケットをパブリック読み取りアクセス (acl = "public-read") で作成します。

IaC スキャンプロセスにおいて、パケットへのパブリックアクセスが許可されているため、スキャンツールはこの設定を検出して、セキュリティリスクとしてフラグを立てるかもしれません。これは、バケットに保存されている機密データを認可されていないユーザーに公開してしまう可能性があります。

IaC スキャンで見つかった結果により、開発チームが Terraform スクリプトを修正して、バケットがパブリックにアクセスできないようにするかもしれません。

次のパートでは、アプリケーションの開発とデプロイメントのさまざまなフェーズでさまざまなタイプの IaC スキャンに対処するのに役立つツールのリストを紹介します。

***

## ツール

### オープンソース

* [ansible-lint](https://github.com/ansible-community/ansible-lint) - Ansible 向けのベストプラクティスチェッカーです。
* [Checkov](https://github.com/bridgecrewio/checkov) - Terraform, Cloudformation, Kubernetes, Serverless フレームワーク, その他の Infrastructure as Code 言語の構築時に Bridgecrew の Checkov でクラウドの設定ミスを防ぎます。
* [KICS](https://github.com/Checkmarx/kics) - Find security vulnerabilities, compliance issues, and infrastructure misconfigurations early in the development cycle of your infrastructure-as-code with KICS by Checkmarx.
* [puppet-lint](https://github.com/rodjek/puppet-lint) - Puppet マニフェストがスタイルガイドに準拠していることをチェックします。
* [terrascan](https://github.com/accurics/terrascan) - Infrastructure as Code のコンプライアンスとセキュリティ違反を検出して、クラウドネイティブインフラストラクチャをプロビジョニングする前にリスクを軽減します。
* [tflint](https://github.com/terraform-linters/tflint) - プラグ可能な Terraform リンターです。
* [tfsec](https://github.com/tfsec/tfsec) - Terraform コード向けのセキュリティスキャナです。
* [Trivy](https://github.com/aquasecurity/trivy) - Docker, Kubernetes, Terraform, CloudFormation の設定問題を検出するためのビルトインポリシーを提供します。また、Conftest のように Rego で独自のポリシーを記述して JSON, YAML などをスキャンできます。

***

### リンク


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://coky-t.gitbook.io/owasp-devsecops-guideline-ja/v0.3/2-purosesu-process/2-3-birudo-build/2-3-4-infastructure-as-code-sekyuriti-infrastructure-as-code-security/2-3-1-3-infastructure-as-code-scanning.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
