Ver Fonte

:arrow_up: Increase default generated key lengths

Ettore Di Giacinto há 3 anos atrás
pai
commit
441f85e46c
1 ficheiros alterados com 10 adições e 7 exclusões
  1. 10 7
      pkg/node/options.go

+ 10 - 7
pkg/node/options.go

@@ -244,22 +244,25 @@ func (y YAMLConnectionConfig) copy(mdns, dht bool, cfg *Config) {
 	cfg.MaxMessageSize = y.MaxMessageSize
 	cfg.MaxMessageSize = y.MaxMessageSize
 }
 }
 
 
+const defaultKeyLength = 24
+
 func GenerateNewConnectionData() *YAMLConnectionConfig {
 func GenerateNewConnectionData() *YAMLConnectionConfig {
+
 	return &YAMLConnectionConfig{
 	return &YAMLConnectionConfig{
 		MaxMessageSize: 20 << 20, // 20MB
 		MaxMessageSize: 20 << 20, // 20MB
-		RoomName:       utils.RandStringRunes(23),
-		Rendezvous:     utils.RandStringRunes(23),
-		MDNS:           utils.RandStringRunes(23),
+		RoomName:       utils.RandStringRunes(defaultKeyLength),
+		Rendezvous:     utils.RandStringRunes(defaultKeyLength),
+		MDNS:           utils.RandStringRunes(defaultKeyLength),
 		OTP: OTP{
 		OTP: OTP{
 			DHT: OTPConfig{
 			DHT: OTPConfig{
-				Key:      gotp.RandomSecret(16),
+				Key:      gotp.RandomSecret(defaultKeyLength),
 				Interval: 9000,
 				Interval: 9000,
-				Length:   12,
+				Length:   defaultKeyLength,
 			},
 			},
 			Crypto: OTPConfig{
 			Crypto: OTPConfig{
-				Key:      gotp.RandomSecret(16),
+				Key:      gotp.RandomSecret(defaultKeyLength),
 				Interval: 9000,
 				Interval: 9000,
-				Length:   12,
+				Length:   defaultKeyLength,
 			},
 			},
 		},
 		},
 	}
 	}