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

DecisionFunc and certificate clean up #258

Closed
RonniSkansing opened this issue Nov 11, 2023 · 2 comments
Closed

DecisionFunc and certificate clean up #258

RonniSkansing opened this issue Nov 11, 2023 · 2 comments
Labels
question Further information is requested

Comments

@RonniSkansing
Copy link

What is your question?

When using the certmagic.OnDemandConfig does certmagic automatically clean up
certificate storage, when a domain is no longer allowed?

Example:

certmagic.Default.OnDemand = &certmagic.OnDemandConfig{
	DecisionFunc: func(name string) error {
            // check in DB if name should have managed TLS
            isAllowed := check(name)
            if !isAllowed {
              // will a previously allowed domain be cleaned up when it changes 
              // from allowed to not allowed?
              return fmt.Errorf("Not allowed: %s", name)
            }
            return nil
	},
}

Also, I am assuming caching does so the DecisionFunc is not call everytime when a name has been allowed.
So when a domain goes from being allowed to not allowed, is there a function or logic that must be followed
to bust the cache for that name, should I manually revoke and/or delete the certificate files?

What have you already tried?

I tried looking into the source files, but been unable to conclude the exact behavior or how it is handled with DecisionFunc

@RonniSkansing RonniSkansing added the question Further information is requested label Nov 11, 2023
@francislavoie
Copy link
Member

The unused cert will stay in storage until it expires, then it will be deleted once expired. So it'll stay in storage for up to 90 days.

@mholt
Copy link
Member

mholt commented Nov 11, 2023

We wait until some time after it expires just in case it's useful to have around for any sort of investigations but yeah, it'll be cleaned up automatically later.

Do NOT revoke certificates unless a private key has been compromised.

@mholt mholt closed this as completed Nov 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants