This page describe which packages are needed for the CEP POCs, how install and configure them.
Note: For this demo, infrastructure is pretty small and simple, there is absolutely no security or reliability functionnalities configured. Don't use those configurations in production.
Demo has been tested on the latest CentOS 8 version (currently 8.0-1905).
Server-side prerequisites
System
yum -y install epel-release
yum update
yum upgrade
vi nano /etc/selinux/config
#Change SELINUX value to
SELINUX=disabled
systemctl stop firewalld
systemctl disable firewalld
reboot
Create a new yum repo file and add the following lines :
vi /etc/yum.repos.d/elasticsearch.repo
[elasticsearch-7.x]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
Java
Installation
sudo yum install java-1.8.0-openjdk
Elasticsearch
Installation
yum install elasticsearch
Configuration
Modify/add the following lines in Elasticsearch configuration file :
sudo vi /etc/elasticsearch/elasticsearch.yml
cluster.name: BOTES
node.name: Glooper
# If you have to change default data path
# Don't forget to change permissions for data folder
# chown -R elasticsearch:elasticsearch /opt/data/elasticsearch/
path.data: /opt/data/elasticsearch
path.logs: /var/log/elasticsearch
bootstrap.memory_lock: true
network.host: localhost
http.port: 9200
cluster.initial_master_nodes: ["$Your_Server_IP"]
Configure system and Elasticsearch for JVM memory usage :
sudo vi /etc/elasticsearch/jvm.options
-Xms2g
# Xmx must but set no more than 50% of total memory and no more than 32Gb
-Xmx2g
sudo vi /etc/security/limits.conf
# Add the following lines
elasticsearch soft memlock unlimited
elasticsearch hard memlock unlimited
sudo vi /etc/sysconfig/elasticsearch
# Modify the folloing lines
MAX_OPEN_FILES=65535
MAX_LOCKED_MEMORY=unlimited
sudo vi /usr/lib/systemd/system/elasticsearch.service
# Add the following line
LimitMEMLOCK=infinity
Modify/add the following lines in Kibana configuration file :
sudo vi /etc/kibana/kibana.yml
server.port: 5601
server.host: "$Your_Server_IP"
server.name: "BOTES"
elasticsearch.hosts: ["http://localhost:9200"]
# Node can be slow if in Raspberry Pi for example
elasticsearch.requestTimeout: 300000
cd /opt
wget http://apache.mirrors.ionfish.org/maven/maven-3/3.6.2/binaries/apache-maven-3.6.2-bin.tar.gz
tar xzf apache-maven-3.6.2-bin.tar.gz
rm -f apache-maven-3.6.2-bin.tar.gz
ln -s /opt/apache-maven-3.6.2/ /opt/maven
export M2_HOME=/opt/maven
export PATH=${M2_HOME}/bin:${PATH}
Flink
Installation
cd /opt
wget http://apache-mirror.8birdsvideo.com/flink/flink-1.9.0/flink-1.9.0-bin-scala_2.11.tgz
tar zxf flink-1.9.0-bin-scala_2.11.tgz
rm -f flink-1.9.0-bin-scala_2.11.tgz
ln -s /opt/flink-1.9.0/ /opt/flink
export FLINK_HOME=/opt/flink/
export PATH=$PATH:$FLINK_HOME/bin
Client-side prerequisites
The following prerequisites apply to clients. It can be configuration or software to collect logs, configuration to make logs more verbose or configuration to make host vulnerable to specifics CVE for the needs of a POC.
Windows
Sysmon
System Monitor (Sysmon) is a Windows system service and device driver that, once installed on a system, remains resident across system reboots to monitor and log system activity to the Windows event log. It provides detailed information about process creations, network connections, and changes to file creation time.
Extract "Sysmon.zip" folder where you want. (In my case directly in C:\)
Open a Powershell as Administrator and launch the following commands to install Winlog beat :
cd C:\winlogbeat-7.4.1-windows-x86_64
set-executionpolicy unrestricted
.\install-service-winlogbeat.ps1
Then go to "Services" and try to start Winlogbeat to validate installation.
Configuration
To configure Winlogbeat, modify the "winlogbeat.yml" file following your need. It's possible to send logs directly to Logstash and/or Elasticsearch, to add Event logs modules/sources, add processors and so on...
With this configuration, Winlogbeat will send logs to Logstash only, include Application, System, Security, Sysmon and TerminalServices-RemoteConnectionManager logs. The processors "add_locale" will also include Timezone in logs.
Linux
Metasploit
Metasploit can be easily installed with the following command :