Add packaged DLP broker and protected Windows service foundation
This commit is contained in:
1 parent
95d23f4e0b
commit
7b5057901a
140 files changed
+11215
-60
No files matched your search
+17
@@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
const {createFramedChannel}=require('../../apps/network-broker/framed-channel.cjs');
|
||||
const channel=createFramedChannel({readable:process.stdin,writable:process.stdout,inboundFirstLimit:2097152});
|
||||
channel.once('disconnect',()=>process.exit(0));
|
||||
let context;
|
||||
channel.on('message',message=>{
|
||||
if(message.type==='start'){
|
||||
context={version:1,generation:message.generation,policyVersion:message.policyVersion};
|
||||
if(message.config.malformed){process.stdout.write(Buffer.from([1,0,0,0,0xff]));return;}
|
||||
channel.send({type:'ready',...context,authMode:'basic',sequence:0,port:message.config.port,credentials:{username:'safetynet-'+'a'.repeat(32),password:'b'.repeat(43)}},error=>{
|
||||
if(error)process.exit(2);
|
||||
if(message.config.audit){const id='12345678-1234-4234-8234-123456789abc';channel.send({type:'audit',...context,sequence:1,requestId:id,event:{eventId:id,kind:'upload.authorized',ruleId:'broker-approved',policyVersion:context.policyVersion,request:{bytes:0,detectedType:'text'}}});}
|
||||
});
|
||||
}else if(message.type==='audit-receipt'){
|
||||
if(message.receipt?.persisted!==true||message.receipt.eventId!==message.requestId)process.exit(3);
|
||||
}else process.exit(4);
|
||||
});
|
||||
Reference in new issue
Block a user