Skip to content
This repository has been archived by the owner on May 2, 2023. It is now read-only.

Don't use cert cache when in an enclave. #36

Merged
merged 2 commits into from
Oct 4, 2022
Merged

Conversation

NullHypothesis
Copy link
Contributor

@NullHypothesis NullHypothesis commented Sep 30, 2022

This PR fixes #35.

Philipp Winter added 2 commits September 30, 2022 08:32
There are several places in the code where we want to know if we're
running inside an enclave or not.  To simplify the code, we only check
once, at package initialization.  Subsequent queries can then refer to a
global variable.
We don't need a certificate cache when we're running inside an enclave
because when the enclave is gone, the certificate cache will be gone as
well.  Besides, the certificate cache makes it more difficult for the
enclave to switch to an unprivileged user before execution because we
now have to deal with the permissions of the cache directory and its
content.

This fixes #35.
Comment on lines -307 to -308
if err = os.MkdirAll(acmeCertCacheDir, 0700); err != nil {
return fmt.Errorf("Failed to create cache directory: %w", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it not still helpful to create the cache directory if necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I noticed that this code is redundant. The cache implementation that we're using creates the directory if it doesn't exist yet.

@rillian rillian merged commit 7fc1b7a into master Oct 4, 2022
@rillian rillian deleted the no-cert-cache-dir branch October 4, 2022 14:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Only use certificate cache outside an enclave
2 participants