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

honor BRIM_SURICATA_USER_DIR in Windows runner #69

Merged
merged 1 commit into from
Mar 17, 2023
Merged

Conversation

nwt
Copy link
Member

@nwt nwt commented Mar 16, 2023

The Windows Suricata runner fails on per-machine installs of the Zui app because it ignores the BRIM_SURICATA_USER_DIR environment variable and tries to write a Suricata configuration file to its own directory, which isn't writable by a non-Administrator on per-machine installs. Fix by writing the file to BRIM_SURICATA_USER_DIR if specified.

The Windows runner also ignores the rules file that suricataupdater.exe generates at $BRIM_SURICATA_USER_DIR\rules\suricata.rules. Fix by using that file if it exists, falling back to the packaged rules file if it does not.

For brimdata/zui#2715.

The Windows Suricata runner fails on per-machine installs of the Zui app
because it ignores the BRIM_SURICATA_USER_DIR environment variable and
tries to write a Suricata configuration file to its own directory, which
isn't writable by a non-Administrator on per-machine installs.  Fix by
writing the file to BRIM_SURICATA_USER_DIR if specified.

The Windows runner also ignores the rules file that suricataupdater.exe
generates at $BRIM_SURICATA_USER_DIR\rules\suricata.rules.  Fix by using
that file if it exists, falling back to the packaged rules file if it
does not.

For brimdata/zui#2715.
@nwt nwt requested review from mattnibs and philrz March 16, 2023 15:39
Copy link
Contributor

@philrz philrz left a comment

Choose a reason for hiding this comment

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

The logic in this change makes sense to me and lines up with what's in the script-based runners that have been working adequately on Linux and macOS. I tested it out with a test Zui artifact from an Actions run that's bundled with a test Brimcap artifact that includes a test Suricata artifact that includes a runner compiled from this branch. It passed two different tests for me:

  1. I did a per-machine install and successfully imported a pcap and saw the generated Suricata alerts, whereas this failed in the past (pcap import fails on Windows with per-machine install zui#2715).

  2. I manually hacked one of the downloaded rules in %APPDATA%\data\suricata\rules\suricata.rules that I knew would be triggered by my pcap and added some unique text, then re-imported my pcap and confirmed I saw that text as part of the alert.

@nwt nwt merged commit 92aa0c4 into master Mar 17, 2023
@nwt nwt deleted the windows-runner-fix branch March 17, 2023 16:16
@philrz philrz linked an issue Mar 17, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pcap import fails on Windows with per-machine install
2 participants