mirror of
https://github.com/gravitational/teleport
synced 2024-10-21 01:34:01 +00:00
Friendlier error message
When `tctl` is executed on a regular node the error message could be better. With this commit it will say "tctl must be executed on the auth server"
This commit is contained in:
parent
e1413e1f92
commit
6bd1737268
|
@ -148,6 +148,10 @@ func connectToAuthService(cfg *service.Config) (client *auth.TunClient, err erro
|
||||||
// read the host SSH keys and use them to open an SSH connection to the auth service
|
// read the host SSH keys and use them to open an SSH connection to the auth service
|
||||||
i, err := auth.ReadIdentity(cfg.DataDir, auth.IdentityID{Role: teleport.RoleAdmin, HostUUID: cfg.HostUUID})
|
i, err := auth.ReadIdentity(cfg.DataDir, auth.IdentityID{Role: teleport.RoleAdmin, HostUUID: cfg.HostUUID})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
// the "admin" identity is not present? this means the tctl is running NOT on the auth server.
|
||||||
|
if trace.IsNotFound(err) {
|
||||||
|
return nil, trace.AccessDenied("tctl must be used on the auth server")
|
||||||
|
}
|
||||||
return nil, trace.Wrap(err)
|
return nil, trace.Wrap(err)
|
||||||
}
|
}
|
||||||
client, err = auth.NewTunClient(
|
client, err = auth.NewTunClient(
|
||||||
|
|
Loading…
Reference in a new issue