Commit graph

24263 commits

Author SHA1 Message Date
Lennart Poettering 7160eb1b86 resolved: properly handles RRs in domains beginning in an asterisk label
Properly handle RRs that begin with an asterisk label. These are the unexpanded forms of wildcard domains and appear in
NSEC RRs for example. We need to make sure we handle the signatures of these RRs properly, since they mostly are
considered normal RRs, except that the RRSIG labels counter is one off for them, as the asterisk label is always
excluded of the signature.
2016-01-13 20:21:56 +01:00
Lennart Poettering 7715f91dca resolved: optimize dnssec_verify_rrset() a bit
Let's determine the source of synthesis once instead of for each RR in the RRset.
2016-01-13 20:21:56 +01:00
Lennart Poettering eb241cdbee shared: add new dns_name_startswith() call
dns_name_startswith() is to dns_name_endswith() as startswith() is to endswith().
2016-01-13 20:21:56 +01:00
Lennart Poettering 522d85ae0a basic: add new ascii_strcasecmp_n() call 2016-01-13 20:21:56 +01:00
Lennart Poettering 4b2e9cfcf0 systemctl: improve wording of "systemctl enable" messages
Closes: #2299
2016-01-13 20:21:36 +01:00
Lennart Poettering d41084a586 resolved: allocate bounded strings on stack instead of heap, if we can 2016-01-13 20:21:36 +01:00
Lennart Poettering 5ae5cd4052 resolved: consider inverted RRSIG validity intervals expired 2016-01-13 20:21:36 +01:00
Lennart Poettering f506d09f71 update TODO 2016-01-13 20:21:36 +01:00
Daniel Mack 0aaa263f16 Merge pull request #2312 from jsynacek/master
man/tmpfiles.d: add note about permissions and ownership of symlinks
2016-01-13 13:29:33 +01:00
Jan Synacek b908bb63c4 man/tmpfiles.d: add note about permissions and ownership of symlinks
...because this is might not be obvious.
2016-01-13 08:41:54 +01:00
Lennart Poettering d9a090b995 Merge pull request #490 from pyssling/master
Add machine-id setting
2016-01-12 23:30:20 +01:00
Nils Carlson ee48dbd55f core: Add machine-id setting
Allow for overriding all other machine-ids which may be present on
the system using a kernel command line systemd.machine_id or
--machine-id= option.

This is especially useful for network booted systems where the
machine-id needs to be static, or for containers where a specific
machine-id is wanted.
2016-01-12 22:10:41 +00:00
Lennart Poettering 7e48712407 Merge pull request #2131 from evverx/regenerate-m4-on-reconfigure
build-sys: regenerate %.m4 -> % on reconfigure
2016-01-12 20:35:55 +01:00
Lennart Poettering 0c50384b30 Merge pull request #2310 from vcaputo/sd-event-profiling-fixups
sd-event: minor fixups to delays profiling changes
2016-01-12 19:45:01 +01:00
Vito Caputo 34a6843d62 sd-event: minor fixups to delays profiling changes 2016-01-12 10:28:00 -08:00
Lennart Poettering 593a2c77cb Merge pull request #2147 from vcaputo/sd-event-measure-latencies
sd-event: instrument sd_event_run() for profiling delays
2016-01-12 18:52:30 +01:00
Vito Caputo 34b8751774 sd-event: instrument sd_event_run() for profiling delays
Set SD_EVENT_PROFILE_DELAYS to activate accounting and periodic logging
of the distribution of delays between sd_event_run() calls.

Time spent in dispatching as well as time spent outside of
sd_event_run() is measured and accounted for.  Every 5 seconds a
logarithmic histogram loop iteration delays since 5 seconds previous is
logged.

