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.
What this skill does
# 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
1. **List all security groups**
2. **Identify overly permissive rules**
3. **Check for unused security groups**
4. **Recommend restrictions**
5. **Implement changes**
### List Security Groups
```bash
# 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:
```bash
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:
```bash
# 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:
```bash
# 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:**
```bash
# 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:**
```bash
# 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:**
```bash
# 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:**
```bash
# 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:**
```bash
# 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:**
```bash
# 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:**
```json
{
"source": ["aws.ec2"],
"detail-type": ["AWS API Call via CloudTrail"],
"detail": {
"eventName": [
"AuthorizeSecurityGroupIngress",
"RevokeSecurityGroupIngress"
]
}
}
```
**AWS Config rules:**
- restricted-ssh: Checks for SSH from 0.0.0.0/0
- restricted-common-ports: Checks for common ports
- vpc-sg-open-only-to-authorized-ports
### Remediation Steps
**For SSH/RDP open to world:**
1. Identify who needs access
2. Get their IP addresses
3. Restrict to those IPs
4. Or use AWS Systems Manager Session Manager
**For database ports open:**
1. Identify application security groups
2. Remove 0.0.0.0/0 rule
3. Add security group reference rules
4. Test connectivity
**For unused security groups:**
1. Verify not in use
2. Document before deletion
3. Delete security group
4. Monitor for issues
### Tools
**AWS Security Hub:**
- Automated security checks
- Compliance standards
- Findings aggregation
**AWS Config:**
- Track security group changes
- Compliance rules
- Automated remediation
**Third-party tools:**
- Prowler (open source)
- CloudMapper
- ScoutSuite
### Example Audit Report
```
Security Group Audit Report
===========================
Critical Issues:
- sg-12345678: SSH (22) open to 0.0.0.0/0
- sg-23456789: MySQL (3306) open to 0.0.0.0/0
High Priority:
- sg-34567890: Unused security group
- sg-45678901: RDP from broad CIDR (10.0.0.0/8)
Recommendations:
1. Restrict SSH to office IP: 203.0.113.0/24
2. Restrict MySQL to app security group: sg-app-12345
3. Delete unused security group: sg-34567890
4. Narrow RDP access to specific subnet
Estimated risk reduction: High
```
## Best Practices
**Regular audits:**
- Weekly: Check for new overly permissive rules
- Monthly: Review all security groups
- Quarterly: Clean up unused security groups
**Documentation:**
- Add descriptions to all security groups
- Document purpose of each rule
- Tag security groups by environment/project
**Automation:**
- Use AWS Config for continuous monitoring
- Set up CloudWatch alarms for changes
- Automate remediation where possible
**Defense in depth:**
- Security groups are one layer
- Also use NACLs, WAF, Shield
- Implement application-level security
Related in Cloud & DevOps
appbuilder-action-scaffolder
IncludedCreate, implement, deploy, and debug Adobe Runtime actions with consistent layout, validation, and error handling. Use this skill whenever the user needs to add actions to an App Builder project, understand action structure (params, response format, web/raw actions), configure actions in the manifest, use App Builder SDKs (State, Files, Events, database), deploy and invoke actions via CLI, debug action issues, or implement patterns such as webhook receivers, custom event providers, journaling consumers, large payload redirects, action sequence pipelines, and Asset Compute workers. Also trigger when users mention serverless functions in Adobe context, action logging, IMS authentication for actions, or cron-style scheduled actions.
orchestrating-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. Use this skill when the user needs a multi-step Data Cloud pipeline, cross-phase troubleshooting, or data space and data kit management. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase sf data360 workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching phase-specific skill), the task is STDM/session tracing/parquet telemetry (use observing-agentforce), standard CRM SOQL (use querying-soql), or Apex implementation (use generating-apex).
github-project-automation
IncludedAutomate GitHub repository setup with CI/CD workflows, issue templates, Dependabot, and CodeQL security scanning. Includes 12 production-tested workflows and prevents 18 errors: YAML syntax, action pinning, and configuration. Use when: setting up GitHub Actions CI/CD, creating issue/PR templates, enabling Dependabot or CodeQL scanning, deploying to Cloudflare Workers, implementing matrix testing, or troubleshooting YAML indentation, action version pinning, secrets syntax, runner versions, or CodeQL configuration. Keywords: github actions, github workflow, ci/cd, issue templates, pull request templates, dependabot, codeql, security scanning, yaml syntax, github automation, repository setup, workflow templates, github actions matrix, secrets management, branch protection, codeowners, github projects, continuous integration, continuous deployment, workflow syntax error, action version pinning, runner version, github context, yaml indentation error
sf-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase `sf data360` workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching sf-datacloud-* skill), the task is STDM/session tracing/parquet telemetry (use sf-ai-agentforce-observability), standard CRM SOQL (use sf-soql), or Apex implementation (use sf-apex).
fabric-cli
IncludedUse this skill for Fabric.so CLI workflows with the `fabric` terminal command: diagnose/install/login, search or browse a Fabric library, save notes/links/files, create folders, ask the Fabric AI assistant, manage tasks/workspaces, generate shell completion, check subscription usage, produce JSON output, and use Fabric as persistent agent memory. Do not use for Microsoft Fabric/Azure/Power BI `fab`, Daniel Miessler's Fabric framework, Python Fabric SSH, Fabric.js, or textile/fashion fabric.
lark
IncludedLark/Feishu CLI skills: lark-cli operations for docs, markdown, sheets, base, calendar, im, mail, task, okr, drive, wiki, slides, whiteboard, apps, approval, attendance, contact, vc, minutes, event. Use when the user needs to operate Lark/Feishu resources via lark-cli, send messages, manage documents, spreadsheets, calendars, tasks, OKRs, deploy web pages, or any Feishu/Lark workspace operations.