Commit Graph

59 Commits

Author SHA1 Message Date
Matthias Oesterheld
415cd73080 Add functionality to create data streams (#17910)
* Create Data Stream template, prepare ism policy

* add ism

* create ism and collect jvm heap as first metric

* change lookup and term query to use data streams

* start moving data stream functionality to graylog

* move data stream management into graylog

* code cleanup, add tests

* better validation, clean up after tests

* additional clean up after IT

* don't remove `index-management` plugin from datanode

* inject ObjectMapper

* change number of replicas from default 1 to 0 for test

* set `number_of_replicas` to 0 for .opendistro-ism-config in test

* replace javax with jakarta classes

* fix integration test

* remove data streams on test cleanup

* set high priority for data stream template
2024-01-17 14:45:19 +01:00
Othello Maurer
8ce9b3f532 Transition from javax to jakarta (#17765)
* Bump jersey version 2.37 -> 3.1.5

* javax.ws.rs:javax.ws.rs-api -> jakarta.ws.rs:jakarta.ws.rs-api

* Ban javax.ws.rs:javax.ws.rs-api dependency

* com.fasterxml.jackson.jaxrs -> com.fasterxml.jackson.jakarta.rs

* javax.validation -> jakarta.validation

* Remove exclusion of hibernate-validator

* jackson-module-jsonSchema -> jackson-module-jsonSchema-jakarta

* Bump hibernate-validator 6.2.5.Final -> 8.0.1.Final

* javax.annotation-api -> jakarta.annotation-api

* Add TODO for banning javax.validation:* dependencies

* Use jakarta.annotation.* where possible

* javax.inject -> jakarta.inject

* Temporarily disable merging master into PR branch when building

* Add javax.persistence to forbidden APIs

* Revert "Temporarily disable merging master into PR branch when building"

This reverts commit dadbeecc0f.

* Fix imports after merge

* Add changelog

* Fix imports after merge

* Add upgrade notes

* javax -> jakarta after merge
2024-01-16 14:07:12 +01:00
Jan Heise
b49a543e74 DataNode: Update to OpenSearch 2.11.0 (#17734)
* Update to OpenSearch 2.11.0

* Update to OpenSearch 2.11.0

* reverting test back

* reverting test back

* better handling of waiting for datanode startups in integration tests

---------

Co-authored-by: Tomas Dvorak <tomas.dvorak@graylog.com>
2024-01-10 08:28:36 +01:00
Tomas Dvorak
b0afd6206e Proxy for datanode rest, jwt auth filter for datanode (#17827)
* Proxy for datanode rest, jwt auth filter for datanode

* fixed test

* fixed test

* Fixed passing request body via datanode proxy

* disable entity capturing for datanode rest proxy calls

* datanode rest proxy refactored to okHttp client

* code cleanup, jwt token and auth filter separation

* Removed unused import

* code cleanup, fixed request body issue
2024-01-09 11:48:03 +01:00
Matthias Oesterheld
c8e34b47a8 add validations for data node lifecycle functions (#17402)
* publish data node status

* add paginated datanode service

* changelog

* adjust changelog

* adjust NodeImplTest

* add start/stop functionality

* changelog

* re-add secured annotation

* refactor initial separation of server node and data node

* fix backward compatibility

* refactor separation of server node and data node

* add timezone

* add new service tests

* add entity tests

* inject DataNodeDto NodeService

* remove clustereventsubscriber registration

* add validations

* add verification tests

---------

Co-authored-by: Ousmane SAMBA <ousmane@graylog.com>
2023-12-05 12:16:39 +01:00
Tomas Dvorak
54c94057e4 Parser for opensearch/elasticsearch data directories (#17487)
* Parser for opensearch/elasticsearch data directories

* add opensearch 1.3 and elasticsearch 6.8.0 to indexer parser

* fixed paths

* code cleanup

* remove explicit dependency version of jackson smile

* Preflight check for index dir compatibility

* indexer dir parser fixed for empty dirs

* added changelog

* rest controller for indices directory parser

* require auth for indices compatibility rest api

* catch incompatibility exceptions of indices dir parsing

* code cleanup

* better dir detection handling

---------

Co-authored-by: Matthias Oesterheld <33032967+moesterheld@users.noreply.github.com>
2023-12-01 16:39:37 +01:00
Matthias Oesterheld
076db1a460 Publish and show data node state information (#17382)
* publish data node status

* add paginated datanode service

* changelog

* adjust changelog

* adjust NodeImplTest

* refactor initial separation of server node and data node

* fix backward compatibility

* refactor separation of server node and data node

* add timezone

* add new service tests

* add entity tests

* inject DataNodeDto NodeService
2023-11-28 15:02:27 +01:00
Matthias Oesterheld
c6101f395c Remove a data node from the cluster (#17248)
* service, rest & permissions for data node management

* add tests

* add reset data node event

* add states and transitions for node removal
add node removal functionality

* changelog

* add datanode permissions to permission list

* add audit event types to list

* add custom thread factory

* add node removal integration test
refactor rest calls in ITs

* wait for primary shard node availability

* refactor duplicate code

* simplify node retrieval

* add `@OnlyInSecuredNode` annotation and request filter
move delete endpoint to management controller and secure it
adjust IT
change javadoc

* stabilize tests
2023-11-20 13:33:26 +01:00
Tomas Dvorak
5a9fc45402 Allow configuring exact datanode directories without automatic nodeid subdirs (#17255)
* Allow configuring exact datanode directories without automatic nodeid subdirs

* added changelog

* use proper locking mechanism to create datanode.lock files

* code cleanup

* code cleanup

* removed unused imports

* fixed test

---------

Co-authored-by: Matthias Oesterheld <33032967+moesterheld@users.noreply.github.com>
2023-11-16 11:26:10 +01:00
Tomas Dvorak
220f14eb3b Fix opensearch configuration sync permissions (#17059)
* Fix opensearch configuration sync permissions

* added changelog
2023-11-02 08:36:35 +01:00
Tomas Dvorak
066794fe6f Fix file permissions for key material (#17026)
* Fix file permissions for key material #17009

* added changelog

* correct file permissions for private key used during preflight CSR

* better http and transport keystore files generation

* removed changelog

---------

Co-authored-by: Jan Heise <jan.heise@graylog.com>
2023-10-23 09:52:49 +02:00
Jan Heise
bf0fe158d5 DataNode: Always using the hostname from the configuration in the NodePingPeriodical (#17020)
* using always the hostname from the configuration

* fixing test

* make existing test more meaningful, removed redundant test
2023-10-20 14:47:32 +02:00
Tomas Dvorak
5885cd2432 refactor datanode directories checks, use configuration validators (#16942)
* refactor datanode directories checks, use configuration validators

* comments, error messages

* fix datanode config dir in docker

* force image pull strategy for datanode dev container

* remove image pull strategy

* More detailed DirectoryWritableValidator for datanode

* remove commons dependency from UploadedCertFilesSecureConfiguration
2023-10-20 11:33:08 +02:00
Dennis Oelkers
d6a43647ac Fixing compilation of single module. (#16936)
* Fixing compilation of single module.

* Adding test case to ensure that unwanted plugins are not included/loaded.

* Adding license header.

* Doing simple web frontend change to trigger reviewbot.

* Fixing linter hint.
2023-10-16 15:05:34 +02:00
Dennis Oelkers
96de5251a5 Data Node: Remove unused OpenSearch plugins. (#16906)
* Remove unused OpenSearch plugins.

* Remove now unneeded plugin configs as well.

* Reusing downloaded extracted tarball.
2023-10-13 10:09:54 +02:00
Tomas Dvorak
bede9d3206 Refactored all usages of directories used by datanode and managed opensearch (#16905)
* Refactored all usages of directories used by datanode and managed opensearch

* add datanode directories preflight check

* code cleanup

* fixed OpensearchSecurityConfiguration

* Fixed DatanodeDirectories logging

* code cleanup
2023-10-13 08:16:58 +02:00
Tomas Dvorak
151c4c4b14 datanode distribution provider refactoring (#16867)
* datanode distribution provider refactoring

* postpone opensearch distribution check till preflight checks

* fixd OpensearchBinPreflightCheck
2023-10-12 08:20:31 +02:00
Tomas Dvorak
47571f35e1 better error message with instructions for problems with opensearch distribution location (#16841) 2023-10-06 15:42:08 +02:00
Jan Heise
dd1a67dbbf Datanode: setting initial master nodes simplification (#16712)
* automatic initial manager nodes

* fixing binding

* removing unneccessary URI usage
2023-09-27 13:14:43 +02:00
Jan Heise
9ef803b2b1 DataNode: Fixing discovery process for new nodes (#16661)
* fixing discovery process for new nodes

* only write discovery seeds on start of the opensearch process depending on the list of active nodes.

* fix dependent init

* fix method call to not depend on pre-initialized members

* fixing parameter map creation

* fixing test and using correct parameter

* fixing test, fixing default roles

* fixing tests
2023-09-26 15:20:20 +02:00
Jan Heise
2478e29640 added the root user to the interface, removed obsolete env vars (#16500) 2023-09-19 09:16:55 +02:00
Tomas Dvorak
70d6edc8a2 basic auth for datanode rest api if security enabled (#16446)
* basic auth for datanode rest api if security enabled

* added changelog

* adapted to master changes

* configurable rest admin username in datanode

---------

Co-authored-by: Jan Heise <jan.heise@graylog.com>
2023-09-15 20:52:14 +02:00
Jan Heise
c73f1ede3c DataNode: aligning test infrastructure (#16432)
* adding datanode dev provider, aligning password/secret/mongoUri usage

* starting mongoDb

* adding providers etc.

* fixing init procedure

* fixing missing license headers

* fixing path

* removing test dependencies

* adding transport, fixed naming

* fixing dependencies

* disabling enormous output

* fixing wrong param

* added hostname as possible config option

* fixed initial cluster name

* fixing dependencies and tests

* fixing dependencies and tests

* fixing dependencies and tests

* fixing test

* trying to load os distri from both possible locations

* fixing paths

* run mvn packager early

* testing full matrix

* adding more debug info

* removing network closing because it's never opened here - so we keep the closing responsibility in one place

* never create a network automatically here

* adding network close

* adding network close

* adding network close

* finding project version and base path consistently

* setting smaller default matrix
2023-09-14 16:01:52 +02:00
Jan Heise
cc52dcb5b0 DataNode: using JWT for authentication/authorisation (#16334)
* jwt implementation, adding preflight + versionprobe

* adding JWT auth to anomaly detection client, some minor refactorings

* added missing license

* added provider, refactorings

* fixing small bugs

* set smaller default expiration

* using the correct OpenSearch distro for the erchitecture

* added config options

* small refactorings, fixing tests, adding dependencies for running tests from inside IntelliJ

* fixing import to correct Duration class

* removing unnecessary debug output

* fixing tests

* fixing tests

* adding JWT to Cluster test

* fixing path

* fixing path problems

* fix architecture logic for DatanodeContainerizedBackend

* fixing path problems

* fixing JWT settings in tests

* fixing JWT settings in tests

* fixing cluster test

* fixing cluster test

* fixing cluster test

* adding missing jwt token

* small refactoring to force thread-safety on creation

* the datanode uses mongodb - so the closing sequence needs to be adjusted

* moving config changes into config file, keep only change that has to be done by code

* adding breaking change info for JWT and clock synchronization.

* renaming config settings

* renaming config settings

* removed debug settings that are no longer in use

* renamed provider/annotation to be more precise

* lowering log level

* smaller refactorings/renamings

* keep config change in code until PR is merged, remove code in a follow-up PR

* moved changelog file to correct folder

* clock synchronsation

Co-authored-by: Dennis Oelkers <dennis@graylog.com>

* added jwt auth into changes after merge

* upped the timeout

* log curl connection information in DatanodeOpensearchWait

* replacing with jwt auth

* changing wait strategy

* fixing imports

* remove uname/pwd from opensearch rest base url

* propagate jwt token provider to http rest client callback, obtain fresh token every time

* inject IndexerJwtAuthTokenProvider in DatanodeConfigurationProvider

* remove rest uname/pwd from datanode configuration

---------

Co-authored-by: Tomas Dvorak <tomas.dvorak@graylog.com>
Co-authored-by: Dennis Oelkers <dennis@graylog.com>
2023-09-12 11:48:44 +02:00
Tomas Dvorak
aa1d69505f Update opensearch to 2.9.0 in matrix integration tests (#16294)
* Update opensearch to 2.9.0 in matrix integration tests

* Update datanode to 2.9.0 opensearch

* workaround for opensearch number_of_replicas in single-node mode

* trigger the fix of replica numbers in opensearch only for 2.9.0 and higher releases

* better hostname handling for DatanodeClusterIT

* log all request/responses for DatanodeClusterIT

* add response logging to DatanodeClusterIT

* print also logs from node B in DatanodeClusterIT in case of error

* fixed DatanodeClusterIT, cached datanode images, synchronized maven packaging

* better handling of DatanodeClusterIT waiting for cluster status

* code cleanup

* log last recorded exception in case of failed waiting for datanode opensearch

* log state machine transitions

* increase waiting timeout for DatanodeClusterIT

* print shard info in case of datanode cluster failure

* safer shard info debug in DatanodeOpensearchWait

* disable scluster.routing.allocation.disk.threshold for datanode integration tests (causes problems in github actions)

---------

Co-authored-by: Dennis Oelkers <dennis@graylog.com>
2023-09-08 14:12:58 +02:00
Jan Heise
af73ea391b DataNode: adding a default config location to avoid NPEs (#16381)
* adding a default

* fixing default paths

* fixing default paths
2023-09-06 11:07:02 +02:00
Jan Heise
fb5f07e51c DataNode: Use the correct architecture for the distribution jar in tests (#16372)
* fix to use the correct architecture for the distribution jar

* added check for archive

* added missing import
2023-09-06 07:36:46 +02:00
Tomas Dvorak
d16c68f1a2 close networks and containers in tests (#16375) 2023-09-05 16:25:59 +02:00
Tomas Dvorak
4c74e9639a add datanode IT to verify cluster add/remove (#16285)
* add datanode IT to verify cluster add/remove

* fixed import
2023-08-30 15:07:25 +02:00
Tomas Dvorak
1a8f5f7df8 typesafe handling of prompts in command line console usages (#16254)
* typesafe handling of prompts in command line console usages

* fixed test
2023-08-25 09:43:31 +02:00
Tomas Dvorak
716f71cf46 Adapt DatanodeClusterIT for full cert setup of all nodes (#16245)
* Adapt DatanodeClusterIT for full cert setup of all nodes

* generated passwords for DatanodeSecuritySetupIT, better truststore

* datanode integration tests code cleanup

* code cleanup
2023-08-24 12:44:03 +02:00
Tomas Dvorak
3b74e30193 rest username and passwords extracted to constants #16009 (#16156) 2023-08-18 13:23:30 +02:00
Tomas Dvorak
18e326b8a1 make cluster initial nodes in datanode configurable (#16146)
* make cluster initial nodes in datanode configurable

* added changelog

* removed forgotten debug logging

* returned opensearch_network_host config for containerized datanode tests
2023-08-10 14:29:48 +02:00
luk-kaminski
e7025a9da8 Insecure startup of OS in datanode only if explicitly configured (#16108)
* Insecure startup of OS in datanode only if explicitly configured

* Data node can be started without starting OS, just to be discovered by pre-flight mode
2023-08-07 17:21:08 +02:00
Tomas Dvorak
e39a53ed2d Refactoring/opensearch security setup (#16087)
* Start datanode jersey only after ssl configuration resolved, listen to change events

* Adapted DatanodeSecuritySetupIT to work with https version of the datanode interface

* simplify hostnames in DatanodeSecuritySetupIT

* code cleanup

* added changelog

* code cleanup

* disable security plugin and perf analyzer in matrix tests opensearch

* Fixed datanode jersey service

* Fixed opensearch instance env

* Opensearch security setup refactored

* code cleanup

* removed commented out code from datanodes JerseyService

* add fqdn to the http cert in the DatanodeSecuritySetupIT

* configure truststore only if the security is enabled

* code cleanup

* reintroduced root certificate finder

* adjusted class and methods visibility of RootCertificateFinder
2023-08-02 14:33:50 +02:00
Tomas Dvorak
b4c2f1f90c Start datanode jersey only after ssl configuration resolved, listen to change events (#16058)
* Start datanode jersey only after ssl configuration resolved, listen to change events

* Adapted DatanodeSecuritySetupIT to work with https version of the datanode interface

* simplify hostnames in DatanodeSecuritySetupIT

* code cleanup

* added changelog

* code cleanup

* disable security plugin and perf analyzer in matrix tests opensearch

* Fixed datanode jersey service

* Fixed opensearch instance env

* add fqdn to the http cert in the DatanodeSecuritySetupIT
2023-08-02 10:46:08 +02:00
Tomas Dvorak
32b59c3a87 Add suffix to docker datanode container name, for parallel runs (#16017) 2023-07-21 17:26:43 +02:00
Jan Heise
34d5b47d2a Include Graylog CA into places where we connect to the DataNode (#15925)
* first version adding gl CA

* adding custom trutstore

* fixed SSLContext

* fixed SSLContext for connectivity check

* fix comments

* fixed imports

* reverting altnames tmp change

* reverting altnames tmp change

* fixed preflightconfig, fixed hostname-verifier

* added credentials to target string, set hostname

* added credentials from target string

* only add TrustManager if https is requested

* fixing tests

* add another alt name

* change creation of restBaseUrl

* DatanodeSecuritySetupIT adaptation for stable hostname of the datanode

* trying to fix naming/binding for docker

* adding another alt name

* added s to http

* changing exception

* more debug output

* change test

* change test

* adding debug

* switch back to http

* more debugging

* more debugging

* added exception to retryer

* fixed boolean eval

* going to the next step on FAILED, too

* fixing if clause

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* removed wrong credentials provider

* added name verifying

* fix alt name handling

* removed unneccessary hostname verifier

* reverted DefaultX509TrustManager

* removed link to DefaultX509TrustManager because it's used in different contexts, singleton for SSL related stuff so we don't instantiate it all the time

* full rollback DefaultX509TrustManager

* reverted change on logging

* revert VersionProbe, unnecessary changes

* DatanodeSecuritySetupIT fixed, separated bind address and hostname

* changed to lambda

* changed to lambda

* small refactorings in csrsigner

* added test for CustomCAX509TrustManager

* added binding for CaService into Preflight

* fixing bindings

* fixing bindings

---------

Co-authored-by: Tomas Dvorak <tomas.dvorak@graylog.com>
2023-07-21 12:59:55 +02:00
luk-kaminski
a8f29b0431 New configuration handling. Incomplete manual config ends with error.… (#15784)
* New configuration handling. Incomplete manual config ends with error. Empty config allows to try different config options.

* Trying to reflect functionality responsibilities with better naming
2023-07-04 13:56:22 +02:00
Tomas Dvorak
4b6d667366 Run MavenPackager before integration tests in datanode (#15780) 2023-06-21 10:36:22 +02:00
Tomas Dvorak
9105655645 Code cleanup around opensearch process info (#15709)
* Code cleanup around opensearch process info

* Code cleanup

* fixed naming and test

* fixed test

* fixed test

* code cleanup

* code cleanup
2023-06-19 06:36:32 +02:00
Tomas Dvorak
bc56d397c3 Datanode config separation (#15701)
* Different variants of security configuration (from file, from mongo, insecure).
Encryption/decryption pattern used in practice.

* Reverting temporary changes

* More precise certificate presence check

* Added unit tests for testHasCert() method

* Datanode and opensearch configuration refactored

* code cleanup

* code cleanup

* code cleanup

* Node preflight config service refactored

* restbaseurl moved to OpensearchConfiguration

---------

Co-authored-by: Lukasz Kaminski <lukasz.kaminski@graylog.com>
2023-06-06 14:44:06 +02:00
luk-kaminski
ea4804b874 OTR Reencryption and Key Storage refactoring for password change (#15668)
* OTR Reencryption and Key Storage refactoring for password change

* Wrong password was used in reencryption. Fixed.
2023-06-02 14:07:54 +02:00
Tomas Dvorak
5651f90aa9 Process watchdog reimplemented to follow transitions of the process state machine (#15676)
* Process watchdog reimplemented to follow transitions of the process state machine

* code cleanup

* code cleanup
2023-06-02 10:52:24 +02:00
luk-kaminski
6f83f2be63 Refactoring and additional tests (#15640)
* Refactoring and additional tests

* One more try-with-resources
2023-05-30 14:40:27 +02:00
Tomas Dvorak
a487ca2f86 Delay opensearch start till configuration is available (#15615)
* Delay opensearch start till configuration is available

* code cleanup
2023-05-30 10:06:47 +02:00
luk-kaminski
f9dc221627 Change ConfigProvider, so that it stops using PEM files, and starts u… (#15460)
* Change ConfigProvider, so that it stops using PEM files, and starts using PKCS12 files.
Refactoring, splitting the functionality to different classes.
Some config changes that make things work in IDEA.
Reusable truststore.
Truststore stores only root certificates.

* Simpler root certificate finding

* Dir Sync does not remove cert files

* Removed unnecessary default config changes. Cleared confusing certificate copying and unnecessary certificate duplication in 2 folders

* Truststore path created outside of TruststoreCreator. Root certificate found in a different way, without considering its place in the certificate chain

* Fixed log message

* Integration test fixed

* Certs are not an exception in FullDirSync. Introduced second config location as a step towards final configuration. Certificates are moved between locations, as it was done previously

* Fixed a test. Minor refactoring.

* Config location has no default value. It is checked if it is provided, as it is required
2023-05-16 08:38:03 +02:00
Tomas Dvorak
2d59457315 Fixed env propagation for datanodes opensearch (#15458) 2023-05-09 14:54:56 +02:00
Tomas Dvorak
2fa7b7b9aa Synchronize opensearch config to a user-defined directory (#15307)
* Synchronize opensearch config to a user-defined directory (fixes #15223)

* fixed check naming

* fixed opensearch configuration location

* simplified Environment constructor

* point gc logs of datanodes opensearch to /tmp for now

* full dir sync for opensearch config

* Fixed full dir sync when removing non-empty dir

* simpified recursive directory deletion
2023-05-02 15:01:12 +02:00
Tomas Dvorak
c36a63495d Opensearch dist dir autodetection (#15216)
* Opensearch dist dir autodetection

* Add arm64 as supported architecture for datanode

* Added changelog
2023-04-14 09:53:33 +02:00