Commit graph

309 commits

Author SHA1 Message Date
Artem Prigoda
0acff18c57
Set read timeout for fetching IMDSv2 token (#104407)
Resubmit of #104397 without setting AWS_METADATA_SERVICE_TIMEOUT randomly in the build.

```
    Use the timeout set by AWS_METADATA_SERVICE_TIMEOUT environment variable both as connect and read timeout analogous to the AWS SDK.
    See https://docs.aws.amazon.com/sdkref/latest/guide/feature-ec2-instance-metadata.html
```

Resolves #104244
2024-01-17 11:08:31 +01:00
Artem Prigoda
ebe71f9fe0
Revert "Set read timeout for fetching IMDSv2 token" (#104397) 2024-01-16 12:58:50 +01:00
Artem Prigoda
063313ffcf
Set read timeout for fetching IMDSv2 token (#104253)
Use the timeout set by AWS_METADATA_SERVICE_TIMEOUT environment variable both as connect and read timeout analogous to the AWS SDK.

See https://docs.aws.amazon.com/sdkref/latest/guide/feature-ec2-instance-metadata.html

Resolves #104244
2024-01-16 10:12:45 +01:00
Sanjay J
51eef046a0
Add support for configuring proxy scheme in S3 client settings and EC2 discovery plugin (#102495)
Closes #101873
2023-11-24 10:33:21 +02:00
Jake Landis
17a46a6e9f
upgrade bouncy castle jars (#100923)
This commit upgrades the Bouncy Castle jars. Bouncy Castle is used for 
some internal build concners as well as a comnand line application. 
Most notably Bouncy Castle is also used as the FIPs certified JCE/JSEE provider 
we use to test our ability to use a FIPs compliant crypto provider. 

The following changes here are a result of the upgraded Bouncy Castle jars:
* TLSv1.3 is now supported when running in FIPs mode 
* RSA PKCS#1 v1.5 is no longer allowed in FIPS mode
* Triple DES (3DES) is no longer allowed in FIPS mode
* Minor updates the security manager configuration used to test FIPs (to read permissions from the security provider)
* Minor adjustments to tests to accommodate the above changes. 
* Minor adjustments to the gradle build to accommodate new dependencies 

Note - update to the documentation will come in a later commit.
2023-11-21 11:14:41 -06:00
Mark Vieira
ee1467d4ff
Improve test avoidance (#101081) 2023-10-26 12:16:06 -07:00
Armin Braun
b7eafce32c
Make some practically static methods static (#97565)
Another round of automated fixes to this, marking things that can be
made static as static. Saves some JIT cycles but also turns some lambdas
from capturing to non-capturing and makes the "utilityness" of some
classes visible.
2023-10-06 23:37:07 +02:00
Tim Vernum
d411acecbc
Suppress this-escape warning for JDK21 (#99848)
Adds @SuppressWarnings("this-escape") to all necessary places to that
Elasticsearch can compile with -Werror on JDK21

No investigation has been done to determine whether any of the cases
are a potential source of errors - we have simply suppressed all
existing occurrences.

Resolves: #99845
2023-09-25 18:30:21 +10:00
Armin Braun
dd7d381922
Dry up getting cluster admin client in tests (#96952)
Drying this up further and adding the same short-cut for single node
tests. Dealing with most of the spots that I could grab via automatic
refactorings.
2023-06-22 14:27:23 +02:00
Ryan Ernst
164e97e2ca
Encapsulate TransportVersion.CURRENT (#96681)
This commit changes access to the latest TransportVersion constant to
use a static method instead of a public static field. By encapsulating
the field we will be able to (in a followup) lazily determine what the
latest is, outside of clinit.
2023-06-13 18:44:15 -04:00
Armin Braun
af5c11702b
Use string list setting throughout codebase (#95901)
We can dry things up a little here and also making things a little faster
(in case we missed a corner case where a list setting is hot) with the optimized
string list setting constructor.
2023-05-09 11:22:28 +02:00
Joe Gallo
582f1be95e
Update log4j2 LICENSE and NOTICE files (#93611) 2023-02-09 08:53:43 -05:00
Simon Cooper
8e28445986
Migrate TcpTransport to TransportVersion (#92960)
The vast majority of this commit is doing a simple s/Version/TransportVersion/, however there are a couple of areas of complexity.

Handshakes proved to be a particularly tricky issue, as they have complex usage of Version.minimumCompatibilityVersion. In lieu of solving this problem now, I've replaced uses of minimumCompatibilityVersion with TransportVersion.minimumCompatibilityVersion and TransportVersion.calculateMinimumCompatVersion.

As a later piece of work, code using both those methods will need to be refactored to do something else, and the methods removed.

Co-authored-by: Przemyslaw Gomulka <przemyslaw.gomulka@elastic.co>
2023-01-24 09:35:28 +00:00
Mark Vieira
c2eda511de
Add JUnit rule based integration test cluster orchestration framework (#92379)
This commit adds a new test framework for configuring and orchestrating
test clusters for both Java and YAML REST testing. This will eventually
replace the existing "test-clusters" Gradle plugin and the build-time
cluster orchestration.
2022-12-21 15:33:46 -08:00
Rene Groeschke
43a0377735
Update forbiddenapis to 3.4 (#90624)
Fix breaking changes to source validation after change in default jdk rule set
2022-10-06 16:52:06 +02:00
Simon Cooper
71455f87d5
Change plugins to use elasticsearch logging (#90227)
Change hdfs, gce, azure, ec2 plugins to use ES logging API
2022-09-29 10:59:31 +01:00
Artem Prigoda
f2aa2cebc0
[discovery-ec2] Update the AWS SDK to 1.12.270 (#89034)
* Manually remove checksums for older AWS versions
2022-09-05 13:03:12 +02:00
Rene Groeschke
3909b5eaf9
Add verification metadata for dependencies (#88814)
Removing the custom dependency checksum functionality in favor of Gradle build-in dependency verification support. 

- Use sha256 in favor of sha1 as sha1 is not considered safe these days.

Closes https://github.com/elastic/elasticsearch/issues/69736
2022-08-04 09:51:16 +02:00
Chris Hegarty
453f12c72d
Upgrade to Log4J 2.18.0 (#88237) 2022-07-04 11:30:38 +01:00
Tim Vernum
6078fc3cbf
Update http client version (#87491)
Moves a few Apache HTTP client dependencies to their latest version

- httpclient -> 4.5.13
- httpasyncclient -> 4.1.5
- httpcore -> 4.4.13
2022-06-28 06:10:17 -04:00
Przemyslaw Gomulka
705b27ae3b
Refactor ParameterizedMessage used in lambda and casted to Supplier (#87156)
This is a result of structural search/replace in intellij. This only affects log methods with a signature
logger.info((Supplier) ()-> ParametrizedMessage) logger.info((Supplier) ()-> ParametrizedMessage, Throwable)

relates #86549
2022-05-31 08:46:35 +02:00
Ryan Ernst
af7525e1f0
Upgrade jackson to 2.13.2 (#86051)
Most of the Jackson uses, eg in x-content and azure, have already been
upgraded. This commit upgrades the rest of the uses. Note that it does
not yet upgrade the aws sdk, this should also be done on its own.
2022-04-22 07:21:17 -07:00
Ryan Ernst
b2c9028384
Move io utils to core package (#85954)
Most classes under elasticsearch-core had been moved to the o.e.core
package. However, a couple io related classes remained in an "internal"
package. This commit moves Streams and IOUtils to the core package, as
they are no more "internal" than the rest of the classes in core.
2022-04-19 21:26:28 -07:00
Rene Groeschke
00f2dc09ff
Avoid overhead of zip / unzip modules when packaging distribution (#84660)
This removes the overhead of zipping up modules that are immediately unzipped again when packaging
the elasticsearch distribution.
We also move some logic for packaging the elasticsearch distribution into a plugin and remove some outdated
overhead dealing with 'meta plugins' when copying modules into a distribution.

Another follow up and related optimization out of scope of this PR is, to also not zip unzip modules declared
for usage in our test cluster setups.

This partially addresses #76726.
2022-03-15 11:37:47 +01:00
Artem Prigoda
892d2a2a94
Support IMDSv2 for EC2 Discovery (#84410)
Support a session-oriented method (IMDSv2) for accessing the instance's metadata. If it's not supported, fallback to IMDSv1.

[AWS Docs](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html) 

Resolves #80398
2022-03-09 14:43:14 +01:00
Ryan Ernst
070fcaa0ad
Move x-content implementation to a separate classloader (#83705)
This change isolates the Jackson implementation of x-content parsers and generators to a separate classloader. The code is loaded dynamically upon accessing any x-content functionality.

The x-content implementation is embedded inside the x-content jar, as a hidden set of resource files. These are loaded through a special classloader created to initialize the XContentProvider through service loader. One caveat to this approach is that IDEs will no longer trigger building the x-content implementation when it changes. However, running any test from the command line, or running a full Build in IntelliJ will trigger the directory to be built.

Co-authored-by: ChrisHegarty <christopher.hegarty@elastic.co>
2022-03-07 15:44:59 -08:00
Armin Braun
0b66c14b7e
Use Netty4 Transport in Internal Cluster Tests (#82088)
Removing the mock nio transport and replacing its usage with the netty transport to make tests
with a more realistic transport implementation. This way improves the real world coverage for
the Netty transport, makes our tests more realistic and saves lots of code.
In particular, coverage on the rather complicated throttling/chunking in the netty message handler
is really ice to have.
The downside of this change is that we lose the slow transport thread warnings that the mock transport
outputs. This isn't a big deal these days in my opinion as we have slow logging in other places
now that makes up for this (we didn't when initially adding the slow logging) and that contains
far more detailed information on what exactly was slow.
Other than that, the mock transport does not come with any features we don't also have in the Netty
transport at this point.
2022-01-17 12:34:35 +01:00
Costin Leau
dddff27498
Upgrade to log4j 2.17.1 (#82111)
Upgrade to log4j 2.17.1
2021-12-28 23:33:07 +02:00
Chris Hegarty
1cc69f86fe
Upgrade to log4j 2.17.0 (#81902) 2021-12-18 17:40:36 +00:00
Artem Prigoda
763d6d510f
Use Java 15 text blocks for JSON and multiline strings (#80751)
The ES code base is quite JSON heavy. It uses a lot of multi-line JSON requests in tests which need to be escaped and concatenated which in turn makes them hard to read. Let's try to leverage Java 15 text blocks for representing them.
2021-12-15 18:01:28 +01:00
Artem Prigoda
442a13a46d
Upgrade log4j to 2.15.0 (#81709)
Originally we tried to a log4j update in #47298, but we were unable to
that due to the `DeprecationLoggerTests.testLogPermissions` test
failing. The test relied on mocking and got removed in
https://github.com/elastic/elasticsearch/pull/61474/files#diff-70de5a6ba5c637e7f19c51341417760d6e957beb5a1fa5703049095ea2719ee0L47

Now we should be able to the upgrade and then we can address the Security
Manager permission questions raised in #47298 separately.

* Initialize pattern layout with AccessController.doPrivileged

We need the `getClassLoader` permissions

* Disable the SecurityManager for command testing because of `CommandLoggingConfigurator` 
which fails under the `SecurityManager`
2021-12-15 14:31:30 +01:00
Mark Vieira
06d7e1682e
Bump source compatibility version to Java 17 (#80851) 2021-12-06 10:58:56 -08:00
Rory Hunter
add386dd00
Fix shadowed vars pt5 (#80855)
Part of #19752. Fix more instances where local variable names were shadowing field names.
2021-11-19 10:47:26 +00:00
Jake Landis
255bf5056b
Change default level for deprecation logging (#80167)
This commit updates all deprecation message (except for REST
compatible API messages) in 8.0+ to be emit at warning level.
Currently none of these have been removed in future versions (yet) so they
should be logged at warning, not critical.

This commit also changes the default assertWarning to assert at warning level
and introduces a new assertCriticalWarning to assert critical warnings.
2021-11-04 12:35:27 -05:00
Mark Vieira
12ad399c48 Reformat Elasticsearch source 2021-10-27 08:19:51 -07:00
Keith Massey
88250c216c
Exposing the ability to log deprecated settings at non-critical level (#79107)
A recent change for the deprecation logs provided the capability to emit deprecation's at critical vs. warning levels, #77482.
However deprecated settings always log at critical level without the ability to express that the setting deprecation is only a
warning.

This commit exposes the ability to set the deprecation level when deprecating a setting.
Closes #78781
2021-10-19 07:51:05 -05:00
Ryan Ernst
208d575e43
Remove Joda dependency (#79007)
This commit removes the dependency on the Joda library. It removes
many remaining references to joda, though not all because some comments
are worthwhile for historical reasoning.
2021-10-13 17:37:31 -07:00
Tim Vernum
e73d16dc20
Update to OpenSAML v4.0 Library (#77012)
This commit switches the security and identity-provider plugins to use
v4.0.1 of the OpenSAML library (upgraded from v3.4).

In order to facilitate this upgrade the following changes are also
made:
- Common Codec is upgraded to 1.14 across all modules
- Guava is upgraded to v28.2 in the 2 affected modules

Relates: #71983
2021-09-22 18:15:34 +10:00
Przemyslaw Gomulka
0d3cebe812
Change default deprecation logger level to CRITICAL (#77030)
This commit changes default deprecation logger level to CRITICAL, where default means deprecations emitted by DeprecationLogger#critical method.
It also introduces WARN deprecations which are emitted by DeprecationLogger#warn Those log lines emitted at WARN are meant to indicate that a functionality is deprecated but will not break at next major version.
relates #76754
2021-09-09 12:23:52 +02:00
David Turner
bfcc93a042
Anonymize AbstractRefCounted (#77208)
Today `AbstractRefCounted` has a `name` field which is only used to
construct the exception message when calling `incRef()` after it's been
closed. This isn't really necessary, the stack trace will identify the
reference in question and give loads more useful detail besides. It's
also slightly irksome to have to name every single implementation.

This commit drops the name and the constructor parameter, and also
introduces a handy factory method for use when there's no extra state
needed and you just want to run a method or lambda when all references
are released.
2021-09-03 07:59:44 +01:00
Rene Groeschke
35ec6f348c
Introduce simple public yaml-rest-test plugin (#76554)
This introduces a basic public yaml rest test plugin that is supposed to be used by external 
elasticsearch plugin authors. This is driven by #76215

- Rename yaml-rest-test to intern-yaml-rest-test
- Use public yaml plugin in example plugins

Co-authored-by: Mark Vieira <portugee@gmail.com>
2021-08-31 08:45:52 +02:00
Jake Landis
4553bf03d5
Remove MavenFilteringHack (#73637) 2021-07-20 17:05:16 -04:00
Ryan Ernst
68817d7ca2
Rename o.e.common in libs/core to o.e.core (#73909)
When libs/core was created, several classes were moved from server's
o.e.common package, but they were not moved to a new package. Split
packages need to go away long term, so that Elasticsearch can even think
about modularization. This commit moves all the classes under o.e.common
in core to o.e.core.

relates #73784
2021-06-08 09:53:28 -07:00
Ryan Ernst
f98b374cf6
Revert "Upgrade Azure SDK and Jackson (#72833) (#72995)" (#73837)
The recent upgrade of the Azure SDK has caused a few test failures that
have been difficult to debug and do not yet have a fix. In particular, a
change to the netty reactor resolving
(https://github.com/reactor/reactor-netty/issues/1655). We need to wait
for a fix for that issue, so this reverts commit
6c4c4a0ecb.

relates #73493
2021-06-07 10:20:46 -07:00
Ryan Ernst
6c4c4a0ecb
Upgrade Azure SDK and Jackson (#72833) (#72995)
This commit upgrades the Azure SDK to 12.11.0 and Jackson to 2.12.2. The
Jackson upgrade must happen at the same time due to Azure depending on
this new version of Jackson.

closes #66555
closes #67214

Co-authored-by: Francisco Fernández Castaño <francisco.fernandez.castano@gmail.com>
2021-05-27 07:55:18 -07:00
Ryan Ernst
8cd3944a0a
Revert "Upgrade Azure SDK and Jackson (#72833)"
This reverts commit dca0e92bef.
2021-05-06 20:51:31 -07:00
Ryan Ernst
dca0e92bef
Upgrade Azure SDK and Jackson (#72833)
This commit upgrades the Azure SDK to 12.11.0 and Jackson to 2.12.2. The
Jackson upgrade must happen at the same time due to Azure depending on
this new version of Jackson.

closes #66555
closes #67214
2021-05-06 20:36:42 -07:00
Rene Groeschke
5bcd02cb4d
Restructure build tools java packages (#72030)
Related to #71593 we move all build logic that is for elasticsearch build only into
the org.elasticsearch.gradle.internal* packages

This makes it clearer if build logic is considered to be used by external projects
Ultimately we want to only expose TestCluster and PluginBuildPlugin logic
to third party plugin authors.

This is a very first step towards that direction.
2021-04-26 14:53:55 +02:00
Jason Tedor
32314493a2
Pass override settings when creating test cluster (#71203)
Today when creating an internal test cluster, we allow the test to
supply the node settings that are applied. The extension point to
provide these settings has a single integer parameter, indicating the
index (zero-based) of the node being constructed. This allows the test
to make some decisions about the settings to return, but it is too
simplistic. For example, imagine a test that wants to provide a setting,
but some values for that setting are not valid on non-data nodes. Since
the only information the test has about the node being constructed is
its index, it does not have sufficient information to determine if the
node being constructed is a non-data node or not, since this is done by
the test framework externally by overriding the final settings with
specific settings that dicate the roles of the node. This commit changes
the test framework so that the test has information about what settings
are going to be overriden by the test framework after the test provide
its test-specific settings. This allows the test to make informed
decisions about what values it can return to the test framework.
2021-04-02 10:20:36 -04:00
Mark Vieira
6339691fe3
Consolidate REST API specifications and publish under Apache 2.0 license (#70036) 2021-03-26 16:20:14 -07:00