Browse Source

fixed server config api

afeiszli 4 years ago
parent
commit
9813fd24a3

+ 2 - 2
README.md

@@ -9,7 +9,7 @@
 ## Documentation
 ## Documentation
 
 
 ### Netmaker's documentation can be found at:  
 ### Netmaker's documentation can be found at:  
-###  [docs.netmaker.org](docs.netmaker.org)
+###  [docs.netmaker.org](https://docs.netmaker.org)
 ###  [netmaker.readthedocs.io](https://netmaker.readthedocs.io)
 ###  [netmaker.readthedocs.io](https://netmaker.readthedocs.io)
   
   
 For information about installing and using Netmaker, including the [quick start guide](https://docs.netmaker.org/quick-start.html), please visit one of the above documentation sites, or read on for a short description of Netmaker.
 For information about installing and using Netmaker, including the [quick start guide](https://docs.netmaker.org/quick-start.html), please visit one of the above documentation sites, or read on for a short description of Netmaker.
@@ -24,7 +24,7 @@ Netmaker is a platform for creating and managing networks that are:
 - Zero-Trust
 - Zero-Trust
 - WireGuard-based
 - WireGuard-based
 
 
-Netmaker manages networks between computers that span data centers, clouds, and edge devices. Networking between environments can be a challenge, so Netmaker is designed to allow developers, DevOps engineers, SRE's, and more to manage virtual networks with as little pain as possible. You create a network with a few clicks, and add machines to that network with a single command.
+Netmaker manages networks between computers that span data centers, clouds, and edge devices. Networking between environments can be a challenge, so Netmaker is designed to allow developers, DevOps engineers, SRE's, and others to manage virtual networks with as little pain as possible. You create a network with a few clicks, and add machines to that network with a single command.
 
 
 ## Why Netmaker?
 ## Why Netmaker?
  1. Create a flat, secure network between multiple/hybrid cloud environments
  1. Create a flat, secure network between multiple/hybrid cloud environments

+ 3 - 2
controllers/intClientHttpController.go

@@ -142,8 +142,9 @@ func RegisterIntClient(client models.IntClient) (models.IntClient, error) {
 	if err != nil {
 	if err != nil {
 		return client, err
 		return client, err
 	}
 	}
-	client.ServerEndpoint = server.ServerEndpoint
-	client.ServerAPIEndpoint = servercfg.GetAPIHost() + ":" + servercfg.GetAPIPort()
+        gcfg := servercfg.GetConfig()
+        client.ServerWGEndpoint = server.ServerWGEndpoint
+        client.ServerAPIEndpoint = gcfg.APIHost + ":" + gcfg.APIPort
 	client.ServerAddress = server.ServerAddress
 	client.ServerAddress = server.ServerAddress
 	client.ServerPort = server.ServerPort
 	client.ServerPort = server.ServerPort
 	client.ServerKey = server.ServerKey
 	client.ServerKey = server.ServerKey

+ 2 - 2
controllers/nodeGrpcController.go

@@ -87,7 +87,7 @@ func (s *NodeServiceServer) GetConn(ctx context.Context, data *nodepb.Client) (*
                 PrivateKey:           data.GetPrivatekey(),
                 PrivateKey:           data.GetPrivatekey(),
                 ServerPort:          data.GetServerport(),
                 ServerPort:          data.GetServerport(),
                 ServerKey:          data.GetServerkey(),
                 ServerKey:          data.GetServerkey(),
-                ServerEndpoint:          data.GetServerendpoint(),
+                ServerWGEndpoint:          data.GetServerwgendpoint(),
         }
         }
 
 
         //Check to see if key is valid
         //Check to see if key is valid
@@ -117,7 +117,7 @@ func (s *NodeServiceServer) GetConn(ctx context.Context, data *nodepb.Client) (*
                         Accesskey:         client.AccessKey,
                         Accesskey:         client.AccessKey,
                         Address:      client.Address,
                         Address:      client.Address,
                         Address6:     client.Address6,
                         Address6:     client.Address6,
-                        Serverendpoint:     client.ServerEndpoint,
+                        Serverwgendpoint:     client.ServerWGEndpoint,
                         Serverport:     client.ServerPort,
                         Serverport:     client.ServerPort,
                         Serverkey:    client.ServerKey,
                         Serverkey:    client.ServerKey,
         }
         }

+ 16 - 12
controllers/serverHttpController.go

@@ -1,6 +1,8 @@
 package controller
 package controller
 
 
 import (
 import (
+    "log"
+    "github.com/davecgh/go-spew/spew"
     "github.com/gravitl/netmaker/models"
     "github.com/gravitl/netmaker/models"
     "github.com/gravitl/netmaker/functions"
     "github.com/gravitl/netmaker/functions"
     "github.com/gravitl/netmaker/serverctl"
     "github.com/gravitl/netmaker/serverctl"
@@ -28,28 +30,29 @@ func securityCheckServer(next http.Handler) http.HandlerFunc {
 
 
 		bearerToken := r.Header.Get("Authorization")
 		bearerToken := r.Header.Get("Authorization")
 
 
-		var hasBearer = true
 		var tokenSplit = strings.Split(bearerToken, " ")
 		var tokenSplit = strings.Split(bearerToken, " ")
 		var  authToken = ""
 		var  authToken = ""
-
 		if len(tokenSplit) < 2 {
 		if len(tokenSplit) < 2 {
-			hasBearer = false
-		} else {
+                      errorResponse = models.ErrorResponse{
+                                Code: http.StatusUnauthorized, Message: "W1R3: You are unauthorized to access this endpoint.",
+                      }
+                      returnErrorResponse(w, r, errorResponse)
+			return 
+	        } else {
 			authToken = tokenSplit[1]
 			authToken = tokenSplit[1]
 		}
 		}
 		//all endpoints here require master so not as complicated
 		//all endpoints here require master so not as complicated
 		//still might not be a good  way of doing this
 		//still might not be a good  way of doing this
-                _, isadmin, err := functions.VerifyUserToken(authToken)
-                if err != nil || !isadmin {
-			if (!hasBearer || !authenticateMasterServer(authToken)) && !isadmin {
+                _, isadmin, _ := functions.VerifyUserToken(authToken)
+
+		if !isadmin && !authenticateMasterServer(authToken) {
 				errorResponse = models.ErrorResponse{
 				errorResponse = models.ErrorResponse{
 					Code: http.StatusUnauthorized, Message: "W1R3: You are unauthorized to access this endpoint.",
 					Code: http.StatusUnauthorized, Message: "W1R3: You are unauthorized to access this endpoint.",
 				}
 				}
 				returnErrorResponse(w, r, errorResponse)
 				returnErrorResponse(w, r, errorResponse)
-			} else {
-				next.ServeHTTP(w, r)
-			}
+				return
 		}
 		}
+		next.ServeHTTP(w, r)
 	}
 	}
 }
 }
 //Consider a more secure way of setting master key
 //Consider a more secure way of setting master key
@@ -78,13 +81,14 @@ func removeNetwork(w http.ResponseWriter, r *http.Request) {
 }
 }
 
 
 func getConfig(w http.ResponseWriter, r *http.Request) {
 func getConfig(w http.ResponseWriter, r *http.Request) {
-        // Set header
+	log.Println("5")
+	// Set header
         w.Header().Set("Content-Type", "application/json")
         w.Header().Set("Content-Type", "application/json")
 
 
         // get params
         // get params
 
 
         scfg := servercfg.GetConfig()
         scfg := servercfg.GetConfig()
-
+	spew.Dump(scfg)
         w.WriteHeader(http.StatusOK)
         w.WriteHeader(http.StatusOK)
         json.NewEncoder(w).Encode(scfg)
         json.NewEncoder(w).Encode(scfg)
 }
 }

+ 73 - 73
grpc/node.pb.go

@@ -668,7 +668,7 @@ type Client struct {
 	Accesskey            string   `protobuf:"bytes,3,opt,name=accesskey,proto3" json:"accesskey,omitempty"`
 	Accesskey            string   `protobuf:"bytes,3,opt,name=accesskey,proto3" json:"accesskey,omitempty"`
 	Address              string   `protobuf:"bytes,4,opt,name=address,proto3" json:"address,omitempty"`
 	Address              string   `protobuf:"bytes,4,opt,name=address,proto3" json:"address,omitempty"`
 	Address6             string   `protobuf:"bytes,5,opt,name=address6,proto3" json:"address6,omitempty"`
 	Address6             string   `protobuf:"bytes,5,opt,name=address6,proto3" json:"address6,omitempty"`
-	Serverendpoint       string   `protobuf:"bytes,6,opt,name=serverendpoint,proto3" json:"serverendpoint,omitempty"`
+	Serverwgendpoint     string   `protobuf:"bytes,6,opt,name=serverwgendpoint,proto3" json:"serverwgendpoint,omitempty"`
 	Serverport           string   `protobuf:"bytes,7,opt,name=serverport,proto3" json:"serverport,omitempty"`
 	Serverport           string   `protobuf:"bytes,7,opt,name=serverport,proto3" json:"serverport,omitempty"`
 	Serverkey            string   `protobuf:"bytes,8,opt,name=serverkey,proto3" json:"serverkey,omitempty"`
 	Serverkey            string   `protobuf:"bytes,8,opt,name=serverkey,proto3" json:"serverkey,omitempty"`
 	XXX_NoUnkeyedLiteral struct{} `json:"-"`
 	XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -736,9 +736,9 @@ func (m *Client) GetAddress6() string {
 	return ""
 	return ""
 }
 }
 
 
-func (m *Client) GetServerendpoint() string {
+func (m *Client) GetServerwgendpoint() string {
 	if m != nil {
 	if m != nil {
-		return m.Serverendpoint
+		return m.Serverwgendpoint
 	}
 	}
 	return ""
 	return ""
 }
 }
@@ -1362,75 +1362,75 @@ func init() {
 func init() { proto.RegisterFile("grpc/node.proto", fileDescriptor_d13bd996b67da4ef) }
 func init() { proto.RegisterFile("grpc/node.proto", fileDescriptor_d13bd996b67da4ef) }
 
 
 var fileDescriptor_d13bd996b67da4ef = []byte{
 var fileDescriptor_d13bd996b67da4ef = []byte{
-	// 1112 bytes of a gzipped FileDescriptorProto
+	// 1113 bytes of a gzipped FileDescriptorProto
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x57, 0x4f, 0x6f, 0x23, 0x35,
 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x57, 0x4f, 0x6f, 0x23, 0x35,
-	0x14, 0x57, 0xd2, 0xa6, 0x49, 0x5f, 0x9a, 0xb6, 0xeb, 0xee, 0x16, 0x13, 0x96, 0x55, 0x15, 0xa1,
-	0x55, 0x17, 0xd1, 0xa6, 0x14, 0x69, 0x85, 0xc4, 0x01, 0x89, 0x2e, 0xaa, 0x40, 0xb0, 0x82, 0x41,
-	0x5c, 0xb8, 0xb9, 0x33, 0x2f, 0xb3, 0x56, 0xa6, 0xf6, 0x74, 0xec, 0x24, 0xdb, 0x1b, 0x17, 0x6e,
-	0x7c, 0x21, 0xbe, 0x0f, 0x57, 0xbe, 0x03, 0xf2, 0x9f, 0xc9, 0x78, 0xa6, 0xe9, 0x9f, 0x65, 0x6f,
-	0xdc, 0xc6, 0x3f, 0xbf, 0xbf, 0xbf, 0xe7, 0xf7, 0xec, 0x81, 0x9d, 0xb4, 0xc8, 0xe3, 0xb1, 0x90,
-	0x09, 0x1e, 0xe7, 0x85, 0xd4, 0x92, 0xac, 0x9b, 0xef, 0x51, 0x02, 0x5b, 0x3f, 0xc8, 0x94, 0x8b,
-	0x08, 0xaf, 0x66, 0xa8, 0x34, 0x79, 0x06, 0x70, 0xc9, 0x62, 0x96, 0x24, 0x05, 0x2a, 0x45, 0x5b,
-	0x07, 0xad, 0xc3, 0xcd, 0x28, 0x40, 0xc8, 0x10, 0x7a, 0x39, 0x53, 0x6a, 0x21, 0x8b, 0x84, 0xb6,
-	0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0xf2, 0x95, 0x3d, 0x4c, 0x65, 0xb5, 0xc9, 0xe3, 0xa5, 0x4c, 0x70,
+	0x56, 0x87, 0xab, 0x50, 0xa3, 0x7c, 0x04, 0x5d, 0x5f, 0x30, 0xb2, 0xdb, 0xa8, 0xdf, 0xd5, 0xb0,
+	0x89, 0xa8, 0x6f, 0xc6, 0xbf, 0x1d, 0xa5, 0x52, 0xa6, 0x19, 0x1e, 0xa7, 0x32, 0x63, 0x22, 0x3d,
+	0x96, 0x45, 0x3a, 0xb6, 0xbf, 0x6d, 0x17, 0xb3, 0xc9, 0x58, 0x5f, 0xe7, 0xa8, 0xc6, 0x53, 0x21,
+	0x17, 0xc2, 0xfe, 0xd0, 0xe5, 0x17, 0x17, 0x1b, 0x76, 0xf3, 0x8b, 0x7f, 0x03, 0x00, 0x00, 0xff,
+	0xff, 0xf1, 0xb2, 0x6f, 0x12, 0xe6, 0x0d, 0x00, 0x00,
 }
 }

+ 1 - 1
grpc/node.proto

@@ -92,7 +92,7 @@ message Client {
     string accesskey = 3;
     string accesskey = 3;
     string address = 4;
     string address = 4;
     string address6 = 5;
     string address6 = 5;
-    string serverendpoint = 6;
+    string serverwgendpoint = 6;
     string serverport = 7;
     string serverport = 7;
     string serverkey = 8;
     string serverkey = 8;
 }
 }

+ 4 - 4
models/intclient.go

@@ -1,15 +1,15 @@
 package models
 package models
 
 
 type IntClient struct {
 type IntClient struct {
-  ClientID       string             `json:"clientid" bson:"clientid"`
+	ClientID       string             `json:"clientid" bson:"clientid"`
 	PrivateKey     string             `json:"privatekey" bson:"privatekey"`
 	PrivateKey     string             `json:"privatekey" bson:"privatekey"`
 	PublicKey      string             `json:"publickey" bson:"publickey"`
 	PublicKey      string             `json:"publickey" bson:"publickey"`
 	AccessKey      string             `json:"accesskey" bson:"accesskey"`
 	AccessKey      string             `json:"accesskey" bson:"accesskey"`
 	Address        string             `json:"address" bson:"address"`
 	Address        string             `json:"address" bson:"address"`
-	Address6        string            `json:"address6" bson:"address6"`
+	Address6       string             `json:"address6" bson:"address6"`
 	Network        string             `json:"network" bson:"network"`
 	Network        string             `json:"network" bson:"network"`
-	ServerEndpoint  string            `json:"serverendpoint" bson:"serverendpoint"`
-  ServerAPIEndpoint  string         `json:"serverapiendpoint" bson:"serverapiendpoint"`
+	ServerWGEndpoint  string          `json:"serverwgendpoint" bson:"serverwgendpoint"`
+	ServerAPIEndpoint  string         `json:"serverapiendpoint" bson:"serverapiendpoint"`
 	ServerAddress  string             `json:"serveraddress" bson:"serveraddress"`
 	ServerAddress  string             `json:"serveraddress" bson:"serveraddress"`
 	ServerPort     string             `json:"serverport" bson:"serverport"`
 	ServerPort     string             `json:"serverport" bson:"serverport"`
 	ServerKey      string             `json:"serverkey" bson:"serverkey"`
 	ServerKey      string             `json:"serverkey" bson:"serverkey"`

+ 1 - 1
serverctl/wireguard.go

@@ -61,7 +61,7 @@ func InitServerWireGuard() error {
 	var client models.IntClient
 	var client models.IntClient
 	client.PrivateKey = wgconfig.GRPCWGPrivKey
 	client.PrivateKey = wgconfig.GRPCWGPrivKey
 	client.PublicKey = wgconfig.GRPCWGPubKey
 	client.PublicKey = wgconfig.GRPCWGPubKey
-	client.ServerEndpoint = wgconfig.GRPCWGEndpoint
+	client.ServerWGEndpoint = wgconfig.GRPCWGEndpoint
 	client.ServerAddress = wgconfig.GRPCWGAddress
 	client.ServerAddress = wgconfig.GRPCWGAddress
 	client.ServerPort = wgconfig.GRPCWGPort
 	client.ServerPort = wgconfig.GRPCWGPort
 	client.Address = wgconfig.GRPCWGAddress
 	client.Address = wgconfig.GRPCWGAddress