Commit Graph

666 Commits

Author SHA1 Message Date
Alexander A. Klimov f71612d8f3 icinga2 object list: warn on possibly outdated config 2022-11-24 10:50:17 +01:00
Alexander A. Klimov 0767c6ef87 icinga2 daemon -C: write icinga2.debug only if --dump-objects given
to save config (re)load time.
2022-11-23 12:54:33 +01:00
Alexander A. Klimov 61f7e029cb Replace two-variants enum with bool 2022-10-07 15:14:33 +02:00
Alexander A. Klimov 22bfcf9ac5 icinga2 daemon: remove no-op SIGCHLD handling
1. Don't set a custom handler for SIGCHLD (in the umbrella process)
   as that handler doesn't actually handle SIGCHLD anymore
2. Don't reset the SIGCHLD handler (in the worker process)
   as there's nothing to reset anymore due to the above change
3. Don't block SIGCHLD across fork(2) as its handler doesn't change anymore
   due to the above changes
2022-09-07 12:12:09 +02:00
Alexander A. Klimov 3de714489c Remove unused UnixWorkerState::Failed 2022-09-07 12:08:33 +02:00
Alexander A. Klimov df9008bfc4 StartUnixWorker(): watch forked child via waitpid(), not SIGCHLD handler
Before:

On SIGCHLD from the forked worker the umbrella process sets a failure flag.
StartUnixWorker() recognises that and does waitpid(), failure message, etc..
On OpenBSD we can't tell the signal source, so we always set the failure flag.
That's not how our IPC shall work, that breaks the IPC sooner or later.

After:

No SIGCHLD handling and no failure flag setting.
Instead StartUnixWorker()'s wait loop uses waitpid(x,y,WNOHANG)
to avoid false positives while watching the forked worker.
2022-09-07 11:46:46 +02:00
Yonas Habteab a0607aceff Fix compiler warnings don't move local variables 2022-02-22 17:51:43 +01:00
Alexander Aleksandrovič Klimov 58e329bc03
Merge pull request #7874 from Icinga/feature/sd_notify-7329
sd_notify() systemd about what we're doing right now
2021-06-28 18:20:15 +02:00
Julian Brost 36ce7d961f Rename silent parameter of ConfigItem::ActivateItems()
As silent now no longer only controls the generation of log messages, a better
name is required. This changes its name, inverts its value to reflect the new
name and adds a documentation comment.
2021-06-21 16:07:36 +02:00
Alexander A. Klimov f0c763465b sd_notify() systemd about what we're doing right now
refs #7329
2021-06-01 18:07:39 +02:00
Alexander Aleksandrovič Klimov ef8619f76b
Merge pull request #8601 from Icinga/feature/replace-std-boost-bind-with-lambdas-7006
Feature: Replace std/boost::bind() with lambdas
2021-03-18 17:56:13 +01:00
Yonas Habteab 43ba2da39c Replace std/boost::bind() function with lambda expression 2021-03-10 16:29:40 +01:00
Alexander Aleksandrovič Klimov aa4f53009e
Merge pull request #8614 from Icinga/bugfix/runworker-exceptions
Improve handling of exceptions thrown by RunWorker
2021-02-08 16:22:35 +01:00
Julian Brost 54a8c7b434 Try to log useful information for exceptions thrown by RunWorker 2021-02-05 15:43:27 +01:00
Alexander A. Klimov c3388e9af6 Use std::mutex, not boost::mutex 2021-02-03 09:54:57 +01:00
Julian Brost d7833a5977 Catch exceptions thrown by RunWorker on Windows
The same is already done on other platforms in line 529.
2021-01-27 15:48:28 +01:00
Alexander Aleksandrovič Klimov 986bedd9a0
Merge pull request #8594 from Icinga/feature/remove-upq-from-activate-items
Remove upq from ConfigItem::ActivateItems
2021-01-15 12:09:57 +01:00
Alexander A. Klimov 931b9307ae StartUnixWorker(): don't exit() on fork() failure
... but let the caller handle the failure.

