diff --git a/Makefile b/Makefile index e9f8ec6633fe2e8696a0d2b12da010e5de6ee414..fe2f2845538d4b9466a96a327d980315e1cae106 100644 --- a/Makefile +++ b/Makefile @@ -19,21 +19,22 @@ build: go mod tidy update_release: - GOFLAGS="" go get gitlab.com/elixxir/primitives@release GOFLAGS="" go get gitlab.com/xx_network/primitives@release - GOFLAGS="" go get gitlab.com/elixxir/crypto@release + GOFLAGS="" go get gitlab.com/elixxir/primitives@release GOFLAGS="" go get gitlab.com/xx_network/crypto@release + GOFLAGS="" go get gitlab.com/elixxir/crypto@release + GOFLAGS="" go get gitlab.com/xx_network/comms@release GOFLAGS="" go get gitlab.com/elixxir/comms@release GOFLAGS="" go get gitlab.com/elixxir/gpumathsgo@release - GOFLAGS="" go get gitlab.com/xx_network/comms@release update_master: - GOFLAGS="" go get gitlab.com/elixxir/primitives@master GOFLAGS="" go get gitlab.com/xx_network/primitives@master - GOFLAGS="" go get gitlab.com/elixxir/crypto@master + GOFLAGS="" go get gitlab.com/elixxir/primitives@master GOFLAGS="" go get gitlab.com/xx_network/crypto@master - GOFLAGS="" go get gitlab.com/elixxir/comms@master + GOFLAGS="" go get gitlab.com/elixxir/crypto@master GOFLAGS="" go get gitlab.com/xx_network/comms@master + GOFLAGS="" go get gitlab.com/elixxir/comms@master + GOFLAGS="" go get gitlab.com/elixxir/gpumathsgo@master master: clean update_master build version diff --git a/README.md b/README.md index 8a8f2e2f1899de85f8c32609b3671df5697812ac..af19dd197a325eb394fd08dd8aac80aa1f810dde 100644 --- a/README.md +++ b/README.md @@ -125,21 +125,20 @@ node: # Path to the private key associated with the self-signed TLS certificate. # (Required) key: "/opt/xxnetwork/creds/node_key.key" - # Path where log file will be saved. + # Path where log file will be saved. (Default "./node.log") log: "/opt/xxnetwork/node-logs/node.log" # Port that the Node will communicate on. (Required) - port: 42069 + port: 11420 # Local IP address of the Node, used for internal listening. Expects an IPv4 # address without a port. (default "0.0.0.0") listeningAddress: "" - # The public IPv4 address of the Node, as reported to the network, to be used - # instead of dynamically looking up Node's own IP address via pinging external - # services. If a port is not included, then the port from the port flag is - # used instead. + # The public IPv4 address of the Node, as reported to the network. When not + # set, external IP address lookup services are used to set this value. If a + # port is not included, then the port from the port flag is used instead. overridePublicIP: "" - # If set, then it is used to override the internal IP address. Expects an IPv4 - # address with or without a port. If no port is included, then the port from - # the port flag is used. + # If set, then it is used to override the internal IP address used to contact + # yourself. Expects an IPv4 address with or without a port. If no port is + # included, then the port from the port flag is used. overrideInternalIP: "" # Information to connect to the Postgres database storing keys. (Required) @@ -154,7 +153,7 @@ gateway: paths: # Path to the self-signed TLS certificate for Gateway. Expects PEM format. # (Required) - cert: "/opt/xxnetwork/creds/gateway-cert.crt" + cert: "/opt/xxnetwork/creds/gateway_cert.crt" permissioning: paths: @@ -166,7 +165,7 @@ permissioning: metrics: # Path to store metrics logs. - log: "/opt/xxnetwork/server-logs/metrics.log" + log: "/opt/xxnetwork/node-logs/metrics.log" ``` ## Project Structure diff --git a/cmd/conf/params.go b/cmd/conf/params.go index b8985b9e06d163f2f3e9d68b30b8c6457844bc83..8494cb7871533f11bb89ac3bc84968ab5667f895 100644 --- a/cmd/conf/params.go +++ b/cmd/conf/params.go @@ -116,6 +116,9 @@ func NewParams(vip *viper.Viper) (*Params, error) { require(params.Node.Paths.Key, "node.paths.key") params.Node.Paths.Log = vip.GetString("node.paths.log") + if params.Node.Paths.Log == "" { + params.Node.Paths.Log = "./node.log" + } params.RecoveredErrPath = vip.GetString("node.paths.errOutput") require(params.RecoveredErrPath, "node.paths.errOutput") diff --git a/cmd/root.go b/cmd/root.go index 8a81e8fe8dec19670bf44d2b8629fa29284dd3d6..d2c485e6d2899b00be4d5fc8428fac5eb35faf8c 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -189,15 +189,7 @@ func handleBindingError(err error, flag string) { func initConfig() { // Use default config location if none is passed if cfgFile == "" { - var err error - cfgFile, err = utils.SearchDefaultLocations("node.yaml", "xxnetwork") - if err != nil { - cfgFile, err = utils.SearchDefaultLocations("server.yaml", "xxnetwork") - } - if err != nil { - jww.FATAL.Panicf("No config provided and non found at default paths") - } - + jww.FATAL.Panicf("No config file provided.") } f, err := os.Open(cfgFile) diff --git a/cmd/version.go b/cmd/version.go index a89903c54b16e553e34f568c88fe692911f4b1eb..ab0d249f1b2c59ef18204dc0a36e339b5a696041 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -17,7 +17,7 @@ import ( ) // Change this value to set the version for this build -const currentVersion = "2.0.0" +const currentVersion = "2.1.0" func printVersion() { fmt.Printf("xx network Server v%s -- %s\n\n", SEMVER, GITVERSION) diff --git a/cmd/version_vars.go b/cmd/version_vars.go index f5a610ab140713fe8c511257d1a25e903a1454bf..96e19962829b70aeddf241c7bfe8e112d54d95da 100644 --- a/cmd/version_vars.go +++ b/cmd/version_vars.go @@ -1,10 +1,10 @@ // Code generated by go generate; DO NOT EDIT. // This file was generated by robots at -// 2021-03-10 10:03:13.499594 -0800 PST m=+0.031621920 +// 2021-03-15 16:54:21.766618 -0500 CDT m=+0.030313819 package cmd -const GITVERSION = `d82ab807 update deps` -const SEMVER = "2.0.0" +const GITVERSION = `8ab7effe updated teh startup poll for dynamic NDF` +const SEMVER = "2.1.0" const DEPENDENCIES = `module gitlab.com/elixxir/server go 1.13 @@ -30,9 +30,9 @@ require ( github.com/spf13/cobra v1.1.1 github.com/spf13/jwalterweatherman v1.1.0 github.com/spf13/viper v1.7.1 - gitlab.com/elixxir/comms v0.0.4-0.20210309193245-64181ff10b68 + gitlab.com/elixxir/comms v0.0.4-0.20210311180506-28ae742c5e35 gitlab.com/elixxir/crypto v0.0.7-0.20210309193114-8a6225c667e2 - gitlab.com/elixxir/gpumathsgo v0.0.2-0.20210126215525-7262661491c7 + gitlab.com/elixxir/gpumathsgo v0.1.0 gitlab.com/elixxir/primitives v0.0.3-0.20210309193003-ef42ebb4800b gitlab.com/xx_network/comms v0.0.4-0.20210309192940-6b7fb39b4d01 gitlab.com/xx_network/crypto v0.0.5-0.20210309192854-cf32117afb96 diff --git a/go.mod b/go.mod index 79d2f326bbdd91226e389f0a10fe7fb2ed147f1d..2d5f78748c8f000f6dab7c2edcf9210894704ec5 100644 --- a/go.mod +++ b/go.mod @@ -23,12 +23,12 @@ require ( github.com/spf13/cobra v1.1.1 github.com/spf13/jwalterweatherman v1.1.0 github.com/spf13/viper v1.7.1 - gitlab.com/elixxir/comms v0.0.4-0.20210311180506-28ae742c5e35 - gitlab.com/elixxir/crypto v0.0.7-0.20210309193114-8a6225c667e2 + gitlab.com/elixxir/comms v0.0.4-0.20210316224000-76529267620c + gitlab.com/elixxir/crypto v0.0.7-0.20210316212419-025ba777a80b gitlab.com/elixxir/gpumathsgo v0.1.0 gitlab.com/elixxir/primitives v0.0.3-0.20210309193003-ef42ebb4800b - gitlab.com/xx_network/comms v0.0.4-0.20210309192940-6b7fb39b4d01 - gitlab.com/xx_network/crypto v0.0.5-0.20210309192854-cf32117afb96 + gitlab.com/xx_network/comms v0.0.4-0.20210316212314-d9a2a5e589c8 + gitlab.com/xx_network/crypto v0.0.5-0.20210316212152-504c0a1e0da0 gitlab.com/xx_network/primitives v0.0.4-0.20210309173740-eb8cd411334a gitlab.com/xx_network/ring v0.0.3-0.20201120004140-b0e268db06d1 // indirect golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad diff --git a/go.sum b/go.sum index 3abec893b36df739d3269e3bd9d3657cde9edc48..539a3c289a0045371ed1c4801824953058cd5235 100644 --- a/go.sum +++ b/go.sum @@ -264,19 +264,38 @@ github.com/zeebo/pcg v1.0.0 h1:dt+dx+HvX8g7Un32rY9XWoYnd0NmKmrIzpHF7qiTDj0= github.com/zeebo/pcg v1.0.0/go.mod h1:09F0S9iiKrwn9rlI5yjLkmrug154/YRW6KnnXVDM/l4= gitlab.com/elixxir/comms v0.0.4-0.20210309193245-64181ff10b68 h1:HR45PZyVl+gvksIKoHPCxFndhOpBT6z3rl7vaa3BaAc= gitlab.com/elixxir/comms v0.0.4-0.20210309193245-64181ff10b68/go.mod h1:96cMuVVlarB+I6nuFKdq4zCagQkbhVK/MUzRk3yOymI= +gitlab.com/elixxir/comms v0.0.4-0.20210309195247-fc17eb8560cf h1:/VDBO0GxcpqGVOFBFeuk/yKxWOKC6j7A2gLnOc1Syuc= +gitlab.com/elixxir/comms v0.0.4-0.20210309195247-fc17eb8560cf/go.mod h1:DNJES7GZaGZnXsIDDP0nNS3lk21mhN27byQlODA+5fA= gitlab.com/elixxir/comms v0.0.4-0.20210311180506-28ae742c5e35 h1:t/ILeoWel5Im+zLQUX2FIroZvrfAkxOaL3DCA8enKcE= gitlab.com/elixxir/comms v0.0.4-0.20210311180506-28ae742c5e35/go.mod h1:96cMuVVlarB+I6nuFKdq4zCagQkbhVK/MUzRk3yOymI= +gitlab.com/elixxir/comms v0.0.4-0.20210311204728-9b628ad57f79 h1:k8FLPJidj+/YEGAzwB/XMYOnGQfnU82q/NtyX2QgivI= +gitlab.com/elixxir/comms v0.0.4-0.20210311204728-9b628ad57f79/go.mod h1:96cMuVVlarB+I6nuFKdq4zCagQkbhVK/MUzRk3yOymI= +gitlab.com/elixxir/comms v0.0.4-0.20210311225503-dc1b9386d22b h1:LllyDrF0r8ogLDNVhRkvQRyhDQVwI3qP9izgmbXpKSE= +gitlab.com/elixxir/comms v0.0.4-0.20210311225503-dc1b9386d22b/go.mod h1:96cMuVVlarB+I6nuFKdq4zCagQkbhVK/MUzRk3yOymI= +gitlab.com/elixxir/comms v0.0.4-0.20210315172845-e08a127d601c h1:1XOPIQMQi7wRen2ABXrKE/+tCw7kSg45rrSlep9sNks= +gitlab.com/elixxir/comms v0.0.4-0.20210315172845-e08a127d601c/go.mod h1:96cMuVVlarB+I6nuFKdq4zCagQkbhVK/MUzRk3yOymI= +gitlab.com/elixxir/comms v0.0.4-0.20210315190821-f82a14c64d8e h1:0aVompsgMwGt22HINf99geqmFgkuHq4I85Yj3qGtZcc= +gitlab.com/elixxir/comms v0.0.4-0.20210315190821-f82a14c64d8e/go.mod h1:96cMuVVlarB+I6nuFKdq4zCagQkbhVK/MUzRk3yOymI= +gitlab.com/elixxir/comms v0.0.4-0.20210316192645-36e23d019d12 h1:AgcrSaZ7dDTnpyHTV1rR5pOIIyod4qiC9gR1Goj2uW4= +gitlab.com/elixxir/comms v0.0.4-0.20210316192645-36e23d019d12/go.mod h1:96cMuVVlarB+I6nuFKdq4zCagQkbhVK/MUzRk3yOymI= +gitlab.com/elixxir/comms v0.0.4-0.20210316212548-21282c4ffdeb h1:uHSUmO4Z1GKj+khrFu261AjQhTmj0zrPJwi6HPdqF1Y= +gitlab.com/elixxir/comms v0.0.4-0.20210316212548-21282c4ffdeb/go.mod h1:yMy042ResQpS2cM6mdaoRYhAtQX9Yx5r3H9jS7619AU= +gitlab.com/elixxir/comms v0.0.4-0.20210316224000-76529267620c h1:0G5UuaWzSersRRq6xcXD0LTP5KY2eKrB1G+TusLxcbk= +gitlab.com/elixxir/comms v0.0.4-0.20210316224000-76529267620c/go.mod h1:yMy042ResQpS2cM6mdaoRYhAtQX9Yx5r3H9jS7619AU= gitlab.com/elixxir/crypto v0.0.0-20200804182833-984246dea2c4/go.mod h1:ucm9SFKJo+K0N2GwRRpaNr+tKXMIOVWzmyUD0SbOu2c= gitlab.com/elixxir/crypto v0.0.3/go.mod h1:ZNgBOblhYToR4m8tj4cMvJ9UsJAUKq+p0gCp07WQmhA= gitlab.com/elixxir/crypto v0.0.6/go.mod h1:V8lricBRpa8v1ySymXQ1/lsb+8/lSak5S7ZWRT6OACY= gitlab.com/elixxir/crypto v0.0.7-0.20201201231824-67328e9b6426 h1:D6lpBBhD4LC/xvQ4T32H2UF2kKf/bjbzPdM2XCs9CSc= gitlab.com/elixxir/crypto v0.0.7-0.20201201231824-67328e9b6426/go.mod h1:fxT8uiFzTpcKtgNbfHEkVr/3QqpkXI0T9nRVzyimv+s= +gitlab.com/elixxir/crypto v0.0.7-0.20210305221450-c94429c34886/go.mod h1:ugRjIGSOJJvVKGfIDpS/k62yeG4cTIrS/YNLqmpEIDM= gitlab.com/elixxir/crypto v0.0.7-0.20210309193114-8a6225c667e2 h1:JMbUxcOjFpdCBUMZS5g8CWfNdPJ6pP8xsAZbnLj66jc= gitlab.com/elixxir/crypto v0.0.7-0.20210309193114-8a6225c667e2/go.mod h1:TMZMB24OsjF6y3LCyBMzDucbOx1cGQCCeuKV9lJA/DU= gitlab.com/elixxir/crypto v0.0.7-0.20210310222014-49f59517a4ee h1:WepXwTY2H47AbNfCMYaXmvP5JU/Wu7ylr9/JWqiFAKE= gitlab.com/elixxir/crypto v0.0.7-0.20210310222014-49f59517a4ee/go.mod h1:ugRjIGSOJJvVKGfIDpS/k62yeG4cTIrS/YNLqmpEIDM= gitlab.com/elixxir/crypto v0.0.7-0.20210310223119-f6784b2fa32f h1:JY+UPtys8OpacypRgemOkjWbii8YbvQlCS+TXw7wMTM= gitlab.com/elixxir/crypto v0.0.7-0.20210310223119-f6784b2fa32f/go.mod h1:TMZMB24OsjF6y3LCyBMzDucbOx1cGQCCeuKV9lJA/DU= +gitlab.com/elixxir/crypto v0.0.7-0.20210316212419-025ba777a80b h1:YpXzYPgkV22hVS2q1Ni3wLjFeQZKpY9UjPKoa/IQDlQ= +gitlab.com/elixxir/crypto v0.0.7-0.20210316212419-025ba777a80b/go.mod h1:3SqRFi6QwGRBuQ4on0gJmPI4jpJdgnPIWPBwK/TnY5g= gitlab.com/elixxir/gpumathsgo v0.0.2-0.20210126215525-7262661491c7 h1:X3UiIX7EsyEVqBI9aZ3k3NIpbHWLjSQk+3zkJgeEvxo= gitlab.com/elixxir/gpumathsgo v0.0.2-0.20210126215525-7262661491c7/go.mod h1:rlTvOgZ7h7NCj3VskHDYRfafe7NyljjF5Svx7WyuLJE= gitlab.com/elixxir/gpumathsgo v0.1.0 h1:ZUmwNvbKERbxzbt4ZPJVKDk2/PQ42Gz1Ioc7MwFZ8HA= @@ -292,8 +311,11 @@ gitlab.com/elixxir/primitives v0.0.3-0.20210305221357-0b3f19cc3c8a/go.mod h1:7o0 gitlab.com/elixxir/primitives v0.0.3-0.20210309193003-ef42ebb4800b h1:TswWfqiZqsdPLeWsfe7VJHMlV01W792kRHGYfYwb2Lk= gitlab.com/elixxir/primitives v0.0.3-0.20210309193003-ef42ebb4800b/go.mod h1:/e3a4KPqmA9V22qKSZ9prfYYNzIzvLI8xh7noVV091w= gitlab.com/xx_network/comms v0.0.0-20200805174823-841427dd5023/go.mod h1:owEcxTRl7gsoM8c3RQ5KAm5GstxrJp5tn+6JfQ4z5Hw= +gitlab.com/xx_network/comms v0.0.4-0.20210305221336-a7e28febdbf6/go.mod h1:bs4GLnnL1UqInyjT4MbHamgTpiTLNtdC5e61CCnVapo= gitlab.com/xx_network/comms v0.0.4-0.20210309192940-6b7fb39b4d01 h1:f93iz7mTHt3r37O97vaQD8otohihLN3OnAEEbDGQdVs= gitlab.com/xx_network/comms v0.0.4-0.20210309192940-6b7fb39b4d01/go.mod h1:aNPRHmPssXc1JMJ83DAknT2C2iMgKL1wH3//AqQrhQc= +gitlab.com/xx_network/comms v0.0.4-0.20210316212314-d9a2a5e589c8 h1:WED5SlL+t6nW/gwFgyJv5vqPb/1pFVd1HRC1wgL+9wY= +gitlab.com/xx_network/comms v0.0.4-0.20210316212314-d9a2a5e589c8/go.mod h1:+4Qb4c5K0yj9Je0b8fxxw+aKZdM5y3PrpQ+ZXUwdUsI= gitlab.com/xx_network/crypto v0.0.3/go.mod h1:DF2HYvvCw9wkBybXcXAgQMzX+MiGbFPjwt3t17VRqRE= gitlab.com/xx_network/crypto v0.0.4/go.mod h1:+lcQEy+Th4eswFgQDwT0EXKp4AXrlubxalwQFH5O0Mk= gitlab.com/xx_network/crypto v0.0.5-0.20201124194022-366c10b1bce0/go.mod h1:+lcQEy+Th4eswFgQDwT0EXKp4AXrlubxalwQFH5O0Mk= @@ -302,11 +324,14 @@ gitlab.com/xx_network/crypto v0.0.5-0.20201201003055-12e514a638ae/go.mod h1:+lcQ gitlab.com/xx_network/crypto v0.0.5-0.20210305221255-f0ef174f5135/go.mod h1:Kg4EgRbpzHjxavzuKP9E1JEgYBT0ez80rFtB7Bwuw+g= gitlab.com/xx_network/crypto v0.0.5-0.20210309192854-cf32117afb96 h1:VZGJNhuU6YunKyK4MbNZf25UxQsmU1bH5SnbK93tI7Q= gitlab.com/xx_network/crypto v0.0.5-0.20210309192854-cf32117afb96/go.mod h1:TtaHpuX0lcuTTtcq+pz+lMusjyTgvSohIHFOlVwN1uU= +gitlab.com/xx_network/crypto v0.0.5-0.20210316212152-504c0a1e0da0 h1:3ZuCXkP5sH23xUFdNhatIN2YX+EOl8G4jrewKQHsNnk= +gitlab.com/xx_network/crypto v0.0.5-0.20210316212152-504c0a1e0da0/go.mod h1:rSBB1QLVgUQoaUvWXQTDCGNV9fGjgJahvted+7DEqSw= gitlab.com/xx_network/primitives v0.0.0-20200803231956-9b192c57ea7c/go.mod h1:wtdCMr7DPePz9qwctNoAUzZtbOSHSedcK++3Df3psjA= gitlab.com/xx_network/primitives v0.0.0-20200804183002-f99f7a7284da/go.mod h1:OK9xevzWCaPO7b1wiluVJGk7R5ZsuC7pHY5hteZFQug= gitlab.com/xx_network/primitives v0.0.2 h1:r45yKenJ9e7PylI1ZXJ1Es09oYNaYXjxVy9+uYlwo7Y= gitlab.com/xx_network/primitives v0.0.2/go.mod h1:cs0QlFpdMDI6lAo61lDRH2JZz+3aVkHy+QogOB6F/qc= gitlab.com/xx_network/primitives v0.0.4-0.20210303180604-1ee442e6463f/go.mod h1:9imZHvYwNFobxueSvVtHneZLk9wTK7HQTzxPm+zhFhE= +gitlab.com/xx_network/primitives v0.0.4-0.20210308175329-436b0c8753ea/go.mod h1:9imZHvYwNFobxueSvVtHneZLk9wTK7HQTzxPm+zhFhE= gitlab.com/xx_network/primitives v0.0.4-0.20210309173740-eb8cd411334a h1:Ume9QbJ4GoJh7v5yg/YVDjowJHx/VFeOC/A4PJZUm9g= gitlab.com/xx_network/primitives v0.0.4-0.20210309173740-eb8cd411334a/go.mod h1:9imZHvYwNFobxueSvVtHneZLk9wTK7HQTzxPm+zhFhE= gitlab.com/xx_network/ring v0.0.2 h1:TlPjlbFdhtJrwvRgIg4ScdngMTaynx/ByHBRZiXCoL0= diff --git a/internal/instance.go b/internal/instance.go index db5d0e75cd39aaf366420914dc0536d1e6ae26c3..ba91a63ef81e4673d0f5960f504c7e903fc671fc 100644 --- a/internal/instance.go +++ b/internal/instance.go @@ -158,7 +158,7 @@ func CreateServerInstance(def *Definition, makeImplementation func(*Instance) *n // Initializes the network state tracking on this server instance var err error instance.consensus, err = network.NewInstance(instance.network.ProtoComms, - def.PartialNDF, def.FullNDF, nil) + def.PartialNDF, def.FullNDF, nil, network.Strict) if err != nil { return nil, errors.WithMessage(err, "Could not initialize network instance") } diff --git a/io/receiveSharePhase.go b/io/receiveSharePhase.go index f5cf9f739c86fcd2240569147307aa988f4291ff..a21d6af330ed1987bd12eb8aadd422d76da533ab 100644 --- a/io/receiveSharePhase.go +++ b/io/receiveSharePhase.go @@ -166,7 +166,7 @@ func ReceiveSharePhasePiece(piece *pb.SharePiece, auth *connect.Auth, // If not a participant, send message to neighboring node if err = TransmitPhaseShare(instance, r, piece); err != nil { roundErr := errors.Errorf("ReceiveSharePhasePiece Error: "+ - "Could not send our shared piece of the key: %s", err) + "Could not send our shared piece of the key: %s", err) instance.ReportRoundFailure(roundErr, instance.GetID(), roundID) } } diff --git a/io/receiveSharePhase_test.go b/io/receiveSharePhase_test.go index 55e3a882f81fd29e11350b09bd6e37e38a6ad1fd..9257e6b40a4f7bb534f995e9670b263936020ca3 100644 --- a/io/receiveSharePhase_test.go +++ b/io/receiveSharePhase_test.go @@ -148,7 +148,6 @@ func TestSharePhaseRound(t *testing.T) { instance.GetPhaseShareMachine().Update(state.STARTED) - // Generate a share to send msg := &pb.SharePiece{ Piece: grp.GetG().Bytes(), @@ -348,4 +347,3 @@ func dummySharePhaseImpl(instance *internal.Instance) *node.Implementation { return impl } - diff --git a/io/registration_test.go b/io/registration_test.go index 31d261f8c12c3843ccceb572343dbfd87606c6f1..05f4fdf5c304fe75df27acb5a2a6e5d72df04579 100644 --- a/io/registration_test.go +++ b/io/registration_test.go @@ -210,12 +210,11 @@ func TestRequestNonce(t *testing.T) { } request := &pb.NonceRequest{ - Salt:salt, - ClientRSAPubKey:string(clientRSAPubKeyPEM), - ClientSignedByServer:&messages.RSASignature{Signature:sigReg}, - ClientDHPubKey:clientDHPub.Bytes(), - RequestSignature:&messages.RSASignature{Signature:sigClient}, - + Salt: salt, + ClientRSAPubKey: string(clientRSAPubKeyPEM), + ClientSignedByServer: &messages.RSASignature{Signature: sigReg}, + ClientDHPubKey: clientDHPub.Bytes(), + RequestSignature: &messages.RSASignature{Signature: sigClient}, } result, err2 := RequestNonce(serverInstance, request, &connect.Auth{ @@ -262,15 +261,14 @@ func TestRequestNonce_BadRegSignature(t *testing.T) { } request := &pb.NonceRequest{ - Salt:salt, - ClientRSAPubKey:string(clientRSAPubKeyPEM), - ClientSignedByServer:&messages.RSASignature{Signature:sigReg}, - ClientDHPubKey:clientDHPub.Bytes(), - RequestSignature:&messages.RSASignature{Signature:sigClient}, - + Salt: salt, + ClientRSAPubKey: string(clientRSAPubKeyPEM), + ClientSignedByServer: &messages.RSASignature{Signature: sigReg}, + ClientDHPubKey: clientDHPub.Bytes(), + RequestSignature: &messages.RSASignature{Signature: sigClient}, } - _, err2 := RequestNonce(serverInstance, request, &connect.Auth{ + _, err2 := RequestNonce(serverInstance, request, &connect.Auth{ IsAuthenticated: true, Sender: gwHost, }) @@ -313,12 +311,11 @@ func TestRequestNonce_BadClientSignature(t *testing.T) { } request := &pb.NonceRequest{ - Salt:salt, - ClientRSAPubKey:string(clientRSAPubKeyPEM), - ClientSignedByServer:&messages.RSASignature{Signature:sigReg}, - ClientDHPubKey:clientDHPub.Bytes(), - RequestSignature:&messages.RSASignature{Signature:sigClient}, - + Salt: salt, + ClientRSAPubKey: string(clientRSAPubKeyPEM), + ClientSignedByServer: &messages.RSASignature{Signature: sigReg}, + ClientDHPubKey: clientDHPub.Bytes(), + RequestSignature: &messages.RSASignature{Signature: sigClient}, } _, err2 := RequestNonce(serverInstance, request, &connect.Auth{ IsAuthenticated: true, @@ -367,9 +364,9 @@ func TestConfirmRegistration(t *testing.T) { } msg := &pb.RequestRegistrationConfirmation{ - UserID:user.ID.Bytes(), + UserID: user.ID.Bytes(), NonceSignedByClient: &messages.RSASignature{ - Signature: sign, + Signature: sign, }, } @@ -422,9 +419,9 @@ func TestConfirmRegistrationFailAuth(t *testing.T) { } msg := &pb.RequestRegistrationConfirmation{ - UserID:user.ID.Bytes(), + UserID: user.ID.Bytes(), NonceSignedByClient: &messages.RSASignature{ - Signature: sign, + Signature: sign, }, } @@ -466,9 +463,9 @@ func TestConfirmRegistrationFailAuthId(t *testing.T) { } msg := &pb.RequestRegistrationConfirmation{ - UserID:user.ID.Bytes(), + UserID: user.ID.Bytes(), NonceSignedByClient: &messages.RSASignature{ - Signature: sign, + Signature: sign, }, } @@ -510,9 +507,9 @@ func TestConfirmRegistration_NonExistant(t *testing.T) { } msg := &pb.RequestRegistrationConfirmation{ - UserID:user.ID.Bytes(), + UserID: user.ID.Bytes(), NonceSignedByClient: &messages.RSASignature{ - Signature: sign, + Signature: sign, }, } @@ -561,9 +558,9 @@ func TestConfirmRegistration_Expired(t *testing.T) { } msg := &pb.RequestRegistrationConfirmation{ - UserID:user.ID.Bytes(), + UserID: user.ID.Bytes(), NonceSignedByClient: &messages.RSASignature{ - Signature: sign, + Signature: sign, }, } @@ -593,9 +590,9 @@ func TestConfirmRegistration_BadSignature(t *testing.T) { } msg := &pb.RequestRegistrationConfirmation{ - UserID:user.ID.Bytes(), + UserID: user.ID.Bytes(), NonceSignedByClient: &messages.RSASignature{ - Signature: []byte("test"), + Signature: []byte("test"), }, } diff --git a/multiInstance_test.go b/multiInstance_test.go index dd065faa0cb3cace12748437c9eb559fd809fded..7409a6c2a02b545b6fe5d25cb1e1b540bccc643b 100644 --- a/multiInstance_test.go +++ b/multiInstance_test.go @@ -572,19 +572,6 @@ func iterate(done chan time.Time, nodes []*internal.Instance, t *testing.T, done <- start } -// Utility function which signs a round info message -func signRoundInfo(ri *pb.RoundInfo) error { - pk, err := tls.LoadRSAPrivateKey(testUtil.RegPrivKey) - if err != nil { - return errors.Errorf("Couldn't load private key: %+v", err) - } - - ourPrivateKey := &rsa.PrivateKey{PrivateKey: *pk} - - signature.Sign(ri, ourPrivateKey) - return nil -} - // generateCert eturns a self-signed cert and key for dummy tls comms, // this is mostly cribbed from: // https://golang.org/src/crypto/tls/generate_cert.go @@ -761,3 +748,16 @@ func buildNdf(nodeLst []internal.Node, grp *cyclic.Group) *ndf.NetworkDefinition } } + +// Utility function which signs a round info message +func signRoundInfo(ri *pb.RoundInfo) error { + pk, err := tls.LoadRSAPrivateKey(testUtil.RegPrivKey) + if err != nil { + return errors.Errorf("Couldn't load private key: %+v", err) + } + + ourPrivateKey := &rsa.PrivateKey{PrivateKey: *pk} + + signature.Sign(ri, ourPrivateKey) + return nil +} diff --git a/node/changeHandlers.go b/node/changeHandlers.go index 2ba466212cd3e54691287fd972cbd5c8a031fdb3..80350f5fdd3ed10684d0816cb325de06d3756e56 100644 --- a/node/changeHandlers.go +++ b/node/changeHandlers.go @@ -117,40 +117,49 @@ func NotStarted(instance *internal.Instance) error { pollDelay := 1 * time.Second - for err != nil && (strings.Contains(err.Error(), ndf.NO_NDF) || strings.Contains(err.Error(), cannotPingErr)) { - time.After(pollDelay) - + for err != nil { var permResponse *mixmessages.PermissionPollResponse // Blocking call: Request ndf from permissioning permResponse, err = permissioning.PollPermissioning(permHost, instance, current.NOT_STARTED) if err == nil { - //find certs in NDF if they are nto already had - if !isRegistered { - err = permissioning.FindSelfInNdf(ourDef, - instance.GetConsensus().GetFullNdf().Get()) - if err != nil { - //if certs are not in NDF, redo the poll - continue + //check if an NDF is returned + if permResponse == nil || permResponse.FullNDF == nil || len(permResponse.FullNDF.Ndf) == 0 { + err = errors.New("NDF returned incomplete") + } else { + //update NDF + err = permissioning.UpdateNDf(permResponse, instance) + // find certs in NDF in order to detect that permissioning views + // this server as online + if err == nil && !permissioning.FindSelfInNdf(ourDef, + instance.GetConsensus().GetFullNdf().Get()) { + err = errors.New("Could not find self in NDF, polling" + + " again") } } - - err = permissioning.UpdateNDf(permResponse, instance) } - } - // Check for unexpected errors (ie errors from polling other than NO_NDF) - if err != nil { - return errors.Errorf("Failed to get ndf: %+v", err) + //if there is an error, print it + if err != nil { + jww.WARN.Printf("Poll of permissioning failed, will "+ + "try again in %s: %s", pollDelay, err) + } + //sleep in order to not overwhelm permissioning + time.Sleep(pollDelay) } - // Then we ping the server and attempt on that port + // Then we ping ourselfs to make sure we can communicate host, exists := instance.GetNetwork().GetHost(instance.GetID()) if exists && host.IsOnline() { jww.DEBUG.Printf("Successfully contacted local address!") + } else if exists { + return errors.Errorf("unable to contact local address: %s", + host.GetAddress()) } else { - return errors.New("unable to contact local address") + return errors.Errorf("unable to find host to try contacting " + + "the local address") } + //init the database cmixGrp := instance.GetConsensus().GetCmixGroup() userDatabase := instance.GetUserRegistry() diff --git a/permissioning/permissioning.go b/permissioning/permissioning.go index 0ae45b0750ef236c01062f9002b1f425db427d65..21f6e62bdd178cf35dc01e6ff7d3082e998e354a 100644 --- a/permissioning/permissioning.go +++ b/permissioning/permissioning.go @@ -399,13 +399,13 @@ func UpdateNDf(permissioningResponse *pb.PermissionPollResponse, instance *inter } // FindSelfInNdf parses the ndf to determine if we exist in the ndf. -func FindSelfInNdf(def *internal.Definition, newNdf *ndf.NetworkDefinition) error { +func FindSelfInNdf(def *internal.Definition, newNdf *ndf.NetworkDefinition) bool { // Find this node's place in the newNDF for _, newNode := range newNdf.Nodes { // If we exist in the ndf, return no error - if bytes.Compare(newNode.ID, def.ID.Bytes()) == 0 { - return nil + if bytes.Equal(newNode.ID, def.ID.Bytes()) { + return true } } - return errors.New("Failed to find node in ndf, maybe node registration failed?") + return false } diff --git a/server.yaml b/server.yaml index b0a4b3d9fd562f5718deafab397f2465670091c4..1803cee37cd7e227a15ce2f46129dbf4343c338a 100644 --- a/server.yaml +++ b/server.yaml @@ -4,13 +4,13 @@ # Registration code used for first time registration. This is a unique code # provided by xx network. (Required) -registrationCode: "" +registrationCode: "[your registration code]" # Toggles use of the GPU. (Default true) useGPU: true # Level of debugging to print (0 = info, 1 = debug, >1 = trace). (Default info) -logLevel: 1 +logLevel: 0 node: paths: @@ -26,36 +26,38 @@ node: # Path to the private key associated with the self-signed TLS certificate. # (Required) key: "/opt/xxnetwork/creds/node_key.key" - # Path where log file will be saved. + # Path where log file will be saved. (Default "./node.log") log: "/opt/xxnetwork/node-logs/node.log" # Port that the Node will communicate on. (Required) - port: 42069 + port: 11420 # Local IP address of the Node, used for internal listening. Expects an IPv4 # address without a port. (default "0.0.0.0") - listeningAddress: "" - # The public IPv4 address of the Node, as reported to the network, to be used - # instead of dynamically looking up Node's own IP address via pinging external - # services. If a port is not included, then the port from the port flag is - # used instead. - overridePublicIP: "" - # If set, then it is used to override the internal IP address. Expects an IPv4 - # address with or without a port. If no port is included, then the port from - # the port flag is used. - overrideInternalIP: "" + # WARNING: Do not modify this option unless explicitly required. + #listeningAddress: "0.0.0.0" + # The public IPv4 address of the Node, as reported to the network. When not + # set, external IP address lookup services are used to set this value. If a + # port is not included, then the port from the port flag is used instead. + # WARNING: Do not modify this option unless explicitly required. + #overridePublicIP: "1.2.3.4" + # If set, then it is used to override the internal IP address used to contact + # yourself. Expects an IPv4 address with or without a port. If no port is + # included, then the port from the port flag is used. + # WARNING: Do not modify this option unless explicitly required. + #overrideInternalIP: "0.0.0.1" # Information to connect to the Postgres database storing keys. (Required) database: name: "cmix_node" address: "0.0.0.0:5432" username: "cmix" - password: "" + password: "[password for database]" # Information to communicate with this Node's Gateway. gateway: paths: # Path to the self-signed TLS certificate for Gateway. Expects PEM format. # (Required) - cert: "/opt/xxnetwork/creds/gateway-cert.crt" + cert: "/opt/xxnetwork/creds/gateway_cert.crt" permissioning: paths: @@ -63,8 +65,8 @@ permissioning: # Expects PEM format. (Required) cert: "/opt/xxnetwork/creds/permissioning_cert.crt" # IP Address of the Permissioning server, provided by xx network. (Required) - address: "" + address: "permissioning.prod.cmix.rip:11420" metrics: # Path to store metrics logs. - log: "/opt/xxnetwork/server-logs/metrics.log" \ No newline at end of file + log: "/opt/xxnetwork/node-logs/metrics.log" \ No newline at end of file