security-group-analyzer
БесплатноБез исполняемых скриптовНе проверенAudit AWS security groups for overly permissive rules and security vulnerabilities. Use when reviewing AWS security, auditing security groups, or improving…
Об этом скилле
Security Group Analyzer
Audit AWS security groups and identify security vulnerabilities.
Quick Start
List security groups, check for 0.0.0.0/0 access, restrict to minimum needed ports and IPs.
Instructions
Security Group Audit Process
- List all security groups
- Identify overly permissive rules
- Check for unused security groups
- Recommend restrictions
- Implement changes
List Security Groups
# List all security groups
aws ec2 describe-security-groups \
--query 'SecurityGroups[].[GroupId,GroupName,Description]' \
--output table
# Get specific security group
aws ec2 describe-security-groups \
--group-ids sg-1234567890abcdef0
Common Security Issues
1. Open to the world (0.0.0.0/0)
Find security groups with unrestricted access:
aws ec2 describe-security-groups \
--filters "Name=ip-permission.cidr,Values=0.0.0.0/0" \
--query 'SecurityGroups[].[GroupId,GroupName,IpPermissions[?IpRanges[?CidrIp==`0.0.0.0/0`]]]'
High-risk ports open to 0.0.0.0/0:
- 22 (SSH)
- 3389 (RDP)
- 3306 (MySQL)
- 5432 (PostgreSQL)
- 27017 (MongoDB)
- 6379 (Redis)
2. Unrestricted outbound rules
Default security groups allow all outbound traffic. Restrict if possible:
# Check outbound rules
aws ec2 describe-security-groups \
--group-ids sg-1234567890abcdef0 \
--query 'SecurityGroups[].IpPermissionsEgress'
3. Unused security groups
Find security groups not attached to any resources:
# List all security groups
aws ec2 describe-security-groups --query 'SecurityGroups[].GroupId' > all-sgs.txt
# List security groups in use
aws ec2 describe-instances --query 'Reservations[].Instances[].SecurityGroups[].GroupId' > used-sgs.txt
aws rds describe-db-instances --query 'DBInstances[].VpcSecurityGroups[].VpcSecurityGroupId' >> used-sgs.txt
# Compare to find unused
Security Best Practices
Principle of least privilege:
- Only allow necessary ports
- Restrict source IPs to minimum needed
- Use security group references instead of CIDR blocks
SSH/RDP access:
# Bad: Open to world
0.0.0.0/0 on port 22
# Good: Restrict to office IP
203.0.113.0/24 on port 22
# Better: Use bastion host or AWS Systems Manager Session Manager
Database access:
# Bad: Open to world
0.0.0.0/0 on port 3306
# Good: Only from application security group
sg-app-12345678 on port 3306
Web servers:
# Acceptable: HTTP/HTTPS from anywhere
0.0.0.0/0 on port 80, 443
# But use CloudFront or ALB for additional protection
Restricting Security Groups
Remove overly permissive rule:
# Revoke SSH from anywhere
aws ec2 revoke-security-group-ingress \
--group-id sg-1234567890abcdef0 \
--protocol tcp \
--port 22 \
--cidr 0.0.0.0/0
Add restricted rule:
# Allow SSH only from office
aws ec2 authorize-security-group-ingress \
--group-id sg-1234567890abcdef0 \
--protocol tcp \
--port 22 \
--cidr 203.0.113.0/24
Use security group references:
# Allow traffic from another security group
aws ec2 authorize-security-group-ingress \
--group-id sg-database-12345678 \
--protocol tcp \
--port 3306 \
--source-group sg-app-12345678
Security Group Rules
Inbound rules structure:
- Protocol: TCP, UDP, ICMP, or All
- Port range: Single port or range
- Source: CIDR block or security group
Example secure configuration:
Web tier (ALB):
Inbound:
- HTTP (80) from 0.0.0.0/0
- HTTPS (443) from 0.0.0.0/0
Outbound:
- All traffic to app-tier-sg
App tier:
Inbound:
- Port 8080 from web-tier-sg
Outbound:
- Port 3306 to db-tier-sg
- HTTPS (443) to 0.0.0.0/0 (for external APIs)
Database tier:
Inbound:
- Port 3306 from app-tier-sg
Outbound:
- None (or minimal)
Audit Checklist
Critical issues:
- SSH (22) open to 0.0.0.0/0
- RDP (3389) open to 0.0.0.0/0
- Database ports open to 0.0.0.0/0
- All ports open to 0.0.0.0/0
High priority:
- Unused security groups
- Overly broad CIDR ranges
- Unnecessary outbound rules
- Missing descriptions
Best practices:
- Use security group references
- Tag security groups
- Document purpose
- Regular audits
Common Patterns
Bastion host:
Bastion SG:
Inbound:
- SSH (22) from office IP only
Private instance SG:
Inbound:
- SSH (22) from bastion-sg only
Load balancer pattern:
ALB SG:
Inbound:
- HTTP/HTTPS from 0.0.0.0/0
App SG:
Inbound:
- App port from alb-sg only
Database pattern:
DB SG:
Inbound:
- DB port from app-sg only
- DB port from bastion-sg (for admin)
Monitoring and Alerts
CloudWatch Events for security group changes:
{
"source": ["aws.ec2"],
"detail-type": ["AWS API Call via CloudTrail"],
"detail": {
"eventName": [
"AuthorizeSecurityGroupIngress",
"RevokeSecurityGroupIngress"
]
}
}
AWS Config rules:
- re
Установить security-group-analyzer в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл security-group-analyzer?
Audit AWS security groups for overly permissive rules and security vulnerabilities. Use when reviewing AWS security, auditing security groups, or improving network security posture.
Как установить скилл security-group-analyzer?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл security-group-analyzer запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic