Skip to content

Issue 6349 - RFE - Use previously extracted key path #6363

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
merged 1 commit into from
Oct 18, 2024

Conversation

Firstyear
Copy link
Contributor

@Firstyear Firstyear commented Oct 16, 2024

Bug Description: slapd_SSL_client_auth uses the values of KeyExtractFile and CertExtractFile from the configuration entry, and each time it's called attempts to determine if this is an absolute or relative path. If the path is relative, it prepends a /tmp location based on if the running system /tmp is a private namespace or not. This causes a replication client that uses TLS certificate authentication to repeatedly emit warnings that the key extraction occurred to non-private tmp in a
container.

Fix Description: During key extraction, we extract keys and files using the "last token" from nss as the item that we extract. Because of this, we know that there can only be a single extracted key and cert, allowing us to extract these and store the full abs path of the extracted files rather than deriving them during each client iteration.

fixes: #6340

Author: William Brown william@blackhats.net.au

Review by: ???

@Firstyear Firstyear requested a review from tbordaz October 16, 2024 07:39
@Firstyear
Copy link
Contributor Author

Tested with suites/replication/tls_client_auth_repl_test.py and suites/basic

@progier389
Copy link
Contributor

Looks good except a minor point:
I wonder if we should not have some cleanup code to free key_extract_file and cert_extract_file called during shutdown (to avoid polluting libasan reports 😉)

Copy link
Contributor

@tbordaz tbordaz left a comment

Choose a reason for hiding this comment

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

The change looks good except a doubt of a small memory leak.
If the concern was about the verbose warning in check_private_certdir you can also log it once, making the change smaller.
So your fix is to avoid those annoying logs and cleanup the code. Correct ?

@Firstyear Firstyear force-pushed the 6340-20241016-cert-warning branch from c12d295 to 972775c Compare October 17, 2024 00:26
@Firstyear
Copy link
Contributor Author

Good catch @tbordaz I have fixed both.

@Firstyear
Copy link
Contributor Author

Firstyear commented Oct 17, 2024

Looks good except a minor point: I wonder if we should not have some cleanup code to free key_extract_file and cert_extract_file called during shutdown (to avoid polluting libasan reports 😉)

We don't seem to have a shutdown call that I can use (unless I'm silly and couldn't see it).

EDIT: We don't have one, so I added one.

@Firstyear Firstyear force-pushed the 6340-20241016-cert-warning branch from 972775c to 9713792 Compare October 17, 2024 00:46
Bug Description: slapd_SSL_client_auth uses the values of
KeyExtractFile and CertExtractFile from the configuration
entry, and each time it's called attempts to determine if
this is an absolute or relative path. If the path is
relative, it prepends a /tmp location based on if the
running system /tmp is a private namespace or not. This
causes a replication client that uses TLS certificate
authentication to repeatedly emit warnings that the
key extraction occurred to non-private tmp in a
container.

Fix Description: During key extraction, we extract
keys and files using the "last token" from nss as the
item that we extract. Because of this, we know that there
can only be a single extracted key and cert, allowing
us to extract these and store the full abs path of
the extracted files rather than deriving them during
each client iteration.

fixes: 389ds#6349

Author: William Brown <william@blackhats.net.au>

Review by: ???
@Firstyear Firstyear force-pushed the 6340-20241016-cert-warning branch from 9713792 to 9c77e0e Compare October 17, 2024 00:57
Copy link
Member

@droideck droideck left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@progier389 progier389 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@tbordaz tbordaz left a comment

Choose a reason for hiding this comment

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

LGTM as well

@Firstyear Firstyear merged commit b1b4356 into 389ds:main Oct 18, 2024
197 checks passed
Firstyear added a commit that referenced this pull request Oct 18, 2024
Bug Description: slapd_SSL_client_auth uses the values of
KeyExtractFile and CertExtractFile from the configuration
entry, and each time it's called attempts to determine if
this is an absolute or relative path. If the path is
relative, it prepends a /tmp location based on if the
running system /tmp is a private namespace or not. This
causes a replication client that uses TLS certificate
authentication to repeatedly emit warnings that the
key extraction occurred to non-private tmp in a
container.

Fix Description: During key extraction, we extract
keys and files using the "last token" from nss as the
item that we extract. Because of this, we know that there
can only be a single extracted key and cert, allowing
us to extract these and store the full abs path of
the extracted files rather than deriving them during
each client iteration.

fixes: #6349

Author: William Brown <william@blackhats.net.au>

Review by: @tbordaz @progier389 @droideck (Thanks!)
Firstyear added a commit that referenced this pull request Oct 18, 2024
Bug Description: slapd_SSL_client_auth uses the values of
KeyExtractFile and CertExtractFile from the configuration
entry, and each time it's called attempts to determine if
this is an absolute or relative path. If the path is
relative, it prepends a /tmp location based on if the
running system /tmp is a private namespace or not. This
causes a replication client that uses TLS certificate
authentication to repeatedly emit warnings that the
key extraction occurred to non-private tmp in a
container.

Fix Description: During key extraction, we extract
keys and files using the "last token" from nss as the
item that we extract. Because of this, we know that there
can only be a single extracted key and cert, allowing
us to extract these and store the full abs path of
the extracted files rather than deriving them during
each client iteration.

fixes: #6349

Author: William Brown <william@blackhats.net.au>

Review by: @tbordaz @progier389 @droideck (Thanks!)
Firstyear added a commit that referenced this pull request Oct 18, 2024
Bug Description: slapd_SSL_client_auth uses the values of
KeyExtractFile and CertExtractFile from the configuration
entry, and each time it's called attempts to determine if
this is an absolute or relative path. If the path is
relative, it prepends a /tmp location based on if the
running system /tmp is a private namespace or not. This
causes a replication client that uses TLS certificate
authentication to repeatedly emit warnings that the
key extraction occurred to non-private tmp in a
container.

Fix Description: During key extraction, we extract
keys and files using the "last token" from nss as the
item that we extract. Because of this, we know that there
can only be a single extracted key and cert, allowing
us to extract these and store the full abs path of
the extracted files rather than deriving them during
each client iteration.

fixes: #6349

Author: William Brown <william@blackhats.net.au>

Review by: @tbordaz @progier389 @droideck (Thanks!)
Firstyear added a commit that referenced this pull request Oct 18, 2024
Bug Description: slapd_SSL_client_auth uses the values of
KeyExtractFile and CertExtractFile from the configuration
entry, and each time it's called attempts to determine if
this is an absolute or relative path. If the path is
relative, it prepends a /tmp location based on if the
running system /tmp is a private namespace or not. This
causes a replication client that uses TLS certificate
authentication to repeatedly emit warnings that the
key extraction occurred to non-private tmp in a
container.

Fix Description: During key extraction, we extract
keys and files using the "last token" from nss as the
item that we extract. Because of this, we know that there
can only be a single extracted key and cert, allowing
us to extract these and store the full abs path of
the extracted files rather than deriving them during
each client iteration.

fixes: #6349

Author: William Brown <william@blackhats.net.au>

Review by: @tbordaz @progier389 @droideck (Thanks!)
Firstyear added a commit that referenced this pull request Oct 18, 2024
Bug Description: slapd_SSL_client_auth uses the values of
KeyExtractFile and CertExtractFile from the configuration
entry, and each time it's called attempts to determine if
this is an absolute or relative path. If the path is
relative, it prepends a /tmp location based on if the
running system /tmp is a private namespace or not. This
causes a replication client that uses TLS certificate
authentication to repeatedly emit warnings that the
key extraction occurred to non-private tmp in a
container.

