Skip to content

Commit 4055654

Browse files
committed
Merge branch 'v1.7' into master
2 parents 00728e7 + 56488d4 commit 4055654

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+2679
-844
lines changed

CHANGELOG.md

+18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Change Log
22

3+
## [v1.6.6](https://github.com/containous/traefik/tree/v1.6.6) (2018-08-20)
4+
[All Commits](https://github.com/containous/traefik/compare/v1.6.5...v1.6.6)
5+
6+
**Bug fixes:**
7+
- **[acme]** Avoid duplicated ACME resolution ([#3751](https://github.com/containous/traefik/pull/3751) by [nmengin](https://github.com/nmengin))
8+
- **[api]** Remove TLS in API ([#3788](https://github.com/containous/traefik/pull/3788) by [Juliens](https://github.com/Juliens))
9+
- **[cluster]** Remove unusable `--cluster` flag ([#3616](https://github.com/containous/traefik/pull/3616) by [dtomcej](https://github.com/dtomcej))
10+
- **[ecs]** Fix bad condition in ECS provider ([#3609](https://github.com/containous/traefik/pull/3609) by [mmatur](https://github.com/mmatur))
11+
- Set keepalive on TCP socket so idleTimeout works ([#3740](https://github.com/containous/traefik/pull/3740) by [ajardan](https://github.com/ajardan))
12+
13+
**Documentation:**
14+
- A tiny rewording on the documentation API's page ([#3794](https://github.com/containous/traefik/pull/3794) by [dduportal](https://github.com/dduportal))
15+
- Adding warnings and solution about the configuration exposure ([#3790](https://github.com/containous/traefik/pull/3790) by [dduportal](https://github.com/dduportal))
16+
- Fix path to the debug pprof API ([#3608](https://github.com/containous/traefik/pull/3608) by [multani](https://github.com/multani))
17+
18+
**Misc:**
19+
- **[oxy,websocket]** Update oxy dependency ([#3777](https://github.com/containous/traefik/pull/3777) by [Juliens](https://github.com/Juliens))
20+
321
## [v1.7.0-rc3](https://github.com/containous/traefik/tree/v1.7.0-rc3) (2018-08-01)
422
[All Commits](https://github.com/containous/traefik/compare/v1.7.0-rc2...v1.7.0-rc3)
523

Gopkg.lock

+3-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
[![](https://images.microbadger.com/badges/image/traefik.svg)](https://microbadger.com/images/traefik)
1010
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/containous/traefik/blob/master/LICENSE.md)
1111
[![Join the chat at https://slack.traefik.io](https://img.shields.io/badge/style-register-green.svg?style=social&label=Slack)](https://slack.traefik.io)
12-
[![Twitter](https://img.shields.io/twitter/follow/traefikproxy.svg?style=social)](https://twitter.com/intent/follow?screen_name=traefikproxy)
12+
[![Twitter](https://img.shields.io/twitter/follow/traefik.svg?style=social)](https://twitter.com/intent/follow?screen_name=traefik)
1313

1414

1515
Træfik is a modern HTTP reverse proxy and load balancer that makes deploying microservices easy.
@@ -164,12 +164,10 @@ Each version is supported until the next one is released (e.g. 1.1.x will be sup
164164

165165
We use [Semantic Versioning](http://semver.org/)
166166

167-
## Plumbing
167+
## Mailing lists
168168

169-
- [Oxy](https://github.com/vulcand/oxy): an awesome proxy library made by Mailgun folks
170-
- [Gorilla mux](https://github.com/gorilla/mux): famous request router
171-
- [Negroni](https://github.com/urfave/negroni): web middlewares made simple
172-
- [Lego](https://github.com/xenolf/lego): the best [Let's Encrypt](https://letsencrypt.org) library in go
169+
- General announcements, new releases: mail at news+subscribe@traefik.io or on [the online viewer](https://groups.google.com/a/traefik.io/forum/#!forum/news)
170+
- Security announcements: mail at security+subscribe@traefik.io or on [the online viewer](https://groups.google.com/a/traefik.io/forum/#!forum/security).
173171

174172
## Credits
175173

acme/acme.go

+42
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"net/url"
1313
"reflect"
1414
"strings"
15+
"sync"
1516
"time"
1617

1718
"github.com/BurntSushi/ty/fun"
@@ -64,6 +65,8 @@ type ACME struct {
6465
jobs *channels.InfiniteChannel
6566
TLSConfig *tls.Config `description:"TLS config in case wildcard certs are used"`
6667
dynamicCerts *safe.Safe
68+
resolvingDomains map[string]struct{}
69+
resolvingDomainsMutex sync.RWMutex
6770
}
6871

6972
func (a *ACME) init() error {
@@ -76,6 +79,10 @@ func (a *ACME) init() error {
7679
}
7780

7881
a.jobs = channels.NewInfiniteChannel()
82+
83+
// Init the currently resolved domain map
84+
a.resolvingDomains = make(map[string]struct{})
85+
7986
return nil
8087
}
8188

@@ -202,6 +209,9 @@ func (a *ACME) leadershipListener(elected bool) error {
202209
}
203210

204211
needRegister = true
212+
} else if len(account.KeyType) == 0 {
213+
// Set the KeyType if not already defined in the account
214+
account.KeyType = acmeprovider.GetKeyType(a.KeyType)
205215
}
206216

207217
a.client, err = a.buildACMEClient(account)
@@ -534,6 +544,10 @@ func (a *ACME) LoadCertificateForDomains(domains []string) {
534544
if len(uncheckedDomains) == 0 {
535545
return
536546
}
547+
548+
a.addResolvingDomains(uncheckedDomains)
549+
defer a.removeResolvingDomains(uncheckedDomains)
550+
537551
certificate, err := a.getDomainsCertificates(uncheckedDomains)
538552
if err != nil {
539553
log.Errorf("Error getting ACME certificates %+v : %v", uncheckedDomains, err)
@@ -565,6 +579,24 @@ func (a *ACME) LoadCertificateForDomains(domains []string) {
565579
}
566580
}
567581

582+
func (a *ACME) addResolvingDomains(resolvingDomains []string) {
583+
a.resolvingDomainsMutex.Lock()
584+
defer a.resolvingDomainsMutex.Unlock()
585+
586+
for _, domain := range resolvingDomains {
587+
a.resolvingDomains[domain] = struct{}{}
588+
}
589+
}
590+
591+
func (a *ACME) removeResolvingDomains(resolvingDomains []string) {
592+
a.resolvingDomainsMutex.Lock()
593+
defer a.resolvingDomainsMutex.Unlock()
594+
595+
for _, domain := range resolvingDomains {
596+
delete(a.resolvingDomains, domain)
597+
}
598+
}
599+
568600
// Get provided certificate which check a domains list (Main and SANs)
569601
// from static and dynamic provided certificates
570602
func (a *ACME) getProvidedCertificate(domains string) *tls.Certificate {
@@ -600,6 +632,9 @@ func searchProvidedCertificateForDomains(domain string, certs map[string]*tls.Ce
600632
// Get provided certificate which check a domains list (Main and SANs)
601633
// from static and dynamic provided certificates
602634
func (a *ACME) getUncheckedDomains(domains []string, account *Account) []string {
635+
a.resolvingDomainsMutex.RLock()
636+
defer a.resolvingDomainsMutex.RUnlock()
637+
603638
log.Debugf("Looking for provided certificate to validate %s...", domains)
604639
allCerts := make(map[string]*tls.Certificate)
605640

@@ -622,6 +657,13 @@ func (a *ACME) getUncheckedDomains(domains []string, account *Account) []string
622657
}
623658
}
624659

660+
// Get currently resolved domains
661+
for domain := range a.resolvingDomains {
662+
if _, ok := allCerts[domain]; !ok {
663+
allCerts[domain] = &tls.Certificate{}
664+
}
665+
}
666+
625667
// Get Configuration Domains
626668
for i := 0; i < len(a.Domains); i++ {
627669
allCerts[a.Domains[i].Main] = &tls.Certificate{}

acme/acme_test.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,12 @@ func TestAcme_getUncheckedCertificates(t *testing.T) {
331331
mm["*.containo.us"] = &tls.Certificate{}
332332
mm["traefik.acme.io"] = &tls.Certificate{}
333333

334-
a := ACME{TLSConfig: &tls.Config{NameToCertificate: mm}}
334+
dm := make(map[string]struct{})
335+
dm["*.traefik.wtf"] = struct{}{}
336+
337+
a := ACME{TLSConfig: &tls.Config{NameToCertificate: mm}, resolvingDomains: dm}
335338

336-
domains := []string{"traefik.containo.us", "trae.containo.us"}
339+
domains := []string{"traefik.containo.us", "trae.containo.us", "foo.traefik.wtf"}
337340
uncheckedDomains := a.getUncheckedDomains(domains, nil)
338341
assert.Empty(t, uncheckedDomains)
339342
domains = []string{"traefik.acme.io", "trae.acme.io"}
@@ -351,6 +354,9 @@ func TestAcme_getUncheckedCertificates(t *testing.T) {
351354
account := Account{DomainsCertificate: domainsCertificates}
352355
uncheckedDomains = a.getUncheckedDomains(domains, &account)
353356
assert.Empty(t, uncheckedDomains)
357+
domains = []string{"traefik.containo.us", "trae.containo.us", "traefik.wtf"}
358+
uncheckedDomains = a.getUncheckedDomains(domains, nil)
359+
assert.Len(t, uncheckedDomains, 1)
354360
}
355361

356362
func TestAcme_getProvidedCertificate(t *testing.T) {

0 commit comments

Comments
 (0)