Skip to content

add automated log transfer, AC-Hunter issue 135#62

Merged
lisaSW merged 10 commits intoconfig_updatefrom
wls_issue_135
Jul 9, 2025
Merged

add automated log transfer, AC-Hunter issue 135#62
lisaSW merged 10 commits intoconfig_updatefrom
wls_issue_135

Conversation

@william-stearns
Copy link
Contributor

This is one half of the resolution of https://github.com/activecm/AC-Hunter/issues/135 . The other PR will be in the AC-Hunter develop branch.

@william-stearns william-stearns requested a review from a team July 3, 2025 19:19
@william-stearns william-stearns self-assigned this Jul 3, 2025
@lisaSW lisaSW changed the base branch from main to config_update July 7, 2025 21:31
@0x6d6f7468 0x6d6f7468 self-requested a review July 8, 2025 15:56
@0x6d6f7468
Copy link
Contributor

FYI I'm going to commit a light linting/cleaning pass over the YAML files into this PR branch to make local review/testing process easier.

Copy link
Contributor

@0x6d6f7468 0x6d6f7468 left a comment

Choose a reason for hiding this comment

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

Testing this on fresh Digital Ocean droplets (using the latest pushed commit, before any linting/cleanup), I'm getting this error:

TASK [Zeek Install: Transfer zeek_log_transport.sh shell script to target system.] ***********************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: If you are using a module and expect the file to exist on the remote, see the remote_src option
fatal: [127.0.0.1]: FAILED! => {"changed": false, "msg": "Could not find or access './opt/zeek_log_transport.sh'\nSearched in:\n\t/home/acm/rita-v5.0.8-installer/files/./opt/zeek_log_transport.sh\n\t/home/acm/rita-v5.0.8-installer/./opt/zeek_log_transport.sh\n\t/home/acm/rita-v5.0.8-installer/files/./opt/zeek_log_transport.sh\n\t/home/acm/rita-v5.0.8-installer/./opt/zeek_log_transport.sh on the Ansible Controller.\nIf you are using a module and expect the file to exist on the remote, see the remote_src option"}

PLAY RECAP ***********************************************************************************************************************************************************************************************************************************
127.0.0.1                  : ok=23   changed=1    unreachable=0    failed=1    skipped=21   rescued=0    ignored=0

Testing methodology (behavior recreated on all three supported distros):

  1. Create fresh droplets
  2. Upload repo contents to droplet
  3. Run ./generate_installer.sh on droplet
  4. Move (or upload) and decompress created installer archive
  5. Run installer with ./install_rita.sh 127.0.0.1

It seems like the installer is referencing a script named zeek_log_transport.sh, but that script isn't retrieved by RITA's installer. I will investigate further.

@0x6d6f7468
Copy link
Contributor

Ok on further inspection, I think we can add script retrieval logic to the installer when $INSTALL_ZEEK is set, as running the installer with ./install_rita.sh --disable_zeek 127.0.0.1 allows the installer to run successfully.

That said, I'm also wondering if we want to flip this and have zeek installation turned off by default, but that might be a discussion for another time.

@0x6d6f7468
Copy link
Contributor

Doing a final round of testing, then I think it'll be good to go.

@0x6d6f7468
Copy link
Contributor

Made the following changes:

  • Light linting/cleanup of YAML files
  • Adds Cron file if non-local Zeek installation is specified
  • Only runs log import-relevant Zeek tasks if the ansible_connection variable value is not local

Worth noting, a condition of when: ansible_connection != "local" does not work if we are using local_action, such as the task named RITA Pre: Generate ssh keypair for log transfers. We could do a step that just checks whether the playbook itself was ran as ssh or local and then use that, but I wasn't sure if that was overkill for this.

Tested on all permutations of Ubuntu, CentOS, and Rocky (both local and remote installations). Testing included #58's changes just to get CentOS/Rocky -> Ubuntu installations to succeed.

@lisaSW lisaSW merged commit 9f14544 into config_update Jul 9, 2025
5 checks passed
@lisaSW lisaSW deleted the wls_issue_135 branch July 9, 2025 17:28
caffeinatedpixel added a commit that referenced this pull request Sep 22, 2025
* Update on config structure, functionality, and tests

Co-Authored-By: Naomi Kramer <[email protected]>

* Extend subnet type to read/write from db, update tests

Co-Authored-By: Liza Tsibur <[email protected]>

* updated read file config test and subnet tests

* fixed config and util tests, updated subnet related functions

Co-Authored-By: Naomi Kramer <[email protected]>

* Remove error return from GetDefaultConfig

Co-Authored-By: Liza Tsibur <[email protected]>

* added json tags to database struct

* Updated beacon weights validation for config

* updates to score thresholds validation tags

* changes to config subnet validation and testing

