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

add citrix_waf package #3425

Merged
merged 9 commits into from
Jul 20, 2022
Merged

add citrix_waf package #3425

merged 9 commits into from
Jul 20, 2022

Conversation

efd6
Copy link
Contributor

@efd6 efd6 commented May 25, 2022

What does this PR do?

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.

Author's Checklist

  • Dashboard will be in a follow-up PR
  • Native Citrix format extended data is not handled as I have been unable to find a specification for it. If this becomes available it will also be in a follow-up PR. From what I can see with other ingesters, people tell users to configure their Citrix device to send logs in CEF.

How to test this PR locally

Related issues

Screenshots

@efd6 efd6 self-assigned this May 25, 2022
@elasticmachine
Copy link

elasticmachine commented May 25, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-07-20T21:22:12.115+0000

  • Duration: 19 min 50 sec

Test stats 🧪

Test Results
Failed 0
Passed 9
Skipped 0
Total 9

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

@efd6 efd6 force-pushed the 1308-citrix_waf branch 3 times, most recently from aa0aa06 to 7414d01 Compare May 25, 2022 09:30
@elasticmachine
Copy link

elasticmachine commented May 25, 2022

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (1/1) 💚
Files 100.0% (3/3) 💚 3.012
Classes 100.0% (3/3) 💚 3.012
Methods 100.0% (21/21) 💚 10.95
Lines 97.561% (240/246) 👍 7.082
Conditionals 100.0% (0/0) 💚

@efd6 efd6 changed the title wip add citrix_waf package Jun 21, 2022
@efd6 efd6 requested a review from a team June 21, 2022 07:05
@efd6 efd6 added the Integration:citrix_waf Citrix Web App Firewall label Jun 21, 2022
@efd6 efd6 marked this pull request as ready for review June 21, 2022 07:08
@elasticmachine
Copy link

Pinging @elastic/security-external-integrations (Team:Security-External Integrations)

@efd6 efd6 force-pushed the 1308-citrix_waf branch 2 times, most recently from fead6ac to 700931e Compare June 21, 2022 23:34
@efd6 efd6 requested a review from taylor-swanson June 29, 2022 06:58
"message": "CEF:0|Citrix|NetScaler|NS11.0|APPFW|APPFW_STARTURL|6|src=175.16.199.1 spt=47606 method=GET request=http://aaron.stratum8.net/FFC/login.html msg=Disallow Illegal URL. cn1=1340 cn2=653 cs1=pr_ffc cs2=PPE1 cs3=EsdGd3VD0OaaURLcZnj05Y6DOmE0002 cs4=ALERT cs5=2015 act=blocked",
"severity": 6,
"timezone": "UTC",
"url": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is an error event.url?

- rename:
# request – request URL
field: citrix.extended_kv.request
target_field: event.url.original
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably should be url.original

Comment on lines 86 to 89
- uri_parts:
field: event.url.original
target_field: event.url
ignore_failure: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same about the url not event.url??

@@ -0,0 +1,6 @@
# newer versions go on top
- version: "0.0.1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any specific reason we would want to start off with experimental, compared to beta or ga?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually release mine as GA as long as you have functional system and pipeline tests with good test data.
If not then I release as beta, unless again it has new functionality like a new filebeat input.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will bump to beta until I have the dashboard in place — next PR.

description: Pipeline for Citrix CEF messages
processors:
- set:
field: event.cef_format
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please dont use ECS root fields for non ECS fields, better then to use citrix.*

override: false
- set:
field: event.timezone
value: '{{{_conf.tz_offset}}}'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also use copy_from rather than using a template value, as it is safer.

field: _tmp.timestamp
if: ctx._tmp?.timestamp != null && ctx.citrix?.event_year != null
value: "{{{citrix.event_year}}} {{{_tmp.timestamp}}}"
- date:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Date formats are quite expensive, are you sure we need all of them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have seen a wide variety in the documentation and it is deeply underspecified.

description: Pipeline for Citrix Native messages
processors:
- set:
field: event.cef_format
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here with using a non ECS root field

value: false
- grok:
description: Extract native header and message.
field: event.message
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here with using a non ECS root field

field: citrix.event_year
ignore_failure: true

- geoip:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a common set of geoip processors that we reuse on a lot of our ingest pipelines, is this something we could use instead? Feel free to modify it to fit your usecase.

# IP Geolocation Lookup
  - geoip:
      field: source.ip
      target_field: source.geo
      ignore_missing: true
  - geoip:
      field: destination.ip
      target_field: destination.geo
      ignore_missing: true

  # IP Autonomous System (AS) Lookup
  - geoip:
      database_file: GeoLite2-ASN.mmdb
      field: source.ip
      target_field: source.as
      properties:
      - asn
      - organization_name
      ignore_missing: true
  - geoip:
      database_file: GeoLite2-ASN.mmdb
      field: destination.ip
      target_field: destination.as
      properties:
      - asn
      - organization_name
      ignore_missing: true
  - rename:
      field: source.as.asn
      target_field: source.as.number
      ignore_missing: true
  - rename:
      field: source.as.organization_name
      target_field: source.as.organization.name
      ignore_missing: true
  - rename:
      field: destination.as.asn
      target_field: destination.as.number
      ignore_missing: true
  - rename:
      field: destination.as.organization_name
      target_field: destination.as.organization.name
      ignore_missing: true

- uri_parts:
field: url.original
target_field: url
ignore_failure: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually try to not use ignore_failures, as both the CI and the end user wont tell us if there are any errors. Are there any other ways we can do this? like a IF statement?

field:
- _tmp
- _conf
ignore_failure: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change this to ignore_missing?

@efd6 efd6 requested a review from P1llus July 12, 2022 07:10
required: false
show_user: false
default: |
#max_connections: 1
Copy link
Member

@andrewkroh andrewkroh Jul 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One setting I recommend for both UDP and TCP is to include a max_message_size. IIRC the default value is like 20 MiB which is way too big and wastes memory.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The WAF messages are fairly small, so I've suggested 10kB and also added a udp_options field.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I suggest having that option uncommented so most users are using it by default when they enable this.

@efd6 efd6 requested a review from andrewkroh July 20, 2022 02:17
@efd6 efd6 merged commit 404ceb2 into elastic:main Jul 20, 2022
@efd6 efd6 deleted the 1308-citrix_waf branch July 20, 2022 22:19
show_user: false
default: |
max_message_size: 10KiB
read_buffer_size: 10KiB
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find any evidence that this read_buffer_size parameter exists. Do you know where this is used in the code?

Copy link
Contributor Author

@efd6 efd6 Jul 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used in the UDP package. Apparently it is useless there too. Nope, called read_buffer in beats.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Integration:citrix_waf Citrix Web App Firewall New Integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants