Skip to content

Commit 92fadd3

Browse files
Merge branch 'main' into ml-auth-task-node-feature
2 parents 9c9347f + 9cb7768 commit 92fadd3

File tree

98 files changed

+16753
-2937
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+16753
-2937
lines changed

.gitattributes

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ CHANGELOG.asciidoc merge=union
44
# Windows
55
build-tools-internal/src/test/resources/org/elasticsearch/gradle/internal/release/*.asciidoc text eol=lf
66

7+
# ESQL parsing and source generated related assets
78
x-pack/plugin/esql/compute/src/main/generated/** linguist-generated=true
89
x-pack/plugin/esql/compute/src/main/generated-src/** linguist-generated=true
910
x-pack/plugin/esql/src/main/antlr/*.tokens linguist-generated=true
1011
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/*.interp linguist-generated=true
11-
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseLexer*.java linguist-generated=true
12-
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseParser*.java linguist-generated=true
12+
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/*BaseLexer*.java linguist-generated=true
13+
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/*BaseParser*.java linguist-generated=true
1314
x-pack/plugin/esql/src/main/generated/** linguist-generated=true
1415
x-pack/plugin/esql/src/main/generated-src/** linguist-generated=true
1516

build-tools-internal/src/main/resources/checkstyle_suppressions.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<suppress files="modules[/\\]lang-painless[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]painless[/\\]antlr[/\\]SuggestLexer\.java" checks="." />
1313
<suppress files="plugin[/\\]sql[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]sql[/\\]parser[/\\]SqlBase(Base(Listener|Visitor)|Lexer|Listener|Parser|Visitor).java" checks="." />
1414
<suppress files="plugin[/\\]eql[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]eql[/\\]parser[/\\]EqlBase(Base(Listener|Visitor)|Lexer|Listener|Parser|Visitor).java" checks="." />
15-
<suppress files="plugin[/\\]esql[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]esql[/\\]parser[/\\]EsqlBase(Parser|Lexer).*.java" checks="." />
15+
<suppress files="plugin[/\\]esql[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]esql[/\\]parser[/\\](EsqlBase|PromqlBase)(Parser|Lexer).*.java" checks="." />
1616
<suppress files="x-pack[/\\]plugin[/\\]otel-data[/\\]build[/\\]generated[/\\]sources[/\\]" checks="." />
1717

1818
<!-- JNA requires the no-argument constructor on JNAKernel32Library.SizeT to be public-->

docs/changelog/137230.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 137230
2+
summary: Principal Extraction from Certificate RDN Attribute Value in PKI Realm
3+
area: Security
4+
type: bug
5+
issues: []

docs/reference/elasticsearch/configuration-reference/security-settings.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,18 @@ In addition to the [settings that are valid for all realms](#ref-realm-settings)
769769
`username_pattern`
770770
: ([Static](docs-content://deploy-manage/stack-settings.md#static-cluster-setting)) The regular expression pattern used to extract the username from the certificate DN. The username is used for auditing and logging. The username can also be used with the [role mapping API](docs-content://deploy-manage/users-roles/cluster-or-deployment-auth/mapping-users-groups-to-roles.md) and [authorization delegation](docs-content://deploy-manage/users-roles/cluster-or-deployment-auth/authorization-delegation.md). The first match group is the used as the username. Defaults to `CN=(.*?)(?:,|$)`.
771771

772+
This setting is ignored if either `username_rdn_oid` or `username_rdn_name` is set.
773+
774+
`username_rdn_oid`
775+
: ([Static](docs-content://deploy-manage/stack-settings.md#static-cluster-setting)) The relative distinguished name (RDN) attribute OID used to extract the username from the certificate DN. The username is used for auditing and logging. The username can also be used with the [role mapping API](docs-content://deploy-manage/users-roles/cluster-or-deployment-auth/mapping-users-groups-to-roles.md) and [authorization delegation](docs-content://deploy-manage/users-roles/cluster-or-deployment-auth/authorization-delegation.md). The value of the most specific RDN matching this attribute OID is used as the username.
776+
777+
This setting takes precedent over `username_pattern`. You cannot use this setting and `username_rdn_name` at the same time.
778+
779+
`username_rdn_name`
780+
: ([Static](docs-content://deploy-manage/stack-settings.md#static-cluster-setting)) The relative distinguished name (RDN) attribute name used to extract the username from the certificate DN. The username is used for auditing and logging. The username can also be used with the [role mapping API](docs-content://deploy-manage/users-roles/cluster-or-deployment-auth/mapping-users-groups-to-roles.md) and [authorization delegation](docs-content://deploy-manage/users-roles/cluster-or-deployment-auth/authorization-delegation.md). The value of the most specific RDN matching this attribute name is used as the username.
781+
782+
This setting takes precedent over `username_pattern`. You cannot use this setting and `username_rdn_oid` at the same time.
783+
772784
`certificate_authorities`
773785
: ([Static](docs-content://deploy-manage/stack-settings.md#static-cluster-setting)) List of paths to the PEM certificate files that should be used to authenticate a user’s certificate as trusted. Defaults to the trusted certificates configured for SSL. This setting cannot be used with `truststore.path`.
774786

libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/DerParser.java

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,22 @@ public final class DerParser {
3636
private static final int CONSTRUCTED = 0x20;
3737

3838
// Tag and data types
39-
static final class Type {
40-
static final int INTEGER = 0x02;
41-
static final int OCTET_STRING = 0x04;
42-
static final int OBJECT_OID = 0x06;
43-
static final int SEQUENCE = 0x10;
44-
static final int NUMERIC_STRING = 0x12;
45-
static final int PRINTABLE_STRING = 0x13;
46-
static final int VIDEOTEX_STRING = 0x15;
47-
static final int IA5_STRING = 0x16;
48-
static final int GRAPHIC_STRING = 0x19;
49-
static final int ISO646_STRING = 0x1A;
50-
static final int GENERAL_STRING = 0x1B;
51-
static final int UTF8_STRING = 0x0C;
52-
static final int UNIVERSAL_STRING = 0x1C;
53-
static final int BMP_STRING = 0x1E;
39+
public static final class Type {
40+
public static final int INTEGER = 0x02;
41+
public static final int OCTET_STRING = 0x04;
42+
public static final int OBJECT_OID = 0x06;
43+
public static final int SEQUENCE = 0x10;
44+
public static final int SET = 0x11;
45+
public static final int NUMERIC_STRING = 0x12;
46+
public static final int PRINTABLE_STRING = 0x13;
47+
public static final int VIDEOTEX_STRING = 0x15;
48+
public static final int IA5_STRING = 0x16;
49+
public static final int GRAPHIC_STRING = 0x19;
50+
public static final int ISO646_STRING = 0x1A;
51+
public static final int GENERAL_STRING = 0x1B;
52+
public static final int UTF8_STRING = 0x0C;
53+
public static final int UNIVERSAL_STRING = 0x1C;
54+
public static final int BMP_STRING = 0x1E;
5455
}
5556

5657
private InputStream derInputStream;

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,6 @@ tests:
411411
- class: org.elasticsearch.xpack.ml.integration.RegressionIT
412412
method: testTwoJobsWithSameRandomizeSeedUseSameTrainingSet
413413
issue: https://github.com/elastic/elasticsearch/issues/138319
414-
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldMapperTests
415-
method: testKnnQuantizedFlatVectorsFormat
416-
issue: https://github.com/elastic/elasticsearch/issues/138368
417414
- class: org.elasticsearch.smoketest.SmokeTestMultiNodeClientYamlTestSuiteIT
418415
method: test {yaml=termvectors/30_realtime/Realtime Term Vectors}
419416
issue: https://github.com/elastic/elasticsearch/issues/138370

server/src/test/java/org/elasticsearch/index/mapper/vectors/DenseVectorFieldMapperTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2003,7 +2003,7 @@ public void testKnnQuantizedFlatVectorsFormat() throws IOException {
20032003
+ (quantizedFlatFormat.equals("int4_flat") ? 4 : 7)
20042004
+ ", compressed="
20052005
+ quantizedFlatFormat.equals("int4_flat")
2006-
+ ", flatVectorScorer=ESQuantizedFlatVectorsScorer("
2006+
+ ", flatVectorScorer=ESFlatVectorsScorer("
20072007
+ "delegate=ScalarQuantizedVectorScorer(nonQuantizedDelegate=DefaultFlatVectorScorer())"
20082008
+ ", factory="
20092009
+ (factory != null ? factory : "null")

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authc/pki/PkiRealmSettings.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
*/
77
package org.elasticsearch.xpack.core.security.authc.pki;
88

