Skip to content
This repository has been archived by the owner on Jul 15, 2019. It is now read-only.

lookup.go: check realm name. For a unused case, this is a [security fix] #34

Merged
merged 1 commit into from
Dec 15, 2015
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
3 changes: 2 additions & 1 deletion keyserver/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ func setupKeyservers(t *testing.T, nReplicas int) (
replicaIDs := []uint64{}
pol := &proto.AuthorizationPolicy{}
realmConfig := &proto.RealmConfig{
RealmName: testingRealm,
Domains: []string{realmDomain},
VRFPublic: vrfPublic,
VerificationPolicy: pol,
Expand Down Expand Up @@ -408,7 +409,7 @@ func doUpdate(
Candidates: []uint64{},
Subexpressions: []*proto.QuorumExpr{},
},
}},
}},
ProfileCommitment: commitment[:],
},
}
Expand Down
4 changes: 4 additions & 0 deletions lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ func VerifyConsensus(rcg *proto.RealmConfig, ratifications []*proto.SignedEpochH
return nil, fmt.Errorf("VerifyConsensus: epoch heads don't match: %x vs %x", want, got)
}
}
// check that the seh corresponds to the realm in question
if got := ratifications[0].Head.Head.Realm; got != rcg.RealmName {
return nil, fmt.Errorf("VerifyConsensus: SEH does not match realm: %q != %q", got, rcg.RealmName)
}
// check that the seh is not expired
if t := ratifications[0].Head.Head.IssueTime.Time().Add(rcg.EpochTimeToLive.Duration()); now.After(t) {
return nil, fmt.Errorf("VerifyConsensus: epoch expired at %v < %v", t, now)
Expand Down
99 changes: 75 additions & 24 deletions proto/config.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 11 additions & 8 deletions proto/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,36 @@ message Config {
}

message RealmConfig {
// RealmName is the canonical name of the realm. It is signed by the
// verifiers as a part of the epoch head.
string RealmName = 1;
// Domains specifies a list of domains that belong to this realm.
// Configuring one domain to belong to multiple realms is considered an
// error.
// TODO: support TLS-style wildcards.
repeated string domains = 1;
repeated string domains = 2;
// Addr is the TCP (host:port) address of the keyserver GRPC interface.
string addr = 2;
string addr = 3;
// URL is the location of the secondary, HTTP-based interface to the
// keyserver. It is not necessarily on the same host as addr.
string URL = 3;
string URL = 4;
// VRFPublic is the public key of the verifiable random function used for
// user id privacy. Here it is used to check that the anti-spam obfuscation
// layer is properly used as a one-to-one mapping between real and
// obfuscated usernames.
bytes VRFPublic = 4;
bytes VRFPublic = 5;
// VerificationPolicy specifies the conditions on how a lookup must be
// verified for it to be accepted. Each verifier in VerificationPolicy MUST
// have a NoOlderThan entry.
AuthorizationPolicy verification_policy = 5;
AuthorizationPolicy verification_policy = 6;

// EpochTimeToLive specifies the duration for which an epoch is valid after
// it has been issued. A client that has access to a clock MUST NOT accept
// epoch heads with IssueTime more than EpochTimeToLive in the past.
Duration epoch_time_to_live = 6 [(gogoproto.nullable) = false];
Duration epoch_time_to_live = 7 [(gogoproto.nullable) = false];

// TreeNonce is the global nonce that is hashed into the Merkle tree nodes.
bytes tree_nonce = 7;
bytes tree_nonce = 8;

TLSConfig client_tls = 8 [(gogoproto.customname) = "ClientTLS"];
TLSConfig client_tls = 9 [(gogoproto.customname) = "ClientTLS"];
}