Skip to content
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

Add setting to restrict license types #49418

Merged
merged 6 commits into from
Dec 10, 2019

Conversation

tvernum
Copy link
Contributor

@tvernum tvernum commented Nov 21, 2019

This adds a new "xpack.license.upload.types" setting that restricts
which license types may be uploaded to a cluster.

By default all types are allowed (excluding basic, which can only be
generated and never uploaded).
This setting does not restrict APIs that generate licenses such as the
start trial API.

This setting is not documented as it is intended to be set by
orchestrators and not end users.

Closes: #48508

This adds a new "xpack.license.upload.types" setting that restricts
which license types may be uploaded to a cluster.

By default all types are allowed (excluding basic, which can only be
generated and never uploaded).
This setting does not restrict APIs that generate licenses such as the
start trial API.

This setting is not documented as it is intended to be set by
orchestrators and not end users.
@tvernum tvernum added >enhancement :Security/License License functionality for commercial features v8.0.0 v7.6.0 labels Nov 21, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-security (:Security/License)

@@ -193,11 +203,21 @@ public void on(License license) {
*/
public void registerLicense(final PutLicenseRequest request, final ActionListener<PutLicenseResponse> listener) {
final License newLicense = request.license();
final License.LicenseType licenseType;
try {
licenseType = License.LicenseType.resolve(newLicense);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not consume any part of the license before we validate its signature first

@@ -64,6 +64,9 @@
return SelfGeneratedLicense.validateSelfGeneratedType(type);
}, Setting.Property.NodeScope);

public static final Setting<List<License.LicenseType>> ALLOWED_LICENSE_TYPES = Setting.listSetting("xpack.license.upload.types",
License.LicenseType.ALL_TYPE_NAMES, License.LicenseType::parse, Setting.Property.NodeScope);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do handle basic explicitly in all places, but should we exclude it from the default value of xpack.license.upload.types too ?

Copy link
Member

@jkakavas jkakavas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jkakavas
Copy link
Member

@elasticmachine run elasticsearch-ci/1

(failed to download ml artifact, transient network issue )

@pebrc pebrc mentioned this pull request Dec 1, 2019
2 tasks
@tvernum
Copy link
Contributor Author

tvernum commented Dec 10, 2019

@elasticmachine update branch

@tvernum tvernum merged commit a6351d6 into elastic:master Dec 10, 2019
tvernum added a commit to tvernum/elasticsearch that referenced this pull request Dec 16, 2019
This adds a new "xpack.license.upload.types" setting that restricts
which license types may be uploaded to a cluster.

By default all types are allowed (excluding basic, which can only be
generated and never uploaded).
This setting does not restrict APIs that generate licenses such as the
start trial API.

This setting is not documented as it is intended to be set by
orchestrators and not end users.

Backport of: elastic#49418
tvernum added a commit that referenced this pull request Dec 17, 2019
This adds a new "xpack.license.upload.types" setting that restricts
which license types may be uploaded to a cluster.

By default all types are allowed (excluding basic, which can only be
generated and never uploaded).
This setting does not restrict APIs that generate licenses such as the
start trial API.

This setting is not documented as it is intended to be set by
orchestrators and not end users.

Backport of: #49418
SivagurunathanV pushed a commit to SivagurunathanV/elasticsearch that referenced this pull request Jan 23, 2020
This adds a new "xpack.license.upload.types" setting that restricts
which license types may be uploaded to a cluster.

By default all types are allowed (excluding basic, which can only be
generated and never uploaded).
This setting does not restrict APIs that generate licenses such as the
start trial API.

This setting is not documented as it is intended to be set by
orchestrators and not end users.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :Security/License License functionality for commercial features v7.6.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting to whitelist allowed licenses
4 participants