Commit graph

23798 commits

Author SHA1 Message Date
Tom Gundersen 8eb3655cdb Merge pull request #2092 from poettering/dnssec2
Second DNSSEC patch set
2015-12-04 14:22:29 +01: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
Tom Gundersen 5fa3be82e5 Merge pull request #1934 from martinpitt/master
tests: add networkd integration test
2015-12-03 18:22:06 +01:00
Tom Gundersen 13bd195053 Merge pull request #2089 from keszybz/journal-fixes-2
Journal fixes
2015-12-03 18:12:10 +01:00
Zbigniew Jędrzejewski-Szmek 4941e4aca9 journal: silently skip failing large messages if journald is missing
We treated -ENOENT errors with silent failure, for small messages.
Do the same for large messages.
2015-12-03 11:44:59 -05:00
Zbigniew Jędrzejewski-Szmek 726f4c4738 journal: unbreak sd_journal_sendv
Borked since
commit 3ee897d6c2
Author: Lennart Poettering <lennart@poettering.net>
Date:   Wed Sep 23 01:00:04 2015 +0200

    tree-wide: port more code to use send_one_fd() and receive_one_fd()

because here our fd is not connected and we need to specify
the address.
2015-12-03 09:14:01 -05:00
Zbigniew Jędrzejewski-Szmek 85049096c7 test-journal-send: add tests for sendv
Also, check the return value of all calls.
They are documented to return 0, even if journald is not listening.
2015-12-03 09:14:01 -05:00
Zbigniew Jędrzejewski-Szmek 9a7800af08 journal: addition and multiplication do not commute 2015-12-03 09:14:01 -05:00
Zbigniew Jędrzejewski-Szmek d94819c80e test-journal-send: no need to set log level
We only use the public api here, so don't include
log.h.
2015-12-02 22:42:49 -05:00
Tom Gundersen 3f967a4ccf Merge pull request #2087 from poettering/dnssec
Basic DNSSEC support, and unrelated fixes
2015-12-03 01:52:01 +01:00
Lennart Poettering 964ef14c25 resolved: support the RSASHA1_NSEC3_SHA1 pseudo-algorithm
RSASHA1_NSEC3_SHA1 is an alias for RSASHA1, used to do NSEC3 feature
negotiation. While verifying RRsets there's no difference, hence support
it here.
2015-12-03 00:39:44 +01:00
Lennart Poettering 37da893166 resolved: synthesize NODATA cache results when we find matching NSEC RRs
If we have a precisely matching NSEC RR for a name, we can use its type
bit field to synthesize NODATA cache lookup results for all types not
mentioned in there.

This is useful for mDNS where NSEC RRs are used to indicate missing RRs
for a specific type, but is beneficial in other cases too.

To test this, consider these two lines:

systemd-resolve-host -t NSEC nasa.gov
systemd-resolve-host -t SRV nasa.gov

The second line will not result in traffic as the first line already
cached the NSEC field.
2015-12-03 00:26:58 +01:00
Lennart Poettering 8730bccfc5 resolved: move algorithm/digest definitions into resolved-dns-rr.h
After all, they are for flags and parameters of RRs and already relevant
when dealing with RRs outside of the serialization concept.
2015-12-03 00:26:58 +01:00
Lennart Poettering 2a32632159 resolved: don't accept expired RRSIGs 2015-12-03 00:26:58 +01:00
Lennart Poettering 2b442ac878 resolved: add basic DNSSEC support
This adds most basic operation for doing DNSSEC validation on the
client side. However, it does not actually add the verification logic to
the resolver. Specifically, this patch only includes:

- Verifying DNSKEY RRs against a DS RRs
- Verifying RRSets against a combination of RRSIG and DNSKEY RRs
- Matching up RRSIG RRs and DNSKEY RRs
- Matching up RR keys and RRSIG RRs
- Calculating the DNSSEC key tag from a DNSKEY RR

All currently used DNSSEC combinations of SHA and RSA are implemented. Support
for MD5 hashing and DSA or EC cyphers are not. MD5 and DSA are probably
obsolete, and shouldn't be added. EC should probably be added
eventually, if it actually is deployed on the Internet.
2015-12-02 22:50:11 +01:00
Lennart Poettering 4e2d538f33 resolved: port ResolveRecord() bus call implementation to dns_resource_record_to_wire_format()
Now that we have dns_resource_record_to_wire_format() we can generate
the RR serialization we return to bus clients in ResolveRecord() with
it. We pass the RR data along in the original form, not the DNSSEC
canonical form, since that would mean we'd lose RR name casing, which is
however important to keep for DNS-SD services and similar.
2015-12-02 22:50:11 +01:00
Lennart Poettering a8812dd7f1 resolved: add code to generate the wire format for a single RR
This adds dns_resource_record_to_wire_format() that generates the raw
wire-format of a single DnsResourceRecord object, and caches it in the
object, optionally in DNSSEC canonical form. This call is used later to
generate the RR serialization of RRs to verify.

This adds four new fields to DnsResourceRecord objects:

- wire_format points to the buffer with the wire-format version of the
  RR
