Browse Source

fixed conflicting password issue

afeiszli 4 years ago
parent
commit
0ad06984e6
4 changed files with 76 additions and 60 deletions
  1. 8 3
      controllers/authGrpc.go
  2. 63 54
      grpc/node.pb.go
  3. 1 0
      grpc/node.proto
  4. 4 3
      netclient/functions/auth.go

+ 8 - 3
controllers/authGrpc.go

@@ -5,6 +5,7 @@ import (
 	"context"
         "golang.org/x/crypto/bcrypt"
         "time"
+	"fmt"
         nodepb "github.com/gravitl/netmaker/grpc"
         "github.com/gravitl/netmaker/models"
         "github.com/gravitl/netmaker/functions"
@@ -105,6 +106,7 @@ func (s *NodeServiceServer) Login(ctx context.Context, req *nodepb.LoginRequest)
 
 	//out := new(LoginResponse)
 	macaddress := req.GetMacaddress()
+	network := req.GetNetwork()
 	password := req.GetPassword()
 
 	var result models.NodeAuth
@@ -123,7 +125,7 @@ func (s *NodeServiceServer) Login(ctx context.Context, req *nodepb.LoginRequest)
             //Search DB for node with Mac Address. Ignore pending nodes (they should not be able to authenticate with API untill approved).
             collection := mongoconn.Client.Database("netmaker").Collection("nodes")
             ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
-            var err = collection.FindOne(ctx, bson.M{ "macaddress": macaddress}).Decode(&result)
+	    var err = collection.FindOne(ctx, bson.M{ "macaddress": macaddress, "group": network}).Decode(&result)
 
             defer cancel()
 
@@ -135,12 +137,15 @@ func (s *NodeServiceServer) Login(ctx context.Context, req *nodepb.LoginRequest)
            //might be able to have a common hash (certificates?) and compare those so that a password isn't passed in in plain text...
            //TODO: Consider a way of hashing the password client side before sending, or using certificates
            err = bcrypt.CompareHashAndPassword([]byte(result.Password), []byte(password))
-           if err != nil && result.Password != password {
+	   if err != nil && result.Password != password {
 			return nil, err
            } else {
                 //Create a new JWT for the node
-                tokenString, _ := functions.CreateJWT(macaddress, result.Group)
+                tokenString, err := functions.CreateJWT(macaddress, result.Group)
 
+		if err != nil {
+			return nil, err
+		}
                 if tokenString == "" {
 		    err = errors.New("Something went wrong. Could not retrieve token.")
                     return nil, err

+ 63 - 54
grpc/node.pb.go

@@ -23,6 +23,7 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
 type LoginRequest struct {
 	Macaddress           string   `protobuf:"bytes,1,opt,name=macaddress,proto3" json:"macaddress,omitempty"`
 	Password             string   `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
+	Network              string   `protobuf:"bytes,3,opt,name=network,proto3" json:"network,omitempty"`
 	XXX_NoUnkeyedLiteral struct{} `json:"-"`
 	XXX_unrecognized     []byte   `json:"-"`
 	XXX_sizecache        int32    `json:"-"`
@@ -67,6 +68,13 @@ func (m *LoginRequest) GetPassword() string {
 	return ""
 }
 
+func (m *LoginRequest) GetNetwork() string {
+	if m != nil {
+		return m.Network
+	}
+	return ""
+}
+
 type LoginResponse struct {
 	Accesstoken          string   `protobuf:"bytes,1,opt,name=accesstoken,proto3" json:"accesstoken,omitempty"`
 	XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -986,58 +994,59 @@ func init() {
 func init() { proto.RegisterFile("grpc/node.proto", fileDescriptor_d13bd996b67da4ef) }
 
 var fileDescriptor_d13bd996b67da4ef = []byte{
-	// 839 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xdd, 0x6e, 0xe3, 0x44,
-	0x14, 0x56, 0xb2, 0x49, 0xe3, 0x9c, 0x34, 0x6d, 0x77, 0xda, 0x45, 0x23, 0x6b, 0xb5, 0x8a, 0x2c,
-	0x84, 0xb2, 0x88, 0x26, 0xa5, 0x48, 0x88, 0x3b, 0x24, 0x8a, 0x84, 0x40, 0xb0, 0x42, 0x46, 0xdc,
-	0x70, 0x37, 0xb1, 0x4f, 0xbc, 0x56, 0x9c, 0x99, 0x89, 0xc7, 0xce, 0xaa, 0x0f, 0xc0, 0xa3, 0xf1,
-	0x46, 0x5c, 0x72, 0x81, 0xe6, 0xc7, 0xf1, 0x4f,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70, 0x91, 0x88, 0x8c, 0xf1, 0x64, 0x21, 0xf2,
-	0x64, 0x69, 0xbe, 0x89, 0x56, 0xe5, 0x7a, 0x59, 0xdc, 0x4b, 0x54, 0xcb, 0x0d, 0x17, 0x1f, 0xb8,
-	0xf9, 0x5a, 0x92, 0xab, 0xd5, 0x89, 0x79, 0xfc, 0xea, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8b,
-	0xd7, 0x8e, 0x6d, 0x43, 0x09, 0x00, 0x00,
+	// 850 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xdd, 0x6a, 0xe3, 0x46,
+	0x14, 0xc6, 0x5e, 0x3b, 0x96, 0x8f, 0xe3, 0x24, 0x3b, 0xc9, 0x96, 0x41, 0x84, 0x10, 0x44, 0x29,
+	0xd9, 0xd2, 0xc4, 0x69, 0x0a, 0xa5, 0x77, 0x85, 0xa6, 0x50, 0x0a, 0xed, 0x52, 0x54, 0x7a, 0xd3,
+	0xbb, 0x89, 0xe6, 0x44, 0x2b, 0xac, 0xcc, 0x8c, 0x35, 0x92, 0x43, 0x1e, 0xa0, 0x8f, 0xd6, 0x37,
+	0xea, 0x65, 0x2f, 0xca, 0xfc, 0xc8, 0xfa, 0x89, 0x9b, 0x64, 0x73, 0xe7, 0xf3, 0xcd, 0xf9, 0x3f,
+	0xdf, 0x39, 0x16, 0xec, 0xa7, 0x85, 0x4a, 0x16, 0x42, 0x72, 0xbc, 0x50, 0x85, 0x2c, 0x25, 0x19,
+	0x99, 0xdf, 0x11, 0x87, 0xdd, 0x5f, 0x64, 0x9a, 0x89, 0x18, 0x57, 0x15, 0xea, 0x92, 0x9c, 0x00,
+	0xdc, 0xb1, 0x84, 0x71, 0x5e, 0xa0, 0xd6, 0x74, 0x70, 0x3a, 0x38, 0x9b, 0xc6, 0x2d, 0x84, 0x84,
+	0x10, 0x28, 0xa6, 0xf5, 0xbd, 0x2c, 0x38, 0x1d, 0xda, 0xd7, 0x8d, 0x4c, 0x28, 0x4c, 0x04, 0x96,
+	0xf7, 0xb2, 0x58, 0xd2, 0x37, 0xf6, 0xa9, 0x16, 0xa3, 0xaf, 0x61, 0xee, 0xa3, 0x68, 0x25, 0x85,
+	0x46, 0x72, 0x0a, 0x33, 0x96, 0x24, 0xa8, 0x75, 0x29, 0x97, 0x28, 0x7c, 0x9c, 0x36, 0x14, 0xfd,
+	0x33, 0x82, 0xd1, 0x07, 0xc9, 0x91, 0xec, 0xc1, 0x30, 0xe3, 0x5e, 0x63, 0x98, 0x71, 0x42, 0x60,
+	0x24, 0xd8, 0x1d, 0xfa, 0xe8, 0xf6, 0xb7, 0x89, 0x5c, 0xa7, 0xec, 0x23, 0xd7, 0xf9, 0x9e, 0x00,
+	0xe4, 0x99, 0x2e, 0x51, 0x28, 0x59, 0x94, 0x74, 0x74, 0x3a, 0x38, 0x1b, 0xc7, 0x2d, 0x84, 0x1c,
+	0xc3, 0x54, 0x55, 0x37, 0x79, 0x96, 0x2c, 0xf1, 0x81, 0x8e, 0xad, 0x6d, 0x03, 0x98, 0x6a, 0x51,
+	0x70, 0x25, 0x33, 0x51, 0xd2, 0x1d, 0x57, 0x6d, 0x2d, 0xf7, 0x3a, 0x35, 0x79, 0xb2, 0x53, 0x41,
+	0xaf, 0x53, 0xc7, 0x30, 0x35, 0xdd, 0x4f, 0x0b, 0x59, 0x29, 0x3a, 0x75, 0x51, 0x37, 0x80, 0x79,
+	0xcd, 0xb4, 0x42, 0xc1, 0x33, 0x91, 0x52, 0x38, 0x1d, 0x9c, 0x05, 0x71, 0x03, 0x90, 0xcf, 0x60,
+	0x47, 0x49, 0x5d, 0x56, 0x8a, 0xce, 0xac, 0xa1, 0x97, 0xc8, 0x11, 0x8c, 0x55, 0x81, 0x95, 0xa2,
+	0xbb, 0x16, 0x76, 0x82, 0xf1, 0xb5, 0x44, 0x54, 0x2c, 0xcf, 0xd6, 0x48, 0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 service NodeService {
 message LoginRequest {
   string macaddress = 1;
   string password = 2;
+  string network = 3;
 }
 
 message LoginResponse { string accesstoken = 1; }

+ 4 - 3
netclient/functions/auth.go

@@ -42,13 +42,14 @@ func AutoLogin(client nodepb.NodeServiceClient, network string) error {
 	        //home, err := os.UserHomeDir()
 		home := "/etc/netclient"
 		//nodecfg := config.Config.Node
-                config, err := config.ReadConfig(network) 
+                cfg, err := config.ReadConfig(network) 
 		if err != nil {
 			return err
 		}
 		login := &nodepb.LoginRequest{
-                        Password: config.Node.Password,
-                        Macaddress: config.Node.MacAddress,
+                        Password: cfg.Node.Password,
+                        Macaddress: cfg.Node.MacAddress,
+                        Network: network,
                 }
     // RPC call
                 res, err := client.Login(context.TODO(), login)