Fix Description: During key extraction, we extract
keys and files using the "last token" from nss as the
item that we extract. Because of this, we know that there
can only be a single extracted key and cert, allowing
us to extract these and store the full abs path of
the extracted files rather than deriving them during
each client iteration.

fixes: #6349

Author: William Brown <william@blackhats.net.au>

Review by: @tbordaz @progier389 @droideck (Thanks!)
Firstyear added a commit that referenced this pull request Oct 18, 2024
Bug Description: slapd_SSL_client_auth uses the values of
KeyExtractFile and CertExtractFile from the configuration
entry, and each time it's called attempts to determine if
this is an absolute or relative path. If the path is
relative, it prepends a /tmp location based on if the
running system /tmp is a private namespace or not. This
causes a replication client that uses TLS certificate
authentication to repeatedly emit warnings that the
key extraction occurred to non-private tmp in a
container.

Fix Description: During key extraction, we extract
keys and files using the "last token" from nss as the
item that we extract. Because of this, we know that there
can only be a single extracted key and cert, allowing
us to extract these and store the full abs path of
the extracted files rather than deriving them during
each client iteration.

fixes: #6349

Author: William Brown <william@blackhats.net.au>

Review by: @tbordaz @progier389 @droideck (Thanks!)
Firstyear added a commit that referenced this pull request Oct 18, 2024
Bug Description: slapd_SSL_client_auth uses the values of
KeyExtractFile and CertExtractFile from the configuration
entry, and each time it's called attempts to determine if
this is an absolute or relative path. If the path is
relative, it prepends a /tmp location based on if the
running system /tmp is a private namespace or not. This
causes a replication client that uses TLS certificate
authentication to repeatedly emit warnings that the
key extraction occurred to non-private tmp in a
container.

Fix Description: During key extraction, we extract
keys and files using the "last token" from nss as the
item that we extract. Because of this, we know that there
can only be a single extracted key and cert, allowing
us to extract these and store the full abs path of
the extracted files rather than deriving them during
each client iteration.

fixes: #6349

Author: William Brown <william@blackhats.net.au>

Review by: @tbordaz @progier389 @droideck (Thanks!)
@Firstyear
Copy link
Contributor Author

   6fa06a719..aaf38ee7e  389-ds-base-3.0 -> 389-ds-base-3.0
   74f2f25a4..8aa9e3423  389-ds-base-2.5 -> 389-ds-base-2.5
   7715ff141..8d82ebf06  389-ds-base-2.4 -> 389-ds-base-2.4
   545947493..b6b0db91d  389-ds-base-2.3 -> 389-ds-base-2.3
   62c77454f..20ce92890  389-ds-base-2.2 -> 389-ds-base-2.2
   f6563c36b..b8a017bf3  389-ds-base-2.1 -> 389-ds-base-2.1
   9f45be601..49d3c04b9  389-ds-base-2.0 -> 389-ds-base-2.0

@Firstyear Firstyear deleted the 6340-20241016-cert-warning branch October 18, 2024 01:36
Firstyear added a commit to Firstyear/389-ds-base that referenced this pull request Nov 6, 2024
Bug Description: Keys/Certs are extracted to PEM
repeatedly causing many warnings during outbound TLS
authenticated replication

Fix Description: slapd_ssl_init() is called every time
an outbound TLS connection is made, and will trigger
a key extraction. If key extraction is already complete
then the extraction is skipped.

fixes: 389ds#6349

Author: William Brown <william@blackhats.net.au>

Review by: ???
Firstyear added a commit that referenced this pull request Nov 7, 2024
Bug Description: Keys/Certs are extracted to PEM
repeatedly causing many warnings during outbound TLS
authenticated replication

Fix Description: slapd_ssl_init() is called every time
an outbound TLS connection is made, and will trigger
a key extraction. If key extraction is already complete
then the extraction is skipped.

fixes: #6349

Author: William Brown <william@blackhats.net.au>

