5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-26 15:21:37 +00:00

Enforce AllowedEncryptionPublicKeys for all peers inc. link-local

This commit is contained in:
Neil Alexander 2019-01-31 23:47:20 +00:00
parent 432f93de89
commit ec5f7d9879
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944

View File

@ -107,16 +107,11 @@ func (intf *linkInterface) handler() error {
} }
// Check if we're authorized to connect to this key / IP // Check if we're authorized to connect to this key / IP
if !intf.link.core.peers.isAllowedEncryptionPublicKey(&meta.box) { if !intf.link.core.peers.isAllowedEncryptionPublicKey(&meta.box) {
// Allow unauthorized peers if they're link-local intf.link.core.log.Debugf("%s connection to %s forbidden: AllowedEncryptionPublicKeys does not contain key %s",
raddrStr, _, _ := net.SplitHostPort(intf.info.remote)
raddr := net.ParseIP(raddrStr)
if !raddr.IsLinkLocalUnicast() {
intf.link.core.log.Debugf("%s connection to %s forbidden: AllowedEncryptionPublicKey does not contain key %s",
strings.ToUpper(intf.info.linkType), intf.info.remote, hex.EncodeToString(meta.box[:])) strings.ToUpper(intf.info.linkType), intf.info.remote, hex.EncodeToString(meta.box[:]))
intf.msgIO.close() intf.msgIO.close()
return nil return nil
} }
}
// Check if we already have a link to this node // Check if we already have a link to this node
intf.info.box = meta.box intf.info.box = meta.box
intf.info.sig = meta.sig intf.info.sig = meta.sig