( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and...

41
12/30/2018 SNMP, SSH and Monitoring https://borchers.ninja/35c3/?print-pdf#/ 1/41 REPLACING SNMP WITH PYTHON REPLACING SNMP WITH PYTHON REPLACING SNMP WITH PYTHON REPLACING SNMP WITH PYTHON (PARAMIKO) AND ELK (PARAMIKO) AND ELK (PARAMIKO) AND ELK (PARAMIKO) AND ELK Eine Präsentation von Heiko Borchers

Transcript of ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and...

Page 1: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 1/41

REPLACING SNMP WITH PYTHONREPLACING SNMP WITH PYTHONREPLACING SNMP WITH PYTHONREPLACING SNMP WITH PYTHON

(PARAMIKO) AND ELK(PARAMIKO) AND ELK(PARAMIKO) AND ELK(PARAMIKO) AND ELK

Eine Präsentation von Heiko Borchers

Page 2: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 2/41

ALLGEMEINESALLGEMEINESALLGEMEINESALLGEMEINES

1. Wer bin ich

2. Das allgemeine Umfeld

3. SNMP Grundlagen

4. Enterprise WLAN

Page 3: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 3/41

WAS WURDE BENUTZTWAS WURDE BENUTZTWAS WURDE BENUTZTWAS WURDE BENUTZT

1. Verwendete Hardware

2. Verwendete Software

Page 4: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 4/41

UMSETZUNGUMSETZUNGUMSETZUNGUMSETZUNG

1. Anfänge

2. Produktiv Einsatz

3. Probleme

4. Ideen für die Zukunft

Page 5: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 5/41

ÜBER MICHÜBER MICHÜBER MICHÜBER MICH

(Ex) Mitarbeiter am ZIM der Heinrich Heine Universität

Vorher: Student an der Uni Bonn

Institutsadmin/Entwickler am CENs

Page 6: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 6/41

DIE HEINRICH HEINE UNIVERSITÄTDIE HEINRICH HEINE UNIVERSITÄTDIE HEINRICH HEINE UNIVERSITÄTDIE HEINRICH HEINE UNIVERSITÄT

Campus Universität im Süden von Düsseldorf

mit über 30.000 Studenten

und ca. 10.000 WLAN Devices täglich

Hardware von HP, aus verschiedenen Generationen. Gemischt

802.1g bis 802.1ac

900 WLAN APs auf 1,3km²

Page 7: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 7/41

SNMP GRUNDLAGENSNMP GRUNDLAGENSNMP GRUNDLAGENSNMP GRUNDLAGEN

SNMP: Simple Network Management Protocoll

Ermöglicht die Überwachung fast aller Netzwerkgeräte

Page 8: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 8/41

Vorteile von SNMP:

Page 9: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 9/41

Einfach zu konfigurieren

Hersteller übergreifender Standard

Strukturiert

Page 10: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 10/41

Nachteile von SNMP

Es ist Langsam

Fehlerbehaftet

UNSICHER!

Page 11: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 11/41

Page 12: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 12/41

ENTERPRISE WLANENTERPRISE WLANENTERPRISE WLANENTERPRISE WLAN

Page 13: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 13/41

Anders als das WLAN zuhause

Bei 900 APs auch kein Wunder

Page 14: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 14/41

Page 15: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 15/41

Page 16: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 16/41

VERWENDETE HARDWAREVERWENDETE HARDWAREVERWENDETE HARDWAREVERWENDETE HARDWARE

Page 17: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 17/41

CONTROLLER:CONTROLLER:CONTROLLER:CONTROLLER:

HPE Unified 870

Page 18: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 18/41

ACCESS POINT "WILDWUCHS":ACCESS POINT "WILDWUCHS":ACCESS POINT "WILDWUCHS":ACCESS POINT "WILDWUCHS":

Page 19: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 19/41

Page 20: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 20/41

Page 21: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 21/41

Page 22: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 22/41

VERWENDETE SOFTWAREVERWENDETE SOFTWAREVERWENDETE SOFTWAREVERWENDETE SOFTWARE

Page 23: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 23/41

HP IMC

Observium

Splunk

Ein Python Script

Page 24: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 24/41

HP IMCHP IMCHP IMCHP IMC

Page 25: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 25/41

Page 26: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 26/41

OBSERVIUMOBSERVIUMOBSERVIUMOBSERVIUM

Page 27: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 27/41

Page 28: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 28/41

SPLUNKSPLUNKSPLUNKSPLUNK

Page 29: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 29/41

Page 30: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 30/41

PRODUKTIV EINSATZPRODUKTIV EINSATZPRODUKTIV EINSATZPRODUKTIV EINSATZ

Page 31: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 31/41

Page 32: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 32/41

ANFÄNGEANFÄNGEANFÄNGEANFÄNGE

"Simples" Script mit 3 SSH befehlen zum Tracken einzelner

MAC-Adressen

Gibt nur Basis Informationen aus:

Verbundener AP, Signalstärke, Datenraten

elif (args.track): trackingtime = int(args.track) for i in range(0, trackingtime, 1): if i % 10 == 0: current_time = datetime.datetime.now().time().isoformat() current_time = current_time.isoformat() print(current_time) output = wlan_controller.ssh_befehl("dis wlan client mac-address " + macaddr + " dis wlan client mac-address " + macaddr + " verbose | inc RSSI

y dis wlan client mac-address " + macaddr + " verbose | inc Rx/Tx") ausgabe(output) time.sleep(1)

Page 33: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 33/41

Page 34: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 34/41

Netzwerkscript zur automatischen Erfassung aller Access Point

und Clients

APs alle 5min, Client 1x pro Stunde

Einlesen von "grafischen" Tabellen und Ausgabe in json Dateie

die von Splunk verarbeitet werden.

Page 35: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 35/41

def wlan_tabellen_parser(self, raw_table, heads): output_table = [] for line in raw_table: if (heads > 0): heads -= 1 else: if not line.startswith("--"): line = re.sub(r"\s{2,}", ',', line) line = re.sub(r"\s", '', line) ap = line.split(",") if not (len(ap) <= 3 or ap[0] == "APName"): output_table.append(ap) return(output_table)

Page 36: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 36/41

AP Name State Model Serial-ID -------------------------------------- $name R/M MSM460-WW xxx --------------------------------------------------- AP Name RID Channel Avg-AQ Min-AQ Interference --------------------------------------------------- $name 1 100 100 100 0 $name 2 1 99 99 0

{"APName": "$name", "ip": null, "status": "R/M", "model": "MSM460-WW", "serial": "xxx", "controller": "Unified_Nord", "avg_air_quality_2_4ghz": "99", "avg_air_quality_5ghz": "minimum_air_quality_2_4ghz": "99", "minimum_air_quality_5ghz": "100", "channel_2_4ghz"interference_2_4ghz": "0", "interference_5ghz": "0", "measurement_timestamp": "2017-05"channel_5ghz": "100"}

Page 37: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 37/41

PROBLEMEPROBLEMEPROBLEMEPROBLEME

DATENSCHUTZ!

Dauer des Scripts

Zuverlässigkeit der Controller

Page 38: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 38/41

IDEEN FÜR DIE ZUKUNFTIDEEN FÜR DIE ZUKUNFTIDEEN FÜR DIE ZUKUNFTIDEEN FÜR DIE ZUKUNFT

Portierung für openWRT

Eine Campus Karte mit Access Points und deren Auslastung

Besserer Schutz für die Privatsphäre der Nutzer

Page 39: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 39/41

DANKE FÜR EUREDANKE FÜR EUREDANKE FÜR EUREDANKE FÜR EURE

AUFMERKSAMKEITAUFMERKSAMKEITAUFMERKSAMKEITAUFMERKSAMKEIT

Page 40: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 40/41

QUELLENQUELLENQUELLENQUELLEN

Wikipedia zu SNMP

Splunk

HPE Homepage (für die meisten Bilder)

Observium

Quelltext mit Beispieldaten

Page 41: ( PA R A M I KO ) A N D E L K R E PL AC I N G S N M P WI T ... · 12/30/2018 SNMP, SSH and Monitoring  2/41 A L LG E M E I N E S 1. Wer bin ich 2 . Das allgem ein e Umfeld

12/30/2018 SNMP, SSH and Monitoring

https://borchers.ninja/35c3/?print-pdf#/ 41/41