Commit graph

23833 commits

Author SHA1 Message Date
Daniel Mack a9da14e1e9 resolved: add 'next_attempt_after' field to DnsTransaction
For each transaction, record when the earliest point in time when the
query packet may hit the wire. This is the same time stamp for which
the timer is scheduled in retries, except for the initial query packets
which are delayed by a random jitter. In this case, we denote that the
packet may actually be sent at the nominal time, without the jitter.

Transactions that share the same timestamp will also have identical
values in this field. It is used to coalesce pending queries in a later
patch.
2015-12-08 16:51:41 +01:00
Daniel Mack 1effe96568 resolved: split dns_transaction_go()
Split some code out of dns_transaction_go() so we can re-use it later from
different context. The new function dns_transaction_prepare_next_attempt()
takes care of preparing everything so that a new packet can conditionally
be formulated for a transaction.

This patch shouldn't cause any functional change.
2015-12-08 16:51:41 +01:00
Daniel Mack 547493c5ad resolved: handle more mDNS protocol details 2015-12-08 16:51:41 +01:00
Daniel Mack a20b959217 resolved: fix debug message 2015-12-08 16:51:40 +01:00
Daniel Mack 124602aea8 resolved: add mDNS packet dispatcher
Add the packet dispatching routine for mDNS.

It differs to what LLMNR and DNS dispatchers do in the way it matches
incoming packets. In mDNS, we actually handle all incoming packets,
regardless whether we asked for them earlier or not.
2015-12-08 16:51:40 +01:00
Daniel Mack d84e543d92 resolved: allow name compression in NSEC records 2015-12-08 16:51:40 +01:00
Daniel Mack 11a27c2ec1 resolved: handle mDNS timeouts per transaction
mDNS packet timeouts need to be handled per transaction, not per link.
Re-use the n_attempts field for this purpose, as packets timeouts should be
determined by starting at 1 second, and doubling the value on each try.
2015-12-08 16:51:40 +01:00
Daniel Mack ef7ce6df4d resolved: short-cut jitter callbacks for LLMNR and mDNS
When a jitter callback is issued instead of sending a DNS packet directly,
on_transaction_timeout() is invoked to 'retry' the transaction. However,
this function has side effects. For once, it increases the packet loss
counter on the scope, and it also unrefs/refs the server instances.

Fix this by tracking the jitter with two bool variables. One saying that
the initial jitter has been scheduled in the first place, and one that
tells us the delay packet has been sent.
2015-12-08 16:51:40 +01:00
Daniel Mack 90325e8c2e resolved: flush keys when DNS_RESOURCE_KEY_CACHE_FLUSH is set
In mDNS, DNS_RESOURCE_KEY_CACHE_FLUSH denotes whether other records with the
same key should be flushed from the cache.
2015-12-08 16:51:39 +01:00
Daniel Mack 23502de3b0 resolved: add cache flush flag to DnsResourceKey
MDNS has a 'key cache flush' flag for records which must be masked out for
the parsers to do our right thing. We will also use that flag later (in a
different patch) in order to alter the cache behavior.
2015-12-08 16:41:45 +01:00
Daniel Mack ea12bcc789 resolved: add mDNS initial jitter
The logic is to kick off mDNS packets in a delayed way is mostly identical
to what LLMNR needs, except that the constants are different.
2015-12-08 16:41:45 +01:00
Daniel Mack b4f1862df2 resolved: create dns scopes for mDNS
Follow what LLMNR does, and create per-link DnsScope objects.
2015-12-08 16:41:45 +01:00
Daniel Mack 0db4c90afd resolved: add code to join/leave mDNS multicast groups
Per link, join the mDNS multicast groups when the scope is created, and
leave it again when the scope goes away.
2015-12-08 16:41:45 +01:00
Daniel Mack 4e5bf5e158 resolved: add packet header details for mDNS
Validate mDNS queries and responses by looking at some header fields,
add mDNS flags.
2015-12-08 16:41:45 +01:00
Daniel Mack bc7702b098 resolved: add infrastructure for mDNS related sockets
Just hook up mDNS listeners with an empty packet dispather function,
introduce a config directive, man page updates etc.
2015-12-08 16:37:40 +01:00
Zbigniew Jędrzejewski-Szmek 2af917de2d Merge pull request #2104 from evverx/rlimit-util-test
tests: add test-rlimit-util
2015-12-07 23:47:45 -05:00
Zbigniew Jędrzejewski-Szmek f2b84856a2 Merge pull request #2117 from evverx/remove-dist-check-python
build-sys: remove dist-check-python
2015-12-07 23:35:19 -05:00
Evgeny Vereshchagin 7118d2f795 build-sys: remove dist-check-python
added: 279419b379
obsoleted: 2c8849add4
2015-12-08 02:33:52 +00:00
Filipe Brandenburger c9811ac800 Merge pull request #2111 from evverx/remove-unnecessary-checking
build-sys: remove unnecessary check
2015-12-07 13:53:02 -08:00
Martin Pitt 1941d19a54 Merge pull request #2109 from keszybz/udev-null-deref
Udev null deref
2015-12-07 17:35:32 +01:00
Evgeny Vereshchagin 5414b34c4b tests: disable hard errors
we don't use it
https://www.gnu.org/software/automake/manual/automake.html#Scripts_002dbased-Testsuites
2015-12-07 09:43:43 +00:00
Evgeny Vereshchagin fe39daf2c1 tests: add test-rlimit-util 2015-12-07 09:41:15 +00:00
Evgeny Vereshchagin abd544d576 build-sys: remove unnecessary check
added: 65adc982d
obsoleted: 2c8849add
2015-12-07 07:05:42 +00:00
Zbigniew Jędrzejewski-Szmek 9eba69df1c udev: fix NULL deref when executing rules
We quite obviously check whether event->dev_db is nonnull, and
right after that call a function which asserts the same. Move
the call under the same if.