* Update subnet.go

* Write missing host entries to http to populate http_proto

* Updating some fields to uint64

* WIP update some field types

* Update zeek count types and fix tests

* Add clickhouse credentials

* Misc fixes

* Update pointer

* Add ability to mark datasets as sample datasets

* fix column name

* Fix datasets exiting import if hour is empty

* Fix zeek count parsing from TSV files

* Remove storing dns conns in arrays, Fix historical first seen dns lag

* Remove unused columns

* Update config.hjson

* Update config.hjson

* updated impact category score functions to use float64

Co-Authored-By: Naomi Kramer <[email protected]>

* Update subnet.go

* Store import version in imports table

* Fix duplicated SNI/IP long connections

* Update subnet_test.go

* Cleanup output

* Rolling files updates (#39)

* Limit number of days to import for rolling datasets

* Fix breaking imports when import was interrupted

* Remove debug output

---------

Co-authored-by: Naomi Kramer <[email protected]>

* Omit parts of env from output

* Set max for threat intel datasize

* Remove SELinux neutering for QA

* Add network size column

* Fix http_proto for missing host, update tests for missing host fixes

* Add online feeds to default config

* Update sshprep (#45)

* Update sshprep

Co-Authored-By: William Stearns <[email protected]>

* Update sshprep

Add Bradley's suggestion of using head -1 to limit to a single address.

---------

Co-authored-by: Naomi Kramer <[email protected]>
Co-authored-by: William Stearns <[email protected]>

* Installer Behavior Tweaks (#41)

* Add --yes flag to add-apt-repository command

* Add missing sudo flags, make sure we're using the SUDO variable instead

* Add ability to perform zone transfers (#48)

* Store zone transfer records

Co-Authored-By: moth <[email protected]>

* Update config

* Add tests

* Tests, connectivity test

* Update tests

---------

Co-authored-by: moth <[email protected]>

* Support RedHat/RHEL as a valid target (#47)

* Update sshprep

Co-Authored-By: William Stearns <[email protected]>

* Supporrt RedHat/RHEL as a valid target

---------

Co-authored-by: Naomi Kramer <[email protected]>
Co-authored-by: William Stearns <[email protected]>
Co-authored-by: moth <[email protected]>

* Fix tests (#49)

* Fix tests

* Update WalkFiles to use UTC

* fixed issue with rolling datasets over 24hours old not getting historical first seen timestamp set (#52)

* Change values from float32 to float64 (#50)

* Switch float32 to float64

* Update threat category calculation to match CalculateBucketedScore (#51)

---------

Co-authored-by: Liza Tsibur <[email protected]>

* Bump max query execution time default value

* Use string instead of error for ZoneTransferConnectivityErrors struct fields (#61)

* Upgrade Golang to version 1.24 (#59) (#60)

* Replace get_url with shell and curl (#58)

* Update sshprep

Co-Authored-By: William Stearns <[email protected]>

* Replace get_url with shell and curl

* Use get_url by default, fall back to curl if it fails

---------

Co-authored-by: Naomi Kramer <[email protected]>
Co-authored-by: William Stearns <[email protected]>
Co-authored-by: moth <[email protected]>

* add automated log transfer, AC-Hunter issue 135 (#62)

* Update sshprep

Co-Authored-By: William Stearns <[email protected]>

* add automated log transfer, PR135

* cron requires non-executable permission

* Specify suggested YAML plugin and config in VSCode workspace

* Linting and light cleanup

* Update generate_installer.sh

Download zeek_log_transport.sh to send to the sensor.

* Create cron file if remote zeek installation

* Only run zeek log import steps for remote sensor installations

---------

Co-authored-by: Naomi Kramer <[email protected]>
Co-authored-by: William Stearns <[email protected]>
Co-authored-by: moth <[email protected]>

* Temporarily disable RITA/Zeek log transport until installer is modular (#66)

* Uniform -y flag usage for repo management/package installation; Uniform SUDO variable usage (#68)

* Resolve Installer Side Effects and Formalize RHEL Support (#73)

* Add missing necessary wildcards for RHEL versions

* Remove Ansible task replacing python3-requests to avoid RHEL distro installation side effects

* Update supported distros in README

* Update scoring defaults

* Resolve Ansible Reboot Errors (#75)

* Clean up conditionals; Fix reboot step for Ubuntu

* Suppress erroneous error output on RPM systems, ignore errors on reboot necessity checks

* Ignore missing host rows for openhttp (#76)

* Fix integration tests due to prevalence (#77)

---------

Co-authored-by: Liza Tsibur <[email protected]>
Co-authored-by: moth <[email protected]>
Co-authored-by: William Stearns <[email protected]>
Co-authored-by: William Stearns <[email protected]>
Co-authored-by: moth <[email protected]>
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.

4 participants