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
40 lines
1.2 KiB
Go
40 lines
1.2 KiB
Go
package classify
|
|
|
|
import "tea.karlcom.de/karl/bucketeer/internal/model"
|
|
|
|
// classifyDigitalOceanSpaces handles
|
|
// <bucket>.<region>.digitaloceanspaces.com and the cdn variant.
|
|
func classifyDigitalOceanSpaces(s *scanner) (model.Match, bool) {
|
|
n := s.n
|
|
if s.label(n-1) != "com" || s.label(n-2) != "digitaloceanspaces" {
|
|
return model.Match{}, false
|
|
}
|
|
// <bucket>.<region>.digitaloceanspaces.com (n==4) or the cdn variant (n==5)
|
|
if n != 4 && !(n == 5 && s.label(2) == "cdn") {
|
|
return model.Match{}, false
|
|
}
|
|
bucket := s.label(0)
|
|
region := s.label(1)
|
|
return model.Match{
|
|
Provider: model.ProviderDigitalOcean,
|
|
Service: model.ServiceObjectStorage,
|
|
ResourceSpecific: true,
|
|
Region: region,
|
|
Resource: bucket,
|
|
}, true
|
|
}
|
|
|
|
// classifyDigitalOceanDB handles <name>.db.ondigitalocean.com.
|
|
func classifyDigitalOceanDB(s *scanner) (model.Match, bool) {
|
|
n := s.n
|
|
if n < 4 || s.label(n-1) != "com" || s.label(n-2) != "ondigitalocean" || s.label(n-3) != "db" {
|
|
return model.Match{}, false
|
|
}
|
|
return model.Match{
|
|
Provider: model.ProviderDigitalOcean,
|
|
Service: model.ServiceDatabase,
|
|
ResourceSpecific: true,
|
|
Resource: s.label(0),
|
|
}, true
|
|
}
|