Commit Graph

443 Commits

Author SHA1 Message Date
Michael Friedrich d2f5008557 API: Ensure that empty passwords w/ client_cn are properly checked
fixes #11482
2016-04-04 16:38:47 +02:00
Gunnar Beutner b621b00e3a Detect infinite recursion in the zone hierarchy graph
fixes #10937
2016-03-23 09:03:53 +01:00
Jean Flach 9cdea730a3 Fix delete object handler returning incorrect status codes
Now a 200 OK only gets returned if all objects could be deleted

fixes #10770
2016-03-01 16:53:52 +01:00
Michael Friedrich c8a9f45697 ApiListener: Bail out if object could not be created during config sync
refs #11006
2016-02-12 14:15:24 +01:00
Jean Flach 19134f41cf Fix client not closing connections
fixes #11122
2016-02-09 15:59:19 +01:00
Jean Flach fa1d633484 Rephrase some log messages
refs #11122
2016-02-09 15:59:19 +01:00
Gunnar Beutner 90e241ca85 Fix: Cluster WQ thread dies after fork()
fixes #11118
2016-02-09 12:46:46 +01:00
Gunnar Beutner 14d805e6fe Fix crash in ApiListener::ConfigUpdateObjectAPIHandler
fixes #11006
2016-02-09 09:13:43 +01:00
Jean Flach 393a6bf641 Remove unused variables
fixes #11111
2016-02-08 17:10:12 +01:00
Gunnar Beutner e224e74994 Make sure the "syncing" attribute is set to false
refs #11083
2016-02-08 13:15:24 +01:00
Michael Friedrich 3227186c7d Fix: API queries on non-existant objects cause exception
fixes #11088
2016-02-04 22:40:01 +01:00
Michael Friedrich 949b129c65 Ensure that config sync updates are always sent on reconnect
fixes #11083
2016-02-04 11:30:27 +01:00
Gunnar Beutner 2dc385e31b Fix memory/thread leak in the HttpServerConnection class
fixes #10655
2016-02-03 09:54:31 +01:00
Gunnar Beutner ec050dd2a7 Fix deadlock in HttpClientConnection::DataAvailableHandler
refs #11014
2016-02-01 14:50:18 +01:00
Gunnar Beutner 98e104a773 Fix incorrect method call in JsonRpcConnection::MessageHandler
refs #11014
2016-02-01 11:25:34 +01:00
Gunnar Beutner deac316a45 Fix deadlock in {HttpServerConnection,JsonRpcConnection}::DataAvailableHandler
refs #11014
2016-02-01 08:35:55 +01:00
Gunnar Beutner fa7d0448f9 Decode cluster messages in the WorkQueue threads
refs #11014
2016-01-27 16:52:01 +01:00
Gunnar Beutner 9689223081 Use multiple WorkQueues to process cluster messages
refs #11014
2016-01-27 15:45:58 +01:00
Gunnar Beutner 54df0b74b6 Improve performance for ApiListener::RelayMessageOne
refs #11014
2016-01-27 13:39:31 +01:00
Gunnar Beutner 8c05003101 Improve the performance for ApiListener::SyncRelayMessage (part 2)
refs #11014
2016-01-27 12:18:16 +01:00
Gunnar Beutner 9ae1f1abee Improve performance for ApiListener::SyncRelayMessage
refs #11014
2016-01-27 08:43:20 +01:00
Gunnar Beutner 4185c75d8a Ignore the .timestamp file when determining whether the zone config has changed (second attempt)
refs #11014
2016-01-26 15:46:03 +01:00
Gunnar Beutner c5a003c162 Ignore the .timestamp file when determining whether the zone config has changed
refs #11014
2016-01-26 11:32:54 +01:00
Gunnar Beutner f3351bc80e Make sure the updated config sync works with old versions of Icinga 2
refs #11014
2016-01-26 10:46:27 +01:00
Gunnar Beutner 1eecc72093 Use MkDirP instead of MkDir when syncing zone configs
fixes #10932
2016-01-26 10:45:03 +01:00
Gunnar Beutner 980ce96910 Make sure the .timestamp file is synced for config updates
refs #11014
2016-01-26 09:04:26 +01:00
Michael Friedrich d412a9055d Fix cluster config timestamp again
refs #11014
2016-01-25 15:49:32 +01:00
Michael Friedrich a17419e8c2 Fix cluster config sync timestamp
refs #11014
2016-01-25 14:39:21 +01:00
Gunnar Beutner 8f53835c11 Make sure we only have one connection per satellite
refs #11014
2016-01-25 10:57:06 +01:00
Gunnar Beutner 6d88d9035d Remove redundant log messages
refs #10963
2016-01-21 13:02:53 +01:00
Gunnar Beutner e48ed33000 Add missing SetSyncing() call
refs #10963
2016-01-20 14:07:07 +01:00
Gunnar Beutner 55f0c589ad Skip log replay for endpoints with log_duration = 0
refs #10963
2016-01-19 17:25:28 +01:00
Gunnar Beutner e4b7111577 Check the certificate name when reconnecting to an instance
refs #10963
2016-01-19 16:24:12 +01:00
Jean Flach 08698c3622 Fix another compiler warning
fixes #10956
2016-01-18 09:41:52 +01:00
Jean Flach cb70d97dcf Plug two memory leaks
refs #10963
2016-01-15 10:11:52 +01:00
Gunnar Beutner 7f4af89a56 Ensure that HttpServerConnections are properly closed
fixes #10655
2016-01-13 10:30:38 +01:00
Gunnar Beutner de11ef704a Fix compiler warning
fixes #10956
2016-01-13 08:33:27 +01:00
Gunnar Beutner 599929b0f6 Update copyright headers for 2016 2016-01-12 08:29:59 +01:00
Jean Flach 957cf3169f Replace boost-base64 with an openssl implementation
Also add unit tests

