Hello everyone,
I would like to monitor this log produced by the OPNSense (OpenVPN module). Specifically, I would like to extract and monitor the username, public IP, and IP that is associated with the user by the VPN server.
****
Nov 4 09:56:15
vpnserver.abcd.it opnsense-openvpn: <29>1 2025-11-04T09:56:15+01:00
vpnserver.abcd.it openvpn_server1 45179 - [meta sequenceId="13857"] user_test/
217.202.95.187:57040 MULTI_sva: pool returned IPv4=192.168.15.17, IPv6=(Not enabled)
****
I created a decoder in this form:
****
<decoder name="openvpn-internal-ip">
<program_name>^opnsense-openvpn$</program_name>
<prematch>MULTI_sva: pool returned IPv4=</prematch>
<regex type="pcre2" offset="after_prematch">(\S+)\/(\S+):(\d+) MULTI_sva: pool returned IPv4=(\S+)</regex>
<order>srcuser, srcip, dstip</order>
</decoder>
****
and afterwards this rule:
****
<rule id="100501" level="3">
<if_matched_sid>81800</if_matched_sid>
<decoded_as>openvpn-internal-ip</decoded_as>
<description>OpenVPN (OPNsense): assegnato IP interno $(dstip) all’utente $(srcuser)</description>
<group>vpn_ip_assignment,openvpn,opnsense</group>
</rule>
****
Now, when testing the decoder and the rule, the result is this:
**Messages:
INFO: (7202): Session initialized with token 'a67e346c'
**Phase 1: Completed pre-decoding.
full event: 'Nov 4 09:56:15 vpnserver.abcd.it opnsense-openvpn: <29>1 2025-11-04T09:56:15+01:00 vpnserver.abcd.it openvpn_server1 45179 - [meta sequenceId="13857"] user_test/217.202.95.187:57040 MULTI_sva: pool returned IPv4=192.168.15.17, IPv6=(Not enabled)'
timestamp: 'Nov 4 09:56:15'
hostname: 'vpnserver.abcd.it'
program_name: 'opnsense-openvpn'
**Phase 2: Completed decoding.
name: 'openvpn'
parent: 'openvpn'
**Phase 3: Completed filtering (rules).
id: '81800'
level: '0'
description: 'OpenVPN messages grouped.'
groups: '["openvpn"]'
firedtimes: '1'
mail: 'false'
It would appear that the log is being decoded by Wazuh's default decoder and not by the decoder-rule pair I created.What do you recommend I change?
Thank you all for your help and have a good day.