Skip to content

Commit

Permalink
Change phantom_blocklist behavior (#75)
Browse files Browse the repository at this point in the history
* Still send phantom blocklisted IPs to registration API, but ignore them locally

* updated comment

Co-authored-by: Jack Wampler <jmwample@users.noreply.github.com>
  • Loading branch information
ewust and jmwample committed Mar 4, 2021
1 parent 6180fba commit 08eb9b5
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions application/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,15 @@ func get_zmq_updates(connectAddr string, regManager *cj.RegistrationManager, con
go tryShareRegistrationOverAPI(reg, conf.PreshareEndpoint)
}


if conf.IsBlocklistedPhantom(reg.DarkDecoy) {
// Note: Phantom blocklist is applied at this stage because the phantom may only be blocked on this
// station. We may want other stations to be informed about the registration, but prevent this station
// specifically from handling / interfering in any subsequent connection. See PR #75
logger.Printf("ignoring registration with blocklisted phantom: %s %v", reg.IDString(), reg.DarkDecoy)
continue
}

// validate the registration
regManager.AddRegistration(reg)
logger.Printf("Adding registration %v\n", reg.IDString())
Expand Down Expand Up @@ -328,14 +337,9 @@ func recieve_zmq_message(sub *zmq.Socket, regManager *cj.RegistrationManager, co
logger.Printf("Failed to create registration: %v", err)
return nil, err
}
if conf.IsBlocklistedPhantom(reg.DarkDecoy) {
logger.Printf("ignoring registration with blocklisted phantom: %s %v", reg.IDString(), reg.DarkDecoy)

} else {
// Received new registration, parse it and return
newRegs = append(newRegs, reg)
}

// Received new registration, parse it and return
newRegs = append(newRegs, reg)
}

if parsed.GetRegistrationPayload().GetV6Support() && conf.EnableIPv6 {
Expand All @@ -344,12 +348,8 @@ func recieve_zmq_message(sub *zmq.Socket, regManager *cj.RegistrationManager, co
logger.Printf("Failed to create registration: %v", err)
return nil, err
}
if conf.IsBlocklistedPhantom(reg.DarkDecoy) {
logger.Printf("ignoring registration with blocklisted phantom: %s %v", reg.IDString(), reg.DarkDecoy)
} else {
// add to list of new registrations to be processed.
newRegs = append(newRegs, reg)
}
// add to list of new registrations to be processed.
newRegs = append(newRegs, reg)
}

// log decoy connection and id string
Expand Down

0 comments on commit 08eb9b5

Please sign in to comment.