Alexander Aleksandrovič Klimov
ca51edeee8
Don't use boost::asio::ip::tcp::resolver::query
...
It was removed in Boost 1.87.
2025-03-11 16:54:09 +01:00
Alexander A. Klimov
d956920bd7
Move Timeout instances from heap to stack
2025-01-13 10:42:36 +01:00
Alexander A. Klimov
1703f99d14
Don't call Timeout#Cancel() where Timeout#~Timeout() is called
2025-01-13 10:42:36 +01:00
Alexander A. Klimov
a47508b7b3
Timeout#Timeout(): drop unnecessary template parameters
2025-01-13 10:42:36 +01:00
Alexander A. Klimov
d69291739f
While using Timeout, don't unnecessarily keep the strand alive via smart pointer
2025-01-13 10:42:36 +01:00
Alexander A. Klimov
f839707c4a
Timeout#Timeout(): don't pass yield_context to callback
...
It's not used. Also, the callback shall run completely at once. This ensures that it won't (continue to) run once another coroutine on the strand calls Timeout#Cancel().
2025-01-13 10:42:36 +01:00
Julian Brost
2fffb28ab0
Add comment for remaining uses of async_shutdown() why it's safe
...
The reason for introducing AsioTlsStream::GracefulDisconnect() was to handle
the TLS shutdown properly with a timeout since it involves a timeout. However,
the implementation of this timeout involves spwaning coroutines which are
redundant in some cases. This commit adds comments to the remaining calls of
async_shutdown() stating why calling it is safe in these places.
2025-01-13 10:33:11 +01:00
Yonas Habteab
eb32283751
Merge pull request #10237 from Icinga/log-connected-endpoint-connection-attempts-214
...
ApiListener: Log connection attempts from an already connected client
2024-11-14 12:57:41 +01:00
Yonas Habteab
8acfb9b214
ApiListener: Log connection attempts from an already connected client
...
Something is definitely going wrong if a client tries to reconnect to
this endpoint while it still has an active connection to that client. So
we shouldn't hide this, but at least log it at info level. Apart from
that, I've added some additional information about the currently active
client, such as when the last message was sent and received.
2024-11-14 11:09:00 +01:00
Yonas Habteab
d5051c7ea3
ApiListener: Log error context only once
...
When logging at the warning level, the logger will automatically look up
for registered context and append them to the log entry accordingly.
2024-11-14 11:05:53 +01:00
Yonas Habteab
d5cd5aff2c
Merge pull request #10080 from Icinga/net-stack-2.14.3
...
Fix network stack stability issues
2024-11-14 11:02:36 +01:00
Yonas Habteab
96839d829b
ApiListener: Reorder logging in ApiTimerHandler()
2024-09-03 16:49:02 +02:00
Yonas Habteab
b9b3e7a925
ApiListener: Catch & supress clients runtime errors
2024-09-03 16:49:02 +02:00
Julian Brost
02334c5f29
Make sure log file is reopened when ApiListener::ReplayLog()
returns
2024-09-03 16:49:02 +02:00
Yonas Habteab
5f2d31bf3c
Use Defer
class for cleanup in ApiListener::ReplayLog()
2024-09-03 16:49:01 +02:00
Alexander A. Klimov
9a0c7d7c75
ApiListener#ReplayLog(): stop reading files ASAP on send error
2024-09-03 16:49:01 +02:00
Alexander A. Klimov
8ff7121e93
ApiListener#ListenerCoroutineProc(): get remote endpoint ASAP for logging
...
On incoming connection timeout we log the remote endpoint which isn't
available if it was already disconnected - an exception is thrown. Get it
as long as we're still connected not to lose it, nor to get an exception.
2024-06-10 13:19:46 +02:00
Yonas Habteab
dfffb29c81
ApiListener: Reset m_LogMessageCount
when rotating
...
Closing and re-opening that very same log file shouldn't reset the
counter, otherwise some log files may exceed the max limit per file as
their offset indicator is reset each time they are re-opened.
2024-06-10 13:19:46 +02:00
Alexander A. Klimov
32f43c4873
ApiListener#Start(): auto-renew CA on its owner
...
otherwise it would expire.
2023-12-18 17:04:59 +01:00
Alexander A. Klimov
b3dee0bb0a
ApiListener#RenewCert(): enable optional CA creation
2023-12-18 17:04:59 +01:00
Alexander Aleksandrovič Klimov
000a776dfb
Built-in check command: ifw-api ( #9062 )
2023-07-06 14:18:21 +02:00
Julian Brost
af9d67b262
Merge pull request #9726 from Icinga/43624b
...
Remove -and notify- expired downtimes immediately, not every 60s II
2023-05-02 11:25:03 +02:00
Alexander A. Klimov
ba7102cae3
Explicitly stop started timers and wait for them
...
before permitting their parent objects' destruction.
For the cases where the handlers have raw pointers to these objects.
2023-04-14 14:52:04 +02:00
Alexander A. Klimov
21b68455ce
Use Timer::Create() instead of new Timer()
...
git ls-files -z |xargs -0 perl -pi -e 's/\bnew Timer\b/Timer::Create/g'
ex. in Timer::Create() itself.
2023-04-04 10:35:20 +02:00
Alexander A. Klimov
4c154f93dc
ApiListener#NewClientHandlerInternal(): on basic_socket#cancel() (due to timeout) don't ssl::stream#async_shutdown()
...
If a connection hangs for too long in ApiListener#NewClientHandler(),
ApiListener#AddConnection()'s Timeout calls boost::asio::basic_socket#cancel()
on that connection to trigger an exception which unwinds
ApiListener#NewClientHandler(). Previously that unwind could trigger a Defer
which called boost::asio::ssl::stream#async_shutdown() which extended the hang.
2023-03-21 10:57:40 +01:00
Julian Brost
c51037725a
Merge pull request #9466 from Icinga/flush-temp-files
...
Deduplicate and stabilize fragile filesystem transactions
2023-02-02 16:29:11 +01:00
Alexander A. Klimov
b92fe23469
Deduplicate and stabilize fragile filesystem transactions
...
by using AtomicFile so they ensure all or nothing of a file gets replaced.
2023-01-27 12:03:56 +01:00
Yonas Habteab
8bb0b857d8
ApiListener: Fix memory leak & group a || b && c
correctly
2023-01-26 09:10:49 +01:00
Alexander A. Klimov
83021f8231
CONTEXT: use << everywhere to unify usages
2022-11-30 11:06:51 +01:00
Alexander A. Klimov
c9e4c016e0
Protect ApiListener#m_SSLContext with a mutex
2022-04-11 11:02:45 +02:00
Alexander A. Klimov
e490883577
Renew certificates also periodically
2022-04-11 11:02:39 +02:00
Alexander A. Klimov
3753f86c80
ApiListener#Start(): auto-renew own cert if CA owner
...
otherwise that particular cert would expire.
2022-04-04 12:13:31 +02:00
Alexander A. Klimov
6d470a3ca5
Introduce ApiListener#RenewCert()
2022-04-04 12:12:31 +02:00
Alexander A. Klimov
5f2e021390
Request certificate renewal also master2->master1
...
not only sat->master to prevent master2's certificate from expiring.
2022-03-29 16:47:23 +02:00
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