Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions loglist3/logfilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
package loglist3

import (
"fmt"

"github.com/google/certificate-transparency-go/x509"
"github.com/google/certificate-transparency-go/x509util"
"k8s.io/klog/v2"
)

// LogRoots maps Log-URLs (stated at LogList) to the pools of their accepted
Expand All @@ -26,6 +29,11 @@ type LogRoots map[string]*x509util.PEMCertPool
// Compatible creates a new LogList containing only Logs matching the temporal,
// root-acceptance and Log-status conditions.
func (ll *LogList) Compatible(cert *x509.Certificate, certRoot *x509.Certificate, roots LogRoots) LogList {
logURLs := make([]string, 0, len(roots))
for logURL := range roots {
logURLs = append(logURLs, logURL)
}
klog.V(1).Info(logURLs)
active := ll.TemporallyCompatible(cert)
// Do not check root compatbility if roots are not being provided.
if certRoot == nil {
Expand Down Expand Up @@ -96,6 +104,14 @@ func (ll *LogList) RootCompatible(certRoot *x509.Certificate, roots LogRoots) Lo
compatible.Operators = append(compatible.Operators, &compatibleOp)
}
}
logMessage := "Root compatible operators: \n"
for _, operator := range ll.Operators {
logMessage += fmt.Sprintf("Operator: %s\n", operator.Name)
for _, l := range operator.Logs {
logMessage += fmt.Sprintf("\t%s\n", l.URL)
}
}
klog.V(1).Info(logMessage)
return compatible
}

Expand Down Expand Up @@ -125,5 +141,14 @@ func (ll *LogList) TemporallyCompatible(cert *x509.Certificate) LogList {
compatible.Operators = append(compatible.Operators, &compatibleOp)
}
}
logMessage := "Temporal compatible logs: \n"
for _, operator := range ll.Operators {
logMessage += fmt.Sprintf("Operator: %s\n", operator.Name)
for _, l := range operator.Logs {
logMessage += fmt.Sprintf("\t%s\n", l.URL)
}
}
klog.V(1).Info(logMessage)
return compatible
}

16 changes: 16 additions & 0 deletions submission/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,14 @@ func (d *Distributor) addSomeChain(ctx context.Context, rawChain [][]byte, loadP
if err != nil {
return nil, err
}
logMessage := "Compatible logs: \n"
for _, operator := range compatibleLogs.Operators {
logMessage += fmt.Sprintf("Operator: %s\n", operator.Name)
for _, l := range operator.Logs {
logMessage += fmt.Sprintf("\t%s\n", l.URL)
}
}
klog.V(1).Info(logMessage)

// Distinguish between precerts and certificates.
isPrecert, err := ctfe.IsPrecertificate(parsedChain[0])
Expand Down Expand Up @@ -373,6 +381,14 @@ func NewDistributor(ll *loglist3.LogList, plc ctpolicy.CTPolicy, lcBuilder LogCl
usableStat := []loglist3.LogStatus{loglist3.UsableLogStatus}
active := ll.SelectByStatus(usableStat)
d.usableLl = &active
logMessage := "Usable logs: \n"
for _, operator := range d.usableLl.Operators {
logMessage += fmt.Sprintf("Operator: %s\n", operator.Name)
for _, l := range operator.Logs {
logMessage += fmt.Sprintf("\t%s\n", l.URL)
}
}
klog.Info(logMessage)
pendingQualifiedStat := []loglist3.LogStatus{
loglist3.PendingLogStatus, loglist3.QualifiedLogStatus}
pending := ll.SelectByStatus(pendingQualifiedStat)
Expand Down
Loading