letsencrypt: Remote duplicate hosts from certificate request

Domain names must be unique in cert bundle request or really bad things happen (like, um, a panic)
This commit is contained in:
Matthew Holt 2015-12-02 12:40:57 -07:00
parent 19c6bbf6a2
commit 9002db2ae0

View file

@ -79,9 +79,19 @@ func Activate(configs []server.Config) ([]server.Config, error) {
}
// little bit of housekeeping; gather the hostnames into a slice
hosts := make([]string, len(cfgIndexes))
for i, idx := range cfgIndexes {
hosts[i] = configs[idx].Host
var hosts []string
for _, idx := range cfgIndexes {
// don't allow duplicates (happens when serving same host on multiple ports!)
var duplicate bool
for _, otherHost := range hosts {
if configs[idx].Host == otherHost {
duplicate = true
break
}
}
if !duplicate {
hosts = append(hosts, configs[idx].Host)
}
}
// client is ready, so let's get free, trusted SSL certificates!