correct distribution of PSKs

This commit is contained in:
Callan Bryant 2020-03-05 22:18:21 +00:00
parent b697afc2ee
commit 78b28be231
No known key found for this signature in database
GPG Key ID: C31FA9DF3ACBFFAA
3 changed files with 2 additions and 8 deletions

3
add.go
View File

@ -51,12 +51,11 @@ func PrintPeerCfg(peer PeerConfig, conf *DsnetConfig) {
const peerConf = `[Interface] const peerConf = `[Interface]
Address = {{ .Peer.IP }} Address = {{ .Peer.IP }}
PrivateKey={{ .Peer.PrivateKey.Key }} PrivateKey={{ .Peer.PrivateKey.Key }}
PresharedKey={{ .Peer.PresharedKey.Key }}
DNS = {{ .DsnetConfig.DNS }} DNS = {{ .DsnetConfig.DNS }}
[Peer] [Peer]
PublicKey={{ .DsnetConfig.PrivateKey.PublicKey.Key }} PublicKey={{ .DsnetConfig.PrivateKey.PublicKey.Key }}
PresharedKey={{ .DsnetConfig.PresharedKey.Key }} PresharedKey={{ .Peer.PresharedKey.Key }}
Endpoint={{ .DsnetConfig.ExternalIP }}:{{ .DsnetConfig.ListenPort }} Endpoint={{ .DsnetConfig.ExternalIP }}:{{ .DsnetConfig.ListenPort }}
#AllowedIPs=0.0.0.0/0 #AllowedIPs=0.0.0.0/0
AllowedIPs={{ .DsnetConfig.Network }} AllowedIPs={{ .DsnetConfig.Network }}

View File

@ -44,7 +44,6 @@ type DsnetConfig struct {
// TODO Default subnets to route via VPN // TODO Default subnets to route via VPN
ReportFile string `validate:"required"` ReportFile string `validate:"required"`
PrivateKey JSONKey `validate:"required,len=44"` PrivateKey JSONKey `validate:"required,len=44"`
PresharedKey JSONKey `validate:"required,len=44"`
Peers []PeerConfig `validate:"dive"` Peers []PeerConfig `validate:"dive"`
} }

View File

@ -18,12 +18,8 @@ func Init() {
ExitFail("Refusing to overwrite existing %s", CONFIG_FILE) ExitFail("Refusing to overwrite existing %s", CONFIG_FILE)
} }
privateKey := GenerateJSONPrivateKey()
presharedKey := GenerateJSONKey()
conf := DsnetConfig{ conf := DsnetConfig{
PrivateKey: privateKey, PrivateKey: GenerateJSONPrivateKey()
PresharedKey: presharedKey,
ListenPort: DEFAULT_LISTEN_PORT, ListenPort: DEFAULT_LISTEN_PORT,
Network: getRandomNetwork(), Network: getRandomNetwork(),
Peers: []PeerConfig{}, Peers: []PeerConfig{},