Wazuh
Each Wazuh alert from the level you pick arrives as a readable message: the rule's description as the title, then the agent, the rule, where it happened, the user and address involved, and the log line. A small integration on the Wazuh manager posts the alerts; two checks it comes with say exactly what is wrong when something is.
Setting it up#
In the app these steps are under Connect a system → Wazuh, or a topic's Send to this topic tab, with the address, topic and a token filled in; New token makes the token.
A custom integration on the Wazuh manager posts each alert from the level you pick, as Wazuh wrote it, and the wazuh template makes it readable. Run these on the manager, as root.
Put Skirl’s integration in /var/ossec/integrations/; it runs with the Python Wazuh comes with. Running it again replaces both files:
cat > /var/ossec/integrations/custom-skirl <<'SKIRL_EOF' #!/bin/sh # SPDX-License-Identifier: AGPL-3.0-only # # Skirl's Wazuh integration (docs/specs/T1b.md, section 3). Wazuh's # integrator runs this with the alert file, the <api_key> and the # <hook_url>; it runs custom-skirl.py, beside it, with Wazuh's own Python. # Install both in /var/ossec/integrations/, owned root:wazuh, mode 750. # By hand: custom-skirl --configure, --check-setup or --check-connection. dir=$(cd "$(dirname "$0")" && pwd -P) py="$dir/../framework/python/bin/python3" # Exit 1, never 127: on 127 the integrator logs the whole command line, # the token with it. if [ ! -x "$py" ]; then echo "custom-skirl: Wazuh's Python is not at $py" >&2 echo "$(date '+%Y/%m/%d %H:%M:%S') custom-skirl: Wazuh's Python is not at $py" >>"$dir/../logs/integrations.log" exit 1 fi exec "$py" "$dir/custom-skirl.py" "$@" SKIRL_EOF cat > /var/ossec/integrations/custom-skirl.py <<'SKIRL_EOF' # SPDX-License-Identifier: AGPL-3.0-only # # Skirl's Wazuh integration (docs/specs/T1b.md, section 3): posts each alert # Wazuh hands it, unchanged, as JSON to a Skirl topic's address, with the # token as a Bearer header. Run by custom-skirl (beside it) as # # custom-skirl.py <alert file> <api_key> <hook_url> [debug] [options file] ... # # which is how wazuh-integratord calls an integration (argv[6] is its own # timeout). The standard library only; a timeout of 10 s, or 2 s under the # integrator's when that is shorter, so the integrator never kills it (it # would log the command line, the token with it); on failure one line in # Wazuh's integrations.log and exit 1 (2 for a wrong address or token). The # token is never logged or printed, nor the address's query. # # By hand, as root, on the manager (the steps on Skirl's Send to this topic): # # custom-skirl --configure puts the <integration> block read from # stdin in ossec.conf, in place of any # custom-skirl block already there # custom-skirl --check-setup one block, its address and token, and # the integration enabled # custom-skirl --check-connection posts a sample alert with the block's # address and token: OK, or why not # # Certificates: Wazuh's Python has its own OpenSSL, which looks for them in # /usr/local/ssl, where no distribution puts them. This uses SSL_CERT_FILE # when it is set, else the system's bundle, else the certifi Wazuh's Python # comes with. Verification is never turned off. import json import os import re import shutil import socket import ssl import sys import time import urllib.error import urllib.parse import urllib.request NAME = "custom-skirl" TIMEOUT = 10 # seconds, at most WAZUH = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) # /var/ossec LOG = os.path.join(WAZUH, "logs", "integrations.log") CONF = os.path.join(WAZUH, "etc", "ossec.conf") OSSEC_LOG = os.path.join(WAZUH, "logs", "ossec.log") # Where each distribution Wazuh's manager runs on keeps its trusted # certificates, with those added by update-ca-certificates or # update-ca-trust (checked in each one's own image, 2026-11-27). CA_FILES = ( "/etc/ssl/certs/ca-certificates.crt", # Debian, Ubuntu (ca-certificates); Fedora and Amazon Linux 2023 link it to the third "/etc/pki/tls/certs/ca-bundle.crt", # RHEL 7-10, CentOS 7 and Stream 10, Rocky, Alma, Oracle, Fedora, Amazon Linux 2 and 2023 "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem", # what the line above links to "/etc/ssl/ca-bundle.pem", # SUSE Linux Enterprise 15, openSUSE Leap 15 "/var/lib/ca-certificates/ca-bundle.pem", # what the line above links to ) # A Skirl token: tk_ and 29 of [a-z0-9], or the older skl_ and 43 of base62. TOKEN = re.compile(r"\A(?:tk_[a-z0-9]{29}|skl_[0-9A-Za-z]{43})\Z") BLOCK = re.compile(r"<integration>(?:(?!</integration>).)*?<name>\s*custom-skirl\s*</name>.*?</integration>", re.S) def log(line): """One line in Wazuh's integrations.log, as the built-in integrations write theirs.""" try: with open(LOG, "a", encoding="utf-8") as f: f.write("%s %s: %s\n" % (time.strftime("%Y/%m/%d %H:%M:%S"), NAME, line.replace("\n", " "))) except OSError: pass def where(url): """The address without its query (which may hold the token) or credentials.""" try: u = urllib.parse.urlsplit(url) return "%s://%s%s%s" % (u.scheme, u.hostname or "", ":%d" % u.port if u.port else "", u.path) except ValueError: return "an address that does not parse" def address_problem(url): """Why <hook_url> is not an address to post to, or None.""" if not url: return "<hook_url> is empty" if re.search(r"[^\x21-\x7e]", url): return "<hook_url> has a space or a character an address never has" try: u = urllib.parse.urlsplit(url) u.port # raises ValueError for a port that is not a number except ValueError: return "<hook_url> is not an address" if u.scheme not in ("http", "https"): return "<hook_url> must start with https:// or http://" if not u.hostname: return "<hook_url> has no server name" if u.path.strip("/") == "": return "<hook_url> has no topic after the server's name" return None def token_problem(token): """Why <api_key> is not a Skirl token, or None. Never says what it is.""" if token == "" or TOKEN.match(token): return None if "\u2022" in token: return "<api_key> is the placeholder Skirl shows before a token is made (tk_ and dots), not a token: make one on the topic's Send to this topic tab, then run the configure step again" return "<api_key> is not a Skirl token (%d characters; a token is tk_ and 29 letters and digits): copy it again from the topic's Send to this topic tab" % len(token) def trust(): """A TLS context that verifies, and where its certificates came from; or None and what to set.""" named = os.environ.get("SSL_CERT_FILE") if named: try: return ssl.create_default_context(cafile=named), "SSL_CERT_FILE (%s)" % named except (OSError, ssl.SSLError) as e: return None, "SSL_CERT_FILE is %s, which has no certificates to read (%s)" % (named, type(e).__name__) for path in CA_FILES: if os.path.isfile(path): try: return ssl.create_default_context(cafile=path), path except (OSError, ssl.SSLError): continue try: import certifi return ssl.create_default_context(cafile=certifi.where()), "certifi %s, in Wazuh's Python" % certifi.__version__ except Exception: pass return None, ( "no trusted certificates to check Skirl's with: none of %s exists, and Wazuh's Python has no certifi; " "install this system's ca-certificates package, or set SSL_CERT_FILE to its CA bundle for wazuh-manager " "(systemctl edit wazuh-manager, then [Service] Environment=SSL_CERT_FILE=/path/to/bundle)" % ", ".join(CA_FILES) ) def why(e, url, came_from, timeout, token): """What went wrong with a post, in words, without the token or the query.""" host = urllib.parse.urlsplit(url).hostname if isinstance(e, urllib.error.HTTPError): if e.code in (401, 403) and not token: return "Skirl wants a token for this topic (HTTP %d): the block has no <api_key>" % e.code if e.code in (401, 403): return "Skirl refused the token (HTTP %d): make a new one on the topic's Send to this topic tab, then run the configure step again" % e.code if e.code == 404: return "HTTP 404: Skirl has no topic at this address" return "HTTP %d" % e.code reason = getattr(e, "reason", e) if isinstance(reason, ssl.SSLCertVerificationError): return "the certificate of %s is not trusted (%s), checked against %s" % (host, reason.verify_message, came_from) if isinstance(reason, ssl.SSLError): return "the secure connection to %s failed (%s)" % (host, reason.reason or type(reason).__name__) if isinstance(reason, socket.gaierror): return "cannot find the name %s (DNS)" % host if isinstance(reason, ConnectionRefusedError): return "%s refused the connection: nothing listens at that address and port" % host if isinstance(reason, (socket.timeout, TimeoutError)): return "%s did not answer within %d s" % (host, timeout) return "%s: %s" % (type(reason).__name__, reason) def post(url, token, body, timeout): """Posts body; returns None, or what went wrong.""" headers = {"Content-Type": "application/json", "User-Agent": "wazuh-" + NAME} if token: headers["Authorization"] = "Bearer " + token context, came_from = None, "" if url.startswith("https:"): context, came_from = trust() if context is None: return came_from try: req = urllib.request.Request(url, data=body, headers=headers, method="POST") with urllib.request.urlopen(req, timeout=timeout, context=context) as res: res.read(65536) return None except Exception as e: # HTTP, TLS, DNS, refused, timed out return why(e, url, came_from, timeout, token) def deliver(argv): """What wazuh-integratord runs: one alert, posted.""" if len(argv) < 4 or not argv[1]: log("needs the alert file and <hook_url> (check the <integration> block in ossec.conf)") return 2 alert_file, token, url = argv[1], argv[2], argv[3] problem = address_problem(url) or token_problem(token) if problem: log("not sent: in ossec.conf, the %s" % problem) return 2 timeout = TIMEOUT if len(argv) > 6 and argv[6].isdigit(): timeout = max(1, min(TIMEOUT, int(argv[6]) - 2)) try: with open(alert_file, "rb") as f: body = f.read().strip() alert = json.loads(body) except (OSError, ValueError) as e: log("could not read the alert %s: %s (is <alert_format>json</alert_format> set?)" % (alert_file, type(e).__name__)) return 3 rule = alert.get("rule") if isinstance(alert, dict) else None what = "alert %s (rule %s) to %s" % ( alert.get("id", "?") if isinstance(alert, dict) else "?", rule.get("id", "?") if isinstance(rule, dict) else "?", where(url), ) problem = post(url, token, body, timeout) if problem: log("could not post %s: %s" % (what, problem)) return 1 return 0 # --- By hand ---------------------------------------------------------------- def field(block, tag): m = re.search(r"<%s>\s*(.*?)\s*</%s>" % (tag, tag), block, re.S) return m.group(1) if m else "" def blocks(): """The custom-skirl <integration> blocks in ossec.conf, and its text.""" with open(CONF, encoding="utf-8") as f: text = f.read() return BLOCK.findall(text), text def configure(): """--configure: the block on stdin, in place of every custom-skirl block in ossec.conf.""" given = sys.stdin.read() if field(given, "name") != NAME: print("Not changed: the block on stdin is not one with <name>%s</name>." % NAME) return 2 url, token, level = field(given, "hook_url"), field(given, "api_key"), field(given, "level") problem = address_problem(url) or token_problem(token) or ("" if token else "<api_key> is empty") if not problem and not (level.isdigit() and 0 <= int(level) <= 16): problem = "<level> must be a number from 0 to 16" if problem: print("Not changed: the %s." % problem) return 2 try: old, text = blocks() except OSError as e: print("Not changed: cannot read %s (%s). Run it as root on the Wazuh manager." % (CONF, e.strerror)) return 1 block = ( "<ossec_config>\n <integration>\n <name>%s</name>\n <hook_url>%s</hook_url>\n <api_key>%s</api_key>\n" " <level>%s</level>\n <alert_format>json</alert_format>\n </integration>\n</ossec_config>\n" ) % (NAME, url, token, int(level)) new = BLOCK.sub("", text) new = re.sub(r"\n?<ossec_config>\s*</ossec_config>[ \t]*\n?", "\n", new) # the wrappers left empty new = new.rstrip("\n") + "\n\n" + block # The first run keeps ossec.conf as it was before Skirl touched it; a # later run leaves that copy alone, so it is never Skirl's own version. backup = CONF + ".skirl-backup" first = not os.path.exists(backup) try: if first: shutil.copy2(CONF, backup) with open(CONF, "r+", encoding="utf-8") as f: # in place: keeps its owner and mode f.write(new) f.truncate() except OSError as e: print("Not changed: cannot write %s (%s). Run it as root on the Wazuh manager." % (CONF, e.strerror)) return 1 was = "as it was: %s" % backup if first else "as it was before Skirl first changed it: %s, kept" % backup if not old: print("Added Skirl's block to %s (%s)." % (CONF, was)) else: print("Replaced %s in %s with this one (%s)." % ("the custom-skirl block" if len(old) == 1 else "the %d custom-skirl blocks" % len(old), CONF, was)) return 0 def the_block(): """The one custom-skirl block's address and token, or None and why not.""" try: found, _ = blocks() except OSError as e: return None, "cannot read %s (%s): run it as root on the Wazuh manager" % (CONF, e.strerror) if not found: return None, "%s has no custom-skirl block: run the configure step" % CONF if len(found) > 1: return None, "%s has %d custom-skirl blocks, so each alert is sent %d times: run the configure step again" % (CONF, len(found), len(found)) return (field(found[0], "hook_url"), field(found[0], "api_key")), None def enabled(): """Whether wazuh-integratord enabled custom-skirl at its last start, after ossec.conf last changed.""" try: with open(OSSEC_LOG, encoding="utf-8", errors="replace") as f: lines = f.read().splitlines() except OSError as e: return "cannot read %s (%s)" % (OSSEC_LOG, e.strerror) starts = [i for i, l in enumerate(lines) if "wazuh-integratord: INFO: Started" in l] after = lines[starts[-1] :] if starts else lines line = next((l for l in after if "Enabling integration for: '%s'" % NAME in l), None) if line is None: return "wazuh-integratord has not enabled custom-skirl: restart the manager, and look for ERROR lines in %s" % OSSEC_LOG try: at = time.mktime(time.strptime(line[:19], "%Y/%m/%d %H:%M:%S")) if os.path.getmtime(CONF) > at + 1: return "ossec.conf changed after wazuh-integratord last started: restart the manager" except (ValueError, OSError): pass return None def check_setup(): """--check-setup: the block, its address and token, and the integration enabled.""" bad = 0 def say(ok, what): nonlocal bad bad += 0 if ok else 1 print(("%s" if ok else "Wrong: %s") % what) got, problem = the_block() say(not problem, problem or "ossec.conf: one custom-skirl block") if got: url, token = got problem = address_problem(url) say(not problem, problem or "address: %s" % where(url)) if not problem and "template=wazuh" not in urllib.parse.urlsplit(url).query: say(False, "the address has no ?template=wazuh, so alerts arrive as Wazuh's raw JSON") problem = token_problem(token) or ("" if token else "<api_key> is empty") say(not problem, problem or "token: a Skirl token") if url.startswith("https:"): context, came_from = trust() say(context is not None, "certificates: %s" % came_from if context else came_from) problem = enabled() say(not problem, problem or "wazuh-integratord: Enabling integration for: '%s'" % NAME) print("OK" if not bad else "Not ready: fix what is wrong above.") return 0 if not bad else 1 def check_connection(): """--check-connection: a sample alert, posted as the integrator would.""" got, problem = the_block() if not got: print("Not sent: %s." % problem) return 1 url, token = got problem = address_problem(url) or token_problem(token) if problem: print("Not sent: the %s." % problem) return 2 host = socket.gethostname() alert = { "timestamp": time.strftime("%Y-%m-%dT%H:%M:%S.000%z"), "rule": {"level": 3, "description": "Skirl's connection check from %s" % host, "id": "0", "groups": ["skirl"]}, "agent": {"id": "000", "name": host}, "manager": {"name": host}, "id": "%d.0" % time.time(), "location": "custom-skirl --check-connection", "full_log": "Sent by hand with ossec.conf's address and token: the manager reaches Skirl.", } problem = post(url, token, json.dumps(alert).encode(), TIMEOUT) if problem: print("Failed: %s." % problem) return 1 print("OK: Skirl took the sample alert (%s). It is in the topic, as \"Skirl's connection check\", unless Everything else is unticked." % where(url)) return 0 def main(argv): if argv[1:2] == ["--configure"]: return configure() if argv[1:2] == ["--check-setup"]: return check_setup() if argv[1:2] == ["--check-connection"]: return check_connection() return deliver(argv) if __name__ == "__main__": sys.exit(main(sys.argv)) SKIRL_EOFGive both files the owner and mode Wazuh requires:
chown root:wazuh /var/ossec/integrations/custom-skirl /var/ossec/integrations/custom-skirl.py chmod 750 /var/ossec/integrations/custom-skirl /var/ossec/integrations/custom-skirl.pyHave the manager send its alerts here, from the level picked above. This puts Skirl’s block in ossec.conf in place of any custom-skirl block already there, so running it again changes the block rather than adding a second. It says Added the first time, Replaced after that:
/var/ossec/integrations/custom-skirl --configure <<'SKIRL_EOF' <integration> <name>custom-skirl</name> <hook_url>https://notify.example.com/wazuh?template=wazuh</hook_url> <api_key>tk_replace_with_your_token</api_key> <level>7</level> <alert_format>json</alert_format> </integration> SKIRL_EOFAdded Skirl's block to /var/ossec/etc/ossec.conf (as it was: /var/ossec/etc/ossec.conf.skirl-backup).Restart the manager:
systemctl restart wazuh-managerCheck the setup: one block, its address and token, the certificates Skirl’s is checked against, and the integration enabled. Each line says what it checked, or Wrong and what to do. The certificates line names this system’s file: /etc/pki/tls/certs/ca-bundle.crt on Red Hat, CentOS, Rocky, Alma, Oracle and Amazon Linux 2, /etc/ssl/ca-bundle.pem on SUSE:
/var/ossec/integrations/custom-skirl --check-setupossec.conf: one custom-skirl block address: https://notify.example.com/wazuh token: a Skirl token certificates: /etc/ssl/certs/ca-certificates.crt wazuh-integratord: Enabling integration for: 'custom-skirl' OKCheck the connection: this sends a sample alert with ossec.conf’s address and token, as the manager will, and says OK or exactly what is wrong (the certificate, the token, the address):
/var/ossec/integrations/custom-skirl --check-connectionOK: Skirl took the sample alert (https://notify.example.com/wazuh). It is in the topic, as "Skirl's connection check", unless Everything else is unticked.Send a test alert through Wazuh: a line it takes for a new user added (it adds none), at level 8. It arrives in this topic within a minute:
echo "$(date '+%b %e %T') $(uname -n) useradd[1]: new user: name=skirl-test, UID=9999, GID=9999, home=/nonexistent, shell=/usr/sbin/nologin" >> /var/ossec/logs/active-responses.log
The steps here show example values (https://notify.example.com, the topic wazuh, tk_replace_with_your_token, level 7): copy them from the app, where yours are filled in. The configure step with the example token answers "Not changed", because that is not a real token.
Run the steps on the Wazuh manager, as root: the integration runs there, with the Python that Wazuh's manager comes with, in /var/ossec/framework/python/.
The app shows the configure step only once there is a token, so a placeholder never ends up in
ossec.conf.In a container without systemd, such as Wazuh's own Docker image, restart the manager with Wazuh's own command instead:
/var/ossec/bin/wazuh-control restartSkirl's tests run these steps on Wazuh's manager image 4.14.11, sending to Skirl over HTTPS with a certificate only the system's store trusts.
The level#
Send alerts from level picks the lowest Wazuh rule level the manager sends: 3 and up, 5 and up, 7 and up (chosen at first), 10 and up or 12 and up. Wazuh's levels run from 0 to 16; 7 and up leaves out routine events, 3 sends almost everything. The level is in the configure step, as <level>.
The level also sets the message's priority:
| Rule level | Priority |
|---|---|
| 0 to 3 | 1 (min) |
| 4 to 6 | 2 (low) |
| 7 to 9 | 3 (default) |
| 10 and 11 | 4 (high) |
| 12 to 16 | 5 (urgent) |
The test alert in the last step is level 8: with 10 and up or 12 and up it is not sent, so pick 7 and up or lower while you test.
Changing it later#
To change the level, the address or the token, pick the new values in the app and run the configure step again, then restart the manager. The configure step replaces Skirl's block in ossec.conf (every custom-skirl block there, if there are several), so running it twice never sends an alert twice.
Events#
| Event | On at first | What it means |
|---|---|---|
| Sign-ins | Yes | Sign-ins that failed or worked, unknown users and brute force: SSH, PAM, su and sudo. |
| File changes | Yes | File integrity monitoring: a file added, changed or deleted, with what changed, the size, the owner and the change itself when Wazuh reports it. |
| Vulnerabilities | Yes | The vulnerability scanner: a CVE in an installed package, with its severity, score, the package and its status. Tapping it opens the CVE's first reference. |
| Malware and rootkits | Yes | Rootcheck, VirusTotal, YARA, rootkit and malware rules. |
| Configuration checks (SCA) | Yes | Failed checks of Wazuh's security configuration assessment, with the fix it suggests, and the scan's score. |
| Everything else | Yes | Every other rule: new users and groups, packages installed, web attacks, the manager starting. The test alert and Skirl's connection check are here too. |
Skirl decides the kind from the rule's groups, trying Vulnerabilities, Malware and rootkits, File changes, Configuration checks and Sign-ins in that order; an alert that is none of them is Everything else.
A new manager's first configuration scan sends each failed check as an alert of its own at level 7: dozens of messages at once. Untick Configuration checks (SCA) if you do not want them.
What a message looks like#
The test alert from the last step:
New user added to the system.
Agent: wazuh-research
Rule 5902, level 8 · syslog, adduser
Where: /var/ossec/logs/active-responses.log
User: skirl-testNov 27 18:19:47 wazuh-research useradd[1]: new user: name=skirl-test, UID=9999, GID=9999, home=/nonexistent, shell=/usr/sbin/nologin
Priority 3 · Tags: warning
SSH brute force, from a real manager:
sshd: brute force trying to get access to the system. Authentication failed.
Agent: wazuh-research
Rule 5763, level 10 · syslog, sshd, authentication_failures
Where: /var/log/skirl-test.log
User: root
From: 192.0.2.88 port 51009Nov 27 18:16:11 web01 sshd[4609]: Failed password for root from 192.0.2.88 port 51009 ssh2
Priority 4 · Tags: warning, signin
The tags are rotating_light (🚨) from level 12, warning (⚠️) from level 7, and the kind of alert (signin, file, vulnerability, malware, sca), except for Everything else.
The commands#
The integration is two files in /var/ossec/integrations/: custom-skirl and custom-skirl.py. Wazuh runs them for each alert. By hand, as root on the manager, they do three things:
--configure reads an
<integration>block from the command's input and puts it inossec.confin place of anycustom-skirlblock there. It is the configure step.--check-setup checks
ossec.confand the manager, and prints one line for each check:/var/ossec/integrations/custom-skirl --check-setup--check-connection sends a sample alert with the address and token in
ossec.conf, as the manager would, and says OK or exactly why not:/var/ossec/integrations/custom-skirl --check-connection
The sample alert arrives as "Skirl's connection check from" and the manager's name, at priority 1, under Everything else. It is sent whatever level you picked.
What the checks say#
Check the setup#
Each line says what was checked, or starts with Wrong:. The last line is OK, or Not ready: fix what is wrong above.
| Line | What to do |
|---|---|
ossec.conf: one custom-skirl block |
Nothing: this is right. |
Wrong: /var/ossec/etc/ossec.conf has no custom-skirl block: run the configure step |
Run the configure step, then restart the manager. |
Wrong: /var/ossec/etc/ossec.conf has 2 custom-skirl blocks, so each alert is sent 2 times: run the configure step again |
Run the configure step: it replaces them all with one. |
Wrong: cannot read /var/ossec/etc/ossec.conf (Permission denied): run it as root on the Wazuh manager |
Run it as root. |
address: https://notify.example.com/wazuh |
Nothing: the address, without what follows ?. |
Wrong: <hook_url> … |
The address is wrong: see The address and the token. |
Wrong: the address has no ?template=wazuh, so alerts arrive as Wazuh's raw JSON |
Copy the configure step from the app again: its address ends with ?template=wazuh. |
token: a Skirl token |
Nothing: the token looks right. Whether Skirl takes it is what the connection check finds out. |
Wrong: <api_key> … |
The token is wrong: see The address and the token. |
certificates: /etc/ssl/certs/ca-certificates.crt |
Nothing: the file Skirl's certificate is checked against (for an https:// address only). |
Wrong: no trusted certificates to check Skirl's with: … |
See Certificates. |
Wrong: SSL_CERT_FILE is …, which has no certificates to read … |
The file named for the manager does not exist or holds no certificates: see Certificates. |
wazuh-integratord: Enabling integration for: 'custom-skirl' |
Nothing: Wazuh started the integration. |
Wrong: wazuh-integratord has not enabled custom-skirl: restart the manager, and look for ERROR lines in /var/ossec/logs/ossec.log |
Restart the manager. If it still says so, Wazuh's own log says why. |
Wrong: ossec.conf changed after wazuh-integratord last started: restart the manager |
Restart the manager, so it reads the new block. |
Wrong: cannot read /var/ossec/logs/ossec.log (…) |
Run it as root on the manager. |
Check the connection#
| It says | What to do |
|---|---|
OK: Skirl took the sample alert (…). It is in the topic, as "Skirl's connection check", unless Everything else is unticked. |
Nothing: the manager reaches Skirl with the token. |
Not sent: … |
ossec.conf has no block, or more than one, or a wrong address or token: the rest of the line says which. Run the configure step. |
Failed: Skirl refused the token (HTTP 401): … |
The token was rotated, revoked or mistyped. Make a new one on the topic's Send to this topic tab, run the configure step again and restart the manager. |
Failed: Skirl refused the token (HTTP 403): … |
The token may not send to this topic: make one on this topic's tab. |
Failed: Skirl wants a token for this topic (HTTP 403): the block has no <api_key> |
Run the configure step with a token. |
Failed: HTTP 404: Skirl has no topic at this address |
The address is not a topic's: copy the configure step from the app again. |
Failed: HTTP 429 |
Too many messages at once: Skirl's rate limits (Rate limits). |
Failed: the certificate of notify.example.com is not trusted (…), checked against … |
See Certificates. |
Failed: the secure connection to notify.example.com failed (…) |
The secure connection failed before the certificate was checked; the reason in brackets says why. Check that the address answers HTTPS on that port. |
Failed: cannot find the name notify.example.com (DNS) |
The manager cannot look up Skirl's name: fix its DNS, or use an address it can find. |
Failed: notify.example.com refused the connection: nothing listens at that address and port |
The address or port is wrong, or Skirl (or its proxy) is not running there. |
Failed: notify.example.com did not answer within 10 s |
A firewall drops the connection, or the address is not reachable from the manager. |
The same reasons, from the manager's own deliveries, are in Wazuh's integrations log: see When nothing arrives.
The address and the token#
The configure step, the checks and every delivery check <hook_url> and <api_key> first. Each problem is said the same way everywhere:
| Problem | What to do |
|---|---|
<hook_url> is empty, is not an address, has a space or a character an address never has |
Copy the configure step from the app again. |
<hook_url> must start with https:// or http:// |
Write the whole address, https:// included. |
<hook_url> has no server name, has no topic after the server's name |
The address must be the topic's: https://notify.example.com/wazuh?template=wazuh. |
<api_key> is empty |
Run the configure step with a token. |
<api_key> is the placeholder Skirl shows before a token is made (tk_ and dots), not a token: … |
Press New token in the app, then copy the configure step again. |
<api_key> is not a Skirl token (… characters; a token is tk_ and 29 letters and digits): … |
Copy the token again, whole, from the app. |
<level> must be a number from 0 to 16 |
Only the configure step says this: copy it from the app again. |
The configure step itself starts each refusal with Not changed: and leaves ossec.conf as it was. It also says Not changed: the block on stdin is not one with <name>custom-skirl</name>. when what it was given is not Skirl's block, and Not changed: cannot read … or cannot write … when it is not run as root on the manager.
Certificates#
For an https:// address, the integration checks Skirl's certificate, and never turns that check off. Wazuh's Python does not look for certificates where Linux systems keep them, so the integration uses the file named by SSL_CERT_FILE when that is set for the manager; else the first of these files that exists; else the certificates that come with Wazuh's Python, if it has them.
| File | Systems |
|---|---|
/etc/ssl/certs/ca-certificates.crt |
Debian, Ubuntu; on Fedora and Amazon Linux 2023 it is a link to tls-ca-bundle.pem, below |
/etc/pki/tls/certs/ca-bundle.crt |
Red Hat 7 to 10, CentOS 7 and Stream 10, Rocky, Alma, Oracle, Fedora, Amazon Linux 2 and 2023 |
/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem |
what the one above links to |
/etc/ssl/ca-bundle.pem |
SUSE Linux Enterprise 15, openSUSE Leap 15 |
/var/lib/ca-certificates/ca-bundle.pem |
what the one above links to |
The setup check names the one it found. These files hold the certificates the system trusts, with those you added yourself. So when Skirl's certificate comes from your own authority, add that authority to the system's store, and the integration trusts it too. On Red Hat and its relatives, put its certificate in /etc/pki/ca-trust/source/anchors/ and run:
update-ca-trustOn Debian and Ubuntu the same is done with update-ca-certificates and /usr/local/share/ca-certificates/.
To name a file yourself, set SSL_CERT_FILE for the manager. Open its service settings:
systemctl edit wazuh-managerand add, with your file's path:
[Service]
Environment=SSL_CERT_FILE=/path/to/bundleThen restart the manager.
The copy of ossec.conf#
The first time the configure step changes ossec.conf, it keeps the file as it was in /var/ossec/etc/ossec.conf.skirl-backup. Later runs leave that copy alone and say so ("as it was before Skirl first changed it: …, kept"), so it is always your ossec.conf from before Skirl, never one with Skirl's block in it.
The configure step writes into ossec.conf itself, so the file keeps its owner and mode. It takes out any custom-skirl block, adds Skirl's at the end in an <ossec_config> of its own, and changes nothing else.
Removing it#
Delete the <integration> block whose <name> is custom-skirl from /var/ossec/etc/ossec.conf, with the <ossec_config> around it, and restart the manager. If nothing else in ossec.conf changed since Skirl's first configure step, putting the copy back does the same:
cp /var/ossec/etc/ossec.conf.skirl-backup /var/ossec/etc/ossec.confThen remove the integration's two files:
rm /var/ossec/integrations/custom-skirl /var/ossec/integrations/custom-skirl.pyWhen nothing arrives#
- Run the setup check, and fix each
Wrong:line (Check the setup). - Run the connection check.
OKmeans the manager reaches Skirl with the token, so the problem is which alerts Wazuh sends (Check the connection). - The alert is under the level you picked. Wazuh sends only alerts from that level up; the test alert is level 8.
- Its kind is unticked. The test alert and the connection check are Everything else; Skirl answers OK and drops them when that is unticked.
- Look at Wazuh's integrations log. Each alert the manager could not deliver is one line there, starting with
custom-skirl:, with the same reasons as the checks:
tail -n 20 /var/ossec/logs/integrations.log| Line | What it means |
|---|---|
custom-skirl: could not post alert … (rule …) to …: … |
The alert did not reach Skirl; the end of the line says why, as in Check the connection. |
custom-skirl: not sent: in ossec.conf, the … |
The address or token in ossec.conf is wrong: The address and the token. |
custom-skirl: could not read the alert …: … (is <alert_format>json</alert_format> set?) |
The block lacks <alert_format>json</alert_format>: run the configure step again. |
custom-skirl: needs the alert file and <hook_url> (check the <integration> block in ossec.conf) |
The block has no <hook_url>: run the configure step again. |
custom-skirl: Wazuh's Python is not at /var/ossec/framework/python/bin/python3 |
This is not a Wazuh manager, or not a complete one: the integration runs only on the manager. |
The integration never writes the token, or the address's query, in any log. More on the address, the token and the network in general: A sender gets no message through.