Tie Flowspec filtering to the router's TCAM (1.17.1)
Flowspec was a flat network-wide licence. In reality the drop rules live in hardware TCAM, and the budget differs by platform, so flowspec is now a router-model capability: none on the used Rusty, a little on merchant-silicon and whitebox models, full on the big chassis. The flood is filtered only where the attacked POP's router can do it, and a bigger TCAM knocks it down further. The licence is gone; the NOC shows how many POPs are capable and the attack panel names the chassis doing the filtering.
This commit is contained in:
parent
c3b99df788
commit
5036f1a5a8
6 changed files with 76 additions and 56 deletions
|
|
@ -171,26 +171,29 @@ test('bank: the venture vultures take a share of revenue instead of payments', (
|
|||
assert.ok(Math.abs(ev('R.cost.revshare') - ev('R.revMo') * 0.1) < 1);
|
||||
});
|
||||
|
||||
test('a shaped DDoS eats capacity, and each tool answers it differently', () => {
|
||||
test('Flowspec is a router-model capability, and each tool answers a flood', () => {
|
||||
const { ev, errors } = load();
|
||||
// The capability table: full TCAM leaves least junk, basic more, none lets it all through.
|
||||
assert.ok(ev("FS_RES[2] < FS_RES[1] && FS_RES[1] < FS_RES[0] && FS_RES[0] === 1"), 'full trims more than basic, basic more than none');
|
||||
assert.ok(ev("RG.some(r=>r.fs===0) && RG.some(r=>r.fs===1) && RG.some(r=>r.fs===2)"), 'models span none/basic/full TCAM');
|
||||
// Start on the used Rusty Router (rgen 0), which has no Flowspec TCAM.
|
||||
ev("ACT.start({});S.cash=1e8;ACT.launchBB({city:'fra'});S.pops.fra.bb.d=200;ACT.buyTransit({city:'fra',net:'cog',tier:1});compute()");
|
||||
assert.equal(ev("fsAt('fra')"), 0, 'the Rusty POP cannot do Flowspec');
|
||||
const clean = ev('R.served');
|
||||
assert.ok(clean > 20, 'traffic flows before the attack');
|
||||
// A 300 Gbps DNS flood on fra, no mitigation: junk starves the exit and node.
|
||||
// A 300 Gbps DNS flood on fra: with no TCAM here the junk starves the exit and node.
|
||||
ev("S.ev.ddos={city:'fra',vec:'dns',gbps:300,until:S.day+3,entry:{k:'t',lab:'x'},bh:false,start:S.day};compute()");
|
||||
const attacked = ev('R.served');
|
||||
assert.ok(attacked < clean, 'the flood displaces real traffic');
|
||||
// Flowspec is a standing licence: it drops the known UDP vector at the edge.
|
||||
ev("ACT.buyFs();compute()");
|
||||
assert.equal(ev('S.ddosFs'), true);
|
||||
assert.ok(ev('R.served') > attacked, 'flowspec recovers a DNS flood');
|
||||
// It cannot touch an application-layer HTTP flood.
|
||||
const withFs = ev("S.ev.ddos.vec='http';compute();R.served");
|
||||
ev("S.ddosFs=false;compute()");
|
||||
assert.ok(Math.abs(withFs - ev('R.served')) < 1, 'flowspec is useless against HTTP');
|
||||
// Scrubbing cleans any vector network-wide.
|
||||
const none = ev('R.served');
|
||||
assert.ok(none < clean, 'an unfiltered flood displaces real traffic');
|
||||
// Give this same router Flowspec TCAM (holding its forwarding capacity fixed): the DNS flood is filtered.
|
||||
const full = ev("RG[0].fs=2;compute();R.served"); ev("RG[0].fs=0");
|
||||
assert.ok(full > none, 'a Flowspec-capable router recovers a known flood');
|
||||
// It cannot touch an application-layer HTTP flood, however big the TCAM.
|
||||
const http = ev("RG[0].fs=2;S.ev.ddos.vec='http';compute();const s=R.served;RG[0].fs=0;s");
|
||||
assert.ok(Math.abs(http - none) < 1, 'Flowspec is useless against HTTP');
|
||||
// Scrubbing cleans any vector, regardless of router.
|
||||
ev("S.ev.ddos.vec='dns';S.scrubAt='fra';compute()");
|
||||
assert.ok(ev('R.served') > attacked, 'scrubbing recovers real traffic');
|
||||
assert.ok(ev('R.served') > none, 'scrubbing recovers real traffic');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
|
|
@ -210,11 +213,13 @@ test('RTBH blackholes the victim, and HackBack 3000 is a gamble', () => {
|
|||
assert.equal(ev('S.stats.vigilante'), 1);
|
||||
});
|
||||
|
||||
test('old saves without DDoS fields load, and a junk attack object is repaired', () => {
|
||||
test('old saves load, and a stale flat DDoS object is repaired away', () => {
|
||||
const { ev } = load();
|
||||
ev("ACT.start({})");
|
||||
// An old save: no ddosFs, and a stale flat attack with no vector.
|
||||
const loaded = ev("const s=JSON.parse(JSON.stringify(S));delete s.ddosFs;s.ev={ddos:{city:'fra',until:9}};sanitize(s);JSON.stringify([s.ddosFs, s.ev.ddos===undefined])");
|
||||
assert.equal(JSON.parse(loaded)[0], false, 'ddosFs defaults to false');
|
||||
assert.equal(JSON.parse(loaded)[1], true, 'a vectorless attack is dropped');
|
||||
// An old save with a pre-1.17 flat attack (no vector) loads and the attack is dropped.
|
||||
const dropped = ev("const s=JSON.parse(JSON.stringify(S));s.ev={ddos:{city:'fra',until:9}};sanitize(s);s.ev.ddos===undefined");
|
||||
assert.equal(dropped, true, 'a vectorless attack is dropped');
|
||||
// A well-formed attack survives sanitize with its fields coerced.
|
||||
const kept = ev("const s=JSON.parse(JSON.stringify(S));s.ev={ddos:{city:'fra',vec:'dns',gbps:'80',until:9}};sanitize(s);JSON.stringify([s.ev.ddos&&s.ev.ddos.vec, s.ev.ddos&&s.ev.ddos.gbps])");
|
||||
assert.deepEqual(JSON.parse(kept), ['dns', 80], 'a shaped attack is kept, numbers coerced');
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue