[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6D25TVBK2T5RHDH4ZMJY4KG":3,"skill-same:01M6D25TVBK2T5RHDH4ZMJY4KG":67},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":49,"ownerHtmlUrl":50,"ownerBlogUrl":49,"ownerDescription":51,"updatedAt":52,"install":53,"resources":66},"01M6D25TVBK2T5RHDH4ZMJY4KG","security-infra",null,"Reviewing infrastructure and deployment security: cloud IAM and public exposure, storage buckets, security groups, instance metadata, container and Kubernetes privileges, network policies, TLS configuration, exposed admin panels and databases, logging and audit trails, and backup protection. Read before reviewing cloud, container or server configuration.","enowdev\u002Fenowxcli","enowdev","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F179420349?v=4","01M6D1MVX2KC0X3Z9NESE7P22K","Enow Dev.","01M6D1MW1FMZGBDKWAJY4GQX81",67,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fsecurity-infra\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"security","security infra","infra","tls","kubernetes","storage","protection","databases","tls configuration","container","read","backup","infrastructure","iam","network","server","audit","admin","logging","deployment","2026-11-10 10:12:30",false,"---\nname: security-infra\ndescription: \"Reviewing infrastructure and deployment security: cloud IAM and public exposure, storage buckets, security groups, instance metadata, container and Kubernetes privileges, network policies, TLS configuration, exposed admin panels and databases, logging and audit trails, and backup protection. Read before reviewing cloud, container or server configuration.\"\n---\n\n# Infrastructure and deployment review\n\nThe naive review runs a cloud scanner and pastes four hundred lines, or\n\"fixes\" a security group live. It misses the PostgreSQL port that Docker\npublished on every interface past the firewall, the Docker socket mounted\ninto the web container, the CI role with `*` on `*`, IMDSv1 one SSRF away\nfrom the instance's keys, and backups in a bucket anyone can list. This is\nwhat to check in configuration and with read-only commands, how to rate it,\nand the rule that you never change live infrastructure. The rules to build by\nare in `devops-security`; the audit method in `security`.\n\n## 1. Rules of engagement\n\n- Read the configuration in the repository first: Terraform or OpenTofu,\n  CloudFormation, CDK, Pulumi, Helm, Kubernetes manifests, Dockerfiles,\n  compose files, nginx, Caddy or Traefik config, Ansible, platform files\n  (`fly.toml`, `vercel.json`, `render.yaml`). Say whether you reviewed code\n  or what runs: they drift.\n- Live checks only with credentials the owner gave for it, read-only: AWS\n  `SecurityAudit` plus `ViewOnlyAccess`, GCP `roles\u002Fiam.securityReviewer`\n  plus `roles\u002Fviewer`, Azure Reader plus Security Reader. First\n  `aws sts get-caller-identity`, to know which account you are in.\n- Describe, list and get only: never `apply`, `create`, `put`, `modify`,\n  `delete`, `kubectl apply`, `edit` or `exec`, `docker stop` or `rm`. No port\n  scans of hosts nobody asked you to test.\n- No secret values: not `aws secretsmanager get-secret-value`,\n  `kubectl get secret -o yaml`, plain `docker inspect` (it prints the\n  environment), `terraform output` or `terraform show` (state holds secrets).\n  `kubectl get secrets` lists names; `docker inspect --format` shows only\n  the fields asked for.\n\n## 2. Identity and access\n\n- **Wildcards**: `\"Action\": \"*\"` or `\"s3:*\"` with `\"Resource\": \"*\"`;\n  `iam:PassRole` on `*`; `AdministratorAccess` on a workload or CI role; a\n  role able to change its own policies (`iam:PutRolePolicy`,\n  `iam:AttachRolePolicy`, `iam:CreatePolicyVersion`), which is admin in\n  disguise.\n- **Trust**: `\"Principal\": \"*\"` or `{\"AWS\": \"*\"}` with no condition; a CI\n  OIDC trust on `token.actions.githubusercontent.com` without a `sub`\n  condition naming the repository and branch or environment, and `aud`\n  equal to `sts.amazonaws.com`.\n- **Keys**: long-lived access keys for workloads instead of instance\n  profiles, ECS task roles, EKS Pod Identity or IRSA, GCP workload identity,\n  Azure managed identities; keys unused or older than 90 days; a root user\n  with access keys or no MFA (`aws iam get-account-summary`:\n  `AccountAccessKeysPresent`, `AccountMFAEnabled`).\n- Humans through SSO with MFA; no shared users; break-glass accounts\n  monitored.\n- **GCP**: `roles\u002Fowner` or `roles\u002Feditor` on service accounts (the default\n  compute service account has Editor), downloaded service account keys,\n  `allUsers` or `allAuthenticatedUsers` bindings. **Azure**: Owner or\n  Contributor at subscription scope for applications, client secrets where a\n  managed identity would do.\n- Tools: IAM Access Analyzer (public, cross-account and unused access),\n  Cloudsplaining for policies, Prowler.\n\n```sh\nrg -n '\"Action\"\\s*:\\s*\"(\\*|[a-z0-9-]+:\\*)\"|\"Resource\"\\s*:\\s*\"\\*\"|\"Principal\"\\s*:\\s*(\"\\*\"|\\{\\s*\"AWS\"\\s*:\\s*\"\\*\")|iam:PassRole|AdministratorAccess' .\nrg -n 'actions\\s*=\\s*\\[\\s*\"\\*\"|token\\.actions\\.githubusercontent\\.com|roles\u002F(owner|editor)|allUsers|allAuthenticatedUsers' -g '*.tf' -g '*.json' -g '*.y*ml' .\n```\n\n## 3. Public exposure\n\n- Rules open to `0.0.0.0\u002F0` or `::\u002F0` on admin and data ports: 22 (SSH),\n  3389 (RDP), 5432 (PostgreSQL), 3306 (MySQL), 1433 (SQL Server), 27017\n  (MongoDB), 6379 (Redis), 9200 (Elasticsearch, OpenSearch), 5601 (Kibana),\n  11211 (memcached), 2375 and 2376 (Docker API), 6443 (Kubernetes API),\n  10250 (kubelet), 2379 (etcd), 15672 (RabbitMQ), 9090 (Prometheus), 8080\n  (Jenkins and many dashboards).\n- **Docker and the firewall**: `ports: - \"5432:5432\"` binds every interface,\n  and Docker's own iptables rules bypass ufw. Publish on\n  `127.0.0.1:5432:5432` or not at all (an internal network). The commonest\n  exposure on a single server.\n- **Storage**: bucket policies with `\"Principal\": \"*\"`, public ACLs, Block\n  Public Access turned off (on by default for new S3 buckets since 2023);\n  GCS `allUsers`; Azure containers with anonymous access; public EBS or RDS\n  snapshots and AMIs; presigned URLs to private data valid for days.\n- **Admin panels on the internet**: database consoles (phpMyAdmin, Adminer,\n  pgAdmin), queue and cache dashboards, the Kubernetes dashboard, Grafana\n  with default credentials, deployment panels without MFA.\n- **Dangling DNS**: a CNAME to a deleted bucket, app or page can be claimed\n  by someone else (subdomain takeover).\n\n```sh\nrg -n '0\\.0\\.0\\.0\u002F0|::\u002F0' -g '*.tf' -g '*.json' -g '*.y*ml' .\nrg -n '^\\s*-\\s*\"?\\d+:\\d+' -g '*compose*.y*ml' .     # ports published on every interface\naws ec2 describe-security-groups --query \"SecurityGroups[?IpPermissions[?contains(IpRanges[].CidrIp, '0.0.0.0\u002F0')]].[GroupId,GroupName]\" --output text\naws s3api get-public-access-block --bucket name\n```\n\n## 4. Instance metadata\n\n- IMDSv2 required (`HttpTokens: required`) with a hop limit of 1 on hosts\n  (2 only where containers must reach it and have no role of their own);\n  Terraform `metadata_options { http_tokens = \"required\" }`; the account\n  default set with `aws ec2 modify-instance-metadata-defaults` (the owner's\n  change to make).\n- `aws ec2 describe-instances --query \"Reservations[].Instances[].[InstanceId,MetadataOptions.HttpTokens,MetadataOptions.HttpPutResponseHopLimit]\" --output text`\n- GCP and Azure metadata need a header (`Metadata-Flavor: Google`,\n  `Metadata: true`): that stops a naive SSRF, not one that can set headers.\n- Pods with their own identity (EKS Pod Identity or IRSA, GKE Workload\n  Identity) and a network policy blocking `169.254.169.254`. The SSRF side\n  is in `security-web` section 5.\n\n## 5. Containers\n\n- **Privilege**: no `USER` in the Dockerfile, or `USER root`; `privileged`;\n  `cap_add` of `SYS_ADMIN`, `NET_ADMIN` or `ALL`; `network_mode: host`,\n  `pid: host`; seccomp or AppArmor `unconfined`; the Docker socket mounted\n  (`\u002Fvar\u002Frun\u002Fdocker.sock` is root on the host); host paths such as `\u002F`,\n  `\u002Fetc` or `\u002Froot` mounted; a writable root filesystem where\n  `read_only: true` with a `tmpfs` would do.\n- **Images**: `latest` tags, unknown registries, `ADD` from a URL, secrets in\n  `ENV` or layers (`security-secrets`), compilers left in the runtime image.\n  grype, `docker scout cves` and dockle scan images as trivy does; rootless\n  Docker or Podman narrows what a breakout gains.\n\n```sh\nrg -n 'privileged|docker\\.sock|cap_add|SYS_ADMIN|network_mode:\\s*host|pid:\\s*host|unconfined|hostPath|hostNetwork|hostPID|allowPrivilegeEscalation:\\s*true|runAsUser:\\s*0' .\nrg --files-without-match '^USER\\s' -g '*Dockerfile*' .\nhadolint Dockerfile && trivy config . && trivy image name:tag\ndocker ps --format '{{.Names}} {{.Image}} {{.Ports}}'\ndocker inspect --format '{{.Name}} user={{.Config.User}} privileged={{.HostConfig.Privileged}} binds={{json .HostConfig.Binds}}' $(docker ps -q)\n```\n\n## 6. Kubernetes\n\n- **RBAC**: `cluster-admin` bound to service accounts or to\n  `system:authenticated`, `system:unauthenticated` or `system:anonymous`;\n  wildcard verbs or resources; `get`, `list` or `watch` on `secrets` granted\n  widely (`list` returns the values); `create` on pods (runs as any service\n  account in the namespace), `pods\u002Fexec`, `escalate`, `bind`, `impersonate`,\n  `nodes\u002Fproxy`.\n- `automountServiceAccountToken: false` where pods never call the API.\n- **Pod security**: namespaces labelled\n  `pod-security.kubernetes.io\u002Fenforce: restricted` (`baseline` at least);\n  `runAsNonRoot: true`, `allowPrivilegeEscalation: false`,\n  `readOnlyRootFilesystem: true`, capabilities dropped (`ALL`), seccomp\n  `RuntimeDefault`; no `hostNetwork`, `hostPID`, `hostIPC` or `hostPath`.\n- **NetworkPolicies**: a default deny for ingress (and egress where\n  practical) in each namespace. They do nothing unless the CNI enforces them\n  (Calico and Cilium do, plain flannel does not).\n- **Secrets**: base64 in etcd unless encryption at rest is configured\n  (managed services differ); External Secrets or the CSI secrets driver\n  rather than manifests in git; nothing secret in ConfigMaps.\n- **Admission**: Kyverno, OPA Gatekeeper or the built-in\n  ValidatingAdmissionPolicy (GA in 1.30) enforcing the above.\n- **Control plane**: the API server private or limited to known networks,\n  anonymous auth off, kubelet with `--anonymous-auth=false` and webhook\n  authorisation, etcd and dashboards not exposed.\n\n```sh\nkubectl get clusterrolebindings -o wide\nkubectl auth can-i --list --as=system:serviceaccount:app:default -n app\nkubectl get ns -L pod-security.kubernetes.io\u002Fenforce\nkubectl get networkpolicy -A\n```\n\nTools: `kubescape scan`, `trivy k8s --report summary`, `kube-linter lint`\nand Polaris for manifests; `kube-bench` (the CIS benchmark) runs as a Job\non the nodes, so the owner starts it. kube-hunter is unmaintained and probes\nthe network: only when the owner asks.\n\n## 7. TLS\n\n- TLS 1.2 minimum, 1.3 preferred; no SSLv3, TLS 1.0 or 1.1; Mozilla's\n  \"intermediate\" profile for ciphers; a full chain; renewal automated\n  (public certificate lifetimes fall to 200 days from March 2026, 100 in\n  2027 and 47 in 2029, so manual renewal will fail).\n- HSTS on HTTPS responses: `max-age=31536000; includeSubDomains`, and\n  `preload` once every subdomain serves HTTPS.\n- Plain text inside: database connections with `sslmode=disable` or\n  `require` (encrypts, verifies nothing; `verify-full` checks the host),\n  Redis without TLS between hosts, service-to-service HTTP across networks\n  carrying tokens.\n- An origin behind a CDN reachable directly by IP skips the WAF and the TLS\n  settings: allow only the CDN's ranges, authenticated origin pulls, or a\n  tunnel.\n- For hosts in scope, the last two commands below; testssl.sh for a full\n  pass, with permission.\n\n```sh\nrg -n 'sslmode=(disable|allow|prefer|require)\\b|ssl\\s*[:=]\\s*false|tls\\s*[:=]\\s*false|InsecureSkipVerify|rejectUnauthorized:\\s*false' .\nopenssl s_client -connect host:443 -servername host -tls1_1 \u003C\u002Fdev\u002Fnull   # must fail\ncurl -sI https:\u002F\u002Fhost | grep -i strict-transport-security\n```\n\n## 8. Databases, caches and the edge\n\n- No public endpoint (RDS `PubliclyAccessible`, a managed database allowing\n  `0.0.0.0\u002F0`); authentication on (Redis `requirepass` or ACLs with\n  `protected-mode yes`, MongoDB `security.authorization: enabled`,\n  Elasticsearch security, on by default since 8.0); private interfaces; TLS;\n  encryption at rest; default passwords changed.\n- The application's database user is not a superuser or the schema owner;\n  migrations run as another user; reporting reads through a read-only one.\n- nginx: `autoindex on`; the project root as `root` (serving `.env` and\n  `.git`); a `location` without a trailing slash with an `alias` that has\n  one lets a request climb a directory; `server_tokens on` (low).\n- Traefik `api.insecure=true` publishes its dashboard without auth; Caddy's\n  admin API stays on localhost.\n- The app trusts `X-Forwarded-For` only from its own proxy\n  (`security-web` section 13); body limits and timeouts at the edge.\n\n```sh\nrg -n 'autoindex\\s+on|\\balias\\s|server_tokens\\s+on|api\\.insecure|PubliclyAccessible|publicly_accessible\\s*=\\s*true|protected-mode\\s+no' .\n```\n\n## 9. Logging and audit\n\n- AWS CloudTrail as a multi-region or organisation trail with log file\n  validation, delivered to a bucket in a separate account; GuardDuty on.\n  GCP Admin Activity logs are always on, Data Access logs are off by\n  default. Azure Activity Log exported, Defender for Cloud on. Kubernetes\n  audit logging on (EKS control plane logs are off by default).\n- Retention long enough for an investigation (a year is common: breaches\n  are often found months later), and logs out of reach of the accounts they\n  record.\n- Alerts on root or break-glass sign-in, IAM and security group changes,\n  logging turned off, new access keys (the CIS benchmarks list them).\n- Application audit trails: `backend-auth` section 7; personal data in\n  logs: `security-privacy`.\n\n## 10. Backups\n\n- Encrypted, in a separate account or project that production credentials\n  cannot write to or delete from; immutable where ransomware matters (S3\n  Object Lock in compliance mode, AWS Backup Vault Lock, GCS retention\n  locks, Azure immutable blob storage).\n- Three copies, two media, one off-site; a dump never in the web root or a\n  public bucket.\n- A restore tested on a schedule, with the date of the last one known; a\n  backup never restored is a hope. Retention matches the privacy policy.\n\n## 11. Tools and rating\n\n| Tool | Covers |\n|---|---|\n| Prowler (`prowler aws`, also `azure`, `gcp`, `kubernetes`) | CIS and best-practice checks for a whole account |\n| ScoutSuite | A multi-cloud configuration report |\n| `checkov -d .` | Terraform, CloudFormation, Kubernetes, Helm, Dockerfiles |\n| `trivy config .` | IaC and Dockerfile misconfiguration (tfsec's checks now live here) |\n| kubescape, kube-bench | Kubernetes posture, CIS benchmark |\n| hadolint, dockle | Dockerfile and image practice |\n\n- **Critical**: a database, cache, Docker API or dashboard reachable from the\n  internet without auth or with data; admin-equivalent credentials usable by\n  an outsider; a public bucket of personal data.\n- **High**: wildcard admin on an internet-facing workload; IMDSv1 behind an\n  SSRF; a privileged container or the Docker socket in an internet-facing\n  service; CI OIDC trust without `sub`; SSH open to the world with\n  passwords.\n- **Medium**: no network policies; root containers with no other flaw; TLS\n  1.0 enabled; audit logging off; untested backups.\n- **Low**: version banners, missing HSTS preload, tags instead of digests.\n\n## Check it\n\n- Every port the configuration exposes is in the report with its reason, or\n  flagged for the owner to confirm.\n- Each workload's identity and permissions are listed, and none is admin.\n- Every finding names the file and line or the resource id, and whether it\n  came from code or a live read.\n- Nothing was changed: your shell history holds only reads.\n\n## Avoid\n\nChanging live infrastructure to \"fix\" something; printing secrets with\n`docker inspect`, `kubectl get secret -o yaml` or `terraform output`; port\nscans nobody asked for; scanner output as the report; `0.0.0.0` ports in\ncompose on a public server; `*` on `*`; the Docker socket in an app\ncontainer; IMDSv1; network policies without a CNI that enforces them;\nbackups the production role can delete.\n","# Infrastructure and deployment review\n\nThe naive review runs a cloud scanner and pastes four hundred lines, or\n\"fixes\" a security group live. It misses the PostgreSQL port that Docker\npublished on every interface past the firewall, the Docker socket mounted\ninto the web container, the CI role with `*` on `*`, IMDSv1 one SSRF away\nfrom the instance's keys, and backups in a bucket anyone can list. This is\nwhat to check in configuration and with read-only commands, how to rate it,\nand the rule that you never change live infrastructure. The rules to build by\nare in `devops-security`; the audit method in `security`.\n\n## 1. Rules of engagement\n\n- Read the configuration in the repository first: Terraform or OpenTofu,\n  CloudFormation, CDK, Pulumi, Helm, Kubernetes manifests, Dockerfiles,\n  compose files, nginx, Caddy or Traefik config, Ansible, platform files\n  (`fly.toml`, `vercel.json`, `render.yaml`). Say whether you reviewed code\n  or what runs: they drift.\n- Live checks only with credentials the owner gave for it, read-only: AWS\n  `SecurityAudit` plus `ViewOnlyAccess`, GCP `roles\u002Fiam.securityReviewer`\n  plus `roles\u002Fviewer`, Azure Reader plus Security Reader. First\n  `aws sts get-caller-identity`, to know which account you are in.\n- Describe, list and get only: never `apply`, `create`, `put`, `modify`,\n  `delete`, `kubectl apply`, `edit` or `exec`, `docker stop` or `rm`. No port\n  scans of hosts nobody asked you to test.\n- No secret values: not `aws secretsmanager get-secret-value`,\n  `kubectl get secret -o yaml`, plain `docker inspect` (it prints the\n  environment), `terraform output` or `terraform show` (state holds secrets).\n  `kubectl get secrets` lists names; `docker inspect --format` shows only\n  the fields asked for.\n\n## 2. Identity and access\n\n- **Wildcards**: `\"Action\": \"*\"` or `\"s3:*\"` with `\"Resource\": \"*\"`;\n  `iam:PassRole` on `*`; `AdministratorAccess` on a workload or CI role; a\n  role able to change its own policies (`iam:PutRolePolicy`,\n  `iam:AttachRolePolicy`, `iam:CreatePolicyVersion`), which is admin in\n  disguise.\n- **Trust**: `\"Principal\": \"*\"` or `{\"AWS\": \"*\"}` with no condition; a CI\n  OIDC trust on `token.actions.githubusercontent.com` without a `sub`\n  condition naming the repository and branch or environment, and `aud`\n  equal to `sts.amazonaws.com`.\n- **Keys**: long-lived access keys for workloads instead of instance\n  profiles, ECS task roles, EKS Pod Identity or IRSA, GCP workload identity,\n  Azure managed identities; keys unused or older than 90 days; a root user\n  with access keys or no MFA (`aws iam get-account-summary`:\n  `AccountAccessKeysPresent`, `AccountMFAEnabled`).\n- Humans through SSO with MFA; no shared users; break-glass accounts\n  monitored.\n- **GCP**: `roles\u002Fowner` or `roles\u002Feditor` on service accounts (the default\n  compute service account has Editor), downloaded service account keys,\n  `allUsers` or `allAuthenticatedUsers` bindings. **Azure**: Owner or\n  Contributor at subscription scope for applications, client secrets where a\n  managed identity would do.\n- Tools: IAM Access Analyzer (public, cross-account and unused access),\n  Cloudsplaining for policies, Prowler.\n\n```sh\nrg -n '\"Action\"\\s*:\\s*\"(\\*|[a-z0-9-]+:\\*)\"|\"Resource\"\\s*:\\s*\"\\*\"|\"Principal\"\\s*:\\s*(\"\\*\"|\\{\\s*\"AWS\"\\s*:\\s*\"\\*\")|iam:PassRole|AdministratorAccess' .\nrg -n 'actions\\s*=\\s*\\[\\s*\"\\*\"|token\\.actions\\.githubusercontent\\.com|roles\u002F(owner|editor)|allUsers|allAuthenticatedUsers' -g '*.tf' -g '*.json' -g '*.y*ml' .\n```\n\n## 3. Public exposure\n\n- Rules open to `0.0.0.0\u002F0` or `::\u002F0` on admin and data ports: 22 (SSH),\n  3389 (RDP), 5432 (PostgreSQL), 3306 (MySQL), 1433 (SQL Server), 27017\n  (MongoDB), 6379 (Redis), 9200 (Elasticsearch, OpenSearch), 5601 (Kibana),\n  11211 (memcached), 2375 and 2376 (Docker API), 6443 (Kubernetes API),\n  10250 (kubelet), 2379 (etcd), 15672 (RabbitMQ), 9090 (Prometheus), 8080\n  (Jenkins and many dashboards).\n- **Docker and the firewall**: `ports: - \"5432:5432\"` binds every interface,\n  and Docker's own iptables rules bypass ufw. Publish on\n  `127.0.0.1:5432:5432` or not at all (an internal network). The commonest\n  exposure on a single server.\n- **Storage**: bucket policies with `\"Principal\": \"*\"`, public ACLs, Block\n  Public Access turned off (on by default for new S3 buckets since 2023);\n  GCS `allUsers`; Azure containers with anonymous access; public EBS or RDS\n  snapshots and AMIs; presigned URLs to private data valid for days.\n- **Admin panels on the internet**: database consoles (phpMyAdmin, Adminer,\n  pgAdmin), queue and cache dashboards, the Kubernetes dashboard, Grafana\n  with default credentials, deployment panels without MFA.\n- **Dangling DNS**: a CNAME to a deleted bucket, app or page can be claimed\n  by someone else (subdomain takeover).\n\n```sh\nrg -n '0\\.0\\.0\\.0\u002F0|::\u002F0' -g '*.tf' -g '*.json' -g '*.y*ml' .\nrg -n '^\\s*-\\s*\"?\\d+:\\d+' -g '*compose*.y*ml' .     # ports published on every interface\naws ec2 describe-security-groups --query \"SecurityGroups[?IpPermissions[?contains(IpRanges[].CidrIp, '0.0.0.0\u002F0')]].[GroupId,GroupName]\" --output text\naws s3api get-public-access-block --bucket name\n```\n\n## 4. Instance metadata\n\n- IMDSv2 required (`HttpTokens: required`) with a hop limit of 1 on hosts\n  (2 only where containers must reach it and have no role of their own);\n  Terraform `metadata_options { http_tokens = \"required\" }`; the account\n  default set with `aws ec2 modify-instance-metadata-defaults` (the owner's\n  change to make).\n- `aws ec2 describe-instances --query \"Reservations[].Instances[].[InstanceId,MetadataOptions.HttpTokens,MetadataOptions.HttpPutResponseHopLimit]\" --output text`\n- GCP and Azure metadata need a header (`Metadata-Flavor: Google`,\n  `Metadata: true`): that stops a naive SSRF, not one that can set headers.\n- Pods with their own identity (EKS Pod Identity or IRSA, GKE Workload\n  Identity) and a network policy blocking `169.254.169.254`. The SSRF side\n  is in `security-web` section 5.\n\n## 5. Containers\n\n- **Privilege**: no `USER` in the Dockerfile, or `USER root`; `privileged`;\n  `cap_add` of `SYS_ADMIN`, `NET_ADMIN` or `ALL`; `network_mode: host`,\n  `pid: host`; seccomp or AppArmor `unconfined`; the Docker socket mounted\n  (`\u002Fvar\u002Frun\u002Fdocker.sock` is root on the host); host paths such as `\u002F`,\n  `\u002Fetc` or `\u002Froot` mounted; a writable root filesystem where\n  `read_only: true` with a `tmpfs` would do.\n- **Images**: `latest` tags, unknown registries, `ADD` from a URL, secrets in\n  `ENV` or layers (`security-secrets`), compilers left in the runtime image.\n  grype, `docker scout cves` and dockle scan images as trivy does; rootless\n  Docker or Podman narrows what a breakout gains.\n\n```sh\nrg -n 'privileged|docker\\.sock|cap_add|SYS_ADMIN|network_mode:\\s*host|pid:\\s*host|unconfined|hostPath|hostNetwork|hostPID|allowPrivilegeEscalation:\\s*true|runAsUser:\\s*0' .\nrg --files-without-match '^USER\\s' -g '*Dockerfile*' .\nhadolint Dockerfile && trivy config . && trivy image name:tag\ndocker ps --format '{{.Names}} {{.Image}} {{.Ports}}'\ndocker inspect --format '{{.Name}} user={{.Config.User}} privileged={{.HostConfig.Privileged}} binds={{json .HostConfig.Binds}}' $(docker ps -q)\n```\n\n## 6. Kubernetes\n\n- **RBAC**: `cluster-admin` bound to service accounts or to\n  `system:authenticated`, `system:unauthenticated` or `system:anonymous`;\n  wildcard verbs or resources; `get`, `list` or `watch` on `secrets` granted\n  widely (`list` returns the values); `create` on pods (runs as any service\n  account in the namespace), `pods\u002Fexec`, `escalate`, `bind`, `impersonate`,\n  `nodes\u002Fproxy`.\n- `automountServiceAccountToken: false` where pods never call the API.\n- **Pod security**: namespaces labelled\n  `pod-security.kubernetes.io\u002Fenforce: restricted` (`baseline` at least);\n  `runAsNonRoot: true`, `allowPrivilegeEscalation: false`,\n  `readOnlyRootFilesystem: true`, capabilities dropped (`ALL`), seccomp\n  `RuntimeDefault`; no `hostNetwork`, `hostPID`, `hostIPC` or `hostPath`.\n- **NetworkPolicies**: a default deny for ingress (and egress where\n  practical) in each namespace. They do nothing unless the CNI enforces them\n  (Calico and Cilium do, plain flannel does not).\n- **Secrets**: base64 in etcd unless encryption at rest is configured\n  (managed services differ); External Secrets or the CSI secrets driver\n  rather than manifests in git; nothing secret in ConfigMaps.\n- **Admission**: Kyverno, OPA Gatekeeper or the built-in\n  ValidatingAdmissionPolicy (GA in 1.30) enforcing the above.\n- **Control plane**: the API server private or limited to known networks,\n  anonymous auth off, kubelet with `--anonymous-auth=false` and webhook\n  authorisation, etcd and dashboards not exposed.\n\n```sh\nkubectl get clusterrolebindings -o wide\nkubectl auth can-i --list --as=system:serviceaccount:app:default -n app\nkubectl get ns -L pod-security.kubernetes.io\u002Fenforce\nkubectl get networkpolicy -A\n```\n\nTools: `kubescape scan`, `trivy k8s --report summary`, `kube-linter lint`\nand Polaris for manifests; `kube-bench` (the CIS benchmark) runs as a Job\non the nodes, so the owner starts it. kube-hunter is unmaintained and probes\nthe network: only when the owner asks.\n\n## 7. TLS\n\n- TLS 1.2 minimum, 1.3 preferred; no SSLv3, TLS 1.0 or 1.1; Mozilla's\n  \"intermediate\" profile for ciphers; a full chain; renewal automated\n  (public certificate lifetimes fall to 200 days from March 2026, 100 in\n  2027 and 47 in 2029, so manual renewal will fail).\n- HSTS on HTTPS responses: `max-age=31536000; includeSubDomains`, and\n  `preload` once every subdomain serves HTTPS.\n- Plain text inside: database connections with `sslmode=disable` or\n  `require` (encrypts, verifies nothing; `verify-full` checks the host),\n  Redis without TLS between hosts, service-to-service HTTP across networks\n  carrying tokens.\n- An origin behind a CDN reachable directly by IP skips the WAF and the TLS\n  settings: allow only the CDN's ranges, authenticated origin pulls, or a\n  tunnel.\n- For hosts in scope, the last two commands below; testssl.sh for a full\n  pass, with permission.\n\n```sh\nrg -n 'sslmode=(disable|allow|prefer|require)\\b|ssl\\s*[:=]\\s*false|tls\\s*[:=]\\s*false|InsecureSkipVerify|rejectUnauthorized:\\s*false' .\nopenssl s_client -connect host:443 -servername host -tls1_1 \u003C\u002Fdev\u002Fnull   # must fail\ncurl -sI https:\u002F\u002Fhost | grep -i strict-transport-security\n```\n\n## 8. Databases, caches and the edge\n\n- No public endpoint (RDS `PubliclyAccessible`, a managed database allowing\n  `0.0.0.0\u002F0`); authentication on (Redis `requirepass` or ACLs with\n  `protected-mode yes`, MongoDB `security.authorization: enabled`,\n  Elasticsearch security, on by default since 8.0); private interfaces; TLS;\n  encryption at rest; default passwords changed.\n- The application's database user is not a superuser or the schema owner;\n  migrations run as another user; reporting reads through a read-only one.\n- nginx: `autoindex on`; the project root as `root` (serving `.env` and\n  `.git`); a `location` without a trailing slash with an `alias` that has\n  one lets a request climb a directory; `server_tokens on` (low).\n- Traefik `api.insecure=true` publishes its dashboard without auth; Caddy's\n  admin API stays on localhost.\n- The app trusts `X-Forwarded-For` only from its own proxy\n  (`security-web` section 13); body limits and timeouts at the edge.\n\n```sh\nrg -n 'autoindex\\s+on|\\balias\\s|server_tokens\\s+on|api\\.insecure|PubliclyAccessible|publicly_accessible\\s*=\\s*true|protected-mode\\s+no' .\n```\n\n## 9. Logging and audit\n\n- AWS CloudTrail as a multi-region or organisation trail with log file\n  validation, delivered to a bucket in a separate account; GuardDuty on.\n  GCP Admin Activity logs are always on, Data Access logs are off by\n  default. Azure Activity Log exported, Defender for Cloud on. Kubernetes\n  audit logging on (EKS control plane logs are off by default).\n- Retention long enough for an investigation (a year is common: breaches\n  are often found months later), and logs out of reach of the accounts they\n  record.\n- Alerts on root or break-glass sign-in, IAM and security group changes,\n  logging turned off, new access keys (the CIS benchmarks list them).\n- Application audit trails: `backend-auth` section 7; personal data in\n  logs: `security-privacy`.\n\n## 10. Backups\n\n- Encrypted, in a separate account or project that production credentials\n  cannot write to or delete from; immutable where ransomware matters (S3\n  Object Lock in compliance mode, AWS Backup Vault Lock, GCS retention\n  locks, Azure immutable blob storage).\n- Three copies, two media, one off-site; a dump never in the web root or a\n  public bucket.\n- A restore tested on a schedule, with the date of the last one known; a\n  backup never restored is a hope. Retention matches the privacy policy.\n\n## 11. Tools and rating\n\n| Tool | Covers |\n|---|---|\n| Prowler (`prowler aws`, also `azure`, `gcp`, `kubernetes`) | CIS and best-practice checks for a whole account |\n| ScoutSuite | A multi-cloud configuration report |\n| `checkov -d .` | Terraform, CloudFormation, Kubernetes, Helm, Dockerfiles |\n| `trivy config .` | IaC and Dockerfile misconfiguration (tfsec's checks now live here) |\n| kubescape, kube-bench | Kubernetes posture, CIS benchmark |\n| hadolint, dockle | Dockerfile and image practice |\n\n- **Critical**: a database, cache, Docker API or dashboard reachable from the\n  internet without auth or with data; admin-equivalent credentials usable by\n  an outsider; a public bucket of personal data.\n- **High**: wildcard admin on an internet-facing workload; IMDSv1 behind an\n  SSRF; a privileged container or the Docker socket in an internet-facing\n  service; CI OIDC trust without `sub`; SSH open to the world with\n  passwords.\n- **Medium**: no network policies; root containers with no other flaw; TLS\n  1.0 enabled; audit logging off; untested backups.\n- **Low**: version banners, missing HSTS preload, tags instead of digests.\n\n## Check it\n\n- Every port the configuration exposes is in the report with its reason, or\n  flagged for the owner to confirm.\n- Each workload's identity and permissions are listed, and none is admin.\n- Every finding names the file and line or the resource id, and whether it\n  came from code or a live read.\n- Nothing was changed: your shell history holds only reads.\n\n## Avoid\n\nChanging live infrastructure to \"fix\" something; printing secrets with\n`docker inspect`, `kubectl get secret -o yaml` or `terraform output`; port\nscans nobody asked for; scanner output as the report; `0.0.0.0` ports in\ncompose on a public server; `*` on `*`; the Docker socket in an app\ncontainer; IMDSv1; network policies without a CNI that enforces them;\nbackups the production role can delete.\n",{"name":5,"description":7},"main","38293fe1b096e6bf3646c7344c38786ed688f464","crates\u002Fenowx-core\u002Fskills\u002Fsecurity-infra",21,"https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli","https:\u002F\u002Fenowx.ai","https:\u002F\u002Fgithub.com\u002Fenowdev","Pretending to be a Developer","2026-10-06 02:05:35",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add enowdev\u002Fenowxcli --skill security-infra",{"tool":59,"command":60},"bunx","bunx skills add enowdev\u002Fenowxcli --skill security-infra",{"tool":62,"command":63},"pnpm","pnpm dlx skills add enowdev\u002Fenowxcli --skill security-infra","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fsecurity-infra\u002FSKILL.md",true,[],[68,79,96,109,130,149],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":39},"01M6D2HQYSQD9N7MTNDT4A7CBM","demo-skill","Project-scope demo skill for tests.","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fworkspace\u002F.agents\u002Fskills\u002Fdemo-skill\u002FSKILL.md",[],[75,76,77,78,29],"demo skill","demo","tests","project",{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":39},"01M6D2HM0GCPM0TM2HPG9HHR2R","writing","Writing words people read: the specific thing instead of claims, words to drop, sentences, interface copy (buttons, labels, errors, empty states, confirmations), page copy, notifications and emails, alt text and link text, numbers and dates, words that translate well, documentation and voice. Read before writing a page's copy, an interface's text or a document.","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fwriting\u002FSKILL.md",[],[81,86,87,88,89,90,29,91,92,93,94,95],"text","emails","empty","drop","document","page","voice","notifications","documentation","translate",{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":39},"01M6D2HG07YS49NM196Q0R3AZ8","ui","Designing or restyling an interface: direction, layout, type, colour, icons, components, states, responsive behaviour. Read before building a page, a screen or a set of components.","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fui\u002FSKILL.md",[],[98,103,104,105,106,91,107,29,108],"icons","components","SET","responsive","layout","before building",{"skillNo":110,"name":111,"nameZh":6,"description":112,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":113,"categories":114,"keywords":115,"publishedAt":39},"01M6D2HB59HZHWG1RYZDV4SJ91","ui-themes","Light and dark themes, and colour that holds in both: tokens with a value per theme, and what each kind of content needs to stay visible (icons, SVG drawings and line art, logos, photos, screenshots, charts, code, maps, borders, shadows, focus, form controls), switching without a flash, and checking both. Read before building a second theme or a theme toggle, and before any drawing, logo or chart on a page that has two themes.","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fui-themes\u002FSKILL.md",[],[98,116,117,118,119,120,121,122,123,29,108,124,91,125,126,127,103,128,129],"ui themes","switching","photos","tokens","drawing","focus","maps","Art","flash","code","Charts","content","screenshots","logo",{"skillNo":131,"name":132,"nameZh":6,"description":133,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":134,"categories":135,"keywords":136,"publishedAt":39},"01M6D2H5R5KRAE524C8QX0T7Q0","ui-structure","Structure before styling: the blueprint written before any interface code (the screen's job, the regions its kind of page needs, their order and why, the layout skeleton in numbers, the components and their states), the anatomy and order of a homepage, a dashboard, a list, a detail page, settings, a form, sign-in, pricing, docs, an article and a checkout, and how to turn the blueprint into code (tokens, layout primitives, components, sections, page). Read first, before building or rebuilding any page or screen.","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fui-structure\u002FSKILL.md",[],[137,98,138,104,139,140,125,141,142,143,107,119,144,145,146,29,108,91,147,148],"structure","ui structure","pricing","dashboard","Blueprint","article","anatomy","styling","primitives","list","why","how",{"skillNo":150,"name":151,"nameZh":6,"description":152,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":153,"categories":154,"keywords":155,"publishedAt":39},"01M6D2H0ZZBJG77MBGPZHA6MWD","ui-stack-vue","Building interfaces in Vue 3 and Nuxt: project layout, script setup with typed defineProps, defineEmits and defineModel, attribute fallthrough, slots and scoped slots, template refs, ref, reactive and computed, watch versus watchEffect, composables and VueUse, provide and inject, Pinia, keyed v-for, transitions, Nuxt 4 (app directory, pages, layouts, useFetch and useAsyncData keys, $fetch in handlers, server routes, runtime config, useSeoMeta, NuxtImg, middleware), VeeValidate forms, Reka UI and Nuxt UI, testing, vue-tsc, and the traps. Read when the project uses Vue or Nuxt.","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fui-stack-vue\u002FSKILL.md",[],[98,156,157,158,159,160,161,162,107,78,163,164,29,165,166,167,34,168,169,170],"vue","stack","ui stack vue","forms","pages","watch","runtime","transitions","fetch","pinia","nuxt","template","config","directory","testing"]