security/wazuh-agent: active response silently fails when /var/ossec/logs/active-responses.log becomes a symlink loop
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 58/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- PHP
- Estrellas
- 1.2k
- Forks
- 932
- Merge medio
- 1 d 11 h
- PR fusionados (30 d)
- 22
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de opnsense/plugins
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
www/squid: configctl proxy stop returns before Squid exits, so stop+start (e.g. Monit restart) failsAbiertosupport
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
opnsense/plugins#5983 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 1 día
-
net/haproxy: IPv6 literal in real server "Source address" generates an invalid `source` directivePosiblemente ocupada @fraenki la tomó hace 6 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
opnsense/plugins#5973 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
[dns/ddclient] Support hiding unused standard fields per service (optional_hiding)Posiblemente ocupada @bringha1 la tomó hace 9 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
Todos los issues de opnsense/plugins
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Automattic/blocks-engine#7881 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 86/100
iruzen-dono/workless#117 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
magicsunday/webtrees-docker#285 ·
Los mantenedores suelen responder en 1 día
-
Flaky browser test: AreaHeadersTest 'shows Counting on the way while deferred tab counts load'Abiertoarea/tests type/bug when/soon
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
WP-CLI 3.0 fixes the cron lock and core download bugs described in the handbookPosiblemente ocupada @mayankmajeji la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
WordPress/hosting-handbook#521 ·