diff --git a/peer/cwtch_peer.go b/peer/cwtch_peer.go index fe1691a..bc5df1e 100644 --- a/peer/cwtch_peer.go +++ b/peer/cwtch_peer.go @@ -10,7 +10,6 @@ import ( "encoding/json" "errors" "git.openprivacy.ca/openprivacy/log" - "runtime/debug" "strconv" "strings" "sync" @@ -299,12 +298,7 @@ func (cp *cwtchPeer) GetGroupState(groupid string) (connections.ConnectionState, func (cp *cwtchPeer) PeerWithOnion(onion string) { cp.mutex.Lock() defer cp.mutex.Unlock() - if contact, exists := cp.Profile.GetContact(onion); !exists { - if contact.IsServer() { - log.Debugf("Tried to peer with a server...should never happen so logging it to try and trace the path:") - debug.PrintStack() - return // ABORT - } + if _, exists := cp.Profile.GetContact(onion); !exists { cp.AddContact(onion, onion, model.AuthApproved) } cp.eventBus.Publish(event.NewEvent(event.PeerRequest, map[event.Field]string{event.RemotePeer: onion})) diff --git a/server/serverConfig.go b/server/serverConfig.go index 45e029f..4bed576 100644 --- a/server/serverConfig.go +++ b/server/serverConfig.go @@ -1,7 +1,6 @@ package server import ( - "crypto/rand" "cwtch.im/tapir/primitives" "encoding/json" "git.openprivacy.ca/openprivacy/log" @@ -49,9 +48,20 @@ func (config *Config) Save(dir, filename string) { func LoadConfig(configDir, filename string) Config { log.Infof("Loading config from %s\n", path.Join(configDir, filename)) config := Config{} - config.ConfigDir = configDir + + id, pk := primitives.InitializeEphemeralIdentity() + tid, tpk := primitives.InitializeEphemeralIdentity() + config.PrivateKey = pk + config.PublicKey = id.PublicKey() + config.TokenServerPrivateKey = tpk + config.TokenServerPublicKey = tid.PublicKey() config.MaxBufferLines = 100000 - config.ServerReporting.LogMetricsToFile = true + config.ServerReporting = Reporting{ + LogMetricsToFile: true, + ReportingGroupID: "", + ReportingServerAddr: "", + } + raw, err := ioutil.ReadFile(path.Join(configDir, filename)) if err == nil { err = json.Unmarshal(raw, &config) @@ -60,11 +70,6 @@ func LoadConfig(configDir, filename string) Config { log.Errorf("reading config: %v", err) } } - - if config.PrivateKey == nil { - config.PublicKey, config.PrivateKey, _ = ed25519.GenerateKey(rand.Reader) - } - // Always save (first time generation, new version with new variables populated) config.Save(configDir, filename) return config diff --git a/testing/cwtch_peer_server_integration_test.go b/testing/cwtch_peer_server_integration_test.go index 5e6f4ce..0173e56 100644 --- a/testing/cwtch_peer_server_integration_test.go +++ b/testing/cwtch_peer_server_integration_test.go @@ -116,6 +116,9 @@ func TestCwtchPeerIntegration(t *testing.T) { log.ExcludeFromPattern("pipeBridge") log.ExcludeFromPattern("tapir") os.RemoveAll("tor") + dataDir := path.Join(".", "tor") + os.MkdirAll(dataDir, 0700) + tor.GenerateTorrc("examplehashedpassword", "./tor/torrc") acn, err := tor.NewTorACNWithAuth(".", "", 9051, tor.HashedPasswordAuthenticator{Password: "examplehashedpassword"}) if err != nil { t.Fatalf("Could not start Tor: %v", err) diff --git a/testing/serverMonitorReport.txt b/testing/serverMonitorReport.txt new file mode 100644 index 0000000..56aadd3 --- /dev/null +++ b/testing/serverMonitorReport.txt @@ -0,0 +1,29 @@ +Uptime: 3m0.015645854s + +messages: +Minutes: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +Hours: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +Days: 0 0 0 0 0 0 0 +Weeks: 0 0 0 0 +Months: 0 0 0 0 0 0 0 0 0 0 0 0 + +Client Connections: +Minutes: 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +Hours: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +Days: 0 0 0 0 0 0 0 +Weeks: 0 0 0 0 +Months: 0 0 0 0 0 0 0 0 0 0 0 0 + +CPU: +Minutes: 0.00 100.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +Hours: 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +Days: 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +Weeks: 0.00 0.00 0.00 0.00 +Months: 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 + +Memory: +Minutes: 14MBs 14MBs 14MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs +Hours: 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs +Days: 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs +Weeks: 0MBs 0MBs 0MBs 0MBs +Months: 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs 0MBs