5126 Commits

Author SHA1 Message Date
Julian Brost
3b6066df60 Merge remote-tracking branch 'origin/bugfix/new-connection-timeout-2.11' into jbrost/2.11.9-with-execute-command-and-connect-timeout 2021-06-28 17:43:27 +02:00
Julian Brost
e1d4fcd8d1 Merge remote-tracking branch 'origin/feature/v1-actions-execute-command-8034-2.11.7' into jbrost/2.11.9-with-execute-command-and-connect-timeout 2021-06-28 17:42:17 +02:00
Julian Brost
0caf82568c Add timeout for all new connections
This commit adds a timeout for both establishing new outgoing and incoming
connections. This timeout applies to everything until the connection is in a
state where either JsonRpcConnection or HttpServerConnection takes over.
2021-06-28 09:25:20 +02:00
Alexander Aleksandrovič Klimov
0bf2c78cc4
Merge pull request #8810 from Icinga/bugfix/mysql-one-transaction-for-programstatus-2.11
IDO: Use own transaction for program status and make sure InternalNewTransaction() gets executed
2021-05-26 15:46:56 +02:00
Alexander Aleksandrovič Klimov
5f6fb3d617
Merge pull request #8770 from Icinga/bugfix/retry-rename-on-windows-2.11
Retry file rename operations on Windows for some errors (2.11)
2021-05-26 13:43:13 +02:00
Alexander Aleksandrovič Klimov
a18a2e3813
Merge pull request #8772 from Icinga/bugfix/problem-notification-at-downtime-end-2.11
Send problem notifications after downtime end for checkables in child zones (2.11)
2021-05-26 13:41:41 +02:00
Alexander Aleksandrovič Klimov
452665d774
Merge pull request #8776 from Icinga/bugfix/runworker-exceptions-2.11
Improve handling of exceptions thrown by RunWorker (2.11)
2021-05-26 13:37:37 +02:00
Alexander Aleksandrovič Klimov
031f379051
Merge pull request #8780 from Icinga/bugfix/concurent-notification-send-and-delete-2.11
Fix crash when notifications are sent while the notification object is deleted (2.11)
2021-05-26 13:36:18 +02:00
Alexander Aleksandrovič Klimov
42c32c70ac
Merge pull request #8784 from Icinga/bugfix/concurrent-schedule-downtime-delete-host-2.11
Fix null pointer dereferences when deleting objects while scheduling downtimes (2.11)
2021-05-26 13:35:43 +02:00
Noah Hilverling
98457f746b IDO-MySQL: Make sure InternalNewTransaction() and FinishAsyncQueries() get executed during high load 2021-05-26 10:35:23 +02:00
Noah Hilverling
cc9451b828 IDO: Use own transaction for programstatus 2021-05-26 10:35:23 +02:00
Julian Brost
77427bedae AddDowntime: return Downtime::Ptr instead of String containing the name
At numerous places in the code, something like this is performed:

    String name = Downtime::AddDowntime(...);
    Downtime::Ptr downtime = Downtime::GetByName(name);

However, `downtime` can be a `nullptr` after this as it is possible that
the downtime is deleted in between.

This commit changes the return type of `Downtime::AddDowntime` to return
a Downtime::Ptr instead of the full name of the downtime. `AddDowntime`
performs the very same `GetByName()` operation internally, but handles
the `nullptr` case correctly and throws an exception.
2021-05-26 08:54:01 +02:00
Julian Brost
5b5efab847 Properly handle service downtime referencing a deleted host
Only two out of three cases were handled properly by the code: host
downtimes referencing a deleted host and service downtimes referencing a
deleted service worked fine. However, if a service downtime references a
deleted host, `Host::GetByName()` returns `nullptr` which isn't
accounted for. Use `Service::GetByNamePair()` instead as this performs a
check for the host being null internally.
2021-05-26 08:54:01 +02:00
Julian Brost
9060264c64 Use reference-counted pointer in notification callback
`this` could be deleted after `Notification::BeginExecuteNotification`
exited and before `Notification::ExecuteNotificationHelper` finished.
This is fixed by constructing a `Notification::Ptr` and operate on that
one as it is properly reference-counted.
2021-05-26 08:53:33 +02:00
Julian Brost
1355341681 Try to log useful information for exceptions thrown by RunWorker 2021-05-26 08:52:37 +02:00
Julian Brost
b1536eac6f Catch exceptions thrown by RunWorker on Windows
The same is already done on other platforms in line 529.
2021-05-26 08:52:37 +02:00
Julian Brost
7511a5c3fc Only handle event::SetSuppressed{Notifications,NotificationTypes} within the local zone
Note that even when passing `nullptr` as target zone to `RelayMessage()`, the
cluster message will still be sent to the parent zone. These incoming messages
will now be rejected by the parent nodes. At the moment, there's no way to only
send within the local zone.
2021-05-26 08:52:05 +02:00
Julian Brost
c0c7d52921 Retry file rename operations on Windows for some errors 2021-05-26 08:51:22 +02:00
Alexander A. Klimov
83eba2b316 ConfigObjectUtility#CreateObject(): check config objects for duplicates
... not to delete already existing objects during a trial of re-creation.