fixes #10714
2016-01-11 15:35:20 +01:00
Michael Friedrich 8055f05d5e Fix cluster config sync for (non-)authoritative configs
Details: https://dev.icinga.org/issues/10819#note-39

refs #10819
2015-12-12 12:16:00 +01:00
Michael Friedrich d781c392d3 Add more debug logging for api package config sync
refs #10819
2015-12-11 17:03:07 +01:00
Michael Friedrich c5b13ff2b1 Fix that cluster config sync ignores zones.d directory from API config packages
fixes #10819
2015-12-10 22:21:29 +01:00
Gunnar Beutner 15ca9987fa Implement support for priorities in the WorkQueue class
fixes #8714
2015-12-10 17:06:00 +01:00
Gunnar Beutner fd65fed6f0 Fix incorrect return value for ApiListener::GetInstance
refs #10711
2015-11-30 15:33:01 +01:00
Michael Friedrich f91edd9564 Use a work queue for replaying the cluster log
refs #10713
2015-11-25 13:11:41 +01:00
Michael Friedrich 3adedcd0a5 Improve performance for Zone::CanAccessObject
fixes #10711
2015-11-25 12:06:20 +01:00
Gunnar Beutner 3505ca3c16 Fix race condition in the ConfigItem class
fixes #10643
2015-11-19 19:38:49 +01:00
Michael Friedrich 6518f78af0 Fix attribute validation for PUT queries
fixes #10601
2015-11-12 10:13:46 +01:00
Michael Friedrich 284a10150b Fix attributes names for joins; update documentation
refs #10551
fixes #10576
2015-11-11 13:50:47 +01:00
Gunnar Beutner b2364884d8 Check whether config file exists before trying to create object
fixes #10602
2015-11-11 10:25:18 +01:00
Gunnar Beutner 356c4cc170 Don't allow users to set internal attributes via PUT
fixes #10601
2015-11-11 08:41:49 +01:00
Michael Friedrich 36cea68c1a Add the HTTP request body to debug log 2015-11-09 22:48:56 +01:00
Michael Friedrich bc05389a79 Improve error handling for unlinking files
refs #10578
2015-11-09 13:35:51 +01:00
Gunnar Beutner 25c490ecb6 Remove config file when object creation fails
fixes #10578
2015-11-09 12:33:37 +01:00
Gunnar Beutner c44701068f Fix: Detailed error message is missing when object creation via API fails
fixes #10580
2015-11-09 12:30:30 +01:00
Gunnar Beutner fa034a96f8 Improve error message for 404s
refs #9447
2015-11-09 10:48:24 +01:00
Gunnar Beutner 4bb9beda19 Don't send cluster config messages for objects with version 0
refs #9927
2015-11-08 21:22:06 +01:00
Gunnar Beutner f8399e45db Remove unused variable
refs #10563
2015-11-08 17:53:22 +01:00
Michael Friedrich e6159ca86a Fix: /v1/console should only use a single permission
fixes #10563
2015-11-08 14:17:13 +01:00
Gunnar Beutner 2c135d82c1 Fix incorrect variable names for joined objects in filters
fixes #10558
2015-11-07 10:28:34 +01:00
Gunnar Beutner b89a7dbdb6 Rename 'object' to 'obj' in filters
refs #9077
2015-11-07 10:01:07 +01:00
Gunnar Beutner 64376dafeb Make the main object available as 'object' in filter expressions
refs #9077
2015-11-07 09:59:00 +01:00
Gunnar Beutner 3a695742e3 Improve error handling when user specifies invalid method for /v1/console
refs #10387
2015-11-07 09:59:00 +01:00
Michael Friedrich 64c936d387 API Actions: Remove -by-id from actions and require names for comments and downtimes
The documentation is updated as well. Furthermore actions provide
detailed error information in case of an exception.
Includes DB IDO schema updates.

