Commit graph

935 commits

Author SHA1 Message Date
Mark Vieira
017d7bfcd8
Add inbound_network entitlement to repository-hdfs plugin (#123907) (#124027) 2025-03-05 05:44:07 +11:00
Lorenzo Dematté
bc9e18fe38
Make NotEntitledException inherit from SecurityException for compatibility purposes (#123984) (#124007) 2025-03-05 02:51:56 +11:00
Nikolaj Volgushev
37fadd7847
Drop TLS_RSA ciphers from default cipher suites for JDK 24 (#123600) (#123989)
This PR adjusts the list of supported ciphers to reflect ciphers
available in JDK 24. 

JDK 24 [drops](https://bugs.openjdk.org/browse/JDK-8245545) support for
`TLS_RSA` suites. These ciphers will no longer be supported in
Elasticsearch with a bundled JDK with version >= 24. JDK's of lower
versions will continue to support to dropped ciphers. 

I will follow up this PR with a separate docs PR.
2025-03-05 00:54:51 +11:00
Lorenzo Dematté
e9b772bc60
[8.18][Entitlements] Add URLConnection instrumentation (#123966)
* [Entitlements] Add URLConnection instrumentation (#123503)

* [Entitlements] Add URLConnection instrumentation for ftp, http and https protocols (#123802)
2025-03-04 20:30:02 +11:00
Lorenzo Dematté
ac3742f353
Add missing APM entitlements (#123462) (#123964) 2025-03-04 20:07:35 +11:00
Lorenzo Dematté
ca7981c65b
[Entitlements] Fix FileAccessTree paths ordering (#123689) (#123849) 2025-03-04 08:23:04 +11:00
Ryan Ernst
c68cff65c8
Grant read access to the config dir (#123882) (#123912)
This matches what Security Manager permissions Elasticsearch had for all
plugins.
2025-03-04 07:54:30 +11:00
Lorenzo Dematté
7e97c1da9c
Fix PolicyManagerTests testFilesEntitlementsWithExclusive failing (#123856) (#123888) 2025-03-04 02:48:23 +11:00
Ryan Ernst
9875f4f183
Remove ignoreUrl file setting property (#123718) (#123821)
Urls may make the FileAccessTree invalid. This commit removes the flag
for filtering urls, instead always filtering them.
2025-03-03 07:39:18 +11:00
Ryan Ernst
426b9810b5
Set root logger level for CLIs (#123742) (#123818)
All CLIs in elasticsearch support command line flags for controlling the
output level. When --silent is used, the expectation is that normal
logging is omitted. Yet the log4j logger is still configured to output
error level logs. This commit sets the appropriate log level for log4j
depending on the Terminal log level.
2025-03-03 06:09:59 +11:00
Lorenzo Dematté
530f2b45f5
[Entitlements] Add a check for filesystem mismatch (#123744) (#123777) 2025-03-01 11:21:06 +11:00
Ryan Ernst
9459cc0b8f
More flexible settings pattern (#123746) (#123758)
This commit reworks the settings globs to be more useable. Primarily it
expands the values so that the settings may be lists, iterating over
each value. Additionally it simplifies the function to also allow
non-glob settings so that this single method may be used to lookup all
values for a given setting pattern, whether it contains a glob or not.
2025-03-01 08:18:51 +11:00
Ryan Ernst
703b8e0f4b
Consolidate path setting files entitlements to config (#123649) (#123670)
The setting based paths could be either absolute or relative, and they
are always relative to the config dir. This commit renames the
path_setting to make it clear it is related to config, and removes the
relative variant.
2025-02-28 13:54:17 +11:00
Nikolaj Volgushev
cb173d9332
Handle NotEntitledException in SSL file utils (#123491) (#123604)
SSL file utils currently only handle security manager access control
exceptions around file read checks. This PR extends these to support
entitlement checks as well. 

There is no easy way to unit test this since we can't run unit tests
with entitlements enabled (for now). The PR includes a REST test
instead. 

Relates: https://github.com/elastic/elasticsearch/issues/121960
2025-02-28 02:35:44 +11:00
Moritz Mack
0a47363f6d
Add missing APM agent entitlements (#123575) (#123579)
Add missing APM agent entitlements
2025-02-27 13:36:44 +01:00
Patrick Doyle
5e619ee2b4
More entitlements for bouncycastle (#123548) (#123572) 2025-02-27 20:27:04 +11:00
Jack Conradson
a0ef3cb433
Add an exclusive parameter for files entitlements (#123087) (#123562)
This adds an exclusive parameter for FilesEntitlement where a path can be made exclusive for a certain 
module. Should two modules attempt to both specify the same path as exclusive an exception is 
thrown.
2025-02-27 13:44:27 +11:00
Ryan Ernst
b9aea477ee
Add ignore_url for setting based files entitlement (#123541) (#123545)
File entitlements which read a setting may actually contain urls. This
commit adds an optional `ignore_url` property for the entitlement to
skip any values which are urls.
2025-02-27 08:53:44 +11:00
Ryan Ernst
957dc2f408
[8.18] Enable entitlements by default (#122907) (#123400)
* Enable entitlements by default (#122907)

Entitlements are almost complete. This commit enables them by default,
in preparation for 8.18/9.0.

* mute test

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-02-26 16:58:41 +11:00
Ryan Ernst
a280eecc9f
Give NamedComponentReader access to read plugins directories (#123431) (#123440)
The NamedComponentReader reads a file created upon plugin installation
for stable plugins from the plugin installation dir. This commit passes
the plugins directory through to entitlements and grants server access.
2025-02-26 12:54:10 +11:00
Lorenzo Dematté
00f967dd53
Fix how we suppress logs for self-tests (#123361) (#123379) 2025-02-26 02:27:02 +11:00
Lorenzo Dematté
9ebd870c4d
Missing log4j policy (#123360) (#123366) 2025-02-26 01:11:52 +11:00
Lorenzo Dematté
dbea12de87
[Entitlements] Follows links during FileAccessTree creation (#123357) (#123362) 2025-02-26 00:58:41 +11:00
Lorenzo Dematté
8c28fe42af
Some missing entitlements preventing serverless to start (#123271) (#123348) 2025-02-25 21:42:38 +11:00
Ryan Ernst
1ebab7b8ae
Add pidfile access for server (#123313) (#123349) 2025-02-25 21:26:21 +11:00
Ryan Ernst
310e0b5415
Consider entitlement lib as system module (#123315) (#123338)
* Consider entitlement lib as system module

Entitlements sometimes needs to perform sensitive operations,
particularly within the FileAccessTree. This commit expands the
trivially allowed check to include entitlements as one of the system
modules alongside the jdk. One consequence is that the self test must be
moved outside entitlements.

* [CI] Auto commit changes from spotless

* remove old method call

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-02-25 20:24:52 +11:00
Ryan Ernst
22bdc9c81e
Remove unnecessary temp dir access (#123314) (#123330)
All modules have read/write access to the temp dir. This commit removes
unnecessarily adding the temp dir explicitly to the server policy.
2025-02-25 13:55:14 +11:00
Ryan Ernst
975f1c7238
Add platform property to files entitlement (#123212) (#123325)
Some file paths are OS specific. This commit adds a `platform` property
to each file in a files entitlement that can be used to limit that file
to a specific platform.

Co-authored-by: Moritz Mack <mmack@apache.org>
Co-authored-by: Lorenzo Dematte <lorenzo.dematte@elastic.co>
2025-02-25 12:46:00 +11:00
Ryan Ernst
6cfbfb183b
[Entitlements] Cross-platform implementation of Path.isAbsolute() (#123282) (#123319)
Co-authored-by: Lorenzo Dematté <lorenzo.dematte@elastic.co>
2025-02-25 11:28:09 +11:00
Ryan Ernst
cb579953ab
Add shared_repo relative dir for files entitlement (#123221) (#123306)
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-25 07:48:21 +11:00
Patrick Doyle
10a223d19b
FileAccessTree fixes for ordering and pruning (#123291) (#123302)
* Custom comparator for paths in FileAccessTree

* Strip trailing separators in normalizePath
2025-02-25 07:04:20 +11:00
Jack Conradson
e341735f9b
Prune extraneous files entitlements paths to prevent incorrect binary search (#123177) (#123205) 2025-02-22 13:54:07 +11:00
Patrick Doyle
f45e283441
Reduce warnings in entitlement REST tests (#123028) (#123063) (#123075)
Backport of a bunch of minor cosmetic changes to reduce warnings.
2025-02-21 14:59:10 -05:00
Patrick Doyle
fcfde3b489
Misc non-java.base file entitlements (#123078) (#123154) (#123164)
* Misc non-java.base file entitlements

* Remove unnecessary dependency
2025-02-22 04:27:16 +11:00
Moritz Mack
b0018b4f50
Add missing entitlements discovered in IT tests (#123015) (#123033)
(cherry picked from commit d1b7639784)
2025-02-21 02:54:22 +11:00
Lorenzo Dematté
6e8074ed6f
[Entitlements] Instrumentation of NIO Files and Channels (#122816 and #122591) (#122986) (#122993)
* [Entitlements] Add check functions for NIO Files (#122591)

* [Entitlements] Instrumentation of NIO file channels (#122816)

* [CI] Auto commit changes from spotless

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-02-20 20:45:01 +11:00
Moritz Mack
e2f45b32dc
[Entitlements] Log message for troubleshooting if not entitled (#122948) (#122961)
Log message for troubleshooting if not entitled.
2025-02-20 07:23:43 +11:00
Patrick Doyle
2cf8e6a25b
Miscellaneous java.base file entitlements (#122906) (#122957)
* 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-20 06:29:06 +11:00
Moritz Mack
f024c427b1
Add missing entitlements for FIPS (#122941) (#122953)
Add missing entitlements for FIPS
2025-02-20 04:53:13 +11:00
Patrick Doyle
f095022ca0
Change printlns to log statements (#122935) (#122943) 2025-02-20 03:07:39 +11:00
Ryan Ernst
24d80df5f7
Add support for setting based file entitlements (#122656) (#122900)
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-19 10:27:29 +11:00
Moritz Mack
b00a24fb3d
Add entitlement checks for java.io stream classes (#122406) (#122851)
(cherry picked from commit 8eb89cf7c1)

# Conflicts:
#	libs/entitlement/bridge/src/main/java/org/elasticsearch/entitlement/bridge/EntitlementChecker.java
#	libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/api/ElasticsearchEntitlementChecker.java
2025-02-19 04:08:13 +11:00
Moritz Mack
e2bde8ac76
Instrument methods on File that require read permissions (#122544) (#122862)
This commit adds instrumentation for File methods that require read permissions.

see #122109 for the write side

(cherry picked from commit bf1cbb0e47)

# Conflicts:
#	x-pack/plugin/security/src/main/plugin-metadata/entitlement-policy.yaml

Co-authored-by: Ryan Ernst <ryan@iernst.net>
2025-02-19 02:56:58 +11:00
Moritz Mack
cef7ee183e
[Entitlements] Add missing entitlements for trust store (#122797) (#122846)
Add missing entitlements for trust store if running in fips mode.

Fixes #122546, fixes #122569, fixes #122568, fixes #122680, fixes
#122566

(cherry picked from commit 87c58ff93f)

# Conflicts:
#	muted-tests.yml
#	x-pack/plugin/security/src/main/plugin-metadata/entitlement-policy.yaml
2025-02-19 01:31:08 +11:00
Lorenzo Dematté
34caaf0a1d
Fix policy manager/parser absolute path checks (#122736) (#122826) 2025-02-19 00:35:33 +11:00
Moritz Mack
46387fbb32
[Entitlements] Instrument nio path (#122507) (#122763)
(cherry picked from commit 7fd1addccf)

# Conflicts:
#	libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/api/ElasticsearchEntitlementChecker.java
2025-02-18 19:54:45 +11:00
Moritz Mack
d4c2c37968
Support file entitlements relative to the user's home directory (#122724) (#122795) 2025-02-18 05:12:17 +11:00
Ryan Ernst
89e9fc637f
Use records for FileData implementations (#122658) (#122769)
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-18 02:32:45 +11:00
Ryan Ernst
9fb65318a8
Remove FileEntitlement (#122657) (#122772)
This is no longer used since FilesEntitlement was added.
2025-02-18 02:22:17 +11:00
Moritz Mack
08e3f456dd
[Entitlements] Add missing file entitlements for server (#122728) (#122750)
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)

(cherry picked from commit cc9679162f)

# Conflicts:
#	muted-tests.yml
2025-02-17 23:27:56 +11:00