Review by: @progier389 @tbordaz
Firstyear added a commit that referenced this pull request Nov 7, 2024
Bug Description: Keys/Certs are extracted to PEM
repeatedly causing many warnings during outbound TLS
authenticated replication

Fix Description: slapd_ssl_init() is called every time
an outbound TLS connection is made, and will trigger
a key extraction. If key extraction is already complete
then the extraction is skipped.

fixes: #6349

Author: William Brown <william@blackhats.net.au>

Review by: @progier389 @tbordaz
Firstyear added a commit that referenced this pull request Nov 7, 2024
Bug Description: Keys/Certs are extracted to PEM
repeatedly causing many warnings during outbound TLS
authenticated replication

Fix Description: slapd_ssl_init() is called every time
an outbound TLS connection is made, and will trigger
a key extraction. If key extraction is already complete
then the extraction is skipped.

fixes: #6349

Author: William Brown <william@blackhats.net.au>

Review by: @progier389 @tbordaz
Firstyear added a commit that referenced this pull request Nov 7, 2024
Bug Description: Keys/Certs are extracted to PEM
repeatedly causing many warnings during outbound TLS
authenticated replication

Fix Description: slapd_ssl_init() is called every time
an outbound TLS connection is made, and will trigger
a key extraction. If key extraction is already complete
then the extraction is skipped.

fixes: #6349

Author: William Brown <william@blackhats.net.au>

Review by: @progier389 @tbordaz
Firstyear added a commit that referenced this pull request Nov 7, 2024
Bug Description: Keys/Certs are extracted to PEM
repeatedly causing many warnings during outbound TLS
authenticated replication

Fix Description: slapd_ssl_init() is called every time
an outbound TLS connection is made, and will trigger
a key extraction. If key extraction is already complete
then the extraction is skipped.

fixes: #6349

Author: William Brown <william@blackhats.net.au>

Review by: @progier389 @tbordaz
Firstyear added a commit that referenced this pull request Nov 7, 2024
Bug Description: Keys/Certs are extracted to PEM
repeatedly causing many warnings during outbound TLS
authenticated replication

Fix Description: slapd_ssl_init() is called every time
an outbound TLS connection is made, and will trigger
a key extraction. If key extraction is already complete
then the extraction is skipped.

fixes: #6349

Author: William Brown <william@blackhats.net.au>

Review by: @progier389 @tbordaz
Firstyear added a commit to Firstyear/389-ds-base that referenced this pull request Nov 21, 2024
Bug Description: Keys/Certs are extracted to PEM
repeatedly causing many warnings during outbound TLS
authenticated replication

Fix Description: After more testing, if the connection is
dropped and restarted, the certpath is retrieved but
re-extraction does not occur. This still triggers the
warning however. To resolve this, we only warn about
the tpm namespace during library initialisation.

I really hope I got it right this time :(

fixes: 389ds#6349

Author: William Brown <william@blackhats.net.au>

Review by: ???
Firstyear added a commit that referenced this pull request Nov 29, 2024
Bug Description: Keys/Certs are extracted to PEM
repeatedly causing many warnings during outbound TLS
authenticated replication

Fix Description: slapd_ssl_init() is called every time
an outbound TLS connection is made, and will trigger
a key extraction. If key extraction is already complete
then the extraction is skipped.

fixes: #6349

Author: William Brown <william@blackhats.net.au>

Review by: @progier389 @tbordaz
Firstyear added a commit that referenced this pull request Nov 29, 2024
Bug Description: Keys/Certs are extracted to PEM
repeatedly causing many warnings during outbound TLS
authenticated replication

Fix Description: slapd_ssl_init() is called every time
an outbound TLS connection is made, and will trigger
a key extraction. If key extraction is already complete
then the extraction is skipped.

fixes: #6349

Author: William Brown <william@blackhats.net.au>

Review by: @progier389 @tbordaz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

excessive log warnings during certificate extraction
4 participants