Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 22 additions & 18 deletions application/lib/registration.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (regManager *RegistrationManager) GetWrappingTransports() map[pb.TransportT
return m
}

func (regManager *RegistrationManager) NewRegistration(c2s *pb.ClientToStation, conjureKeys *ConjureSharedKeys, includeV6 bool) (*DecoyRegistration, error) {
func (regManager *RegistrationManager) NewRegistration(c2s *pb.ClientToStation, conjureKeys *ConjureSharedKeys, includeV6 bool, registrationSource *pb.RegistrationSource) (*DecoyRegistration, error) {

phantomAddr, err := regManager.PhantomSelector.Select(
conjureKeys.DarkDecoySeed, uint(c2s.GetDecoyListGeneration()), includeV6)
Expand All @@ -126,15 +126,16 @@ func (regManager *RegistrationManager) NewRegistration(c2s *pb.ClientToStation,
}

reg := DecoyRegistration{
DarkDecoy: phantomAddr,
Keys: conjureKeys,
Covert: c2s.GetCovertAddress(),
Mask: c2s.GetMaskedDecoyServerName(),
Flags: c2s.Flags,
Transport: c2s.GetTransport(),
DecoyListVersion: c2s.GetDecoyListGeneration(),
RegistrationTime: time.Now(),
regCount: 0,
DarkDecoy: phantomAddr,
Keys: conjureKeys,
Covert: c2s.GetCovertAddress(),
Mask: c2s.GetMaskedDecoyServerName(),
Flags: c2s.Flags,
Transport: c2s.GetTransport(),
DecoyListVersion: c2s.GetDecoyListGeneration(),
RegistrationTime: time.Now(),
RegistrationSource: registrationSource,
regCount: 0,
}

return &reg, nil
Expand Down Expand Up @@ -162,14 +163,15 @@ func (regManager *RegistrationManager) RemoveOldRegistrations() {
}

type DecoyRegistration struct {
DarkDecoy net.IP
Keys *ConjureSharedKeys
Covert, Mask string
Flags *pb.RegistrationFlags
Transport pb.TransportType
RegistrationTime time.Time
DecoyListVersion uint32
regCount int32
DarkDecoy net.IP
Keys *ConjureSharedKeys
Covert, Mask string
Flags *pb.RegistrationFlags
Transport pb.TransportType
RegistrationTime time.Time
RegistrationSource *pb.RegistrationSource
DecoyListVersion uint32
regCount int32
}

// String -- Print a digest of the important identifying information for this registration.
Expand All @@ -188,6 +190,7 @@ func (reg *DecoyRegistration) String() string {
Transport pb.TransportType
RegTime time.Time
DecoyListVersion uint32
Source *pb.RegistrationSource
}{
Phantom: reg.DarkDecoy.String(),
SharedSecret: hex.EncodeToString(reg.Keys.SharedSecret),
Expand All @@ -197,6 +200,7 @@ func (reg *DecoyRegistration) String() string {
Transport: reg.Transport,
RegTime: reg.RegistrationTime,
DecoyListVersion: reg.DecoyListVersion,
Source: reg.RegistrationSource,
}
regStats, err := json.Marshal(stats)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions application/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func recieve_zmq_message(sub *zmq.Socket, regManager *dd.RegistrationManager) ([
var newRegs []*dd.DecoyRegistration

if parsed.RegistrationPayload.GetV4Support() {
reg, err := regManager.NewRegistration(parsed.RegistrationPayload, &conjureKeys, false)
reg, err := regManager.NewRegistration(parsed.RegistrationPayload, &conjureKeys, false, parsed.RegistrationSource)
if err != nil {
logger.Printf("Failed to create registration: %v", err)
return nil, err
Expand All @@ -229,7 +229,7 @@ func recieve_zmq_message(sub *zmq.Socket, regManager *dd.RegistrationManager) ([
}

if parsed.RegistrationPayload.GetV6Support() {
reg, err := regManager.NewRegistration(parsed.RegistrationPayload, &conjureKeys, true)
reg, err := regManager.NewRegistration(parsed.RegistrationPayload, &conjureKeys, true, parsed.RegistrationSource)
if err != nil {
logger.Printf("Failed to create registration: %v", err)
return nil, err
Expand Down
1 change: 1 addition & 0 deletions registration-api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func generateZMQPayload(clientToAPIProto *pb.ClientToAPI) ([]byte, error) {

payload.SharedSecret = clientToAPIProto.Secret
payload.RegistrationPayload = clientToAPIProto.RegistrationPayload
payload.RegistrationSource = pb.RegistrationSource_API.Enum()

return proto.Marshal(payload)
}
Expand Down
3 changes: 2 additions & 1 deletion src/process_packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use PerCoreGlobal;
use util::{IpPacket, FSP};
use elligator;
use protobuf::{Message, SingularPtrField};
use signalling::{ClientToStation, ZMQPayload};
use signalling::{ClientToStation, ZMQPayload, RegistrationSource};


const TLS_TYPE_APPLICATION_DATA: u8 = 0x17;
Expand Down Expand Up @@ -281,6 +281,7 @@ impl PerCoreGlobal
let mut vsp = res.2;
zmq_msg.set_shared_secret(shared_secret);
zmq_msg.registration_payload = SingularPtrField::some(vsp);
zmq_msg.set_registration_source(RegistrationSource::Detector);

let repr_str = hex::encode(res.0);
debug!("New registration {}, {}", flow, repr_str);
Expand Down
Loading