Commit graph

1117 commits

Author SHA1 Message Date
Ryan Ernst
ad99b0d3e8
Add shared_repo relative dir for files entitlement (#123221)
This commit adds the shared repo path as a relative base dir. However,
it does not make this available to policy files, only to server.
2025-02-24 11:39:26 -08:00
Patrick Doyle
763e7cd44a
FileAccessTree fixes for ordering and pruning (#123291)
* Custom comparator for paths in FileAccessTree

* Strip trailing separators in normalizePath
2025-02-24 13:50:33 -05:00
Lorenzo Dematté
c7bcdd37f4
[Entitlements] Cross-platform implementation of Path.isAbsolute() (#123282) 2025-02-24 18:27:36 +01:00
Tim Vernum
fd9f8e1b08 Merge main into multi-project 2025-02-22 16:42:59 +11:00
Jack Conradson
7cbd305a16
Prune extraneous files entitlements paths to prevent incorrect binary search (#123177) 2025-02-22 01:45:39 +00:00
Patrick Doyle
afd7e4e911
Misc non-java.base file entitlements (#123078)
* Misc non-java.base file entitlements

* Remove unnecessary dependency
2025-02-21 14:54:34 +00:00
Tim Vernum
b29682c931 Merge revision b3959b6642 into multi-project 2025-02-21 19:28:00 +11:00
Patrick Doyle
3da1bb808f
Reduce warnings in entitlement REST tests (#123028) 2025-02-20 17:23:17 +01:00
Moritz Mack
d1b7639784
Add missing entitlements discovered in IT tests (#123015) 2025-02-20 15:05:42 +01:00
Tim Vernum
4f918a81b9 Merge main into multi-project 2025-02-20 12:17:12 +11:00
Lorenzo Dematté
a4c7d29675
[Entitlements] Instrumentation of NIO file channels (#122816) 2025-02-19 23:18:07 +01:00
Lorenzo Dematté
20b829fc14
[Entitlements] Add check functions for NIO Files (#122591) 2025-02-19 21:55:06 +01:00
Moritz Mack
2c15b68efa
[Entitlements] Log message for troubleshooting if not entitled (#122948)
Log message for troubleshooting if not entitled.
2025-02-20 06:13:54 +11:00
Patrick Doyle
877963c652
Miscellaneous java.base file entitlements (#122906)
* java.base entitlements

* SuppressForbidden, and add a missing test

* Revert logging back to commented-out printlns

* Merge FileCheckActions and rename for overloads

* Remove stray logger

* Remove more traces of logging change

* Remove more traces of logging
2025-02-19 13:17:15 -05:00
Moritz Mack
3b1825571d
Add missing entitlements for FIPS (#122941)
Add missing entitlements for FIPS
2025-02-20 03:36:10 +11:00
Patrick Doyle
17278183ea
Change printlns to log statements (#122935) 2025-02-19 15:57:43 +01:00
Tim Vernum
de93304b95 Merge main into multi-project 2025-02-19 21:37:13 +11:00
David Turner
997233fd4e
Remove unused @UpdateForV9 owners (#122748)
Several teams have completed all outstanding `@UpdateForV9` tasks, so
this commit removes the corresponding `Owner` symbols.
2025-02-19 21:06:13 +11:00
Tim Vernum
838d8389de Merge main into multi-project 2025-02-19 16:40:34 +11:00
Tim Vernum
81043b5ce0 Merge revision 2eb0d00b8f into multi-project 2025-02-19 16:00:15 +11:00
Ryan Ernst
cffbccbb49
Add support for setting based file entitlements (#122656)
With Security Manager we have SecuredConfigFileSettingAccessPermission.
This commit adds an entitlement equivalent. With each entry in files
entitlement, a `path_setting` can now be used. The value may be an
explicit setting, or a setting glob with a single `*`.

relates ES-10844
2025-02-18 23:13:55 +01:00
Moritz Mack
8eb89cf7c1
Add entitlement checks for java.io stream classes (#122406) 2025-02-18 14:12:01 +01:00
Moritz Mack
87c58ff93f
[Entitlements] Add missing entitlements for trust store (#122797)
Add missing entitlements for trust store if running in fips mode.

Fixes #122546, fixes #122569, fixes #122568, fixes #122680, fixes
#122566
2025-02-18 23:32:05 +11:00
Lorenzo Dematté
cf64bd31f6
Fix policy manager/parser absolute path checks (#122736) 2025-02-17 20:26:30 +01:00
Moritz Mack
67dc1995df
Support file entitlements relative to the user's home directory (#122724) 2025-02-17 17:56:02 +01:00
Ryan Ernst
bf1cbb0e47
Instrument methods on File that require read permissions (#122544)
This commit adds instrumentation for File methods that require read permissions.

see #122109 for the write side
2025-02-17 16:27:42 +01:00
Ryan Ernst
c211040470
Remove FileEntitlement (#122657)
This is no longer used since FilesEntitlement was added.
2025-02-17 06:08:00 -08:00
Ryan Ernst
abfda89e19
Use records for FileData implementations (#122658)
This commit switches to using records in place of classes for FileData
impls. It moves them outside the interface so that they can be private.
This does not change the fact the interface is sealed, nor the factory
methods for creating them.
2025-02-17 06:07:33 -08:00
Tim Vernum
927e67bc5d Merge main into multi-project 2025-02-18 00:19:44 +11:00
Moritz Mack
7fd1addccf
[Entitlements] Instrument nio path (#122507) 2025-02-17 14:01:57 +01:00
Moritz Mack
cc9679162f
[Entitlements] Add missing file entitlements for server (#122728)
Add missing file entitlements for server.

closes https://github.com/elastic/elasticsearch/issues/122569, closes
https://github.com/elastic/elasticsearch/issues/122568, closes
https://github.com/elastic/elasticsearch/issues/122567, closes
https://github.com/elastic/elasticsearch/issues/122566 

(Note, some failures are due to a `NoSuchAlgorithmException` when fips
is enabled. This issue is unrelated to entitlements)
2025-02-17 21:06:11 +11:00
Lorenzo Dematté
191f801f8c
[Entitlements] Add logsDir to entitlement bootstrap parameters (#122605)
While testing https://github.com/elastic/elasticsearch/pull/122591, I
realized we need to grand read/write permission to the logs dir to
server.

This PR adds the `logsDir` to the bootstrap parameters, and uses it in
the `server` policy.
2025-02-17 18:42:08 +11:00
Tim Vernum
d271a48c2a Merge main into multi-project 2025-02-17 17:05:19 +11:00
Lorenzo Dematté
91413351ce
[Entitlements] Add ability to set path relative to a special directory for Files policies (#122370) 2025-02-14 18:08:08 +01:00
Lorenzo Dematté
eff30608ce
Add file read entitlement check to library load functions (#122494) 2025-02-14 17:23:33 +01:00
Tim Vernum
680e7a6979 Merge revision 5c00341c2b into multi-project 2025-02-14 17:17:41 +11:00
Sam Xiao
5d48ded537
Improve SLM Health Indicator to cover missing snapshot (#121370)
Currently the SLM health indicator in health report turns YELLOW when snapshots fail for a number of times. However, the SLM health indicator stays GREEN if snapshot is not completed (no success or failure) for a long time. This change adds a new optional setting unhealthy_if_no_snapshot_within to SLM policy, that sets a time threshold. If the SLM policy has not had a successful snapshot for longer than the threshold, the SLM health indicator will turn YELLOW.
2025-02-14 09:54:26 +08:00
Ryan Ernst
b8e4f4ea6a
Add temp dir access to all modules (#122525)
Temp dir access is necessary all over Elasticsearch, and in general is
not sensitive. With Security Manager all code in ES, including plugins,
are given read/write access to the temp dir. This commit mimicks that
behavior with entitlements.
2025-02-13 17:19:00 -08:00
Lorenzo Dematté
0810e66802
[Entitlements] Make lookupImplementationMethod inheritance-aware (#122474) 2025-02-13 22:08:29 +01:00
Patrick Doyle
f8aa047994
Entitlements: manage_threads (#122261)
* Refactor: protected -> private

* Initial thread-related entitlements

* Entitlements from manual test runs

* Refactor: notEntitled method

* Entitlements reporting mode

* Entitlements from CI

* Revert "Entitlements reporting mode"

This reverts commit 443ca767333269a73accd0cedf9ca6c6ac51698a.

* Remove unnecessary EntitledActions.newThread

* Don't log in entitlements ITs by default

* Import SuppressForbidden

* Respond to PR comments

* Move manage_threads tests to their own file
2025-02-13 13:45:51 -05:00
Lorenzo Dematté
bd242cccbc
[Entitlements] Instrumentation for FileSystemProvider (#122232) 2025-02-12 18:56:13 +01:00
Ryan Ernst
5f00b64ec7
Instrument methods on File that require write permission (#122109)
This commit adds instrumentation for File methods that require write
permission. No server or plugins use these methods, so no policy changes
were necessary. Note that since we are not planning to restrict temp
file creation, the bootstrap self test on file writing was removed,
which failed with these changes.
2025-02-12 06:20:34 -08:00
Lorenzo Dematté
ec7f4ccb04
[Entitlements] Add FileStore instrumentation + tests (#122348) 2025-02-12 14:04:18 +01:00
Yang Wang
04d459009b Merge main into multi-project 2025-02-12 09:57:09 +11:00
Lorenzo Dematté
a10f8a8c1c
[Entitlements] Fix "dynamic" instrumentation target class (#122197) 2025-02-11 08:48:00 +01:00
Tim Vernum
17657c0104
Remove TLSv1.1 from default protocols (#121731)
This commit removes "TLSv1.1" from the list of default protocols in
Elasticsearch (starting with ES9.0)

TLSv1.1 has been deprecated by the IETF since March 2021

This affects a variety of TLS contexts, include
 - The HTTP Server (Rest API)
 - Transport protocol (including CCS and CCR)
 - Outgoing connections for features that have configurable SSL
   settings. This includes
    - reindex
    - watcher
    - security realms (SAML, OIDC, LDAP, etc)
    - monitoring exporters
    - inference services

In practice, however, TLSv1.1 has been disabled in most Elasticsearch
deployments since around 7.12 because most JDK releases have disabled
TLSv1.1 (by default) starting in April 2021

That is, if you run a default installation of Elasticsearch (for any
currently supported version of ES) that uses the bundled JVM then
TLSv1.1 is already disabled.
And, since ES9+ requires JDK21+, all supported JDKs ship with TLSv1.1
disabled by default.

In addition, incoming HTTP connections to Elastic Cloud deployments
have required TLSv1.2 or higher since April 2020

This change simply makes it clear that Elasticsearch does not
attempt to enable TLSv1.1 and administrators who wish to use that
protocol will need to explicitly enable it in both the JVM and in
Elasticsearch.

Resolves: #108057
2025-02-10 09:12:52 +01:00
Ryan Ernst
e32b9f48b0
Use dynamic policy for entitled test plugin (#121852)
Like the plugin being testing, the entitled test plugin needs access to
dynamic elements (namely, file paths). This commit dynamically generates
the entitlement policy for the entitlted test plugin when it is
installed. It also adds using the file entitltlement as an example.
2025-02-07 21:47:48 +01:00
Ryan Ernst
743e5d4c81
Remove assertion about theoretical path separators (#122069)
The only real path separators are either forward or back slash. Trying
to use something else like newline fails to even parse as a path on
windows. This commit removes testing of other separators.

closes #121872
2025-02-07 11:51:26 -08:00
Lorenzo Dematté
05340746bb
Missing providers from nio (#122004) 2025-02-07 17:09:36 +01:00
Lorenzo Dematté
20376e0762
[Entitlements] Add native checks support and tests for Java 21 (preview) (#121881) 2025-02-07 17:01:04 +01:00