This article builds on the Docker testbed to demonstrate how advanced flow analytics can be used to separate the two types of traffic and detect the DDoS attack.
docker run --rm -d -e "COLLECTOR=host.docker.internal" -e "SAMPLING=100" \ --net=host -v /var/run/docker.sock:/var/run/docker.sock:ro \ --name=host-sflow sflow/host-sflowFirst, start a Host sFlow agent using the pre-built sflow/host-sflow image to generate the sFlow telemetry that would stream from the switches and routers in a production deployment.
setFlow('ddos_amplification', { keys:'ipdestination,udpsourceport', value: 'frames', values: ['count:ipsource'] }); setThreshold('ddos_amplification', { metric:'ddos_amplification', value: 10000, byFlow:true, timeout: 2 }); setEventHandler(function(event) { var [ipdestination,udpsourceport] = event.flowKey.split(','); var [sourcecount] = event.values; if(sourcecount === 1) { logInfo("bulk transfer to " + ipdestination); } else { logInfo("DDoS port " + udpsourceport + " against " + ipdestination); } },['ddos_amplification']);The ddos.js script above provides a simple demonstration of sFlow-RT's advanced flow analytics. The setFlow() function defines the a flow signature for detecting UDP amplification attacks, identifying the targetted IP address and the amplification protocol. In addition to the primary value of frames per second, a secondary value counting the number of ipsource addresses has been included. The setThreshold() function causes an event to by generated whenever a flow exceeds 10,000 frames per second. Finally, the setEventHandler() function defines how the events will be processed. See Writing Applications for more information on developing sFlow-RT applications.
docker run --rm -v $PWD/ddos.js:/sflow-rt/ddos.js \ -p 8008:8008 -p 6343:6343/udp --name sflow-rt \ sflow/prometheus -Dscript.file=ddos.jsStart sFlow-RT using pre-built sflow/prometheus image.
docker run --rm -it sflow/hping3 --flood --udp -k \ -p 443 host.docker.internalIn a separate window, simulate a bulk tranfer using pre-built sflow/hping3 image (use CTL+C to stop the attack).
2022-08-09T00:03:20Z INFO: bulk transfer to 192.168.65.2The transfer will be immediately detected and logged in the sFlow-RT window.
docker run --rm -it sflow/hping3 --flood --udp -k \ --rand-source -s 53 host.docker.internalSimulate a UDP amplification attack.
2022-08-09T00:05:19Z INFO: DDoS port 53 against 192.168.65.2The attack will be immmediately detected and logged in the sFlow-RT window.
The open source sFlow-RT ddos-protect application is a full featured DDoS mitigation solution that uses the advanced flow analytics features described in this article to detect a wide range of volumetric attacks. In addition, ddos-protect can automatically mitigate attacks using BGP remotely triggered blackhole (RTBH) or BGP Flowspec actions. DDoS protection quickstart guide describes how to test, deploy, and monitor the DDoS mitigation solution with examples using Arista, Cisco, and Juniper routers.
No comments:
Post a Comment