security/wazuh-agent: active response silently fails when /var/ossec/logs/active-responses.log becomes a symlink loop
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 58/100
Direzione di ricerca
Start with /usr/local/opnsense/scripts/wazuh/opnsense-fw and its send_log() function, then read /usr/local/opnsense/scripts/wazuh/setup.php where the active response log symlink is created. Reproduce the self-referencing symlink described in the issue and check that logging failure no longer blocks the firewall action and setup restores a regular log file with the stated ownership and permissions.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Important notices
- I have read the contributing guide lines at https://github.com/opnsense/plugins/blob/master/CONTRIBUTING.md
- I have searched the existing issues, open and closed, and I'm convinced that mine is new.
- The title contains the plugin to which this issue belongs
Describe the bug
Active response with the opnsense-fw command did not block anything. Investigation showed that /var/ossec/logs/active-responses.log had become a symbolic link pointing to itself. send_log() in /usr/local/opnsense/scripts/wazuh/opnsense-fw opens that file in append mode without error handling:
def send_log(line):
with open('/var/ossec/logs/active-responses.log', 'a') as handle:
so the script dies on the first send_log('Started') (OSError: [Errno 62] Too many levels of symbolic links) before the address is added to the __wazuh_agent_drop table. On the firewall nothing happens and nothing is logged.
/usr/local/opnsense/scripts/wazuh/setup.php creates symlinks around this file ("temporary solution to link log files"):
@symlink("/var/ossec/logs/active-responses.log", "/var/log/wazuhagent/activeresponses/activeresponses_99991231.log");
We could not determine exactly which step turned the target itself into a self-referencing link (log housekeeping of /var/log/wazuhagent/* is our main suspect), so we report the observation and the effect.
To Reproduce
ln -sf /var/ossec/logs/active-responses.log /var/ossec/logs/active-responses.log(simulates the broken state we found).- Trigger an active response for
opnsense-fw(or run the script with a test event on stdin). - The source address is not added to
__wazuh_agent_drop; no error is visible.
Expected behavior
- A logging failure should never prevent the firewall action.
setup.phpshould repair the log file if it is not a regular file.
Suggested fix
- In
opnsense-fw, makesend_log()tolerant: wrap it intry/except OSError(fall back to syslog). - In
setup.php, before creating the debug symlinks: if/var/ossec/logs/active-responses.logis a link,unlink()it andtouch()a regular file (owner root:wazuh, 0660).
We are happy to submit a PR for both points.
Relevant log files
None — which is the problem: the failure is silent. Fixed on our side by replacing the link with a regular file; active response then worked immediately (manual test with agent_control -b <ip> -f opnsense-fw3600 -u <agent id>).
Environment
OPNsense 26.7.x (amd64), os-wazuh-agent 1.3_1, wazuh-agent 4.14.8, manager Wazuh 4.14.x
- Lingua principale
- PHP
- Stelle
- 1.2k
- Fork
- 932
- Merge medio
- 1g 11h
- PR unite (30g)
- 22
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di opnsense/plugins
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
www/squid: configctl proxy stop returns before Squid exits, so stop+start (e.g. Monit restart) failsApertasupport
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
opnsense/plugins#5983 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno
-
net/haproxy: IPv6 literal in real server "Source address" generates an invalid `source` directiveForse già presa @fraenki l’ha presa 6 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
opnsense/plugins#5973 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[dns/ddclient] Support hiding unused standard fields per service (optional_hiding)Forse già presa @bringha1 l’ha presa 9 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di opnsense/plugins
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Automattic/blocks-engine#7881 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
iruzen-dono/workless#117 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
magicsunday/webtrees-docker#285 ·
I maintainer di solito rispondono entro 1 giorno
-
Flaky browser test: AreaHeadersTest 'shows Counting on the way while deferred tab counts load'Apertaarea/tests type/bug when/soon
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
WP-CLI 3.0 fixes the cron lock and core download bugs described in the handbookForse già presa @mayankmajeji l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
WordPress/hosting-handbook#521 ·