-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate over to certmagic from using autocert (#190)
* Use certmagic for challenge validation * WIP * Get the correct key * Override preflight check logic * Fix logging for imported packages and tidy config.cfg * Fix test and add docstrings * Update README
- Loading branch information
Showing
8 changed files
with
465 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package main | ||
|
||
import "github.com/go-acme/lego/challenge/dns01" | ||
|
||
// ChallengeProvider implements go-acme/lego Provider interface which is used for ACME DNS challenge handling | ||
type ChallengeProvider struct { | ||
servers []*DNSServer | ||
} | ||
|
||
// NewChallengeProvider creates a new instance of ChallengeProvider | ||
func NewChallengeProvider(servers []*DNSServer) ChallengeProvider { | ||
return ChallengeProvider{servers: servers} | ||
} | ||
|
||
// Present is used for making the ACME DNS challenge token available for DNS | ||
func (c *ChallengeProvider) Present(_, _, keyAuth string) error { | ||
_, token := dns01.GetRecord("whatever", keyAuth) | ||
for _, s := range c.servers { | ||
s.PersonalKeyAuth = token | ||
} | ||
return nil | ||
} | ||
|
||
// CleanUp is called after the run to remove the ACME DNS challenge tokens from DNS records | ||
func (c *ChallengeProvider) CleanUp(_, _, _ string) error { | ||
for _, s := range c.servers { | ||
s.PersonalKeyAuth = "" | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.