Skip to content

Commit

Permalink
recover back AuthIdentityEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
klizhentas committed Jun 8, 2016
1 parent 0676993 commit 2773a68
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion lib/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ const (
// TeleportExitEvent is generated when someone is askign Teleport Process to close
// all listening sockets and exit
TeleportExitEvent = "TeleportExit"
// AuthIdentityEvent is generated when auth's identity has been initialized
AuthIdentityEvent = "AuthIdentity"
)

// RoleConfig is a configuration for a server role (either proxy or node)
Expand Down Expand Up @@ -346,7 +348,25 @@ func (process *TeleportProcess) initAuthService(authority auth.Authority) error

// Heart beat auth server presence, this is not the best place for this
// logic, consolidate it into auth package later
var authClient *auth.TunClient
storage := utils.NewFileAddrStorage(
filepath.Join(process.Config.DataDir, "authservers.json"))

authUser := identity.Cert.ValidPrincipals[0]
authClient, err := auth.NewTunClient(
string(teleport.RoleAuth),
process.Config.AuthServers,
authUser,
[]ssh.AuthMethod{ssh.PublicKeys(identity.KeySigner)},
auth.TunClientStorage(storage),
)
// success?
if err != nil {
return trace.Wrap(err)
}
process.BroadcastEvent(Event{Name: AuthIdentityEvent, Payload: &Connector{
Identity: identity,
Client: authClient,
}})
process.RegisterFunc(func() error {
srv := services.Server{
ID: process.Config.HostUUID,
Expand Down

0 comments on commit 2773a68

Please sign in to comment.