Not to stop working completely just because of fork() failure during a reload.
2021-01-14 13:40:18 +01:00
Julian Brost 0c6abc817b Remove upq from ConfigItem::ActivateItems
Since commit d9010c7b9f, ActivateItems no
longer uses the WorkQueue upq to perform tasks but instead performs
these locally. One instance of `upq.Join()`/`upq.HasExceptions()`
remained in the function, but I believe this was just missed when
removing the `upq.Enqueue()` call just before.

This commit removes the corresponding parameter and updates all call
sites accordingly.
2021-01-13 15:19:55 +01:00
Alexander Aleksandrovič Klimov d996d1e201
Merge pull request #8580 from bebehei/typo
Fix typo seemless -> seamless
2021-01-11 13:45:08 +01:00
Alexander Aleksandrovič Klimov 862add5f3f
Merge pull request #8512 from Icinga/bugfix/zombie-processes
Revert "icinga2 daemon: reap remaining child processes after reload"
2021-01-11 11:38:20 +01:00
Benedikt Heine 8a455e8150 Fix typo seemless -> seamless 2020-12-25 23:27:08 +01:00
Alexander A. Klimov 8c6bfdcf54 Revert "icinga2 daemon: reap remaining child processes after reload"
This reverts commit 91265a5b0e
which isn't needed anymore as Icinga 2 isn't PID 1 anymore.
2020-12-14 13:38:35 +01:00
Julian Brost 4c0247c02d Allow specifying a CRL in `icinga2 pki verify` 2020-12-09 12:12:01 +01:00
Julian Brost e86bd24348 Verify certificates against CRL before renewing them
When a CRL is specified in the ApiListener configuration, Icinga 2 only
used it when connections were established so far, but not when a
certificate is requested. This allows a node to automatically renew a
revoked certificate if it meets the other conditions for auto-renewal
(issued before 2017 or expires in less than 30 days).
2020-12-09 12:10:59 +01:00
Alexander Aleksandrovič Klimov 4926353269
Merge pull request #8277 from Icinga/bugfix/latency-8196
Call Process::InitializeSpawnHelper() ASAP
2020-10-16 16:49:06 +02:00
Alexander Aleksandrovič Klimov d6a4db935f
Merge pull request #8374 from Icinga/bugfix/docker-memory-leak
icinga2 daemon: reap remaining child processes after reload
2020-10-16 10:33:49 +02:00
Alexander Aleksandrovič Klimov 1f55338cbd
Merge pull request #8166 from Icinga/bugfix/logrotate-crash-8050
Ensure the daemon doesn't get killed by logrotate
2020-10-15 10:39:47 +02:00
Alexander A. Klimov 91265a5b0e icinga2 daemon: reap remaining child processes after reload
... as we may be PID 1.
2020-10-15 10:25:14 +02:00
Alexander A. Klimov d3f6a97a7e Ensure the daemon doesn't get killed by logrotate
refs #8050
2020-10-14 14:02:44 +02:00
Alexander A. Klimov 177f930375 Call Process::InitializeSpawnHelper() ASAP
refs #8196
2020-09-23 11:49:13 +02:00
Alexander A. Klimov 3617f05836 icinga2 pki save-cert: allow to specify --key and --cert
refs #7992
2020-04-28 17:34:00 +02:00
Michael Friedrich 06d0c3ea4e
Merge pull request #7843 from Icinga/feature/cli-pki-verify
CLI: Add `pki verify` command for better TLS certificate troubleshooting
2020-02-25 09:07:24 +01:00
Michael Friedrich 12b6c1aab9 CLI: Improve error handling for 'pki verify' command 2020-02-20 15:10:57 +01:00
Michael Friedrich e4e26d66a6 Build fix 2020-02-17 18:40:28 +01:00
Michael Friedrich 6f263a4922 Add `pki verify` CLI command: print, signed by CA, valid CA, CN match 2020-02-17 18:10:51 +01:00
Michael Friedrich cfd9b80027
Merge pull request #7838 from Icinga/bugfix/catch-exception-in-node-setup
Catch exception when trusted cert is not readable during node setup on agent/satellite
2020-02-14 09:51:17 +01:00
Michael Insel e4f25269fe
Fix Build
I have no idea how this got lost.
2020-02-14 07:56:23 +01:00
Michael Insel 90ac6cd9a1 CLI: Catch exception when trusted cert is not readable
This catches an exception when the trusted cert is not readable during
node setup.
2020-02-13 20:03:17 +01:00
Michael Friedrich 82e055bfb6 CLI: Clean up 'pki save-cert' command and remove deprecated params
This got obsoleted 4 years ago in a monster commit.
b297e8cfa7
2020-02-13 16:14:01 +01:00
Michael Friedrich e1557def94 CLI: Verify --trustedcert being a client, non CA certificate in 'node setup'
This commit also cleans some shell output with master vs. parent.
2020-02-13 16:09:16 +01:00
Michael Friedrich 5812dae55b Dev: Allow to delay main worker process in order to attach with LLDB
Introduce `-DInternal.DebugWorkerDelay=120` and sleep inside `RunWorker()`.

