With audit logging being supported by nftables as a simple (fake) log
level, translating AUDIT target is easy. Especially since xt_AUDIT in
kernel doesn't quite care about --type parameter.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
}
}
+static int audit_xlate(struct xt_xlate *xl,
+ const struct xt_xlate_tg_params *params)
+{
+ /* audit type is merely sanity checked by xt_AUDIT.ko,
+ * so nftables doesn't even support it */
+
+ xt_xlate_add(xl, "log level audit");
+ return 1;
+}
+
static struct xtables_target audit_tg_reg = {
.name = "AUDIT",
.version = XTABLES_VERSION,
.save = audit_save,
.x6_parse = audit_parse,
.x6_options = audit_opts,
+ .xlate = audit_xlate,
};
void _init(void)
--- /dev/null
+iptables-translate -t filter -A INPUT -j AUDIT --type accept
+nft add rule ip filter INPUT counter log level audit
+
+iptables-translate -t filter -A INPUT -j AUDIT --type drop
+nft add rule ip filter INPUT counter log level audit
+
+iptables-translate -t filter -A INPUT -j AUDIT --type reject
+nft add rule ip filter INPUT counter log level audit