https://bugzilla.redhat.com/show_bug.cgi?id=1283971
2015-12-07 00:44:14 -05:00
Zbigniew Jędrzejewski-Szmek 90b33a2746 libudev: simplify udev_device_ensure_usec_initialized a bit 2015-12-07 00:44:14 -05:00
Lennart Poettering 1fbcad80f0 Merge pull request #2095 from evverx/fix-distcheck-for-disable-timesync
build-sys: move "dist" parts out of conditional
2015-12-06 20:58:11 +01:00
Lennart Poettering 0fbf9d1fa3 Merge pull request #2100 from msekletar/nologin-label
user-sessions: make sure /run/nologin has correct SELinux label
2015-12-06 20:57:33 +01:00
Lennart Poettering e28039b2eb Merge pull request #2107 from phomes/misc
Misc cleanups
2015-12-06 20:49:12 +01:00
Lennart Poettering c8a65ef42d Merge pull request #2097 from kinvolk/alban/TasksMax
nspawn: set TasksMax in machined instead of nspawn
2015-12-06 20:48:02 +01:00
Thomas Hindoe Paaboel Andersen 22ebb9e4a9 resolve: remove unused variable 2015-12-06 13:49:33 +01:00
Thomas Hindoe Paaboel Andersen a8fbdf5424 shared: include what we use
The next step of a general cleanup of our includes. This one mostly
adds missing includes but there are a few removals as well.
2015-12-06 13:49:33 +01:00
Alban Crequy b370fec2b9 nspawn: set TasksMax in machined instead of nspawn
https://github.com/systemd/systemd/issues/2016
2015-12-04 23:36:39 +01:00
Michal Sekletar 716cff4b45 login: make sure /run/nologin has correct SELinux label 2015-12-04 22:29:38 +01:00
Michal Sekletar ea4e6292af user-sessions: make sure /run/nologin has correct SELinux label 2015-12-04 22:01:17 +01:00
Tom Gundersen 8eb3655cdb Merge pull request #2092 from poettering/dnssec2
Second DNSSEC patch set
2015-12-04 14:22:29 +01:00
Evgeny Vereshchagin f47477332f build-sys: move "dist" parts out of conditional
Fixes:
$ ./autogen.sh
$ ./configure ... --disable-timesyncd
$ make distcheck
...
make[1]: *** No rule to make target 'src/timesync/timesyncd-gperf.gperf', needed by 'src/timesync/timesyncd-gperf.c'.  Stop.
2015-12-04 06:26:34 +00:00
Zbigniew Jędrzejewski-Szmek 517d12cc0c Merge pull request #2093 from evverx/add-test-dnssec-to-gitignore
.gitignore: add test-dnssec
2015-12-03 21:41:53 -05:00
Evgeny Vereshchagin eb588312e8 .gitignore: add test-dnssec
This is a follow-up for 2b442ac878
2015-12-04 01:32:15 +00:00
Lennart Poettering bb1fa24261 resolved: update DNSSEC TODO list a bit 2015-12-03 21:17:50 +01:00
Lennart Poettering 931851e8e4 resolved: add a concept of "authenticated" responses
This adds a new SD_RESOLVED_AUTHENTICATED flag for responses we return
on the bus. When set, then the data has been authenticated. For now this
mostly reflects the DNSSEC AD bit, if DNSSEC=trust is set. As soon as
the client-side validation is complete it will be hooked up to this flag
too.