Rationale: With 2.11 we've introduced a real umbrella process where the
main process is spawned as child fork. Running icinga2 in foreground on
a macOS shell with LLDB will now exit, and not follow the child process.

LLDB doesn't support `follow-fork-mode child` like GDB and therefore we
need to:

- Print the child process PID
- Sleep for X seconds to allow the developer to run `lldb -p <PID>`, set breakpoints, etc.

This commit also documents all available debug build enabled internal constants.
2020-01-29 13:21:05 +01:00
Stuart Henderson 6744b1af54 cope with OS which don't fill in si_pid in siginfo
Icinga processes check si_pid on IPC signals to ensure that the signal
comes from an expected process. OpenBSD doesn't currently fill in si_pid
in siginfo (leaving it 0) so signals never pass this check, resulting
in startup failing to complete (the worker doesn't see the umbrella's
signal and vice-versa) - issue #7505.

Relax the requirement so that either 0 or the wanted pid is accepted.
2020-01-07 22:08:38 +00:00
Michael Friedrich 7e369c0443
Merge pull request #7546 from Icinga/feature/zone-in-zone-7530
DaemonUtility#ValidateConfigFiles(): re-try unknown zones once they may have become known
2019-10-31 16:34:08 +01:00
Alexander A. Klimov ba1ce9c853 Replace std::shared_ptr<boost::asio::ssl::context> with Shared<boost::asio::ssl::context>::Ptr 2019-10-21 16:12:46 +02:00
Alexander A. Klimov a1683568a1 Replace std::shared_ptr<AsioTlsStream> with Shared<AsioTlsStream>::Ptr 2019-10-21 16:12:35 +02:00
Alexander A. Klimov eacdb3dac7 DaemonUtility#ValidateConfigFiles(): re-try unknown zones once they may have become known
refs #7530
2019-09-30 10:26:13 +02:00
Michael Friedrich 5fa7331cc9 Quality: Replace deprecated Boost IO service code
https://github.com/boostorg/asio/issues/110
https://www.boost.org/doc/libs/1_66_0/doc/html/boost_asio/example/cpp03/services/logger_service.hpp
2019-09-09 15:27:57 +02:00
Michael Friedrich 9d6ee44e71
Merge pull request #7346 from Icinga/feature/check-plugins-code-page-7110
DaemonCommand#Run(): set code page to UTF-8
2019-08-27 14:51:30 +02:00
Michael Friedrich 01fe243f23 Log a hint after failed config validation for systemd users 2019-08-07 12:03:17 +02:00