Commit Graph

54 Commits

Author SHA1 Message Date
Michael Tremer
ca4de26318 unbound-dhcp-leases-bridge: Fall back to the default domain
When the bridge cannot detect a domain name for any of the leases, it
uses localdomain which is not always the best choice. So instead, this
patches changes the behaviour that we read the default domain of the
firewall.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org>
2022-10-04 14:48:26 +00:00
Peter Müller
80745fb58f unbound.conf: Aggressive NSEC is enabled by default since Unbound 1.15.0
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-06-13 15:50:10 +00:00
Michael Tremer
1918174dbb unbound-dhcp-leases-bridge: Don't open stderr on daemonization
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-04-04 20:07:15 +00:00
Michael Tremer
f961135513 unbound-dhcp-leases-bridge: Initialize logging after daemonization
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-04-04 20:07:15 +00:00
Michael Tremer
091cb62ada unbound-dhcp-leases-bridge: Read configuration only once
This saves some resources when we re-read the same configuration file
too often.

Suggested-by: Anthony Heading <ajrh@ajrh.net>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-04-04 20:07:15 +00:00
Michael Tremer
6d6e7949cf unbound-dhcp-leases-bridge: Fix inotify handling
This patch changes that the script will listen to changes to the
directory instead of the file which got complicated when files got
renamed.

It also processes all changes at the same time and tries finding out
what actions have to be performed in order to avoid unnecessary
iterations.

The script is also limited to process any changes only once every five
seconds to keep resource usage in check on busy systems.

Suggested-by: Anthony Heading <ajrh@ajrh.net>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-04-04 20:07:15 +00:00
Michael Tremer
29a3603610 unbound-dhcp-leases-bridge: Improve logging
This improves logging and enables logging to the console.

Suggested-by: Anthony Heading <ajrh@ajrh.net>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-04-04 20:07:15 +00:00
Michael Tremer
83e5f67256 unbound-dhcp-leases-bridge: Fix exception when running without debug
Fixes: https://bugzilla.ipfire.org/show_bug.cgi?id=12622
Fixes: #12622
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-05-17 15:33:13 +00:00
Michael Tremer
a8b1843bf7 unbound-dhcp-leases-bridge: Fix shebang
Reported-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-05-14 13:22:37 +00:00
Michael Tremer
96c86cf621 unbound-dhcp-leases-bridge: Migrate to Python 3
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-05-14 11:54:21 +00:00
Peter Müller
89b0449185 unbound.conf: do not set defaults again
These are meanwhile set by Unbound upstream as well, so there is no need
to do things twice here.

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-02-02 10:54:31 +00:00
Jonatan Schlag
211b6bc16e unbound: keep probing when servers are down
Till now when a server was in the "blocking regime" there was one probe
made every 15 min, to see if this server is up again. In situations
where all servers where down (e.g. because of a massive package loss)
it could take up to 15 min to have a working dns again.

This patch changes this behaviour in a way that a server marked down is
probed every 2 min.

Fixes: #12557

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-01-06 15:31:05 +00:00
Michael Tremer
9700617aeb unbound: Disable using mixed case for DNS queries
This seems to cause that some resolvers do not respond
to queries any more until unbound falls back.

To ensure better DNS performance, we disabled this.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-03-04 21:47:37 +00:00
Peter Müller
e737776db5 unbound.conf: Do not set defaults explicitly
In order to keep configuration files small and easy to review/audit,
omitting defaults makes more sense than configure them explicitly (have
changed my mind here).

Unbound comes with a good default confiuration, and we should only make
changes when they are necessary. In addition, this patch updates the
documentation's URL to the current one.

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Cc: Michael Tremer <michael.tremer@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-03-04 21:46:48 +00:00
Arne Fitzenreiter
61cc563558 Merge remote-tracking branch 'ms/next-dns-ng' into next 2020-01-13 21:42:49 +00:00
Michael Tremer
7be4822f3d unbound: Make dhcp-leases.conf readable for everyone
unbound runs as nobody and cannot reload its configuration
when this file is only readable for root.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-01-13 21:43:27 +01:00
Michael Tremer
6137797cb3 unbound: Write hosts to unbound configuration file
This will allow us to read more hosts in a shorter time.