- wire_format_size stores the size of that buffer
- wire_format_rdata_offset specifies the index into the buffer where the
  RDATA of the RR begins (i.e. the size of the key part of the RR).
- wire_format_canonical is a boolean that stores whether the cached wire
  format is in DNSSEC canonical form or not.

Note that this patch adds a mode where a DnsPacket is allocated on the
stack (instead of on the heap), so that it is cheaper to reuse the
DnsPacket object for generating this wire format. After all we reuse the
DnsPacket object for this, since it comes with all the dynamic memory
management, and serialization calls we need anyway.
2015-12-02 22:50:11 +01:00
Lennart Poettering 9551c15505 resolved: add code to map DNSSEC digest types to strings and back 2015-12-02 22:50:11 +01:00
Lennart Poettering f91dc2400d resolved: store DNSKEY fields flags+protocol as-is
When verifying signatures we need to be able to verify the original
data we got for an RR set, and that means we cannot simply drop flags
bits or consider RRs invalid too eagerly. Hence, instead of parsing the
DNSKEY flags store them as-is. Similar, accept the protocol field as it
is, and don't consider it a parsing error if it is not 3.

Of course, this means that the DNSKEY handling code later on needs to
check explicit for protocol != 3.
2015-12-02 22:50:11 +01:00
Lennart Poettering e30ec345ac resolved: add RFC 5702 defined DNSSEC algorithms to table 2015-12-02 22:50:11 +01:00
Lennart Poettering 3cd03457bd util-lib: update dns_name_to_wire_format() to optionally generate DNSSEC canonical names
We'll need this later when putting together RR serializations to
checksum.
2015-12-02 22:50:11 +01:00
Lennart Poettering 92aea95e16 resolved: make sure DNS_ANSWER_FOREACH() can be nested
Change the iterator counter so that a different varable is used for each
invocation of the macro, so that it may be nested.
2015-12-02 20:43:11 +01:00
Lennart Poettering c38a52dae3 resolved: simplify dns_packet_append_string()
It essentially does the same as dns_packet_append_raw_string(), hence
make it a wrapper around it.
2015-12-02 20:35:08 +01:00
Lennart Poettering f3f4f0086e hostnamed: SMBIOS 3.0 knows the "tablet" form factor, add support for it 2015-12-02 20:32:58 +01:00
Lennart Poettering 5449f1e331 Merge pull request #2073 from poettering/dns-label-fixes
Dns label fixes + unrelated selinux clean-up
2015-12-02 20:16:23 +01:00
Lennart Poettering 1eb30a4c5c Merge pull request #2084 from keszybz/ppc64-fixes-2
Test fixes to run in ppc64 mock
2015-12-02 20:15:34 +01:00
Zbigniew Jędrzejewski-Szmek b3aa622929 lz4: fix size check which had no chance of working on big-endian 2015-12-02 09:50:01 -05:00
Zbigniew Jędrzejewski-Szmek 1d31abf792 tests: fix newlines in skip message 2015-12-02 09:50:01 -05:00
Zbigniew Jędrzejewski-Szmek 8b3aa503c1 tests: turn check if manager cannot be intialized into macro
We need to check the same thing in multiple tests. Use a shared
macro to make it easier to update the list of errnos.

Change the errno code for "unitialized cgroup fs" for ENOMEDIUM.
Exec format error looks like something more serious.

This fixes test-execute invocation in mock.
2015-12-02 09:50:00 -05:00
Zbigniew Jędrzejewski-Szmek ade61d3b48 basic/virt: add missing includes to compile on ppc64 2015-12-01 22:56:06 -05:00
Tom Gundersen 375f1b0491 Merge pull request #2082 from phomes/basic-sort-includes
basic: re-sort includes
2015-12-02 00:27:02 +01:00
Thomas Hindoe Paaboel Andersen 93cc7779e0 basic: re-sort includes
My previous patch to only include what we use accidentially placed
the added inlcudes in non-sorted order.
2015-12-01 23:40:17 +01:00
Tom Gundersen c0f1f52317 Merge pull request #2074 from keszybz/test-acl-util-fix
test-acl-util: fix two issues from review
2015-12-01 00:25:47 +01:00
Tom Gundersen 9b86cda0a9 Merge pull request #2075 from phomes/includes-cleanup-basic
basic: include only what we use
2015-12-01 00:25:07 +01:00
Thomas Hindoe Paaboel Andersen 11c3a36649 basic: include only what we use
This is a cleaned up result of running iwyu but without forward
declarations on src/basic.
2015-11-30 21:51:03 +01:00
Zbigniew Jędrzejewski-Szmek d879fca6bc test-acl-util: fix two issues from review
https://github.com/systemd/systemd/pull/2063
2015-11-30 15:48:21 -05:00
Lennart Poettering 6344f3e28d core: simplify selinux AVC initialization
Let's merge access_init() and mac_selinux_access_init(), and only call
mac_selinux_use() once, inside the merged function, instead of multiple
times, including in the caller.

See comments on:

https://github.com/systemd/systemd/pull/2053
2015-11-30 20:26:03 +01:00