This is useful in identifying the frequency and magnitude of latencies
affecting the event loop, which should be kept to a minimum.
2016-01-12 09:35:17 -08:00
Lennart Poettering 45630488f9 Merge pull request #2308 from zonque/xsprintf
tree-wide: use xsprintf() where applicable
2016-01-12 16:03:48 +01:00
Daniel Mack d054f0a4d4 tree-wide: use xsprintf() where applicable
Also add a coccinelle receipt to help with such transitions.
2016-01-12 15:36:32 +01:00
Lennart Poettering 1f52a79d4e Merge pull request #2265 from ipuustin/ambient
capabilities: added support for ambient capabilities.
2016-01-12 15:16:24 +01:00
Daniel Mack 4a6a24be18 Merge pull request #2303 from aadamowski/fix-miscalculated-buffer
Fix miscalculated buffer size and uses of size-unlimited sprintf()
2016-01-12 15:06:41 +01:00
Ismo Puustinen ece87975a9 man: add AmbientCapabilities entry. 2016-01-12 12:14:50 +02:00
Ismo Puustinen 70d7aea5c7 tests: test ambient capabilities.
The ambient capability tests are only run if the kernel has support for
ambient capabilities.
2016-01-12 12:14:50 +02:00
Ismo Puustinen 755d4b67a4 capabilities: added support for ambient capabilities.
This patch adds support for ambient capabilities in service files. The
idea with ambient capabilities is that the execed processes can run with
non-root user and get some inherited capabilities, without having any
need to add the capabilities to the executable file.

You need at least Linux 4.3 to use ambient capabilities. SecureBit
keep-caps is automatically added when you use ambient capabilities and
wish to change the user.

An example system service file might look like this:

[Unit]
Description=Service for testing caps

[Service]
ExecStart=/usr/bin/sleep 10000
User=nobody
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_RAW

After starting the service it has these capabilities:

CapInh: 0000000000003000
CapPrm: 0000000000003000
CapEff: 0000000000003000
CapBnd: 0000003fffffffff
CapAmb: 0000000000003000
2016-01-12 12:14:50 +02:00
Ismo Puustinen a103496ca5 capabilities: keep bounding set in non-inverted format.
Change the capability bounding set parser and logic so that the bounding
set is kept as a positive set internally. This means that the set
reflects those capabilities that we want to keep instead of drop.
2016-01-12 12:14:50 +02:00
Lennart Poettering f466acdc63 Merge pull request #2290 from vcaputo/normalize-log-source-priorities
journal: normalize priority of logging sources
2016-01-12 02:03:23 +01:00
Aleksander Adamowski 13f5402c6b Fix miscalculated buffer size and uses of size-unlimited sprintf()
function.

Not sure if this results in an exploitable buffer overflow, probably not
since the the int value is likely sanitized somewhere earlier and it's
being put through a bit mask shortly before being used.
2016-01-11 15:26:41 -08:00
Tom Gundersen a41a7181c9 Merge pull request #2289 from poettering/dnssec13
Thirteenth DNSSEC patch set
2016-01-11 21:31:53 +01:00
Lennart Poettering eee026a7ba resolved: improve query RR type error wording a bit 2016-01-11 20:19:10 +01:00
Lennart Poettering 04680e36a4 resolved: don#t allow explicit queries for RRSIG RRs
We wouldn't know how to validate them, since they are the signatures, and hence have no signatures.
2016-01-11 20:15:28 +01:00
Lennart Poettering d0129ddb9f resolved: refuse doing queries for known-obsolete RR types
Given how fragile DNS servers are with some DNS types, and given that we really should avoid confusing them with
known-weird lookups, refuse doing lookups for known-obsolete RR types.
2016-01-11 20:05:29 +01:00
Lennart Poettering 274b874830 resolved: rename DnsTransaction's current_features field to current_feature_level
This is a follow-up for f4461e5641.
2016-01-11 19:40:00 +01:00
Lennart Poettering 011842775f resolved: split out resetting of DNS server counters into a function call of its own
A suggested by Vito Caputo:

https://github.com/systemd/systemd/pull/2289#discussion-diff-49276220
2016-01-11 19:40:00 +01:00
Lennart Poettering 372dd764a6 resolved: accept rightfully unsigned NSEC responses 2016-01-11 19:40:00 +01:00
Lennart Poettering 92ec902aad resolved: rework how and when we detect whether our chosen DNS server knows DNSSEC
Move detection into a set of new functions, that check whether one specific server can do DNSSEC, whether a server and
a specific transaction can do DNSSEC, or whether a transaction and all its auxiliary transactions could do so.

Also, do these checks both before we acquire additional RRs for the validation (so that we can skip them if the server
doesn't do DNSSEC anyway), and after we acquired them all (to see if any of the lookups changed our opinion about the
servers).

THis also tightens the checks a bit: a server that lacks TCP support is considered incompatible with DNSSEC too.
2016-01-11 19:40:00 +01:00
Lennart Poettering 6cb08a8930 resolved: cache formatted server string in DnsServer structure
This makes it easier to log information about a specific DnsServer object.
2016-01-11 19:40:00 +01:00
Lennart Poettering 6bb2c08597 resolved: rework server feature level logic
This changes the DnsServer logic to count failed UDP and TCP failures separately. This is useful so that we don't end
up downgrading the feature level from one UDP level to a lower UDP level just because a TCP connection we did because
of a TC response failed.

