From 78b28be231efc3d0841c5457fe298a5350cdaf13 Mon Sep 17 00:00:00 2001 From: Callan Bryant Date: Thu, 5 Mar 2020 22:18:21 +0000 Subject: [PATCH] correct distribution of PSKs --- add.go | 3 +-- configtypes.go | 1 - init.go | 6 +----- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/add.go b/add.go index 43ee8e9..7517329 100644 --- a/add.go +++ b/add.go @@ -51,12 +51,11 @@ func PrintPeerCfg(peer PeerConfig, conf *DsnetConfig) { const peerConf = `[Interface] Address = {{ .Peer.IP }} PrivateKey={{ .Peer.PrivateKey.Key }} -PresharedKey={{ .Peer.PresharedKey.Key }} DNS = {{ .DsnetConfig.DNS }} [Peer] PublicKey={{ .DsnetConfig.PrivateKey.PublicKey.Key }} -PresharedKey={{ .DsnetConfig.PresharedKey.Key }} +PresharedKey={{ .Peer.PresharedKey.Key }} Endpoint={{ .DsnetConfig.ExternalIP }}:{{ .DsnetConfig.ListenPort }} #AllowedIPs=0.0.0.0/0 AllowedIPs={{ .DsnetConfig.Network }} diff --git a/configtypes.go b/configtypes.go index 3cbf728..95b90dd 100644 --- a/configtypes.go +++ b/configtypes.go @@ -44,7 +44,6 @@ type DsnetConfig struct { // TODO Default subnets to route via VPN ReportFile string `validate:"required"` PrivateKey JSONKey `validate:"required,len=44"` - PresharedKey JSONKey `validate:"required,len=44"` Peers []PeerConfig `validate:"dive"` } diff --git a/init.go b/init.go index 92d91ae..01d3df3 100644 --- a/init.go +++ b/init.go @@ -18,12 +18,8 @@ func Init() { ExitFail("Refusing to overwrite existing %s", CONFIG_FILE) } - privateKey := GenerateJSONPrivateKey() - presharedKey := GenerateJSONKey() - conf := DsnetConfig{ - PrivateKey: privateKey, - PresharedKey: presharedKey, + PrivateKey: GenerateJSONPrivateKey() ListenPort: DEFAULT_LISTEN_PORT, Network: getRandomNetwork(), Peers: []PeerConfig{},