iac-security
БесплатноБез исполняемых скриптовНе проверенInfrastructure-as-Code security for Terraform, CloudFormation, Ansible, Pulumi and similar configuration. USE WHEN: securing Terraform, CloudFormation…
от claude-dev-suite★ 51 звезда на GitHubОб этом скилле
Infrastructure as Code Security Skill
USE WHEN: Securing Terraform, CloudFormation, Ansible, Pulumi, or other IaC configurations. DO NOT USE FOR: General IaC patterns, cloud architecture design, cost optimization.
IaC Security Overview
Common Vulnerability Categories
| Category | Examples |
|---|---|
| Secrets Exposure | Hardcoded API keys, passwords in plaintext |
| Overly Permissive IAM | * actions, * resources |
| Network Exposure | 0.0.0.0/0 ingress, public S3 buckets |
| Missing Encryption | Unencrypted EBS, S3, RDS |
| Logging Disabled | No CloudTrail, no VPC flow logs |
| Resource Misconfig | Default security groups, weak TLS |
Terraform Security
Secrets Management
# Bad: Hardcoded secrets
resource "aws_db_instance" "main" {
password = "mysecretpassword" # Never do this!
}
# Good: Use variables with sensitive flag
variable "db_password" {
type = string
sensitive = true
}
resource "aws_db_instance" "main" {
password = var.db_password
}
# Better: Use AWS Secrets Manager
data "aws_secretsmanager_secret_version" "db" {
secret_id = "production/db/password"
}
resource "aws_db_instance" "main" {
password = jsondecode(data.aws_secretsmanager_secret_version.db.secret_string)["password"]
}
# Best: Use external secrets with SOPS or Vault
data "sops_file" "secrets" {
source_file = "secrets.enc.yaml"
}
resource "aws_db_instance" "main" {
password = data.sops_file.secrets.data["db_password"]
}
IAM Least Privilege
# Bad: Overly permissive
resource "aws_iam_policy" "bad" {
policy = jsonencode({
Version = "2012-10-17"
Statement = [{
Effect = "Allow"
Action = "*"
Resource = "*"
}]
})
}
# Good: Least privilege
resource "aws_iam_policy" "good" {
policy = jsonencode({
Version = "2012-10-17"
Statement = [{
Effect = "Allow"
Action = [
"s3:GetObject",
"s3:PutObject"
]
Resource = [
"${aws_s3_bucket.data.arn}/*"
]
Condition = {
StringEquals = {
"s3:x-amz-acl" = "bucket-owner-full-control"
}
}
}]
})
}
# Good: Use AWS IAM Access Analyzer
resource "aws_accessanalyzer_analyzer" "main" {
analyzer_name = "main"
type = "ACCOUNT"
}
Network Security
# Bad: Open to the world
resource "aws_security_group" "bad" {
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"] # SSH open to internet!
}
}
# Good: Restricted access
resource "aws_security_group" "good" {
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
security_groups = [aws_security_group.bastion.id] # Only from bastion
}
ingress {
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = [var.corporate_cidr] # Only corporate network
}
egress {
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"] # HTTPS egress OK
}
}
Encryption at Rest
# S3 with encryption
resource "aws_s3_bucket" "secure" {
bucket = "my-secure-bucket"
}
resource "aws_s3_bucket_server_side_encryption_configuration" "secure" {
bucket = aws_s3_bucket.secure.id
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "aws:kms"
kms_master_key_id = aws_kms_key.main.arn
}
bucket_key_enabled = true
}
}
resource "aws_s3_bucket_public_access_block" "secure" {
bucket = aws_s3_bucket.secure.id
block_public_acls = true
block_public_policy = true
ignore_public_acls = true
restrict_public_buckets = true
}
# RDS with encryption
resource "aws_db_instance" "secure" {
storage_encrypted = true
kms_key_id = aws_kms_key.rds.arn
# Additional security
deletion_protection = true
skip_final_snapshot = false
# Logging
enabled_cloudwatch_logs_exports = ["postgresql", "upgrade"]
}
# EBS encryption by default
resource "aws_ebs_encryption_by_default" "main" {
enabled = true
}
Logging and Monitoring
# CloudTrail for all regions
resource "aws_cloudtrail" "main" {
name = "main-trail"
s3_bucket_name = aws_s3_bucket.cloudtrail.id
include_global_service_events = true
is_multi_region_trail = true
enable_log_file_validation = true
kms_key_id = aws_kms_key.cloudtrail.arn
event_selector {
read_write_type = "All"
include_management_events = true
data_resource {
type = "AWS::S3::Object"
values = ["arn:aws:s3"]
}
}
}
# VPC Flow Logs
resource "aws_flow_log" "main" {
iam_role_arn = aws_iam_role.flow_log.arn
log_destination = aws_cloudwatch_log_group.flow_log.arn
traffic_type = "ALL"
vpc_id = aws_vpc.main.id
}
CloudFormation Security
Secure Template Patterns
AWS
Установить iac-security в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobBashFAQ
Что делает скилл iac-security?
Infrastructure-as-Code security for Terraform, CloudFormation, Ansible, Pulumi and similar configuration. USE WHEN: securing Terraform, CloudFormation, Ansible, Pulumi, or other IaC configurations DO NOT USE FOR: general IaC patterns, cloud architecture design, cost optimization
Как установить скилл iac-security?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл iac-security запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic