Files
bucketeer/internal/classify/gcp.go
T
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

50 lines
1.5 KiB
Go

package classify
import "tea.karlcom.de/karl/bucketeer/internal/model"
func gcp(service model.Service, resource, region string) model.Match {
return model.Match{
Provider: model.ProviderGCP,
Service: service,
ResourceSpecific: true,
Region: region,
Resource: resource,
}
}
// classifyGCS handles <bucket>.storage.googleapis.com.
func classifyGCS(s *scanner) (model.Match, bool) {
n := s.n
if n < 4 || s.label(n-1) != "com" || s.label(n-2) != "googleapis" || s.label(n-3) != "storage" {
return model.Match{}, false
}
return gcp(model.ServiceObjectStorage, s.label(0), ""), true
}
// classifyFirebaseIO handles <database>.firebaseio.com.
func classifyFirebaseIO(s *scanner) (model.Match, bool) {
n := s.n
if n < 3 || s.label(n-1) != "com" || s.label(n-2) != "firebaseio" {
return model.Match{}, false
}
return gcp(model.ServiceFirebaseDB, s.label(0), ""), true
}
// classifyFirebaseDB handles <database>.<region>.firebasedatabase.app.
func classifyFirebaseDB(s *scanner) (model.Match, bool) {
n := s.n
if n < 4 || s.label(n-1) != "app" || s.label(n-2) != "firebasedatabase" {
return model.Match{}, false
}
return gcp(model.ServiceFirebaseDB, s.label(0), s.label(1)), true
}
// classifyAppspot handles <project>.appspot.com.
func classifyAppspot(s *scanner) (model.Match, bool) {
n := s.n
if n < 3 || s.label(n-1) != "com" || s.label(n-2) != "appspot" {
return model.Match{}, false
}
return gcp(model.ServiceWebApp, s.label(0), ""), true
}