Academia.eduAcademia.edu

Monitoring {DNS} with Open-Source Solutions

2018

Monitoring DNS with Open-Source Solutions Felipe Espinoza - Javier Bustos-Jiménez NIC Chile Research Labs Context: NIC Chile (.cl ccTLD) operations ● Administrator of the “.cl” ccTLD. ● More than 550,000 registered domains. ○ Netnod ● 26+ nodes directly managed on 10+ countries. ○ Packet Clearing House (PCH) ● Two external DNS clouds 2 Context: why is DNS monitoring interesting? ● 2016: Dyn DNS attack. ● More than 1,200 affected domains. ● Peak of 1.2 Tb/s. ● 2 hours between detection and resolution. Image from Merit.edu 3 Context: why is DNS monitoring interesting? Image from Merit.edu 4 How is DNS Monitored? ● ● ● DNS Statistics Collector (DSC) ● Pre-Aggregated Data ● QTYPE ● OPCODE ● RCODE ● … ● Pos-Aggregation ● Stats by server DNS-STATS ENTRADA ● Transfer pcap files ● Hadoop Cluster for processing 5 First Try: Develop our own solution We developed RaTA DNS (Real Time Analysis of DNS packets) ● ● ● Capture and reduce information. Transfer results over REDIS Queue. Show the information on our own presenter. Were we reinventing the wheel? Fun fact: dnsadmins didn’t liked it because the visual interface was too much white and clean. 6 Second Try: Use Open Source Software ● Instead of developing everything, integrate different open source software. ● Many parts of a monitoring system have already been developed. ● Many of them are used in production. 7 What we wanted to measure? ● Packet Metadata ● DNS Query/Response ○ Datetime ○ QR ○ Server Name ○ OpCode ○ IP Version ○ Class ○ IP Prefix ○ Type ○ Network Protocol ○ Edns0 ○ Size ○ DoBit ○ ResponseCode ○ Question 8 Requirements Storage DNS Packet Capture Visualization ● Secure ● Unitary ● Fast Access ● Fast ● Compressed ● Relevant Information ● Low Cost ● Fast to process ● Alert Abnormalities ● Big Volume of Information ● Scalable 9 Software to analyze Storage Capture Visualization ● PacketBeat ● Prometheus ● Kibana ● Collectd ● Druid ● Grafana ● Fievel ● ClickHouse ● Graphite ● DSC ● InfluxDB ● gopassivedns ● ElasticSearch ● OpenTSDB 10 Packet Capture IPv4 IPv4 Fragmented IPv6 IPv6 Fragmented UDP Fievel ✔ ✔ ✔ Packetbeat ✔ ✔ ✔ collectd ✔ ✔ ✔ dsc ✔ gopassivedns ✔ ✔ ✔ ✔ TCP Disaggregated Information ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ 11 Packet Capture ● ● DnsZeppelin: DNS Packet capturer. ○ Based on PacketBeat and gopassivedns. ○ Fragmented IP Assembly. ○ TCP Assembly. ○ Direct connection to database system. Source code: https://github.com/niclabs/dnszeppelin 12 Software to analyze Storage Capture Visualization ● PacketBeat ● Prometheus ● Kibana ● Collectd ● Druid ● Grafana ● Fievel ● ClickHouse ● Graphite ● DSC ● InfluxDB ● gopassivedns ● ElasticSearch ● DnsZeppelin ✔ ● OpenTSDB 13 Benchmark ● CPU: Intel(R) Core(TM) i5-4200U. ● Cores: 2. ● Threads: 2. ● Primary Memory: 8GiB DDR3 1600. ● CPU Usage ● Operating System: Ubuntu 14.04 LTS. ● Primary Memory ● Architecture: x64 ● Secondary Memory ● Query Time ● Testing rate: 3,000 Packets/Second. 14 Benchmark * ElasticSearch stopped answering query's after 3 hours of the benchmark. 15 16 Software to analyze Storage Capture ● ● ● ● ● ● PacketBeat Collectd Fievel DSC gopassivedns DnsZeppelin ✔ ● ● ● ● ● ● Prometheus Druid ClickHouse ✔ InfluxDB ElasticSearch OpenTSDB Visualization ● ● ● Kibana Grafana Graphite 17 Visualization Prometheus Kibana Grafana Graphite Druid ClickHouse InfluxDB ✔ ✔ ElasticSearch OpenTSDB ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ 18 Software to analyze Storage Capture Visualization ● PacketBeat ● Prometheus ● Kibana ● Collectd ● Druid ● Grafana ✔ ● Fievel ● ClickHouse ✔ ● Graphite ● DSC ● InfluxDB ● gopassivedns ● ElasticSearch ● DnsZeppelin ✔ ● OpenTSDB 19 Resulted System 20 Architecture Capture ... DNS Server Capture Capture ClickHouse Storage Visualization 21 Load Simulation ● Normal Simulation: ● Packets/Second: ~7,000 pps ● Time running: 36 Hours ● Total packet count: ~927,000,000 ● Total uncompressed data: 52 GB ● Total compressed data: 7.1 GB ● Compressed packet size: ~8.3 Bytes 22 Load Simulation ● Normal Simulation: ● Flood Simulation: ● Packets/Second: ~7,000 qps ● Packets/Second: 120,000 qps ● Time running: 36 Hours ● Average CPU Usage: 30% ● Total packet count: ~927,000,000 ● Total uncompressed data: 52 GB ● Total compressed data: 7.1 GB ● Compressed packet size: ~8.3 Bytes 23 Grafana Panel 24 Grafana Panel 25 Grafana Panel 26 Grafana Panel 27 SQL Interface ● Query individual DNS packet. ● Show last ServFail 28 Alerting ● Grafana Alerting ○ Define thresholds. ○ Send messages on start/end of events. 29 Attack Example ● Typical DNS packet flood. ● What type of attack is it? 30 Attack Example 31 Attack Example ● <randomstring>.cl ● ISP don’t have query cached. ● Random DNS Query Attack. 32 Attack Example 33 Attack Example ● example.cl ● ISP have query cached. ● Packets are easier to craft. 34 Limitations ● Currently it’s not handling all the data in the DNS packet. ● Require small modifications to use the distributed capabilities of ClickHouse. ● The alert system is too simple. 35 tl;dr ● Working DNS Monitoring Solution ● DnsZeppelin ● ClickHouse ● Grafana ● Make our monitoring more intelligent. ● Use open source software. 36 Questions? Source code: https://github.com/niclabs/dnszeppelin-clickhouse Felipe Espinoza - [email protected] Javier Bustos - [email protected] 37