Skip to main content
  1. Posts/
  2. Authentik/

Authentik: setting up a Reputation Policy

··586 words·3 mins· loading · loading · ·
Stilicho2011
Author
Stilicho2011
Writing about homelab, self-hosting, automation and open-source solutions
Table of Contents
Authentik - This article is part of a series.
Part : This Article

Policies provide configuration and flexibility when defining the user login and authentication process.

Essentially, policies decide whether a given stage will be applied within a flow, as well as whether specific users can access that flow at all.

For example, you can create a policy that skips the MFA prompt stage for certain users. Or you could define a policy that only allows access to the login flow if certain conditions are met. In this article, I’ll look at the reputation policy.

Reputation Policy
#

Authentik tracks recent login attempts for each identifier (username, email address, etc.) and client IP address. These values are stored as scores. Failed login attempts decrease the score by 1, and successful ones increase it by 1.

This policy can be used, for example, to make users with a low score go through a CAPTCHA check before continuing to log in.

Under the administrator account, go to the Flows and Stages > Flows menu

Select your main identification flow, in my case default-authentication-flow, then go to the Policy/Groups/User Bindings section

Policy/Group/User Bindings section of the default-authentication-flow

Next, go to Create and Bind Policy, and select Reputation Policy from the menu.

Selecting the policy type - Reputation Policy

In the next section, give the policy a name that makes sense to you.

Next comes a very important point to keep in mind. If you select both check ip and check username, then if, say, user Vanya fails a login attempt from a specific IP address, that access will be denied. But if, say, Galya successfully logs in from that same IP address, she will be granted access.

If you select only check ip, then failed login attempts from a specific IP address, regardless of username, will result in that IP being denied.

Conversely, if you select only check username, then failed login attempts under a specific username will result in that specific user being denied, regardless of the IP address they’re trying to authenticate from.

Choose whichever option best fits your needs.

Threshold is the value at which the policy kicks in. The default is -5.

Configuring the Reputation Policy - Check IP and Threshold

In the next section, enable the Negate the result option.

Binding the Reputation Policy - Negate result and Order
Note

In short: Negate the result is a flag that inverts the policy’s outcome.

Put simply:

  • disabled → the policy works “as is”
  • enabled → the policy’s result gets flipped

For example, suppose the policy returns:

  • true - conditions are met
  • false - conditions are not met

If you enable Negate the result:

  • true → becomes false
  • false → becomes true

Why is this needed in Authentik: this is handy when a policy defines a “bad” condition, but you need to react to the “good” one, or vice versa - applying a stage only when the conditions are NOT met.

Example with the Reputation Policy: the policy checks score ≥ 0. Without negation, the stage is applied when the reputation is normal. With Negate the result, the stage is instead applied when the reputation is bad (for example, to show a CAPTCHA or block the login).

Also specify the policy’s order number.


In the Flow overview section, you can see how the flow now works.

Diagram of the default-authentication-flow with the Reputation Policy attached

If your reputation is good, you’ll be able to go through all authentication stages. If your reputation is below the configured threshold (in my case, three failed login attempts from the same IP address), Authentik simply won’t let you proceed further.

You can view reputation values in the CustomisationReputation Scores menu.

Reputation Scores table in Customisation

In the next article, we’ll talk about setting up a policy based on the geographic location of the user’s IP address.

Authentik - This article is part of a series.
Part : This Article

Related