You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: en_US/access-control/authn/authn.md
+16-4
Original file line number
Diff line number
Diff line change
@@ -89,7 +89,7 @@ When an authentication chain is configured, EMQX processes authenticators in the
89
89
Here’s how it works, using password-based authentication as an example:
90
90
91
91
1.**Evaluate Preconditions (if configured):**
92
-
If the authenticator has a [precondition](#authenticator-preconditions), EMQX first evaluates the expression based on client information (e.g., `listener`, `clientid`, `username`).
92
+
If the authenticator has a [precondition](#authenticator-preconditions), EMQX first evaluates the expression based on client attributes information (e.g., `listener`, `clientid`, `username`).
93
93
- If the expression evaluates to `true`, the authenticator is invoked.
94
94
- If not, the authenticator is skipped.
95
95
2.**Execute the Authenticator:**
@@ -106,11 +106,23 @@ Here’s how it works, using password-based authentication as an example:
106
106
107
107
### Authenticator Preconditions
108
108
109
-
Starting from EMQX 5.9, you can assign a precondition to each authenticator to control whether it should be invoked for a given client.
109
+
Starting from EMQX 5.9, you can assign a precondition to each authenticator to control whether it should be invoked for a given client. A precondition is a [Variform expression](../../configuration/configuration.md#variform-expressions) that evaluates client attributes (such as `listener`, `username`, `clientid`, etc.). If the expression does not evaluate to `true`, the authenticator is skipped.
110
110
111
-
A precondition is a [Variform expression](../../configuration/configuration.md#variform-expressions) that evaluates client metadata (such as `listener`, `username`, `clientid`, etc.). If the expression does not evaluate to `true`, the authenticator is skipped.
111
+
This feature enables conditional logic in the authentication chain. It allows for fine-grained control over authentication logic, such as applying different authenticators for clients connecting through different listeners or based on client attributes. EMQX can then invoke authenticators only when appropriate and avoid unnecessary requests to external systems.
112
112
113
-
This feature enables conditional logic in the authentication chain, allowing EMQX to invoke authenticators only when appropriate and avoid unnecessary requests to external systems.
113
+
#### Supported Client Attributes in Precondition
114
+
115
+
Supported client attributes in a precondition include:
116
+
117
+
-`username`: The username of the client
118
+
-`password`: The password of the client
119
+
-`clientid`: The client ID of the client
120
+
-`client_attrs.*`: The client attributes of the client
121
+
-`cert_common_name`: The subject field from the client's TLS certificate
122
+
-`cert_subject`: The Common Name (CN) from the client's TLS certificate
123
+
-`peersni`: The SNI (Server Name Indication) sent by the TLS client
Copy file name to clipboardExpand all lines: en_US/access-control/authn/cinfo.md
+17-12
Original file line number
Diff line number
Diff line change
@@ -10,18 +10,23 @@ Client-Info authentication (`cinfo` type) is a lightweight authentication mechan
10
10
11
11
## Configure Client-Info Authentication via Dashboard
12
12
13
-
In the EMQX Dashboard, navigate to **Access Control** -> **Authentication** in the left menu to enter the **Authentication** page. Click **Create** at the top right corner, then select **Client Info** as the **Mechanism**, Client-Info authentication does not require selecting a backend, so you can proceed by clicking **Next** to enter the **Configure Parameters** step.
14
-
15
-
1. Click **Add** in the **Checks**.
16
-
- In the **Match Conditions** input box, enter the Variform expression used to match client information. If there are multiple expressions, enter each on a new line. When all expressions return `true`, the authenticator will return the relevant result; otherwise, the current check will be skipped. The following variables are supported in the expressions:
17
-
-`username`: Username
18
-
-`clientid`: Client ID
19
-
-`client_attrs.*`: Client Attributes
20
-
-`peerhost`: Client IP
21
-
-`cert_subject`: TLS Certificate Subject
22
-
-`cert_common_name`: TLS Certificate Common Name
23
-
- Select `allow`, `ignore`, or `deny` from the **Result** dropdown menu.
24
-
2. Click **Create** to complete the authentication configuration.
13
+
1. In the EMQX Dashboard, navigate to **Access Control** -> **Authentication** in the left menu to enter the **Authentication** page.
14
+
2. Click **Create** at the top right corner, then select **Client Info** as the **Mechanism**. Client-Info authentication does not require selecting a backend, so you can proceed by clicking **Next** to enter the **Configure Parameters** step.
15
+
3. Follow the instructions below to configure the backend:
16
+
-**Precondition**: A [Variform expression](../../configuration/configuration.md#variform-expressions) used to control whether this Client Info authenticator should be applied to a client connection. The expression is evaluated against attributes from the client (such as `username`, `clientid`, `listener`, etc.). The authenticator will only be invoked if the expression evaluates to the string `"true"`. Otherwise, it will be skipped. For more information about the precondition, see [Authentication Preconditions](./authn.md#authentication-preconditions).
17
+
- Click **Add** in the **Checks**.
18
+
- In the **Match Conditions** input box, enter the Variform expression used to match client information. If there are multiple expressions, enter each on a new line. When all expressions return `true`, the authenticator will return the relevant result; otherwise, the current check will be skipped. The following variables are supported in the expressions:
19
+
-`username`: Username
20
+
-`clientid`: Client ID
21
+
-`client_attrs.*`: Client Attributes
22
+
-`peerhost`: Client IP
23
+
-`cert_subject`: TLS Certificate Subject
24
+
-`cert_common_name`: TLS Certificate Common Name
25
+
- From the **Result** dropdown menu, select the result to return if the match condition is true:
26
+
-`allow`: Allow the client to connect.
27
+
-`ignore`: Defer the authentication to the next authenticator in the chain.
28
+
-`deny`: Deny the client to connect.
29
+
4. Click **Create** to complete the authentication configuration.
25
30
26
31
## Configure Client-Info Authentication via Configuration Items
Copy file name to clipboardExpand all lines: en_US/access-control/authn/http.md
+19-19
Original file line number
Diff line number
Diff line change
@@ -63,36 +63,36 @@ Due to the lack of expressiveness, it has been redesigned to make use of HTTP bo
63
63
64
64
You can use EMQX Dashboard to finish the relevant configuration.
65
65
66
-
On [EMQX Dashboard](http://127.0.0.1:18083/#/authentication), click **Access Control** -> **Authentication** on the left navigation tree to enter the **Authentication** page. Click **Create** at the top right corner, then click to select **Password-Based** as **Mechanism**, and **HTTP Server** as **Backend**, this will lead us to the **Configuration** tab, as shown below.
66
+
1. In the EMQX Dashboard, click **Access Control** -> **Authentication** from the left navigation menu.
67
+
2. On the **Authentication** page, click **Create** in the top right corner.
68
+
3. Click to select **Password-Based** as **Mechanism**, and **HTTP Server** as **Backend** to go to the **Configuration** tab, as shown below.
The `POST` method is recommended. When using the `GET` method, some sensitive information (such as plain text passwords) may be exposed via HTTP server logs. Also, for untrusted environments, please use HTTPS.
77
-
:::
78
+
The `POST` method is recommended. When using the `GET` method, some sensitive information (such as plain text passwords) may be exposed via HTTP server logs. Also, for untrusted environments, please use HTTPS.
79
+
:::
78
80
79
-
-**URL**: Enter the URL address of the HTTP service.
80
-
-**Headers** (optional): HTTP request header. You can add several headers. Keys and values support using [placeholders](./authn.md#authentication-placeholders).
81
-
-**Enable TLS**: Turn on the toggle switch if you want to enable TLS. For more information on enabling TLS, see [Network and TLS](../../network/overview.md).
81
+
-**URL**: Enter the URL address of the HTTP service.
82
+
-**Precondition**: A [Variform expression](../../configuration/configuration.md#variform-expressions) used to control whether this HTTP Server authenticator should be applied to a client connection. The expression is evaluated against attributes from the client (such as `username`, `clientid`, `listener`, etc.). The authenticator will only be invoked if the expression evaluates to the string `"true"`. Otherwise, it will be skipped. For more information about the precondition, see [Authentication Preconditions](./authn.md#authentication-preconditions).
83
+
-**Headers** (optional): HTTP request header. You can add several headers. Keys and values support using [placeholders](./authn.md#authentication-placeholders).
84
+
-**Enable TLS**: Turn on the toggle switch if you want to enable TLS. For more information on enabling TLS, see [Network and TLS](../../network/overview.md).
85
+
-**Body**: Request template; for `POST` requests, it is sent as a JSON in the request body; for `GET` requests, it is encoded as a Query String in the URL. Mapping keys and values support using [placeholders](./authn.md#authentication-placeholders).
86
+
-**Advanced Settings**:
87
+
-**Pool size** (optional): Input an integer value to define the number of concurrent connections from an EMQX node to an HTTP server. Default: `8`.
82
88
83
-
-**Body**: Request template; for `POST` requests, it is sent as a JSON in the request body; for `GET` requests, it is encoded as a Query String in the URL. Mapping keys and values support using [placeholders](./authn.md#authentication-placeholders).
89
+
-**Connect Timeout** (optional): Specify the waiting period before EMQX assumes the connection is timed out. Units supported include milliseconds, second, minute, and hour.
84
90
85
-
-**Advanced Settings**:
91
+
-**HTTP Pipelining** (optional): Input a positive integer to specify the maximum number of HTTP requests that can be sent without waiting for a response; default value: `100`.
86
92
87
-
-**Pool size** (optional): Input an integer value to define the number of concurrent connections from an EMQX node to an HTTP server. Default: `8`.
93
+
-**Request Timeout** (optional): Specify the waiting period before EMQX assumes the request is timed out. Units supported include milliseconds, second, minute, and hour.
88
94
89
-
-**Connect Timeout** (optional): Specify the waiting period before EMQX assumes the connection is timed out. Units supported include milliseconds, second, minute, and hour.
90
-
91
-
-**HTTP Pipelining** (optional): Input a positive integer to specify the maximum number of HTTP requests that can be sent without waiting for a response; default value: `100`.
92
-
93
-
-**Request Timeout** (optional): Specify the waiting period before EMQX assumes the request is timed out. Units supported include milliseconds, second, minute, and hour.
94
-
95
-
After you finish the settings, click **Create**.
95
+
5. After you finish the settings, click **Create**.
Copy file name to clipboardExpand all lines: en_US/access-control/authn/jwt.md
+2-1
Original file line number
Diff line number
Diff line change
@@ -57,7 +57,7 @@ Example:
57
57
58
58
1. Select **Access Control** -> **Authentication** from the left navigation menu.
59
59
60
-
2. On the **Authentication** page, click **Create**at the top right corner. Click to select **JWT** as **Mechanism**, and click **Next**. Skip the Backend selection and go to the **Configuration** tab.
60
+
2. On the **Authentication** page, click **Create**in the top right corner. Click to select **JWT** as the**Mechanism**, and click **Next**. Skip the Backend selection and go to the **Configuration** tab.
-`public-key`: Uses a private key to generate the JWT's signature and a public key for verification. Supported algorithms are RS256, RS384, RS512, ES256, ES384, and ES512. Configuration must include:
75
75
-`Public Key`: Specify the public key in PEM format used to verify the signature.
76
76
77
+
-**Precondition**: A [Variform expression](../../configuration/configuration.md#variform-expressions) used to control whether this JWT authenticator should be applied to a client connection. The expression is evaluated against attributes from the client (such as `username`, `clientid`, `listener`, etc.). The authenticator will only be invoked if the expression evaluates to the string `"true"`. Otherwise, it will be skipped. For more information about the precondition, see [Authentication Preconditions](./authn.md#authentication-preconditions).
77
78
-**Disconnect After Expiration**: Configures whether to disconnect clients after their JWT expires, enabled by default.
78
79
-**Payload**: Specify additional claims checks that the user wants to perform. Users can define multiple key-value pairs with the **Claim** and **Expacted Value** fields, where the key is used to find the corresponding claim in the JWT, so it needs to have the same name as the JWT claim to be checked, and the value is used to compare with the actual value of the claim. Currently, the placeholders supported are `${clientid}` and `${username}`.
Copy file name to clipboardExpand all lines: en_US/access-control/authn/kerberos.md
+15-8
Original file line number
Diff line number
Diff line change
@@ -56,23 +56,30 @@ To configure the Kerberos authenticator, you need a running KDC (Key Distributio
56
56
57
57
EMQX can only support keytab files at the default location. You can configure the system default value by using the environment variable `KRB5_KTNAME` or by setting `default_keytab_name` in `/etc/krb5.conf`.
58
58
59
-
## Configure via Dashboard
59
+
::: tip Note
60
60
61
-
In the EMQX Dashboard, navigate to **Access Control** -> **Authentication** in the left menu to enter the **Authentication** page. Click **Create** at the top right corner, then select **GSSAPI** as the **Mechanism**, and **Kerberos** as the **Backend**. Click **Next** to go to the **Configuration** step.
61
+
The keytab file `/etc/krb5.conf` must be located on the EMQX nodes, and the user running the EMQX service must have read permissions for the file.
62
62
63
-
1. Configure the following fields:
63
+
:::
64
64
65
-
-**Principal**: Set Kerberos principal for the server to define the server's identity within the Kerberos authentication system. For example, `mqtt/[email protected]`.
65
+
## Configure via Dashboard
66
66
67
-
Note: The realm in use must be configured in `/etc/krb5.conf` on EMQX nodes.
67
+
1. In the EMQX Dashboard, navigate to **Access Control** -> **Authentication** in the left menu to enter the **Authentication** page.
68
68
69
+
2. Click **Create** at the top right corner, then select **GSSAPI** as the **Mechanism**, and **Kerberos** as the **Backend**.
69
70
70
-
-**Keytab File**: Specify the path to the Kerberos keytab file.
71
+
3. Click **Next** to go to the **Configuration** step.
71
72
72
-
Note: The keytab file must be located on the EMQX nodes, and the user running the EMQX service must have read permissions for the file.
73
+
4. Configure the following fields:
74
+
75
+
-**Principal**: Set Kerberos principal for the server to define the server's identity within the Kerberos authentication system. For example, `mqtt/[email protected]`.
76
+
77
+
Note: The realm in use must be configured in `/etc/krb5.conf` on EMQX nodes.
78
+
79
+
-**Precondition**: A [Variform expression](../../configuration/configuration.md#variform-expressions) used to control whether this Kerberos authenticator should be applied to a client connection. The expression is evaluated against attributes from the client (such as `username`, `clientid`, `listener`, etc.). The authenticator will only be invoked if the expression evaluates to the string `"true"`. Otherwise, it will be skipped. For more information about the precondition, see [Authentication Preconditions](./authn.md#authentication-preconditions).
73
80
74
81
75
-
2. Click **Create** to complete the configuration.
82
+
5. Click **Create** to complete the configuration.
0 commit comments