Commit Graph

283 Commits

Author SHA1 Message Date
Alexander A. Klimov 3bf180a341 Fix typo
refs #8766
2021-10-08 10:27:35 +02:00
Alexander A. Klimov 80a1128ec7 Introduce SetupSslContext() 2021-07-22 11:12:33 +02:00
Alexander Aleksandrovič Klimov 692f5aa615
Merge pull request #8718 from Icinga/feature/tls-1.3
Support TLS 1.3
2021-06-29 17:52:55 +02:00
Julian Brost 0e7a05ad7a Support TLS 1.3 2021-06-29 11:08:47 +02:00
Julian Brost 84d778580f 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-23 11:21:42 +02:00
Julian Brost f346a9eea4
Merge pull request #8652 from Icinga/bugfix/l_appversionint-0-8628
l_AppVersionInt: respect versions like r2.12.0, not just v2.12.0
2021-06-07 16:07:04 +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 A. Klimov 1c5f69683f l_AppVersionInt: respect versions like r2.12.0, not just v2.12.0
refs #8628
2021-02-25 15:31:07 +01:00
Alexander A. Klimov c3388e9af6 Use std::mutex, not boost::mutex 2021-02-03 09:54:57 +01:00
Yonas Habteab d27f533e5f ApiListener: Update the ssl cont after each accepting incoming connection 2021-01-14 18:40:20 +01:00
Yonas Habteab 8eb4f2e062 ApiListener: Display log message if two nodes run on different versions 2020-12-16 16:09:28 +01:00
Alexander Aleksandrovič Klimov bee4ac7f7c
Merge pull request #8040 from Icinga/feature/v1-actions-execute-command-8034
Add API endpoint: /v1/actions/execute-command
2020-12-02 10:53:24 +01:00
Alexander A. Klimov 1343fd538d Start ApiListener#SyncClient() in the thread pool
... not hosting the coroutines not to block them.

Otherwise a large replay log would block messages sending
until the peer disconnects us.
2020-11-24 17:25:43 +01:00
Julian Brost c154d4d50e
Merge pull request #8466 from Icinga/feature/one-connection
ApiListener#NewClientHandlerInternal(): reject connections from already connected endpoints
2020-11-24 16:33:15 +01:00
Julian Brost cb476172ec Fix cluster message routing for global zones
RelayMessageOne used to relay the message only to one other endpoint for
other zones, which is fine, as long as the target zone is a child/parent
zone but breaks if the target zone is a global one. In this case, the
message has to be forwarded within the local zone as well as to one node
in each child zone.
2020-11-09 15:43:43 +01:00
Alexander Aleksandrovič Klimov 1e281b060a
Merge pull request #7952 from Icinga/fix/SO_REUSEPORT-optional
apilistener: Make SO_REUSEPORT optional
2020-10-29 15:56:56 +01:00
Alexander A. Klimov bb851b0558 Merge branch 'master' into feature/v1-actions-execute-command-8034 2020-10-28 18:37:08 +01:00
Alexander A. Klimov 38110e55d3 ApiListener#NewClientHandlerInternal(): reject connections from already connected endpoints 2020-10-26 15:20:58 +01:00
Alexander A. Klimov 40ac05c182 Introduce Endpoint#capabilities
refs #8034
2020-10-19 13:04:20 +02:00
Alexander A. Klimov 645dcbdc9e Introduce Endpoint#icinga_version
... and set it to e.g. 21200 via icinga::Hello.
2020-07-07 18:24:06 +02:00
Alexander A. Klimov 647f1547a9 Generalize I/O timeout emulation 2020-06-17 10:31:40 +02:00
Markus Frosch b5fa7569f2 apilistener: Make SO_REUSEPORT optional 2020-03-31 18:03:59 +02:00
Michael Friedrich d99f76bdae Merge pull request #7767 from Icinga/bugfix/replay-log-windows-rename
Ensure that log replay files are properly renamed on Windows
2020-02-10 11:42:25 +01:00
Alexander A. Klimov 35c9f2e7b3 Close connections w/o sucessful TLS handshakes during 10s
refs #7805
2020-02-05 15:53:56 +01:00
Michael Friedrich 0da46c1d4b Ensure that log replay files are properly renamed on Windows
rename() without _unlink() before doesn't work on Windows.
This commits also adds an error message which was swallowed
previously.
2020-01-20 11:41:43 +01:00
Michael Insel 859658ab98 Fix TLS context copies in ApiListener
This avoids copying the TLS context in the ApiListener class and removes
the obsolete variable.

