MIT Network Audit docs
Verification

Verify the log and export evidence

5 min read Odoo 18.0

This page shows you how to check that the stored Audit Log has not been changed, and how to export a signed file that another person can check outside Odoo.

Who this is for: administrators and security officers. You need: a user in the Network Audit group. For the independent check you also need the standalone verifier script that comes with the module's source repository, and Python 3.

Before you begin

  1. Know what the checks cover. Verify chain recomputes the hash chain of the rows that are in the log now. It shows edits, inserted rows and removed rows inside the chain. It does not show that every connection was captured, and it does not by itself show that the end of the log was cut off.
  2. Read Understand a recorded event if you do not know what the chain fields are.
  3. Decide who will check the file, and how you will give them the signing key if they should also check the signed head. See Check the signed head below.

What an intact log proves

An intact log means that the stored rows are consistent with each other. It does not prove that the module captured every connection. It also does not protect against a person who controls the whole database. Such a person could rebuild the chain, and could replace the signed head, because the signing key is stored in the same database.

Verify the chain

  1. Open Network Audit ▸ Trust Report.
  2. Click Verify chain.

What you should see: a short notification with one of two messages (read it before it fades):

  • Audit chain verified OK — no tampering detected. Every row's hash matched.
  • Audit chain BROKEN at chain_seq=N — tampering detected. N is the first row that does not match. Everything after it is affected as a result. Start your investigation at row N.

The Trust Report with the confirmation that the audit chain verified OK A passed check. A failed check names the first broken row.

The check always covers the whole log. It starts from the oldest row that is still in the log, so rows that the retention job removed do not cause a false alarm. For the same reason, the check does not detect that the oldest rows were removed.

Export a signed file

The export writes a JSON file with the rows, their hashes and the latest signed head.

Quick export of the whole log:

  1. Open Network Audit ▸ Trust Report.
  2. Click Export signed proof.

What you should see: your browser downloads a file named mit_network_audit_export_<database>_all.json.

Export of a part of the log:

  1. Open Network Audit ▸ Export Signed Audit.
  2. In Window, choose All period, Date range, Last N days or From chain position, and fill in the matching field.
  3. Click Download. Click Close to cancel.

What you should see: your browser downloads a JSON file. For a partial export the file name includes the window.

The Export Signed Audit wizard with the window options and the Download and Close buttons The Export Signed Audit wizard.

Window Rows in the file
All period Every row in the log.
Date range Rows between the two dates you set.
Last N days Rows from the last N days.
From chain position Rows from the chain position you set onward.

What the file contains

Field Meaning
format, module_version, db_name The file format, the module version that wrote it, and the database name.
hashed_fields The fields of each row that go into its hash.
exported_window The window you chose.
signed_head The latest daily signed head, as chain_seq:row_hash:signature. It is empty until the daily job has run once.
chain_seq_min, chain_seq_max The first and last row positions in the file.
rows[] For each row: position, hashes, the hashed fields, and a separate enrichment block.

The enrichment block holds header names and masked values, content types and size labels. It is not protected by the chain. Someone could change it without breaking the check. Do not rely on it as evidence.

The file holds metadata only. It has no request or response bodies.

Check the file outside Odoo

  1. Copy the verifier script verify_export.py and the exported file to a machine with Python 3. The script uses only the standard library.
  2. Run python verify_export.py export.json.

What you should see: a line that says the hash chain is intact. The exit code is 0 if the chain is intact, 1 if the script found tampering, and 2 for bad input.

To also check the signed head, add --key <signing key>. The key is a per-database secret that the module creates the first time it signs. Handle it like a password. Anyone who has it can sign a head for your database. If you give it to the person who checks, do it through a safe channel.

Check the signed head

A hash chain alone cannot show that someone deleted the newest rows. A daily job signs the current head of the chain with HMAC and stores it in a system parameter. If rows are cut off from the end, the signed head still points to a position that the log no longer reaches. The check with --key compares them.

Use an All period export for this check. In a partial export the last row can lie below the signed head, and the script then reports a cut-off that did not happen.

These limits apply:

  • The signed head is made once a day. Rows saved after the last signing, and then deleted, leave no trace in it.

  • The signing key is stored in the same database as the log. A person with full control of that database could replace both the chain and the signed head.

  • Verify chain in Odoo does not compare the signed head. Use the standalone verifier with --key for that check.

The retention job never deletes rows at or after the signed head, so normal clean-up does not look like tampering.

If it does not work

Symptom Check Safe next step
Verify chain reports a broken row. Note the chain_seq. Open that row and the one before it. Export the log now, keep a copy of the database, and tell your security contact. Do not delete anything.
signed_head is empty in the file. The daily job has not run yet, or the module is new. Wait for the job (Network Audit: sign chain head) or ask an administrator to run it. Export again.
The verifier prints a signed-head: message about an invalid HMAC. The key does not belong to this database, or the signed head was changed. The script still exits with 0 in this case, so read its output. Get the key from the system parameter mit_network_audit.chain_sign_key of the right database. Only an administrator should do this.
The export download is a 404 page. Your user is not in the Network Audit group. Ask an administrator.

Next step

Change audit settings.

Related: What the audit log can and cannot show.