Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Filebeat] panos config option to set internal/external zones #22998

Merged
merged 3 commits into from
Dec 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Add new httpjson input features and mark old config ones for deprecation {pull}22320[22320]
- Add logic for external network.direction in sophos xg fileset {pull}22973[22973]
- Add `http.request.mime_type` for Elasticsearch audit log fileset. {pull}22975[22975]
- Add configuration option to set external and internal networks for panw panos fileset {pull}22998[22998]

*Heartbeat*

Expand Down
9 changes: 9 additions & 0 deletions x-pack/filebeat/filebeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1507,6 +1507,15 @@ filebeat.modules:
# Filebeat will choose the paths depending on your OS.
#var.paths:

# Set internal security zones. used to determine network.direction
# default "trust"
#var.internal_zones:

# Set external security zones. used to determine network.direction
# default "untrust"
#var.external_zones:


#------------------------------ PostgreSQL Module ------------------------------
#- module: postgresql
# Logs
Expand Down
9 changes: 9 additions & 0 deletions x-pack/filebeat/module/panw/_meta/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,12 @@
# Set custom paths for the log files. If left empty,
# Filebeat will choose the paths depending on your OS.
#var.paths:

# Set internal security zones. used to determine network.direction
# default "trust"
#var.internal_zones:

# Set external security zones. used to determine network.direction
# default "untrust"
#var.external_zones:

14 changes: 14 additions & 0 deletions x-pack/filebeat/module/panw/panos/config/input.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,20 @@ processors:
fields:
- csv

{{ if .external_zones }}
- add_fields:
target: _temp_
fields:
external_zones: {{ .external_zones | tojson }}
{{ end }}

{{ if .internal_zones }}
- add_fields:
target: _temp_
fields:
internal_zones: {{ .internal_zones | tojson }}
{{ end }}

- community_id: ~

- community_id:
Expand Down
50 changes: 44 additions & 6 deletions x-pack/filebeat/module/panw/panos/ingest/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,24 +134,62 @@ processors:
- set:
field: network.direction
value: inbound
if: 'ctx?.panw?.panos?.type == "TRAFFIC" && ctx?.panw?.panos?.source?.zone == "untrust" && ctx?.panw?.panos?.destination?.zone == "trust"'
if: >
ctx?.panw?.panos?.type == "TRAFFIC" &&
ctx?._temp_?.external_zones != null &&
ctx?._temp_?.internal_zones != null &&
ctx?.observer?.ingress?.zone != null &&
ctx?.observer?.egress?.zone != null &&
ctx._temp_.external_zones.contains(ctx.observer.ingress.zone) &&
ctx._temp_.internal_zones.contains(ctx.observer.egress.zone)
- set:
field: network.direction
value: outbound
if: 'ctx?.panw?.panos?.type == "TRAFFIC" && ctx?.panw?.panos?.source?.zone == "trust" && ctx?.panw?.panos?.destination?.zone == "untrust"'
if: >
ctx?.panw?.panos?.type == "TRAFFIC" &&
ctx?._temp_?.external_zones != null &&
ctx?._temp_?.internal_zones != null &&
ctx?.observer?.ingress?.zone != null &&
ctx?.observer?.egress?.zone != null &&
ctx._temp_.external_zones.contains(ctx.observer.egress.zone) &&
ctx._temp_.internal_zones.contains(ctx.observer.ingress.zone)
- set:
field: network.direction
value: internal
if: 'ctx?.panw?.panos?.type == "TRAFFIC" && ctx?.panw?.panos?.source?.zone == "trust" && ctx?.panw?.panos?.destination?.zone == "trust"'
if: >
ctx?.panw?.panos?.type == "TRAFFIC" &&
ctx?._temp_?.internal_zones != null &&
ctx?.observer?.ingress?.zone != null &&
ctx?.observer?.egress?.zone != null &&
ctx._temp_.internal_zones.contains(ctx.observer.egress.zone) &&
ctx._temp_.internal_zones.contains(ctx.observer.ingress.zone)
- set:
field: network.direction
value: external
if: 'ctx?.panw?.panos?.type == "TRAFFIC" && ctx?.panw?.panos?.source?.zone == "untrust" && ctx?.panw?.panos?.destination?.zone == "untrust"'
if: >
ctx?.panw?.panos?.type == "TRAFFIC" &&
ctx?._temp_?.external_zones != null &&
ctx?.observer?.ingress?.zone != null &&
ctx?.observer?.egress?.zone != null &&
ctx._temp_.external_zones.contains(ctx.observer.egress.zone) &&
ctx._temp_.external_zones.contains(ctx.observer.ingress.zone)
- set:
field: network.direction
value: unknown
if: 'ctx?.panw?.panos?.type == "TRAFFIC" && ((ctx?.panw?.panos?.source?.zone != "trust" && ctx?.panw?.panos?.source?.zone != "untrust") || (ctx?.panw?.panos?.destination?.zone != "trust" && ctx?.panw?.panos?.destination?.zone != "untrust"))'

if: >
ctx?.panw?.panos?.type == "TRAFFIC" &&
ctx?._temp_?.external_zones != null &&
ctx?._temp_?.internal_zones != null &&
(
(
!ctx._temp_.external_zones.contains(ctx?.observer?.egress?.zone) &&
!ctx._temp_.internal_zones.contains(ctx?.observer?.egress?.zone)
) ||
(
!ctx._temp_.external_zones.contains(ctx?.observer?.ingress?.zone) &&
!ctx._temp_.internal_zones.contains(ctx?.observer?.ingress?.zone)
)
)
# Set network.direction from threat direction (Threat logs).
- set:
field: network.direction
Expand Down
6 changes: 6 additions & 0 deletions x-pack/filebeat/module/panw/panos/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ var:
default: syslog
- name: community_id
default: true
- name: internal_zones
default:
- trust
- name: external_zones
default:
- untrust

ingest_pipeline: ingest/pipeline.yml
input: config/input.yml
Expand Down
9 changes: 9 additions & 0 deletions x-pack/filebeat/modules.d/panw.yml.disabled
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,12 @@
# Set custom paths for the log files. If left empty,
# Filebeat will choose the paths depending on your OS.
#var.paths:

# Set internal security zones. used to determine network.direction
# default "trust"
#var.internal_zones:

# Set external security zones. used to determine network.direction
# default "untrust"
#var.external_zones: