Skip to main content
Version: 4.1

nauthilus_misc

Availability

All functions are available in every Lua runtime. Nauthilus 4.0.0 to 4.1.0 did not provide wait_random in environment sources, subject sources, and actions; 4.1.1 removed that limit. See Lua runtimes and capabilities.

The nauthilus_misc module exposes small helper functions for Lua scripts.

local misc = require("nauthilus_misc")

misc.scoped_ip​

Returns a normalized identifier for an IP address according to configured scoping rules.

Configuration precedence​

  • for ctx = "lua_generic":
    • auth.backends.lua.backend.default.ip_scoping_v6_cidr
    • auth.backends.lua.backend.default.ip_scoping_v4_cidr
  • for ctx = "rwp" and ctx = "tolerations":
    • the brute-force scoping settings under auth.controls.brute_force.ip_scoping

Example configuration​

auth:
backends:
lua:
backend:
default:
ip_scoping_v6_cidr: 64
ip_scoping_v4_cidr: 24

Example usage​

local misc = require("nauthilus_misc")

local scoped = misc.scoped_ip("lua_generic", request.client_ip)

When no CIDR is configured for the chosen context and IP version, the original IP is returned unchanged.