Commit graph

1447 commits

Author SHA1 Message Date
Ryan Ernst
584b2379f0
Use Terminal.readSecret in add string keystore command (#126966)
As a followon to #126729, the add string keystore command doesn't need
to use a reader at all (and it was incorrect for it to close the reader
from the terminal). Instead, the Terminal abstraction already handles
how to get at line by line secrets. This commit removes that usage of
reader and uses readSecret calls instead.

closes #126882
2025-04-18 19:50:15 +02:00
Ryan Ernst
42dc870ece
Ensure logs dir exists before using as working dir (#126566)
With the change to using the logs dir as the working dir of the
Elasticsearch process we need to ensure the logs dir exists within the
CLI instead of later during startup.

relates #124966
2025-04-17 12:59:47 -07:00
Brian Seeders
3d78c9428c
[bwc] Add bugfix3 project (#126880) 2025-04-16 16:27:03 -04:00
Ryan Ernst
b47bd3adc7
Use terminal reader in keystore add command (#126729)
When reading a string value from stdin the keystore add command
currently looks directly at stdin. However, stdin may also be consumed
while reading the keystore password. This commit changes the add command
to use the reader from the termainl instead of looking at stdin
directly.

closes #98115
2025-04-14 12:55:56 -07:00
Rene Groeschke
31995ace2d
Add docker hub specific docker context (#126625)
The labels we require for openshift are incompatible with docker hub policies. therefore we need to use different docker contexts for those.
2025-04-11 13:30:00 +02:00
Rene Groeschke
ca195736ca
Address review feedback on es default docker image (#126330)
This addresses feedback we got for our default image at https://github.com/docker-library/official-images/pull/18692
This also introduces separate docker source files to make maintaining those easier.

We cannot take over all suggested changes as we require certain settings to have our packaging tests pass as expected.
2025-04-10 17:14:22 +02:00
Ryan Ernst
3bac50e818
Use logs dir as working directory (#124966)
In the unexpected case that Elasticsearch dies due to a segfault or
other similar native issue, a core dump is useful in diagnosing the
problem. Yet core dumps are written to the working directory, which is
read-only for most installations of Elasticsearch. This commit changes
the working directory to the logs dir which should always be writeable.
2025-04-09 07:07:11 -07:00
Mariusz Józala
afe503f02f
[CI] Use official UBI9 image for testing (#126455)
Internal UBI images from `docker.elastic.co` are planned to be removed.
2025-04-09 09:05:26 +02:00
Rene Groeschke
6cfb2e9d4a
Resolve fips specific metricbeat and filebeat libs for ES fips image (#126312)
Also updated DRA handling to reflect resolving fips specific artifacts
2025-04-05 06:47:30 +11:00
Lorenzo Dematté
40dd91b800
[Entitlements] Replace Permissions with Entitlements in InstallPluginAction (#125207)
This PR replaces the parsing and formatting of SecurityManager policies with the parsing and formatting of Entitlements policy during plugin installation.

Relates to ES-10923
2025-04-02 11:03:27 +01:00
Rene Groeschke
611f5cba4f
[BUILD] Support AARCH64 for docker fips images (#125927)
This updates the docker fips base image which support arm and x84
architectures
2025-03-31 22:41:04 +11:00
Rene Groeschke
9dd0228990
Fix fips tests (#125754)
reported as broken due to issue in gradle setup
2025-03-27 21:31:50 +11:00
Rene Groeschke
653c179b08
[Build] Add FIPS docker image for GovCloud (#117152)
- Adds docker image based on chainguard base fips image
- x86 only for now as the base image is x86 only
- the image does not provide any elasticsearch.yml configuration. for testing purposes you can follow the elasticsearch fips guide available at https://github.com/elastic/FIPSGuide/tree/main/elasticsearch

The image is shipped with:
- org.bouncycastle:bc-fips:1.0.2.5 and org.bouncycastle:bctls-fips:1.0.19 in Elasticsearch libs folder
- config/jvm.options.d/fips.options for fips specific JVM options
- fips_java.security file
- fips_java.policy

Out of scope:
- Add packaging test coverage (part of later PR as we want to provide that image for testing early and packaging tests require more general restructuring for support fips scenarios)
2025-03-26 16:15:15 +01:00
Lorenzo Dematté
e0b7c8bdfc
[Entitlements] Print a warning during plugin installation if a legacy policy file is found (#125294)
This PR adds a check and a warning message if the user is trying to install a plugin containing the legacy plugin-security.policy used by SecurityManager.

Relates to ES-10846
2025-03-24 08:29:52 +01:00
Armin Braun
50437e79d3
Cleanup missing use of StandardCharsets (#125424)
Random annoyance that I figured, I'd just fix globally:
We can do a bit of a cleaner job when doing byte <-> string conversion here and there.
2025-03-21 20:10:15 +01:00
Lorenzo Dematté
a4d7297944
Permanently switch from SecurityManager to Entitlements (#124865) (#125117)
The JDK team has completely disabled the Java SecurityManager from Java 24. Elasticsearch has always used the Java SecurityManager as an additional protection mechanism; in order to retain this second line of defense, the Elasticsearch Core/Infra team has been working on the Entitlements project.

Similar to SecurityManager, Entitlements only allow calling specific methods in the JDK when the caller has a matching policy attached. In other words, if some code (in the main Elasticsearch codebase, in a plugin/module, or in a script) attempts to perform a "privileged" operation and it is not entitled to do so, a NotEntitledException will be thrown.

This PR includes the minimal set of changes to always use Entitlements, regardless of system properties or Java version.

Relates to ES-10921
2025-03-18 18:38:45 +02:00
Ryan Ernst
11961730da
Cleanup command line setting errors (#124963)
This commit improves the error cases when command line settings are
found that are duplicates or conflict with special system properties.
2025-03-18 09:38:14 -07:00
Luigi Dell'Aquila
f3ed9b3a2d
ES|QL query log (#124094) 2025-03-18 16:31:55 +01:00
Ryan Ernst
789eb2fadb
Log system information early during startup (#124926)
Information about the system, and in particular the running JVM, is
logged relatively late in startup. When problems occur in low level
initialization, it is often useful to have this information. This commit
moves logging of system information to right after logging has been
initialized. Note that it no longer utilizes the JvmInfo class as most
was already easily available and the static init of JvmInfo does a lot.
2025-03-15 14:55:02 +00:00
Ryan Ernst
aeee44f2a5
Ignore _JAVA_OPTIONS (#124843)
The JVM has a couple ways that Java options can be passed. In
Elasticsearch we ignore these common patterns, instead using our own
bespoke mechanisms for setting options (ES_JAVA_OPTS, etc). The primary
reason for this is some systems like Ubuntu setting these options
globally and then affecting Elasticsearch, often in ways that cause
Elasticsearch to fail to start.

This commit ignores _JAVA_OPTIONS, which is a little known environment
variable that the JVM may pick up options from.
2025-03-15 14:53:37 +00:00
Ryan Ernst
47454df24e
Ensure we always use vectorization in Lucene (#124914)
By default Lucene only uses vectorization up to the JDK version
available at the time of its release. When testing against EA versions,
we want to still use vectorization. This commit adds a sysprop to force
lucene to use the current version for vectorization.
2025-03-14 20:08:15 +00:00
Mark Vieira
74ccd4dba2
Filter module-info.class from entitlements-bridge jar in distribution (#124580) 2025-03-11 13:37:03 -07:00
Julien Mailleret
e5cf597782
Fix IronBank hardening_manifest CI test (#124579)
This commit fix the IronBank hardening_manifest CI test that expect the
hardening_manifest.yaml values to match `'^(?!\\s*$)[ -~|]*$'` regex:

```
| hardening_manifest           | ERROR    | Hardening Manifest failed jsonschema validation
| hardening_manifest           | ERROR    | Verify Hardening Manifest content
| hardening_manifest           | ERROR    | 'Rene Gröschke' does not match '^(?!\\s*$)[ -~|]*$'
```

43219286

cc @breskeby 

<!-- Thank you for your interest in and contributing to Elasticsearch!
There are a few simple things to check before submitting your pull
request that can help with the review process. You should delete these
items from your submission, but they are here to help bring them to your
attention. -->

- Have you signed the [contributor license agreement](https://www.elastic.co/contributor-agreement)?
- Have you followed the [contributor guidelines](https://github.com/elastic/elasticsearch/blob/main/CONTRIBUTING.md)?
- If submitting code, have you built your formula locally prior to submission with `gradle check`?
- If submitting code, is your pull request against main? Unless there is a good reason otherwise, we prefer pull requests against main and will backport as needed.
- If submitting code, have you checked that your submission is for an [OS and architecture that we support](https://www.elastic.co/support/matrix#show_os)?
- If you are submitting this code for a class then read our [policy](https://github.com/elastic/elasticsearch/blob/main/CONTRIBUTING.md#contributing-as-part-of-a-class) for that.
2025-03-12 06:22:10 +11:00
Joe Gallo
f8ef78446a
Upgrade httpclient to 5.3.3 for build-tools-internal (#124018) 2025-03-07 11:43:15 -05:00
Rene Groeschke
496c38e5a5
Reapply "Update Gradle wrapper to 8.13 (#122421)" (#123889) (#123896)
This reverts commit 36660f2e5f.
2025-03-05 08:02:13 +01:00
Mark Vieira
d61b86477d
Add jdk.management.agent module to server boot layer on start (#123938) 2025-03-04 11:32:42 -08:00
Rene Groeschke
36660f2e5f
Revert "Update Gradle wrapper to 8.13 (#122421)" (#123889)
This reverts commit e19b2264af.
2025-03-03 15:51:07 +01:00
Rene Groeschke
e19b2264af
Update Gradle wrapper to 8.13 (#122421)
* Fix Gradle Deprecation warning as declaring an is- property with a Boolean type has been deprecated.
* Make use of new layout.settingsFolder api to address some cross project references
* Fix buildParams snapshot check for multiprojet projects
2025-03-03 14:10:00 +01:00
Arpad Kiraly
196e083502
Remove @UpdateForV9 usages that are related to security manager removal (#123690)
* Remove @UpdateForV9 annotation in RuntimeVersionFeature

Re ES-10338 the Core/Infra team agreed that this is not blocked on security manager removal. We should go ahead and remove these 2 instances of the @UpdateForV9 annotation, the code will be cleaned up soon with the removal of Security Manager.

* Remove @UpdateForV9 annotation from SystemJvmOptions

re ES-10338 the Core/Infra team agreed this is not blocked on security manager removal. We should go ahead and remove this instance of the @UpdateForV9 annotation.
2025-03-03 11:34:46 +01:00
Rene Groeschke
cd8fbab5b5
Fix some early tasks creations (#123637)
We want to use the task avoidance api whereever possible and delay task
creation
2025-02-28 07:54:01 +11:00
Ryan Ernst
b5e482bc91
Enable entitlements by default (#122907)
Entitlements are almost complete. This commit enables them by default,
in preparation for 8.18/9.0.
2025-02-25 09:58:39 -08:00
Lorenzo Dematté
6d042511a1
Create test entitlement libs dir and jar to pass validation (#123013) 2025-02-20 13:34:19 -05:00
Lorenzo Dematté
4c6fd56864
Skip tests that require old security manager policy parsing/validation when running on Java 24 (#123009) 2025-02-20 14:54:28 +01:00
Lorenzo Dematté
a4c7d29675
[Entitlements] Instrumentation of NIO file channels (#122816) 2025-02-19 23:18:07 +01:00
Lorenzo Dematté
2b54de1e4b
Skip SM policy parsing and validation for Java24+ (#122233) 2025-02-12 08:14:36 +01:00
Ryan Ernst
0cf42f2388
Rename environment dir accessors (#121803)
The node environment has many paths. The accessors for these currently
use a "file" suffix, but they are always directories. This commit
renames the accessors to make it clear these paths are directories.
2025-02-05 14:03:28 -08:00
Mark Vieira
6c405093d7
Update BWC versions to support multiple staged releases 2025-01-30 08:22:54 -08:00
Mark Vieira
61dc93107f
Add lucene version compatibility tests (#121104)
This commit adds compatibility tests that target ES revisions that align with specific Lucene versions. In this case, we are intending to upgrade from Lucene 10.0 to 10.1. Since no on-prem Elasticsearch release exists with 10.0, we need another method to ensure compatibility with Lucene 10.0 indicies.

The work here is a bit hacky since all our compatibility testing infrastructure is centered around versions and we're now effectively doing compatibility tests between two different revisions of Elasticsearch that both report the same version. Ideally this specific testing would be replaced by unit tests, rather that reusing our full cluster restart tests for this purpose.

We'll also want to bump the commit referenced in the CI pipelines here to align with the last commit using Lucene 10.0.
2025-01-29 13:20:25 -08:00
Moritz Mack
6648a03bab
Revert "Revert "Remove deprecated tracing.apm.* settings for v9 (#119926)"" (#120895)
This reverts commit 5f44911ef8.
Reverts revert in #120268 after blockers have been resolved.
Relates to ES-10293
2025-01-27 16:04:36 +01:00
Lorenzo Dematté
81a9348431
[Entitlements] Enable native access based on policies (#120638) 2025-01-24 08:29:38 +01:00
Lorenzo Dematté
cbb7c24ada
[Entitlements] Network access checks for miscellanea (#120262) 2025-01-17 09:48:22 +01:00
Moritz Mack
5f44911ef8
Revert "Remove deprecated tracing.apm.* settings for v9 (#119926)" (#120268)
Temporarily reverts elastic/elasticsearch#119926 due to unforeseen
usage.

Relates to ES-10293
2025-01-16 22:47:49 +11:00
Moritz Mack
5123b948a9
Remove deprecated tracing.apm.* settings for v9 (#119926) 2025-01-14 08:41:11 +01:00
Ryan Ernst
38b2fc53a7
Default to entitlements only for JDK 24+ (#119885)
Since entitlements are still being developed, we are not yet ready to
enable them for all JDK versions. But we must use them for JDK 24+ since
the security manager is not useable there. This commit tweaks the logic
for determining whether to use entitlements to take into account  the
runtime version.
2025-01-10 09:19:39 -08:00
Moritz Mack
16d8aaf386
Strengthen encryption for elasticsearch-keystore tool to AES 256 (#119749)
The latest format version (7) of KeyStoreWrapper will be using a 256
bits key for the AES cipher.

Closes #ES-10419
2025-01-09 08:57:47 +01:00
Lorenzo Dematté
28ce53f0aa
[Entitlements] Fix "No SecurityManager when entitlements are enabled" (#119742) 2025-01-08 15:17:41 +01:00
Lorenzo Dematté
3464adb3ae
Adjust Bootstrap and JVM options to ensure the SM is never used when entitlements are enabled (#119689) 2025-01-08 10:24:03 +01:00
Patrick Doyle
6484f94614
Entitlements for JDK-wide global state changes (#119592)
* Refactor: separate check method name vs signature parsing

* Cosmetic: change checker comment format

* Entitlements for JDK-wide global state

* [CI] Auto commit changes from spotless

* Comment explaining entitlement add-exports

* @SuppressForbidden

* Refactor: rename dummy subclases

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-01-08 01:12:27 +00:00
Rene Groeschke
7b6d4d192f
[Gradle] Fix deprecation warning in release tests after 8.12 update (#119608) 2025-01-07 19:08:06 +11:00
Mark Vieira
5960af62c1
Fix vcs revision label in docker images (#119531) 2025-01-03 10:15:46 -08:00