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

Script "ssh_integrity_check_bsd" isn't working properly for pFsense [FreeBSD] #8791

Open
YNRA opened this issue May 25, 2021 · 0 comments
Open

Comments

@YNRA
Copy link

YNRA commented May 25, 2021

Wazuh version Component Install type Install method Platform
-- Agentless Manager -- --

Description

The Agentless Integrity check BSD capability uses the /var/ossec/agentless/ssh_integrity_check_bsd script to connect the remote BSD system via SSH and run the defined commands to extract the required information.
We noticed the current code is not working as expected with pFsense, which is running on FreeBSD.

How to reproduce

One the SSH connection is configured, we can test it with :

cd /var/ossec/ ; expect agentless/ssh_integrity_check_bsd <user>@<hostname> /directory_to_monitor

Because of the menu of pfSense, which isn't directly a shell, we have to tell the script to wait, then to go to the shell option. Otherwise, the menu will be loaded several times, and the integrity scan won't be performed.

Proposed fix

After a few tries, we managed to obtain a correct script, just by adding a few lines:

set timeout 600
sleep 0.5
send "8\r"
sleep 0.5
send "sh\r"
send "for i in `find  $args 2>/dev/null`;do tail \$i >/dev/null 2>&1 &&  md5=`md5 \$i | cut -d \"=\" -f 2|cut -d \" \" -f 2` && sha1=`sha1 \$i | cut -d \"=\" -f 2|cut -d \" \" -f 2` && echo FWD: `stat -f \"%Dz:%Dp:%Du:%Dg\" \$i`:\$md5:\$sha1 \$i; done; exit\r"
send "exit\r"
send "\r"
  • send "8\r" : open pFsense shell
  • send "sh\r" : use sh instead of csh
  • send "\r" : exit pFsense

Thanks in advance.

Best regards.

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

No branches or pull requests

1 participant