Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include nodename in the host certificate. #1787

Merged
merged 1 commit into from
Mar 17, 2018
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
10 changes: 9 additions & 1 deletion lib/auth/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,15 @@ func ReadIdentity(dataDir string, id IdentityID) (i *Identity, err error) {
}
}

return ReadIdentityFromKeyPair(keyBytes, sshCertBytes, tlsCertBytes, tlsCACertBytes)
identity, err := ReadIdentityFromKeyPair(keyBytes, sshCertBytes, tlsCertBytes, tlsCACertBytes)
if err != nil {
return nil, trace.Wrap(err)
}

// Inject nodename back into identity read from disk.
identity.ID.NodeName = id.NodeName

return identity, nil
}

// WriteIdentity writes identity keypair to disk
Expand Down
12 changes: 10 additions & 2 deletions lib/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,11 @@ func (process *TeleportProcess) readIdentity(role teleport.Role) (*auth.Identity
process.Lock()
defer process.Unlock()

id := auth.IdentityID{HostUUID: process.Config.HostUUID, Role: role}
id := auth.IdentityID{
Role: role,
HostUUID: process.Config.HostUUID,
NodeName: process.Config.Hostname,
}
identity, err := auth.ReadIdentity(process.Config.DataDir, id)
if err != nil {
return nil, trace.Wrap(err)
Expand All @@ -219,7 +223,11 @@ func (process *TeleportProcess) GetIdentity(role teleport.Role) (i *auth.Identit
return i, nil
}

id := auth.IdentityID{HostUUID: process.Config.HostUUID, Role: role}
id := auth.IdentityID{
Role: role,
HostUUID: process.Config.HostUUID,
NodeName: process.Config.Hostname,
}
i, err = auth.ReadIdentity(process.Config.DataDir, id)
if err != nil {
if trace.IsNotFound(err) {
Expand Down