The next bit would be to create indices with different names instead of "wazuh-alerts-%{+YYYY.MM.dd}" so my idea for separting the alerts so we can assign permissions / roles with X-Pack is to modify the output based on the beats agent sending the logs, these would live in 2 separate config files in /etc/logstash/conf.d/:
Company1.conf:
# Wazuh - Logstash configuration file
## Remote Wazuh Manager - Filebeat input
input {
beats {
port => 5000
host => "Company 1 IP"
codec => "json_lines"
ssl => true
ssl_certificate => "/etc/logstash/logstash.crt"
ssl_key => "/etc/logstash/logstash.key"
}
}
## Local Wazuh Manager - JSON file input
#input {
# file {
# type => "wazuh-alerts"
# path => "/var/ossec/logs/alerts/alerts.json"
# codec => "json"
# }
#}
filter {
geoip {
source => "srcip"
target => "GeoLocation"
fields => ["city_name", "continent_code", "country_code2", "country_name", "region_name", "location"]
}
date {
match => ["timestamp", "ISO8601"]
target => "@timestamp"
}
mutate {
remove_field => [ "timestamp", "beat", "fields", "input_type", "tags", "count", "@version", "log", "offset", "type"]
}
}
output {
elasticsearch {
hosts => ["localhost:9200"]
index => "company1-alerts-%{+YYYY.MM.dd}"
document_type => "wazuh"
template => "/etc/logstash/wazuh-elastic5-template.json"
# template => "/etc/logstash/wazuh-elastic2-template.json"
template_name => "wazuh"
template_overwrite => true
}
}
Company2.conf:
# Wazuh - Logstash configuration file
## Remote Wazuh Manager - Filebeat input
input {
beats {
port => 5000
host => "Company 2 IP"
codec => "json_lines"
ssl => true
ssl_certificate => "/etc/logstash/logstash.crt"
ssl_key => "/etc/logstash/logstash.key"
}
}
## Local Wazuh Manager - JSON file input
#input {
# file {
# type => "wazuh-alerts"
# path => "/var/ossec/logs/alerts/alerts.json"
# codec => "json"
# }
#}
filter {
geoip {
source => "srcip"
target => "GeoLocation"
fields => ["city_name", "continent_code", "country_code2", "country_name", "region_name", "location"]
}
date {
match => ["timestamp", "ISO8601"]
target => "@timestamp"
}
mutate {
remove_field => [ "timestamp", "beat", "fields", "input_type", "tags", "count", "@version", "log", "offset", "type"]
}
}
output {
elasticsearch {
hosts => ["localhost:9200"]
index => "company2-alerts-%{+YYYY.MM.dd}"
document_type => "wazuh"
template => "/etc/logstash/wazuh-elastic5-template.json"
# template => "/etc/logstash/wazuh-elastic2-template.json"
template_name => "wazuh"
template_overwrite => true
}
}
Then in the Kibana front end we would have to define new index patterns:
company1-alerts-* & company2-alerts-*
I believe this would translate in to all users having index pattern matches for both companies logs, however we would then assign roles which would come with index level permissions so the only returned results would be on that companies index.
So we would create 2 roles, 1 for each companies IT team:
Company 1 role:
{
"cluster": [ "monitor" ],
"indices": [
{
"names": [ "company1-alerts-*" ],
"privileges": [ "read" ],
}
]
}
Company 2 role:
{
"cluster": [ "monitor" ],
"indices": [
{
"names": [ "company2-alerts-*" ],
"privileges": [ "read" ],
}
]
}
The Wazuh plugin. Now I know the Wazuh plugin is driven from both queries to the Elasticsearch API but also to the Wazuh manager API. This is where I don;t really know how to separate out the access to "agents" and "manager" to the front end.
Any and all thoughts are much appreciated!
Steve
--
You received this message because you are subscribed to the Google Groups "Wazuh mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wazuh+unsubscribe@googlegroups.com.
To post to this group, send email to wa...@googlegroups.com.
Visit this group at https://groups.google.com/group/wazuh.
To view this discussion on the web visit https://groups.google.com/d/msgid/wazuh/8c6dadfd-3fd0-4c4a-a802-a294cf9a58e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
filebeat:
prospectors:
- input_type: log
paths:
- "/var/ossec/logs/alerts/alerts.json"
fields:
company_name: my_company
document_type: json
json.message_key: log
json.keys_under_root: true
json.overwrite_keys: true
output {
if [company_name] == "company1" {
elasticsearch {
hosts => ["localhost:9200"]
index => "wazuh-alerts-company1-%{+YYYY.MM.dd}"
document_type => "wazuh"
template => "/etc/logstash/wazuh-elastic5-template.json"
template_name => "wazuh"
template_overwrite => true
}
}
if [company_name] == "company2" {
elasticsearch {
hosts => ["localhost:9200"]
index => "wazuh-alerts-company2-%{+YYYY.MM.dd}"
document_type => "wazuh"
template => "/etc/logstash/wazuh-elastic5-template.json"
template_name => "wazuh"
template_overwrite => true
}
}
}
index => "wazuh-alerts-%{company_name}-%{+YYYY.MM.dd}"
filebeat.prospectors:
- paths: ["/var/log/app/*.json"]
tags: ["company1"]
if "company1" in [tags] {
...
{
"indices": [
{
"names": [ "wazuh-*" ],
"privileges": [ "read" ],
"query": "{\"match\": {\"company_name\": \"company1\"}}"
}
]
}
To view this discussion on the web visit https://groups.google.com/d/msgid/wazuh/CAEb-Ba_9Bm6ctr2_iPeT5Sa9o9HO-So%3D1pX_Lv%3Di0iJv2sM3Mg%40mail.gmail.com.
https {
upstream escluster01 {
server es01.example.com;
server es02.example.com;
}
server {
listen *:2525;
listen [::]:2525;
server_name "localhost";
ssl on;
ssl_certificate /etc/nginx/ssl/cert.pem;
ssl_certificate_key /etc/nginx/ssl/server.key;
access_log /var/log/nginx/kibana.access.log;
error_log /var/log/nginx/kibana.error.log;
location / {
proxy_pass https://escluster01;
}
}
}
Failed to create monitoring event {:message=>"For path: events", :error=>"LogStash::Instrument::MetricStore::MetricNotFound"}
curl -XGET localhost:9200/.kibana/wazuh-configuration/_search?pretty
"hits" : [
{
"_index" : ".kibana",
"_type" : "wazuh-configuration",
"_id" : "AVnMgnTZPYNGMxxxx",
"_score" : 1.0,
"_source" : {
"api_user" : "foo",
"api_password" : "xxxx",
"url" : "http://x.x.x.x.x",
"api_port" : "55000",
"insecure" : "true",
"component" : "API",
"active" : "true",
"manager" : "vpc-xxx",
"extensions" : {
"oscap" : true,
"audit" : true,
"pci" : true
}
}
}
]
To view this discussion on the web visit https://groups.google.com/d/msgid/wazuh/cca33517-fb3f-4a25-9039-428473c4343b%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wazuh/82720223-57be-4865-b87c-57817c13aa6d%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wazuh/8b083e20-8afe-40b8-8d3d-18637cb239d7%40googlegroups.com.