9+
import com.unboundid.ldap.sdk.LDAPException;
10+
import com.unboundid.ldap.sdk.schema.AttributeTypeDefinition;
11+
import com.unboundid.ldap.sdk.schema.Schema;
12+
913
import org.elasticsearch.common.settings.SecureString;
1014
import org.elasticsearch.common.settings.Setting;
1115
import org.elasticsearch.core.TimeValue;
@@ -29,6 +33,33 @@ public final class PkiRealmSettings {
2933
key -> new Setting<>(key, DEFAULT_USERNAME_PATTERN, s -> Pattern.compile(s, Pattern.CASE_INSENSITIVE), Setting.Property.NodeScope)
3034
);
3135

36+
public static final Setting.AffixSetting<String> USERNAME_RDN_OID_SETTING = Setting.affixKeySetting(
37+
RealmSettings.realmSettingPrefix(TYPE),
38+
"username_rdn_oid",
39+
key -> Setting.simpleString(key, Setting.Property.NodeScope)
40+
);
41+
42+
public static final Setting.AffixSetting<String> USERNAME_RDN_NAME_SETTING = Setting.affixKeySetting(
43+
RealmSettings.realmSettingPrefix(TYPE),
44+
"username_rdn_name",
45+
key -> new Setting<>(key, (String) null, s -> {
46+
if (s == null) {
47+
return "";
48+
}
49+
Schema schema;
50+
try {
51+
schema = Schema.getDefaultStandardSchema();
52+
} catch (LDAPException e) {
53+
throw new IllegalStateException("Unexpected error occurred obtaining default LDAP schema", e);
54+
}
55+
AttributeTypeDefinition atd = schema.getAttributeType(s);
56+
if (atd == null) {
57+
throw new IllegalArgumentException("Unknown RDN name [" + s + "] for setting [" + key + "]");
58+
}
59+
return atd.getOID();
60+
}, Setting.Property.NodeScope)
61+
);
62+
3263
private static final TimeValue DEFAULT_TTL = TimeValue.timeValueMinutes(20);
3364
public static final Setting.AffixSetting<TimeValue> CACHE_TTL_SETTING = Setting.affixKeySetting(
3465
RealmSettings.realmSettingPrefix(TYPE),
@@ -75,6 +106,8 @@ private PkiRealmSettings() {}
75106
public static Set<Setting.AffixSetting<?>> getSettings() {
76107
Set<Setting.AffixSetting<?>> settings = new HashSet<>();
77108
settings.add(USERNAME_PATTERN_SETTING);
109+
settings.add(USERNAME_RDN_OID_SETTING);
110+
settings.add(USERNAME_RDN_NAME_SETTING);
78111
settings.add(CACHE_TTL_SETTING);
79112
settings.add(CACHE_MAX_USERS_SETTING);
80113
settings.add(DELEGATION_ENABLED_SETTING);

x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/Literal.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
import java.io.IOException;
2424
import java.time.Duration;
25+
import java.time.Instant;
2526
import java.util.Collection;
2627
import java.util.Objects;
2728

@@ -217,6 +218,10 @@ public static Literal timeDuration(Source source, Duration literal) {
217218
return new Literal(source, literal, DataType.TIME_DURATION);
218219
}
219220

221+
public static Literal dateTime(Source source, Instant literal) {
222+
return new Literal(source, literal, DataType.DATETIME);
223+
}
224+
220225
public static Literal integer(Source source, Integer literal) {
221226
return new Literal(source, literal, INTEGER);
222227
}
@@ -229,6 +234,10 @@ public static Literal fromLong(Source source, Long literal) {
229234
return new Literal(source, literal, LONG);
230235
}
231236

237+
public static Expression fromBoolean(Source source, Boolean literal) {
238+
return new Literal(source, literal, DataType.BOOLEAN);
239+
}
240+
232241
private static BytesRef longAsWKB(DataType dataType, long encoded) {
233242
return dataType == GEO_POINT ? GEO.longAsWkb(encoded) : CARTESIAN.longAsWkb(encoded);
234243
}

x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/predicate/operator/arithmetic/Arithmetics.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public static Number mod(Number l, Number r) {
148148
return l.intValue() % r.intValue();
149149
}
150150

151-
static Number negate(Number n) {
151+
public static Number negate(Number n) {
152152
if (n == null) {
153153
return null;
154154
}

0 commit comments

Comments
 (0)