diff --git a/Gopkg.lock b/Gopkg.lock index d8810826..d7f7499f 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -62,7 +62,7 @@ branch = "master" name = "github.com/jedisct1/dlog" packages = ["."] - revision = "fcbcc457e6a2b4eab2325a0902fd3d0a7d17e548" + revision = "b53fa44bbfb62dc284a052d828390b21f50d61f9" [[projects]] branch = "master" diff --git a/dnscrypt-proxy/certs.go b/dnscrypt-proxy/certs.go index 42d5213a..793b382a 100644 --- a/dnscrypt-proxy/certs.go +++ b/dnscrypt-proxy/certs.go @@ -71,6 +71,14 @@ func FetchCurrentCert(proxy *Proxy, proto string, pk ed25519.PublicKey, serverAd serial := binary.BigEndian.Uint32(binCert[112:116]) tsBegin := binary.BigEndian.Uint32(binCert[116:120]) tsEnd := binary.BigEndian.Uint32(binCert[120:124]) + if tsBegin >= tsEnd { + dlog.Warnf("[%v] certificate ends before it starts") + continue + } + ttl := tsEnd - tsBegin + if ttl > 86400 { + dlog.Warnf("[%v] the key validity period for this server is excessively long (%d days), significantly reducing reliability and forward security.", providerName, ttl/86400) + } if now > tsEnd || now < tsBegin { dlog.Debugf("[%v] Certificate not valid at the current date", providerName) continue @@ -108,7 +116,7 @@ func FetchCurrentCert(proxy *Proxy, proto string, pk ed25519.PublicKey, serverAd certInfo.CryptoConstruction = cryptoConstruction copy(certInfo.ServerPk[:], serverPk[:]) copy(certInfo.MagicQuery[:], binCert[104:112]) - dlog.Noticef("[%v] Valid cert (crypto version %d) found - rtt: %dms", providerName, cryptoConstruction, rtt.Nanoseconds()/1000000) + dlog.Noticef("[%v] OK (crypto v%d) - rtt: %dms", providerName, cryptoConstruction, rtt.Nanoseconds()/1000000) } if certInfo.CryptoConstruction == UndefinedConstruction { return certInfo, 0, errors.New("No useable certificate found") diff --git a/vendor/github.com/jedisct1/dlog/dlog.go b/vendor/github.com/jedisct1/dlog/dlog.go index 656ecf7d..744b8009 100644 --- a/vendor/github.com/jedisct1/dlog/dlog.go +++ b/vendor/github.com/jedisct1/dlog/dlog.go @@ -187,7 +187,7 @@ func logf(severity Severity, format string, args ...interface{}) { if _globals.syslogger != nil { (*_globals.syslogger).WriteLevel(severityToSyslogPriority[severity], []byte(message)) } else { - line := fmt.Sprintf("[%d-%02d-%02d %02d:%02d:%02d] [%s] [%s] %s\n", year, int(month), day, hour, minute, second, _globals.appName, SeverityName[severity], message) + line := fmt.Sprintf("[%d-%02d-%02d %02d:%02d:%02d] [%s] %s\n", year, int(month), day, hour, minute, second, SeverityName[severity], message) if _globals.outFd != nil { _globals.outFd.WriteString(line) _globals.outFd.Sync()