1 parent
98b65945f6
commit
0b6dcbd547
13 files changed
+417
-68
No files matched your search
+25
-6
@@ -56,12 +56,13 @@ type App struct {
|
||||
cfg *config.Store
|
||||
ver string
|
||||
|
||||
blocks *blocklist.Manager
|
||||
cache *cache.Manager
|
||||
cstore *cache.Store
|
||||
logger *qlog.Logger
|
||||
aclH *acl.Holder
|
||||
local *localzone.Holder
|
||||
blocks *blocklist.Manager
|
||||
overrideMu sync.Mutex
|
||||
cache *cache.Manager
|
||||
cstore *cache.Store
|
||||
logger *qlog.Logger
|
||||
aclH *acl.Holder
|
||||
local *localzone.Holder
|
||||
// zones is the Kubernetes-sourced zone client.
|
||||
zones *kubezones.Client
|
||||
// managedZones is the console-managed zone directory: the only zone data
|
||||
@@ -316,6 +317,23 @@ func (a *App) startBlocklist() {
|
||||
Config: a.cfg,
|
||||
Logger: a.log,
|
||||
})
|
||||
if a.zones != nil {
|
||||
ctx := context.Background()
|
||||
content, exists, err := a.zones.Data(ctx, "address-overrides.rpz")
|
||||
if err == nil && !exists {
|
||||
if seed, readErr := os.ReadFile("/etc/fancy-dns/rpz/address-overrides.rpz"); readErr == nil {
|
||||
content = string(seed)
|
||||
if saveErr := a.zones.SaveData(ctx, "address-overrides.rpz", content); saveErr != nil {
|
||||
a.log.Warn("seed address overrides failed", "error", saveErr)
|
||||
}
|
||||
}
|
||||
}
|
||||
if err == nil {
|
||||
a.blocks.SetManagedRPZ(content)
|
||||
} else {
|
||||
a.log.Warn("load address overrides failed", "error", err)
|
||||
}
|
||||
}
|
||||
// Compile once before serving so the first queries are not unprotected.
|
||||
if _, err := a.blocks.RefreshAll(context.Background()); err != nil {
|
||||
a.markDegraded("blocklist: " + err.Error())
|
||||
@@ -576,6 +594,7 @@ func (a *App) startCluster(ctx context.Context, cfg *config.Config) {
|
||||
// probes and the metrics gauge.
|
||||
func (a *App) startBackground(ctx context.Context, cfg *config.Config) {
|
||||
go a.watchLocalZones(ctx)
|
||||
go a.watchAddressOverrides(ctx)
|
||||
// Cache snapshots.
|
||||
if a.cstore != nil {
|
||||
interval := cfg.Cache.Persist.Interval.D()
|
||||
|
||||
Reference in new issue
Block a user