fixes #10512
2015-11-06 17:06:12 +01:00
Gunnar Beutner a177e5e05a Change output format for object queries
fixes #10551
2015-11-06 14:45:38 +01:00
Michael Friedrich 7e5f5544fc Require 'Accept' header for API requests (except for GET)
fixes #10548
2015-11-05 15:18:53 +01:00
Michael Friedrich 18e162da5e Build fix
refs #10545
2015-11-05 11:55:07 +01:00
Michael Friedrich 5d46f661ea Implement 'console' cli command using the API
fixes #10387
2015-11-04 16:01:06 +01:00
Gunnar Beutner 9c5758958c Fix crash in JsonRpcClient::DataAvailableHandler
fixes #10495
2015-11-02 17:45:44 +01:00
Michael Friedrich 6f8e25a349 Add doc URL to /v1 info page
refs #9105
2015-10-29 18:59:30 +01:00
Gunnar Beutner 050c520b2a Convert Comment/Downtime to config objects
fixes #9777
2015-10-28 17:56:29 +01:00
Gunnar Beutner 4763dea571 Fix incorrect URL check in the InfoHandler class
refs #9105
2015-10-28 07:46:04 +01:00
Jean Flach edfc0e3a38 Update error messages
Removes verboseError from httprequest and uses
HttpUtility::GetLastParameter() instead to find out whether verbose
errors are enabled. Also parsing an invalid URL will now not lead to a
stacktrace anymore.

refs #10194
2015-10-27 15:26:19 +01:00
Gunnar Beutner dd77863910 Implement Array::ToString and Dictionary::ToString
fixes #10329
2015-10-26 11:05:24 +01:00
Gunnar Beutner 618e031f46 Handle exceptions for NetString::WriteStringToStream in ApiListener::ReplayLog
fixes #10455
2015-10-26 07:56:58 +01:00
Michael Friedrich d516d16c9a Fix restore_attribute not working in clusters
fixes #10386
2015-10-22 14:50:43 +02:00
Gunnar Beutner 1b8fd9637f Add redirect for /
refs #9105
2015-10-22 13:29:31 +02:00
Gunnar Beutner 10bd3ed9b7 Implement URL handler for /v1
refs #9105
2015-10-22 12:15:32 +02:00
Gunnar Beutner 4aa0165701 Add getter for endpoint 'connected' attribute
fixes #10394
2015-10-22 10:52:38 +02:00
Michael Friedrich cb99402766 Fix filter permissions in event streams
refs #9078
2015-10-21 15:38:26 +02:00
Michael Friedrich 286538c17e Implement api event streams
Documentation is not yet complete.

