Skip to content

Commit

Permalink
Fix bug causing webroot path in legacy config file not to be used
Browse files Browse the repository at this point in the history
This bug was caused by loading the legacy configuration file after
the targets were loaded, but default configuration is copied over
to the targets when the targets are loaded, so the configured
webroots were never used.

A workaround is to move the webroot paths to the conf/target file,
the now-preferred location for them. This fixes this bug, making
the workaround no longer necessary.

Fixes #85.
  • Loading branch information
hlandau committed Jan 25, 2016
1 parent 7de5c8e commit 2ebbb89
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion responder/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,12 @@ L:

// Tries to write a challenge file to each of the directories.
func webrootWriteChallenge(webroots map[string]struct{}, token string, ka []byte) {
log.Debug("writing webroot challenge files")
log.Debugf("writing %d webroot challenge files", len(webroots))

for wr := range webroots {
os.MkdirAll(wr, 0755) // ignore errors
fn := filepath.Join(wr, token)
log.Debugf("writing webroot file %s", fn)

// Because /var/run/acme/acme-challenge may not exist due to /var/run
// possibly being a tmpfs, and because that tmpfs is likely to be world
Expand Down
14 changes: 7 additions & 7 deletions storage/storage-fdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,6 @@ func (s *fdbStore) Reload() error {
return err
}

// Legacy support
s.loadWebrootPaths()
s.loadRSAKeySize()

return nil
}

Expand Down Expand Up @@ -494,14 +490,18 @@ func (s *fdbStore) loadTargets() error {

dtgt, err := s.validateTargetInner("target", confc, true)
if err == nil {
dtgt.Satisfy.Names = nil
dtgt.Satisfy.ReducedNames = nil
dtgt.Request.Names = nil
dtgt.genericise()
s.defaultTarget = dtgt
} else {
log.Errore(err, "error loading default target file")
s.defaultTarget = &Target{}
}

// Legacy support. We have to do this here so that these defaults get copied
// across to the targets.
s.loadWebrootPaths()
s.loadRSAKeySize()

// targets
c := s.db.Collection("desired")

Expand Down

0 comments on commit 2ebbb89

Please sign in to comment.