This is a follow-up from #7654
2019-11-29 16:03:38 +01:00
Michael Insel 8431ea52ee Make SSL context const again
Turns out that the switch to the class member variable inside the lambda
expression is sufficient to fix the issue.
2019-11-25 23:42:32 +01:00
Michael Insel 016a6c3f25 Fix ApiListener const SSL context
This makes the SSL context in ApiListener::SpawnCoroutine non-const to
address an issue when an agent recieves an signed certificate from the
master and tries to update the SSL context. This also uses the class
member variable which is captured by `this` in the lamda expression.

fixes #7650
2019-11-25 22:21:09 +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 a1fef92835 Replace std::shared_ptr<boost::asio::ip::tcp::acceptor> with Shared<boost::asio::ip::tcp::acceptor>::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
Michael Friedrich 2c0e0da2d9 Introduce IoEngine::SpawnCoroutine wrapping asio::spawn and Boost exceptions
This is required to

- catch all exceptions and wrap them into Boost exceptions. They
are the only ones allowed with Boost.Coroutine.
- set a dedicated coroutine stack size for Windows.

refs #7431
2019-09-09 16:40:35 +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 17d4d17307 Avoid the Defer-Disconnect destructor pattern with Boost.Coroutines
Exceptions in Disconnect() might be thrown (this has been reworked
into error_code locally) which are swallowed inside the Destructor
for being dangerous. On the other hand, swallowing them may
corrupt the stack unwinding operation from the coroutine layer.

The best is to avoid Defer inside lib/remote and call Disconnect()
directly after breaking from other operations.

refs #7351
refs #7431
2019-09-09 10:57:13 +02:00
Michael Friedrich fcc1799a5d Split config file sync updates, part I
This commit also introduces a playground for checksums,
whilst refactoring the code in large parts.
2019-06-19 14:46:11 +02:00
Michael Friedrich 2c39d69428 Implement first draft for cluster config staged sync 2019-06-19 14:46:11 +02:00
Alexander A. Klimov 42a33cdc7d Fix build errors with Boost v1.70
refs #7237
2019-06-07 16:30:34 +02:00
Michael Friedrich 3798089642 Improve error handling with network connections (Boost ASIO)
refs #7041
2019-06-05 09:42:51 +02:00
Michael Friedrich 146b337d4d
Merge pull request #7211 from Icinga/feature/asio-tls-version
Require TLS 1.2 for Cluster & REST API
2019-06-03 16:19:22 +02:00
Michael Friedrich d82c067555 Require TLS 1.2 for Cluster & REST API
refs #7041
2019-05-29 17:08:36 +02:00
Michael Friedrich 59b95ed1f0 Quality: Replace deprecated get_io_service() with get_executor().context() for Boost ASIO
refs #7041
2019-05-29 14:36:10 +02:00
Michael Friedrich 6cce9c0fdd API: Automatically repair broken packages
This partially reverts #7150 and avoids exceptions
inside the flow. Each time an empty active stage
is detected, Icinga tries to repair it from the
the given directory tree.

Also, the code now takes into account that it should
create the package storage on startup, whether within
the API object, or if disabled, inside the application.

Caching the active stages for packages in memory
only is in effect with the API feature being enabled.
This is useful for other deployed config packages,
not only the internal one.

fixes #7173
refs #7150
refs #7119
fixes #6959
2019-05-10 12:48:34 +02:00
Michael Friedrich 502c43fb12 Active packages: Don't try to fix broken config packages which are not cached yet 2019-04-30 12:19:35 +02:00
Michael Friedrich 2bca7a5bb5 Repair broken API config packages at runtime
This means a new timer which checks every 5m whether the
active-stage can be read, and if not, it overwrites the
file on disk with the details from memory.
2019-04-26 14:53:36 +02:00
Michael Friedrich c821e73364 Cache the API package stage name with a active-stage fallback
This prevents reading the file everytime the stageName is required
for when creating a runtime object via REST API.
2019-04-26 13:40:27 +02:00
Alexander A. Klimov 5afef1015d Replace unlink() with boost::filesystem::remove()
refs #7101
2019-04-25 09:53:02 +02:00
Michael Friedrich 0f804d126b
Merge pull request #7133 from Icinga/feature/boost-asio-pki
Use new I/O engine in PkiUtility::FetchCert() and PkiUtility::RequestCertificate()
2019-04-23 14:27:48 +02:00
Michael Friedrich 20d51d21dc
Merge pull request #7127 from Icinga/bugfix/replay-log
ApiListener#RotateLogFile(): don't overwrite previous log
2019-04-23 12:08:12 +02:00
Alexander A. Klimov 407e77883c ApiListener#ReplayLog(): read current log file too instead of rotating 2019-04-18 17:22:36 +02:00