refs #9078
2015-10-21 15:34:26 +02:00
Gunnar Beutner 438210651f Build fix for OpenBSD 2015-10-20 22:54:58 +02:00
Gunnar Beutner d01f09f3ef Hide internal attributes in the API
fixes #10393
2015-10-20 08:25:10 +02:00
Michael Friedrich f51a76e13d Log a warning message on unauthorized http request
fixes #10388
2015-10-16 15:32:35 +02:00
Michael Friedrich 10c306673d Fix wrong connection log message for global zones
fixes #10377
2015-10-15 17:15:19 +02:00
Michael Friedrich 934fb64b9e Fix log message formatting for object version
refs #10355
2015-10-15 16:52:49 +02:00
Michael Friedrich 5852a003d0 Ensure that modified attributes work with clients with local config and no zone attribute
fixes #10371
2015-10-15 14:05:39 +02:00
Michael Friedrich a0631cd351 Fix wrong type for object version
refs #10355
2015-10-15 11:11:07 +02:00
Gunnar Beutner 4f647527fd Fix: ApiListener::SyncRelayMessage doesn't send message to all zone members
fixes #10365
2015-10-15 09:28:20 +02:00
Gunnar Beutner f89877cd28 Fix incorrect variable type in ApiListener::ConfigUpdateObjectAPIHandler
refs #10355
2015-10-15 09:26:58 +02:00
Gunnar Beutner 21a2986635 Avoid evaluating unnecessary filters
refs #10360
2015-10-14 16:52:01 +02:00
Gunnar Beutner f841daf680 Improve performance for object queries
fixes #10360
2015-10-14 16:08:23 +02:00
Gunnar Beutner 48d80e29a0 Don't look up joined objects when we don't need to
refs #10360
2015-10-14 15:36:59 +02:00
Gunnar Beutner 3bfc9a2406 Don't log messages we've already relayed to all relevant zones
fixes #10262
2015-10-01 14:53:28 +02:00
Michael Friedrich 9dcb33e8f4 Change object version to timestamps for diff updates on config sync
fixes #10257
2015-09-30 16:58:18 +02:00
Gunnar Beutner c1892a2f30 Remove JsonRpcConnection::m_WriteQueue
refs #9976
2015-09-30 16:39:36 +02:00
Michael Friedrich 0529d51a85 Config sync does not set endpoint syncing and plays disconnect-sync ping-pong
fixes #10255
2015-09-30 16:14:04 +02:00
Michael Friedrich 657e749c9b Config sync shouldn't send updates for objects the client doesn't have access to
fixes #10249
2015-09-30 15:08:01 +02:00
Gunnar Beutner f779b20ec0 Properly encode URLs in Icinga Studio
fixes #10241
2015-09-30 14:02:18 +02:00
Gunnar Beutner f3fdcb0f6b Fix: /v1/objects/<type> returns an HTTP error when there are no objects of that type
fixes #10253
2015-09-30 13:26:19 +02:00
Michael Friedrich 19e7524b31 Fix problem with non-existing objects in config sync updates
refs #9851
refs #9927
refs #9081
2015-09-30 10:04:37 +02:00
Gunnar Beutner 7e4953dd35 Improve log messages for HTTP requests
refs #9074
2015-09-30 08:41:09 +02:00
Michael Friedrich dfa2ac450c Re-add missing package and stage name in configstageshandler
refs #10194
2015-09-29 18:25:48 +02:00
Michael Friedrich 905de04293 Fix deadlock in ApiClient::~ApiClient()
refs #9976
2015-09-29 16:03:38 +02:00
Michael Friedrich bb3b724219 Fix object sync for modified attributes
refs #9851
refs #9927
refs #9081
2015-09-29 14:24:39 +02:00
Michael Friedrich e5b26e60a5 Don't throw an exception when replaying the current replay log file
fixes #10239
2015-09-29 11:02:08 +02:00
Gunnar Beutner 0e40c3ee1d Fix deadlock in TlsStream::Close
fixes #10235
2015-09-29 10:31:16 +02:00
Gunnar Beutner 8dec953829 Fix incorrect variable in Url::ParsePort
refs #10224
2015-09-29 08:28:30 +02:00
Gunnar Beutner 143aa13118 Make Icinga Studio work with the latest API version
fixes #10224
2015-09-29 08:09:48 +02:00
Gunnar Beutner 8a2c7a055d Remove debug code
refs #9077
2015-09-29 06:48:16 +02:00
Michael Friedrich 76baeadb5b Fix wrong query type in modify object api request
refs #10212
2015-09-28 19:14:38 +02:00
Gunnar Beutner b40152f9fb Fix null pointer dereference in StatusTargetProvider::GetTargetByName
refs  #9088
2015-09-28 16:31:49 +02:00
Michael Friedrich f498ce39f3 Improve api error handling
refs #10194
2015-09-28 16:08:14 +02:00
Michael Friedrich a2058f0e55 Fix incorrect parameter name for status queries
refs #9088
2015-09-28 15:19:01 +02:00
Gunnar Beutner f091379177 Fix: PerfdataValue is not properly serialised in status queries
fixes #10211
2015-09-28 14:37:50 +02:00
Gunnar Beutner 425a1a0166 Implement API permissions
fixes #9088
2015-09-28 14:30:46 +02:00
Gunnar Beutner 8a5d71a565 Move /v1/<type> to /v1/objects/<type>
refs #10212
2015-09-28 08:39:56 +02:00
Michael Friedrich 6549721ec6 Ensure that multiple object handler request methods still work
refs #10194
2015-09-27 15:27:08 +02:00
Michael Friedrich 717118fed4 Fix wrong log lag in cluster-zone check
Refactor the calculation into a generic function
which is also used inside the 2.4 status API.

