Skip to content

New integration for SonicWall firewall#3365

Merged
adriansr merged 26 commits intoelastic:mainfrom
adriansr:new_sonicwall
May 24, 2022
Merged

New integration for SonicWall firewall#3365
adriansr merged 26 commits intoelastic:mainfrom
adriansr:new_sonicwall

Conversation

@adriansr
Copy link
Contributor

@adriansr adriansr commented May 17, 2022

What does this PR do?

This integration (sonicwall_firewall) allows to receive syslog messages from SonicOS devices.

Replaces the existing rsa2elk integration (sonicwall).

Uses logs and some ideas from #2729 by @jhaugh0.

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

  • Add system tests (file & udp)
  • Deprecate existing integration.
  • Dashboard
  • Document supported event types

Related issues

Screenshots

image
Screen Shot 2022-05-17 at 12 12 23

Dashboard:

Screenshot 2022-05-19 at 20-13-39 SonicWall Firewall Dashboard - Elastic

Deprecated package:
Screen Shot 2022-05-17 at 13 18 56

@elasticmachine
Copy link

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

@adriansr adriansr requested a review from a team May 17, 2022 10:16
@elasticmachine
Copy link

elasticmachine commented May 17, 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-05-24T07:16:41.771+0000

  • Duration: 16 min 47 sec

Test stats 🧪

Test Results
Failed 0
Passed 18
Skipped 0
Total 18

🤖 GitHub comments

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

  • /test : Re-trigger the build.

@elasticmachine
Copy link

elasticmachine commented May 17, 2022

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (2/2) 💚
Files 100.0% (2/2) 💚 3.778
Classes 100.0% (2/2) 💚 3.778
Methods 88.889% (24/27) 👍 0.265
Lines 97.487% (1164/1194) 👍 6.707
Conditionals 100.0% (0/0) 💚

@jamiehynds
Copy link

@adriansr is it possible to add a dashboard to avoid having to revisit down the line? Some potential resources on the dashboard:

Top 10 Source IPs
Activity by Protocol
Activity by Port
Denied Traffic on WAN Interface by Port
Denied Traffic on WAN Interface by Source Location
Top 10 Event Types (including count)
Opened and Closed Connections Over Time
VPN Logons by Username (successful and failed)

@jamiehynds
Copy link

@adriansr is it also possible to include the support log types within the integration description, to set expectations as to which events are covered? e.g. System, Users, VPN, Firewall. Full list available on page 5 here: https://www.sonicwall.com/techdocs/pdf/sonicos-6-5-4-log-events-reference-guide.pdf

@adriansr
Copy link
Contributor Author

sure @jamiehynds , will do

Copy link
Contributor

@efd6 efd6 left a comment

Choose a reason for hiding this comment

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

Minor comments only, otherwise LGTM.

- add_locale: ~
{{#if processors}}
{{processors}}
{{/if}} No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: final newline

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

- name: sonicwall
type: group
fields:
- name: firewall
Copy link
Contributor

Choose a reason for hiding this comment

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

Worth a description of the data that would be here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

description: Extracts optional port number from src nat field
ignore_missing: true
patterns:
- '^%{IPV4:source.nat.ip}:%{POSINT:source.nat.port}$'
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we see IPv6 IPs here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one is there to handle the (undocumented) case of the nat field being ip:port instead of ip. I've only observed this with IPv4, not sure if that can happen with IPv6 and what the format would be.

Just in case I added support for [ipv6]:port, which in my understanding is a common way of appending a port to an IPv6 address.

Copy link
Contributor

@efd6 efd6 May 23, 2022

Choose a reason for hiding this comment

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

I have a set of patterns that work for this, but it can happen in a later PR. (

- "^\\[%{IPV6:json.access_device.ip}\\]:%{PORT:json.access_device.port}$"
- "^%{IPV6NOCOMPRESS:json.access_device.ip}:%{PORT:json.access_device.port}$"
- "^%{IPV6:json.access_device.ip}%{IPV6PORTSEP}%{PORT:json.access_device.port}$"
)

@@ -0,0 +1,78 @@
# SonicWall Firewall Integration

This integration collects syslog messages from SonicWall firewalls. It has been tested with SonicOS 6.5 and 7.0.
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a link to the vendor docs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

- creation
outcome: success

message_codes:
Copy link
Contributor

Choose a reason for hiding this comment

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

For future maintenance a link to the origin for these would be helpful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

}

#
# Extends message field with note
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice.

},
"event": {
"code": "97",
"original": "10.0.0.1 id=firewall sn=12345678 time=\"2022-03-11 14:17:52 UTC\" fw=10.0.0.2 pri=6 c=1024 gcat=2 m=97 srcMac=12:34:56:78:90:ab src=10.0.0.4:41856:X0 srcZone=Trusted natSrc=10.0.0.2:8689 dstMac=ab:09:87:65:43:21 dst=89.160.20.112:443:X1 dstZone=Untrusted natDst=89.160.20.112:443 usr=\"Unknown (SSO failed)\" proto=tcp/https sent=104 rcvd=230 rule=\"15 (LAN-\u003eWAN)\" app=5 af_polid=4 ipscat=N/A appcat=\"PROXY-ACCESS\" appid=2900 dstname=89.160.20.112 arg=/ code=64 Category=\"Not Rated\" note=\"Policy: cfsZonePolicy0, Info: 6148 \" n=2520325 fw_action=\"NA\" dpi=1 op=0",
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like no message is written when there is a note, but no msg. Maybe promote the note to a message in this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, done

@adriansr adriansr requested review from a team and efd6 May 23, 2022 11:58
Copy link
Member

@P1llus P1llus left a comment

Choose a reason for hiding this comment

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

LGTM, added some comments that are more questions rather than fixes.

Awesome job on the documentation and dashboarding as well! :)

@@ -0,0 +1,20 @@
host: "{{syslog_host}}:{{syslog_port}}"
Copy link
Member

Choose a reason for hiding this comment

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

I know that @taylor-swanson has been doing some changes to allow for both TCP and UDP for all our firewall integrations, would it be worthwhile to add a similar one here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this case, the SonicWall only supports UDP so I kept it simple. I see they've received requests for tcp+ssl but the latest version is still udp-only.

https://community.sonicwall.com/technology-and-support/discussion/1774/syslog-over-secure-tcp

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

Choose a reason for hiding this comment

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

Is it correct for the initial version to be 0.6.0 rather than 0.1.0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

type: constant_keyword
description: Data stream dataset.
- name: data_stream.namespace
type: constant_keyword
Copy link
Member

Choose a reason for hiding this comment

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

Do we not add in event.module and event.dataset anymore? For example:

- name: event.module
  type: constant_keyword
  description: Event module
  value: o365
- name: event.dataset
  type: constant_keyword
  description: Event dataset
  value: o365.audit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Given that elastic-package doesn't add those when creating a data_stream, I though those were not needed anymore now that we have the data_stream.* fields. But it's worth adding them

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:sonicwall_firewall SonicWall Firewall New Integration Issue or pull request for creating a new integration package.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sonicwall

6 participants