-
Notifications
You must be signed in to change notification settings - Fork 25.3k
http proxy support in JWT realm #127337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
http proxy support in JWT realm #127337
Changes from all commits
72e7d77
5fdc175
1eedb87
963b0bb
2e05ffd
078bdf5
a8b028d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pr: 127337 | ||
summary: Http proxy support in JWT realm | ||
area: Authentication | ||
type: enhancement | ||
issues: | ||
- 114956 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ | |
import java.util.stream.Stream; | ||
|
||
import static org.elasticsearch.xpack.core.security.authc.support.SecuritySettingsUtil.verifyNonNullNotEmpty; | ||
import static org.elasticsearch.xpack.core.security.authc.support.SecuritySettingsUtil.verifyProxySettings; | ||
|
||
/** | ||
* Settings unique to each JWT realm. | ||
|
@@ -193,7 +194,10 @@ private static Set<Setting.AffixSetting<?>> getNonSecureSettings() { | |
HTTP_CONNECTION_READ_TIMEOUT, | ||
HTTP_SOCKET_TIMEOUT, | ||
HTTP_MAX_CONNECTIONS, | ||
HTTP_MAX_ENDPOINT_CONNECTIONS | ||
HTTP_MAX_ENDPOINT_CONNECTIONS, | ||
HTTP_PROXY_SCHEME, | ||
HTTP_PROXY_HOST, | ||
HTTP_PROXY_PORT | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We also have to document these new settings. I'm fine if you prefer to do documentation update in a followup PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want to backport this? 9.0 docs are in a different repo, so I need to raise a different PR regardless There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, we should backport this to 8.18 at least. Makes total sense to handle the docs in a followup. The docs for 9.x are in different repo, but docs for 8.x are still in elastricsearch repo. |
||
) | ||
); | ||
// Standard TLS connection settings for outgoing connections to get JWT issuer jwkset_path | ||
|
@@ -481,6 +485,49 @@ public Iterator<Setting<?>> settings() { | |
key -> Setting.intSetting(key, DEFAULT_HTTP_MAX_ENDPOINT_CONNECTIONS, MIN_HTTP_MAX_ENDPOINT_CONNECTIONS, Setting.Property.NodeScope) | ||
); | ||
|
||
public static final Setting.AffixSetting<String> HTTP_PROXY_HOST = Setting.affixKeySetting( | ||
richard-dennehy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
RealmSettings.realmSettingPrefix(TYPE), | ||
"http.proxy.host", | ||
key -> Setting.simpleString(key, new Setting.Validator<>() { | ||
@Override | ||
public void validate(String value) { | ||
// There is no point in validating the hostname in itself without the scheme and port | ||
} | ||
|
||
@Override | ||
public void validate(String value, Map<Setting<?>, Object> settings) { | ||
verifyProxySettings(key, value, settings, HTTP_PROXY_HOST, HTTP_PROXY_SCHEME, HTTP_PROXY_PORT); | ||
} | ||
|
||
@Override | ||
public Iterator<Setting<?>> settings() { | ||
final String namespace = HTTP_PROXY_HOST.getNamespace(HTTP_PROXY_HOST.getConcreteSetting(key)); | ||
final List<Setting<?>> settings = List.of( | ||
HTTP_PROXY_PORT.getConcreteSettingForNamespace(namespace), | ||
HTTP_PROXY_SCHEME.getConcreteSettingForNamespace(namespace) | ||
); | ||
return settings.iterator(); | ||
} | ||
}, Setting.Property.NodeScope) | ||
); | ||
public static final Setting.AffixSetting<Integer> HTTP_PROXY_PORT = Setting.affixKeySetting( | ||
RealmSettings.realmSettingPrefix(TYPE), | ||
"http.proxy.port", | ||
key -> Setting.intSetting(key, 80, 1, 65535, Setting.Property.NodeScope), | ||
() -> HTTP_PROXY_HOST | ||
); | ||
public static final Setting.AffixSetting<String> HTTP_PROXY_SCHEME = Setting.affixKeySetting( | ||
RealmSettings.realmSettingPrefix(TYPE), | ||
"http.proxy.scheme", | ||
key -> Setting.simpleString( | ||
key, | ||
"http", | ||
// TODO allow HTTPS once https://github.com/elastic/elasticsearch/issues/100264 is fixed | ||
value -> verifyNonNullNotEmpty(key, value, List.of("http")), | ||
Setting.Property.NodeScope | ||
) | ||
); | ||
|
||
// SSL Configuration settings | ||
|
||
public static final Collection<Setting.AffixSetting<?>> SSL_CONFIGURATION_SETTINGS = SSLConfigurationSettings.getRealmSettings(TYPE); | ||
|
Uh oh!
There was an error while loading. Please reload this page.