Fixes: #11743
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-01-13 21:10:18 +01:00
Michael Tremer
34ae42da0f unbound: No longer try to include safe-search.conf
This file is no longer generated and therefore cannot
be imported any more.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-01-11 14:18:48 +00:00
Michael Tremer
beebf925c3 unbound: Implement setting qname minimisation into strict mode
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-01-07 16:32:35 +00:00
Michael Tremer
ffc46751f2 unbound: Add path to TLS CA bundle
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-01-07 12:59:24 +00:00
Michael Tremer
372576e0ab unbound: Set EDNS buffer size to 1232 bytes
Fixes: #12240
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-01-07 11:12:33 +00:00
Peter Müller
4a46575628 unbound-dhcp-leases-bridge: handle PTR generation parameter
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Reported-by: Matthias Fischer <matthias.fischer@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-07-15 12:22:51 +01:00
Arne Fitzenreiter
6511460487 unbound: update root.hints to 2019070301
IPv4 of server B has changed. Other changes are whitespace only.

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2019-07-14 07:45:51 +02:00
Michael Tremer
661ab15389 unbound: Add Safe Search
This is a feature that will filter adult content from search
engine's results.

The old method of rewriting the HTTP request no longer works.

This method changes the DNS response for supported search engines
which violates our belief in DNSSEC and won't allow these search
engines to ever enable DNSSEC.

However, there is no better solution available to this and this
an optional feature, too.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
2019-05-11 04:19:37 +01:00
Michael Tremer
b666975ec2 unbound-dhcp-leases-bridge: Replace leases file atomically
When there is a large number of leases, writing the file may
take a long time. When unbound is re-reading its configuration
in that time, the file might syntactically incorrect.

This change writes the file first and then moves it
to the right place in one transaction.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-03-28 12:51:06 +00:00
Michael Tremer
9bc1760052 unbound: Drop certificates for local control connection
These are a cause of worry because they are sometimes generated with
an invalid timestamp and therefore render unbound being unusable.

There is no strong reason to use self-signed certificates for extra
security here.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-02-17 13:46:51 +00:00
Peter Müller
2e0660f9ce Unbound: output statistics daily instead of just on shutdown
Currently, Unbound only prints statistics if it is being shutdown
(mostly because of a machine reboot). This makes detecting DNS
anomalies hard as no intermediate statistic result is being logged.

This patch changes Unbound's behaviour in order to log statistics
every 86,400 seconds (i.e. 24 hours).

Signed-off-by: Peter Müller <peter.mueller@link38.eu>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2018-11-01 10:31:09 +00:00
Peter Müller
8a0585837c Unbound: Use aggressive NSEC
This avoids some needless lookups to destination domains
with a very high NXDOMAIN rate and reduces load on upstream
servers.

See https://nlnetlabs.nl/documentation/unbound/unbound.conf/
for further details.

Signed-off-by: Peter Müller <peter.mueller@link38.eu>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2018-09-10 16:34:30 +01:00
Peter Müller
4e4128faac Unbound: Use caps for IDs
Attempt to detect DNS spoofing attacks by inserting 0x20-encoded
random bits into upstream queries. Upstream documentation claims
it to be an experimental implementation, it did not cause any trouble
on productive systems here.

See https://nlnetlabs.nl/documentation/unbound/unbound.conf/ for
further details.

Signed-off-by: Peter Müller <peter.mueller@link38.eu>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2018-09-10 16:34:20 +01:00
Peter Müller
ffba3c98ba Unbound: Enable DNS cache poisoning mitigation
By default, Unbound neither keeps track of the number of unwanted
replies nor initiates countermeasures if they become too large (DNS
cache poisoning).

This sets the maximum number of tolerated unwanted replies to
1M, causing the cache to be flushed afterwards. (Upstream documentation
recommends 10M as a threshold, but this turned out to be ineffective
against attacks in the wild.)

