Check credentials when connecting to shim

NewUnixSocketCredentials was actually never invoked before.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
Kenfe-Mickael Laventure 2017-08-10 16:43:18 -07:00
parent 24aac336f3
commit 587a811d09
No known key found for this signature in database
GPG Key ID: 40CF16616B361216
2 changed files with 5 additions and 4 deletions

View File

@ -80,7 +80,7 @@ func main() {
if err != nil {
return err
}
server := grpc.NewServer()
server := newServer()
e, err := connectEvents(context.GlobalString("address"))
if err != nil {
return err
@ -182,9 +182,10 @@ func connect(address string, d func(string, time.Duration) (net.Conn, error)) (*
gopts := []grpc.DialOption{
grpc.WithBlock(),
grpc.WithInsecure(),
grpc.WithTimeout(100 * time.Second),
grpc.WithTimeout(60 * time.Second),
grpc.WithDialer(d),
grpc.FailOnNonTempDialError(true),
grpc.WithBackoffMaxDelay(3 * time.Second),
}
conn, err := grpc.Dial(dialAddress(address), gopts...)
if err != nil {

View File

@ -33,7 +33,7 @@ func setupSignals() (chan os.Signal, error) {
}
func newServer() *grpc.Server {
return grpc.NewServer(grpc.Creds(NewUnixSocketCredentils(0, 0)))
return grpc.NewServer(grpc.Creds(NewUnixSocketCredentials(0, 0)))
}
type unixSocketCredentials struct {
@ -42,7 +42,7 @@ type unixSocketCredentials struct {
serverName string
}
func NewUnixSocketCredentils(uid, gid int) credentials.TransportCredentials {
func NewUnixSocketCredentials(uid, gid int) credentials.TransportCredentials {
return &unixSocketCredentials{uid, gid, "locahost"}
}