fixes #8805
2015-09-25 14:24:45 +02:00
Jean-Marcel Flach 5ef4204d06 Improve API error handling and fix some whitespace
fixes #10194
2015-09-25 13:57:28 +02:00
Jean-Marcel Flach 15a46958f0 Rename statusqueryhandler to objectqueryhandler
fixes #10209
2015-09-24 17:38:44 +02:00
Jean-Marcel Flach d8eca3d0c2 Move /status/Collection to /status
fixes #10210
2015-09-24 15:26:57 +02:00
Michael Friedrich aa12a4e75c Add icinga, cluster, cluster-zone check information to the ApiListener status handler
fixes #8093
2015-09-23 18:09:46 +02:00
Jean-Marcel Flach 4ef9761fee Implement status api handler
Global statistics, features, etc.

fixes #10116
2015-09-23 16:59:07 +02:00
Gunnar Beutner b163e4a002 Make ConfigObject::{Get,Set}Field() methods public
fixes #10186
2015-09-23 08:33:18 +02:00
Gunnar Beutner 1a6b41787a Implement joins for status queries
fixes #10060
2015-09-22 09:45:23 +02:00
Michael Friedrich f7b5aa33ce Fix a couple of wrong white spaces 2015-09-18 13:04:09 +02:00
Michael Friedrich 57179f3bdd Only sync objects actually belonging to a cluster zone
refs #9927
refs #9100
2015-09-18 12:49:38 +02:00
Michael Friedrich f2c3bffdd9 Sync cluster config before replaying the logs
If there were objects added at runtime (either through direct api
creation or by using the config file management api) the newly
created objects must be synced first, and then the stored historical
data should be synced.