See https://nlnetlabs.nl/documentation/unbound/unbound.conf/ for
details. This version of the patch uses 1M as threshold instead of
5M and supersedes the first and second version.

Signed-off-by: Peter Müller <peter.mueller@link38.eu>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2018-09-10 16:34:18 +01:00
Arne Fitzenreiter
40c81f6929 unbound: update dns hints and keys
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2017-08-17 14:25:42 +02:00
Michael Tremer
c2adb460d6 Revert "unbound: Deactivate qname-minimization & harden-below-nxdomain"
This reverts commit 86e9d04bfb.

This seems to be working with unbound 1.6.0 so that this can be
re-enabled for better privacy.

http://lists.ipfire.org/pipermail/development/2016-December/002807.html
2016-12-16 11:59:59 +00:00
Michael Tremer
86e9d04bfb unbound: Deactivate qname-minimization & harden-below-nxdomain
This causes trouble when you try to resolve a record like
a.b.blah.com where b.blah.com responds with NXDOMAIN. unbound
won't try to resolve a.b.blah.com because it is assumed that
everything longer than b.blah.com does not exist which is
probably not good usability.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2016-11-25 17:45:39 +00:00
Michael Tremer
d4af85f252 unbound: Send out replies from where they came in
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2016-11-04 18:23:25 +00:00
Michael Tremer
3ddad158cd unbound: Allow recursion from everywhere
Users use the IPFire DNS service from VPNs and other
routed networks.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2016-11-04 17:08:13 +00:00
Michael Tremer
8b1eb795ac unbound-dhcp-bridge: Make leases unique by IP address
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2016-10-15 22:32:05 +01:00
Michael Tremer
3ec5ba501e unbound-dhcp-bridge: Only update cache when lease was added/removed
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2016-10-15 19:17:44 +02:00
Michael Tremer
c7b83f9bed unbound-dhcp-bridge: Rewrite update algorithm
Before the bridge tries reading any existing leases from unbound
but this makes it difficult to destinguish between what is a DHCP lease,
static host entry or anything else.

This patch will change the bridge back to just remember what has been
added to the cache already which makes it easier to keep track.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2016-10-15 19:08:22 +02:00
Michael Tremer
5d4f3a42ce unbound-dhcp-bridge: Skip processing leases with empty hostname
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2016-10-15 19:06:27 +02:00
Michael Tremer
7354d2947a unbound-dhcp-bridge: Reading in static hosts
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2016-10-15 19:05:11 +02:00
Michael Tremer
1b4d5ad9af unbound: Move "listen on all" to main configuration file
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2016-10-12 22:37:26 +01:00
Michael Tremer
86c9deb2ea unbound: Public static leases in DNS, too
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2016-10-11 19:14:33 +02:00
Michael Tremer
998e880b61 unbound: Skip invalid hostnames
If there are any invalid hostnames in the DHCP leases
table, we just skip them and do not create and RRs for
them.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2016-10-10 20:11:57 +01:00
Michael Tremer
e22bcd38d6 unbound: Correctly format PTR records
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2016-10-06 10:42:49 +01:00
Michael Tremer
d20ef9d703 unbound+DHCP: Make sure to only remove old leases and not static hosts
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2016-09-14 16:35:41 +01:00
Michael Tremer
74a5ab67fe unbound+DHCP: Read correct DHCP domain name for lease
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2016-09-14 16:29:53 +01:00
Michael Tremer
b8dd42b9a6 unbound+DHCP: Read existing leases from unbound
This allows us to restart unbound and all DHCP leases
will be re-imported even if the unbound-dhcp-leases-bridge is
not restarted.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2016-09-14 15:54:36 +01:00
Michael Tremer
077ea717e0 unbound+DHCP: Set TTL for local leases to 1m
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2016-09-12 21:14:44 +01:00
Michael Tremer
b658a451fb unbound: Automatically scale configuration to system
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2016-09-08 19:46:43 +01:00
Michael Tremer
b8f5eda86b unbound: Rewrite configuration and initscript
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2016-08-06 19:20:27 +01:00