Skip to content

SSZcreate/Pentab_server / .agents/skills/cybersecurity/skills/implementing-cloud-workload-protection

implementing-cloud-workload-protection

Verified

Implements cloud workload protection using boto3 and google-cloud APIs for runtime security monitoring, process anomaly detection, and file integrity checking on EC2/GCE instances. Scans for cryptomining, reverse shells, and unauthorized binaries. Use when building runtime security controls for cloud compute workloads.

FileKindSize
LICENSEother11.0 KB
SKILL.mdskill md2.3 KB
references/api-reference.mdmarkdown1.7 KB
scripts/agent.pyscript6.8 KB

references/api-reference.md

View on GitHub
# API Reference: Implementing Cloud Workload Protection

## AWS SSM Run Command (boto3)

```python
import boto3
ssm = boto3.client("ssm")

# Execute command on instances
resp = ssm.send_command(
    InstanceIds=["i-abc123"],
    DocumentName="AWS-RunShellScript",
    Parameters={"commands": ["ps aux"]},
    TimeoutSeconds=60,
)
command_id = resp["Command"]["CommandId"]

# Get output
output = ssm.get_command_invocation(
    CommandId=command_id, InstanceId="i-abc123"
)
print(output["StandardOutputContent"])
```

## CloudWatch CPU Monitoring

```python
cw = boto3.client("cloudwatch")
resp = cw.get_metric_statistics(
    Namespace="AWS/EC2", MetricName="CPUUtilization",
    Dimensions=[{"Name": "InstanceId", "Value": "i-abc123"}],
    StartTime=start, EndTime=end, Period=300,
    Statistics=["Average"],
)
```

## Key Detection Commands

| Threat | Command |
|--------|---------|
| Cryptominer | `ps aux \| grep -iE 'xmrig\|minerd'` |
| Reverse shell | `ss -tlnp \| grep ESTAB` |
| File integrity | `rpm -Va \| grep '^..5'` |
| Unauthorized binaries | `find /tmp -executable -type f` |
| Cron persistence | `crontab -l; ls /etc/cron.d/` |

## GuardDuty Integration

```python
gd = boto3.client("guardduty")
findings = gd.list_findings(DetectorId="detector-id")
for fid in findings["FindingIds"]:
    detail = gd.get_findings(DetectorId="detector-id", FindingIds=[fid])
    print(detail["Findings"][0]["Type"])
```

### References

- SSM Run Command: https://docs.aws.amazon.com/systems-manager/latest/userguide/run-command.html
- CloudWatch: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/cloudwatch.html
- GuardDuty: https://docs.aws.amazon.com/guardduty/latest/ug/
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 465kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 465kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 465kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 192kUpdated Claude CodeCodexVerifiedInstall