This also adds accounting of truncated packets. If we detect incoming truncated packets, and count too many failed TCP
connections (which is the normal fall back if we get a trucnated UDP packet) we downgrade the feature level, given that
the responses at the current levels don't get through, and we somehow need to make sure they become smaller, which they
will do if we don't request DNSSEC or EDNS support.

This makes resolved work much better with crappy DNS servers that do not implement TCP and only limited UDP packet
sizes, but otherwise support DNSSEC RRs. They end up choking on the generally larger DNSSEC RRs and there's no way to
retrieve the full data.
2016-01-11 19:40:00 +01:00
Lennart Poettering ef9fb66c0b resolved: add missing case to switch statement 2016-01-11 19:40:00 +01:00
Lennart Poettering 034e803191 resolved: log why we use TCP when UDP isn't supported by a server 2016-01-11 19:40:00 +01:00
Lennart Poettering f757cd8510 resolved: log about truncated replies before trying again, not after 2016-01-11 19:40:00 +01:00
Lennart Poettering 91adc4db33 resolved: don't attempt to send queries for DNSSEC RR types to servers not supporting them
If we already degraded the feature level below DO don't bother with sending requests for DS, DNSKEY, RRSIG, NSEC, NSEC3
or NSEC3PARAM RRs. After all, we cannot do DNSSEC validation then anyway, and we better not press a legacy server like
this with such modern concepts.

This also has the benefit that when we try to validate a response we received using DNSSEC, and we detect a limited
server support level while doing so, all further auxiliary DNSSEC queries will fail right-away.
2016-01-11 19:40:00 +01:00
Lennart Poettering 29ab055292 resolved: log about reasons for switching to TCP 2016-01-11 19:40:00 +01:00
Lennart Poettering 571370c155 resolved: when we get a packet failure from a server, don't downgrade UDP to TCP or vice versa
Under the assumption that packet failures (i.e. FORMERR, SERVFAIL, NOTIMP) are caused by packet contents, not used
transport, we shouldn't switch between UDP and TCP when we get them, but only downgrade the higher levels down to UDP.
2016-01-11 19:40:00 +01:00
Lennart Poettering 7e1851e3c6 resolved: properly handle UDP ICMP errors as lost packets
UDP ICMP errors are reported to us via recvmsg() when we read a reply. Handle this properly, and consider this a lost
packet, and retry the connection.

This also adds some additional logging for invalid incoming packets.
2016-01-11 19:40:00 +01:00
Lennart Poettering a1a3f73a57 resolved: when we get a TCP connection failure, try again
Previously, when we couldn't connect to a DNS server via TCP we'd abort the whole transaction using a
"connection-failure" state. This change removes that, and counts failed connections as "lost packet" events, so that
we switch back to the UDP protocol again.
2016-01-11 19:39:59 +01:00
Lennart Poettering 6a1a5eec43 resolved: when DNS/TCP doesn't work, try DNS/UDP again
If we failed to contact a DNS server via TCP, bump of the feature level to UDP again. This way we'll switch back
between UDP and TCP if we fail to contact a host.

Generally, we prefer UDP over TCP, which is why UDP is a higher feature level. But some servers only support UDP but
not TCP hence when reaching the lowest feature level of TCP and want to downgrade from there, pick UDP again. We this
keep downgrading until we reach TCP and then we cycle through UDP and TCP.
2016-01-11 19:39:59 +01:00
Lennart Poettering 8d10d62055 resolved: introduce dns_transaction_retry() and use it everywhere
The code to retry transactions has been used over and over again, simplify it by replacing it by a new function.
2016-01-11 19:39:59 +01:00
Lennart Poettering aa4a9deb7d resolved: set a description on all our event sources 2016-01-11 19:39:59 +01:00
Lennart Poettering 35908b9835 resolved: fix error propagation 2016-01-11 19:39:59 +01:00
Lennart Poettering d51155663a shared: make sure foo.bar and foobar result in different domain name hashes
This also introduces a new macro siphash24_compress_byte() which is useful to add a single byte into the hash stream,
and ports one user over to it.
2016-01-11 19:39:59 +01:00