IP Address Anonymization Module (mmanon)

Module Name:

mmanon

Author:

Rainer Gerhards <rgerhards@adiscon.com>

Available since:

7.3.7

Purpose

The mmanon module permits to anonymize IP addresses. It is a message modification module that actually changes the IP address inside the message, so after calling mmanon, the original message can no longer be obtained. Note that anonymization will break digital signatures on the message, if they exist.

Please note that log files can also be anonymized via SLFA after they have been created.

How are IP-Addresses defined?

We assume that an IPv4 address consists of four octets in dotted notation, where each of the octets has a value between 0 and 255, inclusively.

An IPv6 is defined by being between zero and eight hex values between 0 and ffff. These are separated by ‘:’. Leading zeros in blocks can be omitted and blocks full of zeros can be abbreviated by using ‘::’. However, this can only happen once in an IP address.

An IPv6 address with embedded IPv4 is an IPv6 address where the last two blocks have been replaced by an IPv4 address. (see also: RFC4291, 2.2.3)

Configuration Parameters

Note

Parameter names are case-insensitive; camelCase is recommended for readability.

Action Parameters

Parameters starting with ‘IPv4.’ will configure IPv4 anonymization, while ‘IPv6.’ parameters do the same for IPv6 anonymization.

Parameter

Summary

ipv4.enable

Enables or disables IPv4 address anonymization for the mmanon action.

ipv4.mode

Selects the IPv4 anonymization mode used by the mmanon action.

ipv4.bits

Sets how many low-order bits of IPv4 addresses are anonymized.

ipv4.replaceChar

Sets the character used to overwrite anonymized IPv4 octets in simple mode.

ipv6.enable

Enables or disables IPv6 address anonymization for the mmanon action.

ipv6.anonMode

Defines how IPv6 addresses are anonymized by the mmanon action.

ipv6.bits

Sets how many low-order bits of IPv6 addresses are anonymized.

embeddedIpv4.enable

Enables or disables anonymization of IPv6 addresses with embedded IPv4 parts.

embeddedIpv4.anonMode

Defines how IPv6 addresses with embedded IPv4 parts are anonymized.

embeddedIpv4.bits

Sets how many low-order bits of embedded IPv4 addresses within IPv6 are anonymized.

See Also

Caveats/Known Bugs

  • will not anonymize addresses in the header

Examples

Anonymizing messages

In this snippet, we write one file without anonymization and another one with the message anonymized. Note that once mmanon has run, access to the original message is no longer possible (except if stored in user variables before anonymization).

module(load="mmanon")
action(type="omfile" file="/path/to/non-anon.log")
action(type="mmanon" ipv6.enable="off")
action(type="omfile" file="/path/to/anon.log")

Anonymizing a specific part of the ip address

This next snippet is almost identical to the first one, but here we anonymize the full IPv4 address. Note that by modifying the number of bits, you can anonymize different parts of the address. Keep in mind that in simple mode (used here), the bit values must match IP address bytes, so for IPv4 only the values 8, 16, 24 and 32 are valid. Also, in this example the replacement is done via asterisks instead of lower-case “x”-letters. Also keep in mind that “replacementChar” can only be set in simple mode.

module(load="mmanon") action(type="omfile" file="/path/to/non-anon.log")
action(type="mmanon" ipv4.bits="32" ipv4.mode="simple" replacementChar="\*" ipv6.enable="off")
action(type="omfile" file="/path/to/anon.log")

Anonymizing an odd number of bits

The next snippet is also based on the first one, but anonymizes an “odd” number of bits, 12. The value of 12 is used by some folks as a compromise between keeping privacy and still permitting to gain some more in-depth insight from log files. Note that anonymizing 12 bits may be insufficient to fulfill legal requirements (if such exist).

module(load="mmanon") action(type="omfile" file="/path/to/non-anon.log")
action(type="mmanon" ipv4.bits="12" ipv6.enable="off") action(type="omfile"
file="/path/to/anon.log")

Anonymizing ipv4 and ipv6 addresses

You can also anonymize IPv4 and IPv6 in one go using a configuration like this.

module(load="mmanon") action(type="omfile" file="/path/to/non-anon.log")
action(type="mmanon" ipv4.bits="12" ipv6.bits="128" ipv6.anonmode="random") action(type="omfile"
file="/path/to/anon.log")

Anonymizing with default values

It is also possible to use the default configuration for both types of anonymization. This will result in IPv4 addresses being anonymized in zero mode anonymizing 16 bits. IPv6 addresses will also be anonymized in zero mode anonymizing 96 bits.

module(load="mmanon")
action(type="omfile" file="/path/to/non-anon.log")
action(type="mmanon")
action(type="omfile" file="/path/to/anon.log")

Anonymizing only ipv6 addresses

Another option is to only anonymize IPv6 addresses. When doing this you have to disable IPv4 anonymization. This example will lead to only IPv6 addresses anonymized (using the random-consistent mode).

module(load="mmanon")
action(type="omfile" file="/path/to/non-anon.log")
action(type="mmanon" ipv4.enable="off" ipv6.anonmode="random-consistent")
action(type="omfile" file="/path/to/anon.log")

Support: rsyslog Assistant | GitHub Discussions | GitHub Issues: rsyslog source project

Contributing: Source & docs: rsyslog source project

© 2008–2025 Rainer Gerhards and others. Licensed under the Apache License 2.0.