refs #7726
2021-05-25 19:39:17 +02:00
Alexander Aleksandrovič Klimov
04d8eee3e5
Merge pull request #8793 from Icinga/bugfix/211boost174
Support Boost 1.74
2021-05-25 15:26:19 +02:00
Julian Brost
50820f1a73 Provide a conversion function from icinga::String to boost::string_view
Boost.Beast changed the signature of
boost::beast::http::basic_fields::set in version 1.74 so that no longer
allows passing an icinga::String instance as value. This adds a
conversion function so that it works again.
2021-05-20 16:28:30 +02:00
Julian Brost
058d267397 Use content_length method for setting the Content-Length header
Boost.Beast changed the signature of the previously used generic `set`
method so that it no longer accepts integer types, however there is
alreay a more specific method for setting the Content-Length header, so
use this one instead.
2021-05-20 16:28:30 +02:00
Louis Sautier
514a4e326f Fix ‘fs::copy_option’ has not been declared with boost 1.74.0
It was deprecated in
f199152b7d
2021-05-20 16:28:30 +02:00
Julian Brost
398a5baf70 Remove unused function declarations in tlsutility.hpp
These were introduced in c510fe4dfed0f65824bb259433faa0988caa2447, probably
when resolving a merge conflict. However, these functions do not exist in 2.11,
but refer to the Array type which is not included in the header, leading to
non-unity build failing.

This commit simply removes these declarations and thus restores non-unity
builds in 2.11.
2021-05-20 14:25:59 +02:00
Noah Hilverling
d17b4ecc4b
Merge pull request #8560 from Icinga/bugfix/children-recover-too-late
On recovery: re-check children
2020-12-15 13:11:46 +01:00
Noah Hilverling
9c433044cc Build fix: Use correct shared pointer implementation 2020-12-15 13:00:23 +01:00
Julian Brost
c510fe4dfe 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-15 10:38:37 +01:00
Alexander A. Klimov
4b0313d3f3 On recovery: re-check children 2020-12-11 16:40:29 +01:00
Alexander A. Klimov
3c15e71e19 Don't fire suppressed notifications if last parent recovery >= last check result 2020-12-11 16:40:29 +01:00
Noah Hilverling
03b728b83e Fix runtime config updates not working for objects without zone
refs #8533
2020-12-10 17:07:04 +01:00
Julian Brost
905cf5aa65 Use ERR_error_string_n() instead of ERR_error_string()
Explicitly pass the actual length of the buffer to avoid overflows.
2020-12-09 12:23:07 +01:00
Julian Brost
3b37867d2e Increase size of buffer for OpenSSL error messages
According to man 3 ERR_error_string, "buf must be at least 256 bytes
long", therefore increase the buffer size to 256 everywhere.
2020-12-09 12:23:07 +01:00
Julian Brost
64a49ee3a1 Remove std::string to_string(const errinfo_openssl_error& e)
The function was never used and it's implementation contains a bug where
a buffer of too small size is used as a paramter to ERR_error_string.
According to the `man 3 ERR_error_info`, the buffer has to be at least
256 bytes in size.

Also the function seems of limited use as it allows to output the tag
object used with additional error information for exceptions in Boost.
However, you boost::get_error_info<>() just returns the value type but
not the full tag object from the exception.
2020-12-09 12:22:52 +01:00
Julian Brost
072434f3f3 Remove SpinLock
No longer needed as its only user now uses std::mutex.
2020-11-27 11:24:17 +01:00
Julian Brost
7d546aa2d8 ApiListener: merge new config validation and actication functions
Merge AsyncTryActivateZonesStage and TryActivateZonesStageCallback and
name the result TryActivateZonesStage. The old split was a leftover from
the one being a callback function with no actual meaningful separation.
2020-11-27 11:24:17 +01:00
Julian Brost
a96e6c3861 Use std::mutex instead of Spinlock 2020-11-27 11:24:17 +01:00
Julian Brost
3081d9942d API filesync: wait for validation process to exit
This avoid having to pass a lock implictly using the captured variables
of a lambda.
2020-11-27 11:24:17 +01:00
Julian Brost
fde51ed9f7 Add Process::WaitForResult to allow waiting for the process to finish 2020-11-27 11:24:17 +01:00
Alexander A. Klimov
eb454b8517 Introduce Endpoint#capabilities
refs #8034
2020-11-20 17:41:45 +01:00
Alexander A. Klimov
9d574e7702 Fix missing include
refs #8034
2020-11-20 17:41:08 +01:00
Mattia Codato
c9cc8a7c70 Add timer to clean deadlined executions 2020-11-20 17:40:45 +01:00
Mattia Codato
4559b5a22d Use ExecuteCommand::ExecuteOverride also for ido check 2020-11-20 17:38:27 +01:00
Mattia Codato
76007d369f Remove an useless check 2020-11-20 17:38:27 +01:00
Mattia Codato
e4c9616068 Set exit code 126 if endpoint doens't support the new executeCommand API 2020-11-20 17:38:27 +01:00
Mattia Codato
f1f5bb4738 Check child endpoint versions and check child zone can access to the target endpoint 2020-11-20 17:38:27 +01:00
Mattia Codato
85e2f3a479 Check satellites Icinga version before relay the execute command message 2020-11-20 17:38:27 +01:00
Mattia Codato
3516c9c631 Use local zone for update executions 2020-11-20 17:38:27 +01:00
Mattia Codato
1253aa07e4 Change checkable with the endpoint zone for execute command relay message 2020-11-20 17:38:27 +01:00
Mattia Codato
5134eca2ab Forward the execute command through the zones 2020-11-20 17:38:27 +01:00
Mattia Codato
3edf36658e Use ternary operator to get ExecuteOverride or checkable command 2020-11-20 17:38:27 +01:00