We also set this bit whenver we generated the data ourselves, for
example, because it originates in our local LLMNR zone, or from the
built-in trust anchor database.

The "systemd-resolve-host" tool has been updated to show the flag state
for the data it shows.
2015-12-03 21:17:49 +01:00
Lennart Poettering 3ba27cd339 resolved: when synthesizing NODATA from cached NSEC bitmaps, honour CNAME/DNAME
When an RR type is not set in an NSEC, then the CNAME/DNAME types might
still be, hence check them too.

Otherwise we might end up refusing resolving of CNAME'd RRs if we cached
an NSEC before.
2015-12-03 21:17:49 +01:00
Lennart Poettering 2cd8727718 resolved: maintain a short TODO list for DNSSEC support in the dnssec C files for now 2015-12-03 21:17:49 +01:00
Lennart Poettering 24710c48ed resolved: introduce a dnssec_mode setting per scope
The setting controls which kind of DNSSEC validation is done: none at
all, trusting the AD bit, or client-side validation.

For now, no validation is implemented, hence the setting doesn't do much
yet, except of toggling the CD bit in the generated messages if full
client-side validation is requested.
2015-12-03 21:17:49 +01:00
Lennart Poettering 896c567247 resolved: add a limit on the max DNSSEC RRSIG expiry skew we allow 2015-12-03 21:17:49 +01:00
Lennart Poettering 0d2cd47617 resolved: add a simple trust anchor database as additional RR source
When doing DNSSEC lookups we need to know one or more DS or DNSKEY RRs
as trust anchors to validate lookups. With this change we add a
compiled-in trust anchor database, serving the root DS key as of today,
retrieved from:

https://data.iana.org/root-anchors/root-anchors.xml

The interface is kept generic, so that additional DS or DNSKEY RRs may
be served via the same interface, for example by provisioning them
locally in external files to support "islands" of security.

The trust anchor database becomes the fourth source of RRs we maintain,
besides, the network, the local cache, and the local zone.
2015-12-03 21:17:49 +01:00
Lennart Poettering 28b9b76406 resolved: rework how we allow allow queries to be dispatched to scopes
Previously, we'd never do any single-label or root domain lookups via
DNS, thus leaving single-label lookups to LLMNR and the search path
logic in order that single-label names don't leak too easily onto the
internet. With this change we open things up a bit, and only prohibit
A/AAAA lookups of single-label/root domains, but allow all other
lookups. This should provide similar protection, but allow us to resolve
DNSKEY+DS RRs for the top-level and root domains.

(This also simplifies handling of the search domain detection, and gets
rid of dns_scope_has_search_domains() in favour of
dns_scope_get_search_domains()).
2015-12-03 21:17:49 +01:00
Lennart Poettering 22f711bb6a resolved: don't bother with picking a search domain when searching is disabled 2015-12-03 21:17:49 +01:00
Lennart Poettering 1b4f6e79ec resolved: optionally, allocate DnsResourceKey objects on the stack
Sometimes when looking up entries in hashmaps indexed by a
DnsResourceKey it is helpful not having to allocate a full
DnsResourceKey dynamically just to use it as search key. Instead,
optionally allow allocation of a DnsResourceKey on the stack. Resource
keys allocated like that of course are subject to other lifetime cycles
than the usual Resource keys, hence initialize the reference counter to
to (unsigned) -1.

While we are at it, remove the prototype for
dns_resource_key_new_dname() which was never implemented.
2015-12-03 21:17:49 +01:00
Lennart Poettering 2a44bec4f6 resolved: make expiration error recognizable 2015-12-03 21:17:49 +01:00
Lennart Poettering c9ad0edbab resolved: refuse resolving of a number of domains listed in RFC6303
We already blacklisted a few domains, add more.
2015-12-03 21:17:49 +01:00