refs #9927
refs #9100
2015-09-18 10:07:13 +02:00
Michael Friedrich 18d645e4ef Add zone attribute influencing cluster config sync for API objects
1) No zone defined. The object will only be synced in the local zone for HA purposes.
2) Zone is set to 'master'. Only nodes in the master zone will get this object and updates synced.
3) Zone is set to 'satellite'. Only nodes in the satellite zone, or in parent zones above will get this object and updates synced.
4) Zone is set to 'client'. Only nodes in the client zone, and in parent zones (satellite, master) will get object updates.

Furthermore this commit adds a bit more security measures for syncing object
config bottom-up which is clearly restricted at this time. Clients cannot
send their config to the top, but yet we only support the top-down thing we
also have with the cluster file config sync.

The initial sync will also take the zone relation model into account
and only allow object syncs only when the same conditions apply as written
above.

refs #9927
refs #9100
2015-09-17 14:20:44 +02:00
Michael Friedrich 0fd9d3406b Prevent object deletion on shutdown when checking !IsActive()
This is fairly ugly and sets an extension for the ConfigObjectUtility
delete handler to signal the OnActiveChanged handler inside the cluster
configsync to send a delete event to the other nodes.

refs #9927
2015-09-17 14:20:44 +02:00
Michael Friedrich 4955c28b0c Implement initial api object sync for newly connected endpoints
TODO: Figure out how to deal with Shutdown() deactivating and
therefore deleting all api created objects.

refs #9927
2015-09-17 14:20:44 +02:00
Michael Friedrich b2715943c6 Config Sync: Properly modify attributes and object version
refs #9927
2015-09-17 14:20:44 +02:00
Michael Friedrich 81a0bc6f1b Implement deleting api created objects in the cluster
refs #9927
2015-09-17 14:20:44 +02:00
Michael Friedrich f9c058eca2 Implement object config sync permissions and modified attributes based on version
refs #9927
2015-09-17 14:20:43 +02:00
Gunnar Beutner 6fa58a520c Implement config object sync
Adds object version.

refs #9927
2015-09-17 14:20:43 +02:00
Jean Flach 6571ffc2c8 Update url parser
fixes #10039
2015-09-04 14:40:27 +02:00
Gunnar Beutner 5c77e6eafe Fix deadlock in ApiListener::RelayMessage
fixes #10002
2015-09-02 07:46:30 +02:00
Michael Friedrich da83bae660 Rename config/modules to config/packages
fixes #9953
2015-09-01 20:09:04 +02:00
Gunnar Beutner c37a23ccba Implement the Icinga Studio application
fixes #10042
2015-08-31 07:50:01 +02:00
Gunnar Beutner 6705853e33 Add plural_name field to /v1/types
fixes #10038
2015-08-29 12:05:44 +02:00
Gunnar Beutner 9d9a7ca73d Fix filtering by name
fixes #10027
2015-08-28 10:52:59 +02:00
Gunnar Beutner d7a21c2361 Fix incorrect HTTP encoding
refs #10024
2015-08-28 10:03:26 +02:00
Gunnar Beutner 49fd5b582d Fix: HttpHandler is calling HttpResponse::Finish twice for 404s
fixes #10024
2015-08-28 09:49:31 +02:00
Jean Flach f1a1dfb26e Update use of String::Trim()
fixes #9704
2015-08-27 18:06:20 +02:00
Jean Flach 01ced1549a Implement all actions except modified attributes
refs #9080 #9979
2015-08-26 13:53:17 +02:00
Gunnar Beutner b6eb621d30 Add missing field attribute for the /v1/types API handler
refs #9076
2015-08-26 11:02:22 +02:00
Gunnar Beutner 06f02f8b10 Implement reflection support for the API
fixes #9076
2015-08-26 10:58:59 +02:00
Gunnar Beutner 1f63bcb1b3 Remove unused argument 'async'
refs #9972
2015-08-26 06:57:24 +02:00
Gunnar Beutner de09a562f6 Use dependency graph when deleting objects
refs #9096
2015-08-26 06:35:06 +02:00