OPNsense Elastic Search mit PFELK

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen

Vorraussetzungen

Hardware

  • 8 - 32 GB RAM
  • 32 GB Festplattenspeicher für Docker und ELK Stack

Swap für mehr Stabilität entfernen

  • Falls eine Swap-Partition bei der Installation erstellt wurde, empfiehlt die Dokumentation, diese auszuschalten
  • swapoff -a
  • vim /etc/fstab # swap entfernen

Maximale Memory Maps erhöhen

  • vim /etc/sysctl.conf
vm.max_map_count=262144
  • sysctl -p

Installation

Download installer script from pfelk repository
Make script executable
  • chmod +x pfelk-installer.sh
Run installer script
  • sudo ./pfelk-installer.sh

Konfiguration

Enrollment token

Enrollment-token.png

Kibana Verification Code

Kcode.png

Logstash

  • cp pfelk/etc/pfelk/config/pipelines.yml /etc/logstash/
  • mkdir -p /etc/pfelk/logs
  • cp pfelk/etc/pfelk/scripts/error-data.sh /etc/pfelk/scripts/
  • chmod +x /etc/pfelk/scripts/error-data.sh
  • cp -r /etc/elasticsearch/certs /etc/logstash/config/
  • chown -R logstash:logstash /etc/logstash

Dienste aktivieren

  • systemctl daemon-reload
  • systemctl enable --now elasticsearch.service
  • systemctl enable --now kibana.service
  • systemctl enable --now logstash.service

Elastic

  • Enrollment-Key generieren und in die Weboberfläche eintragen
  • /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token --scope kibana
  • http://ip.elk.stack:5601
  • Kibana wird für einen Verifikationscode fragen
  • /usr/share/kibana/bin/kibana-verification-code
  • http://ip.elk.stack:5601
  • Falls das Passwort für den Nutzer elastic verloren gegangen ist, kann dieser so zurückgesetzt werden
  • /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic
  • http://ip.elk.stack:5601
user: elastic
pass: ******

Links