Files
StasonJatham e8f7d6bfdf ctcloud: CertSpotter-backed CT cloud-resource monitor
Single stateless Go process that consumes CT logs via embedded (patched)
CertSpotter internals, classifies cloud/database/storage DNS identifiers
in-process with a zero-allocation classifier, enriches via round-robin DNS
resolvers with CNAME following, and batch-writes useful findings to PostgreSQL.

- third_party/certspotter: 2-hunk IdentifierSink patch, no stdout/JSON/files
- internal/classify: AWS/Azure/GCP/Firebase/Cloudflare R2/DigitalOcean/Supabase/OCI
- internal/dns: sharded bounded TTL cache, multi-resolver load balancing + failover
- internal/pipeline: bounded queues, dedup, direct-priority load shedding
- internal/store: pgx batch writer, Postgres CT checkpoints (no cert contents)
- internal/probe: optional non-destructive reachability checks (off by default)
- Docker: distroless non-root, read-only rootfs, no app volume, resource limits
- tests enforce 0 allocs/op on the classifier and sink hot path
2026-09-22 13:13:10 +02:00

35 lines
1.1 KiB
Go

package classify
import "tea.karlcom.de/karl/bucketeer/internal/model"
// classifyR2 handles <account-id>.r2.cloudflarestorage.com.
func classifyR2(s *scanner) (model.Match, bool) {
n := s.n
if n < 4 || s.label(n-1) != "com" || s.label(n-2) != "cloudflarestorage" || s.label(n-3) != "r2" {
return model.Match{}, false
}
return model.Match{
Provider: model.ProviderCloudflare,
Service: model.ServiceObjectStorage,
ResourceSpecific: true,
Resource: s.label(0),
}, true
}
// classifyR2Dev handles <account>.r2.dev. The hostname form is explicitly a
// public development/public URL, which is why it carries PublicSemanticPublicURL
// while still not asserting that data is readable.
func classifyR2Dev(s *scanner) (model.Match, bool) {
n := s.n
if n < 3 || s.label(n-1) != "dev" || s.label(n-2) != "r2" {
return model.Match{}, false
}
return model.Match{
Provider: model.ProviderCloudflare,
Service: model.ServiceObjectStorage,
ResourceSpecific: true,
PublicSemantic: model.PublicSemanticPublicURL,
Resource: s.label(0),
}, true
}