Skip to content

Set keyUsage for generated HTTP certificates and self-signed CA (#126376) #126448

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

Merged

Conversation

slobodanadamovic
Copy link
Contributor

Backport

This will backport the following commits from main to 8.17:

Questions ?

Please refer to the Backport tool documentation

…astic#126376)

The `elasticsearch-certutil http` command, and security auto-configuration,
generate the HTTP certificate and CA without setting the `keyUsage` extension.

This PR fixes this by setting (by default):
- `keyCertSign` and `cRLSign` for self-signed CAs
- `digitalSignature` and `keyEncipherment` for HTTP certificates and CSRs

These defaults can be overridden when running `elasticsearch-certutil http`
command. The user will be prompted to change them as they wish.

For `elasticsearch-certutil ca`, the default value can be overridden by passing
the `--keysage` option, e.g.
```
elasticsearch-certutil ca --keyusage "digitalSignature,keyCertSign,cRLSign" -pem
```

Fixes elastic#117769

(cherry picked from commit 284121a)

# Conflicts:
#	docs/reference/elasticsearch/command-line-tools/certutil.md
Copy link
Contributor

github-actions bot commented Apr 8, 2025

Documentation preview:

@slobodanadamovic slobodanadamovic added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Apr 8, 2025
@slobodanadamovic slobodanadamovic added >bug :Security/TLS SSL/TLS, Certificates Team:Security Meta label for security team labels Apr 8, 2025
@slobodanadamovic slobodanadamovic added auto-backport Automatically create backport pull requests when merged v8.18.1 v8.19.0 labels Apr 8, 2025
@slobodanadamovic slobodanadamovic changed the title [8.17] Set keyUsage for generated HTTP certificates and self-signed CA (#126376) Set keyUsage for generated HTTP certificates and self-signed CA (#126376) Apr 8, 2025
@elasticsearchmachine elasticsearchmachine merged commit 65d1526 into elastic:8.17 Apr 8, 2025
20 checks passed
@slobodanadamovic slobodanadamovic deleted the backport/8.17/pr-126376 branch April 8, 2025 10:47
slobodanadamovic added a commit to slobodanadamovic/elasticsearch that referenced this pull request Apr 8, 2025
…astic#126376) (elastic#126448)

* Set `keyUsage` for generated HTTP certificates and self-signed CA (elastic#126376)

The `elasticsearch-certutil http` command, and security auto-configuration,
generate the HTTP certificate and CA without setting the `keyUsage` extension.

This PR fixes this by setting (by default):
- `keyCertSign` and `cRLSign` for self-signed CAs
- `digitalSignature` and `keyEncipherment` for HTTP certificates and CSRs

These defaults can be overridden when running `elasticsearch-certutil http`
command. The user will be prompted to change them as they wish.

For `elasticsearch-certutil ca`, the default value can be overridden by passing
the `--keysage` option, e.g.
```
elasticsearch-certutil ca --keyusage "digitalSignature,keyCertSign,cRLSign" -pem
```

Fixes elastic#117769

(cherry picked from commit 284121a)

# Conflicts:
#	docs/reference/elasticsearch/command-line-tools/certutil.md

* fix compilation error

* [CI] Auto commit changes from spotless

* fix failing test

---------

Co-authored-by: elasticsearchmachine <[email protected]>
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.18
8.x

slobodanadamovic added a commit to slobodanadamovic/elasticsearch that referenced this pull request Apr 8, 2025
…astic#126376) (elastic#126448)

* Set `keyUsage` for generated HTTP certificates and self-signed CA (elastic#126376)

The `elasticsearch-certutil http` command, and security auto-configuration,
generate the HTTP certificate and CA without setting the `keyUsage` extension.

This PR fixes this by setting (by default):
- `keyCertSign` and `cRLSign` for self-signed CAs
- `digitalSignature` and `keyEncipherment` for HTTP certificates and CSRs

These defaults can be overridden when running `elasticsearch-certutil http`
command. The user will be prompted to change them as they wish.

For `elasticsearch-certutil ca`, the default value can be overridden by passing
the `--keysage` option, e.g.
```
elasticsearch-certutil ca --keyusage "digitalSignature,keyCertSign,cRLSign" -pem
```

Fixes elastic#117769

(cherry picked from commit 284121a)

# Conflicts:
#	docs/reference/elasticsearch/command-line-tools/certutil.md

* fix compilation error

* [CI] Auto commit changes from spotless

* fix failing test

---------

Co-authored-by: elasticsearchmachine <[email protected]>
elasticsearchmachine added a commit that referenced this pull request Apr 8, 2025
…26376) (#126448) (#126454)

* Set `keyUsage` for generated HTTP certificates and self-signed CA (#126376)

The `elasticsearch-certutil http` command, and security auto-configuration,
generate the HTTP certificate and CA without setting the `keyUsage` extension.

This PR fixes this by setting (by default):
- `keyCertSign` and `cRLSign` for self-signed CAs
- `digitalSignature` and `keyEncipherment` for HTTP certificates and CSRs

These defaults can be overridden when running `elasticsearch-certutil http`
command. The user will be prompted to change them as they wish.

For `elasticsearch-certutil ca`, the default value can be overridden by passing
the `--keysage` option, e.g.
```
elasticsearch-certutil ca --keyusage "digitalSignature,keyCertSign,cRLSign" -pem
```

Fixes #117769

(cherry picked from commit 284121a)

# Conflicts:
#	docs/reference/elasticsearch/command-line-tools/certutil.md

* fix compilation error

* [CI] Auto commit changes from spotless

* fix failing test

---------

Co-authored-by: elasticsearchmachine <[email protected]>
elasticsearchmachine added a commit that referenced this pull request Apr 8, 2025
…26376) (#126448) (#126453)

* Set `keyUsage` for generated HTTP certificates and self-signed CA (#126376)

The `elasticsearch-certutil http` command, and security auto-configuration,
generate the HTTP certificate and CA without setting the `keyUsage` extension.

This PR fixes this by setting (by default):
- `keyCertSign` and `cRLSign` for self-signed CAs
- `digitalSignature` and `keyEncipherment` for HTTP certificates and CSRs

These defaults can be overridden when running `elasticsearch-certutil http`
command. The user will be prompted to change them as they wish.

For `elasticsearch-certutil ca`, the default value can be overridden by passing
the `--keysage` option, e.g.
```
elasticsearch-certutil ca --keyusage "digitalSignature,keyCertSign,cRLSign" -pem
```

Fixes #117769

(cherry picked from commit 284121a)

# Conflicts:
#	docs/reference/elasticsearch/command-line-tools/certutil.md

* fix compilation error

* [CI] Auto commit changes from spotless

* fix failing test

---------

Co-authored-by: elasticsearchmachine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport >bug :Security/TLS SSL/TLS, Certificates Team:Security Meta label for security team v8.17.5 v8.18.1 v8.19.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants