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
Enable WebSocket authentication using a JSON Web Token (JWT). This option supports two formats depending on whether the JWT is locally generated or externally fetched and verified:
466
-
.IP
467
-
\fB<jwt[:secret]>\fR: Specifies a static JWT for WebSocket authentication, with an optional secret for local generation or validation. If only "jwt" is provided (e.g., \fB\-\-ws-auth=jwt\fR), GoAccess generates a JWT using a secret sourced from the environment variable \fBGOACCESS_WSAUTH_SECRET\fR or a default HS256-compatible secret if unset. If a secret is included (e.g., \fB\-\-ws-auth=jwt:mysecret\fR), it's used directly as the HS256 signing key or read from a file if the value is a valid path (e.g., \fB\-\-ws-auth=jwt:/path/to/secret.key\fR).
468
-
.IP
469
-
\fBjwt:verify:secret\fR: Enables verification of an externally fetched JWT (e.g., via \fB\-\-ws-auth-url\fR). The "verify" keyword indicates that the JWT is provided by an external source, and the secret must be specified for validation. The secret can be a direct HS256 key (e.g., \fB\-\-ws-auth=jwt:verify:mysecret\fR), a file path (e.g., \fB\-\-ws-auth=jwt:verify:/path/to/secret.key\fR), or an environment variable name (e.g., \fB\-\-ws-auth=jwt:verify:$JWT_SECRET\fR). This format is required when using \fB\-\-ws-auth-url\fR and optionally \fB\-\-ws-auth-refresh-url\fR to fetch and verify JWTs from external endpoints.
470
-
.IP
471
-
When this option is used, the HTML report will not bootstrap the initial parsed data. Instead, it will only display the report if authentication succeeds, ensuring secure access to real-time data.
465
+
Enable WebSocket authentication using a JSON Web Token (JWT). This option
466
+
supports two formats depending on whether the JWT is locally generated or
467
+
externally fetched and verified:
468
+
.IP
469
+
\fB<jwt[:secret]>\fR: Specifies a static JWT for WebSocket authentication, with
470
+
an optional secret for local generation or validation. If only "jwt" is
471
+
provided (e.g., \fB\-\-ws-auth=jwt\fR), GoAccess generates a JWT using a secret
472
+
sourced from the environment variable \fBGOACCESS_WSAUTH_SECRET\fR or a default
473
+
HS256-compatible secret if unset. If a secret is included (e.g.,
474
+
\fB\-\-ws-auth=jwt:mysecret\fR), it's used directly as the HS256 signing key or
475
+
read from a file if the value is a valid path (e.g.,
476
+
\fB\-\-ws-auth=jwt:/path/to/secret.key\fR).
477
+
.IP
478
+
\fBjwt:verify:secret\fR: Enables verification of an externally fetched JWT
479
+
(e.g., via \fB\-\-ws-auth-url\fR). The "verify" keyword indicates that the JWT
480
+
is provided by an external source, and the secret must be specified for
481
+
validation. The secret can be a direct HS256 key (e.g.,
482
+
\fB\-\-ws-auth=jwt:verify:mysecret\fR), a file path (e.g.,
483
+
\fB\-\-ws-auth=jwt:verify:/path/to/secret.key\fR), or an environment variable
484
+
name (e.g., \fB\-\-ws-auth=jwt:verify:$JWT_SECRET\fR). This format is required
485
+
when using \fB\-\-ws-auth-url\fR and optionally \fB\-\-ws-auth-refresh-url\fR
486
+
to fetch and verify JWTs from external endpoints.
487
+
.IP
488
+
When this option is used, the HTML report will not bootstrap the initial parsed
489
+
data. Instead, it will only display the report if authentication succeeds,
490
+
ensuring secure access to real-time data.
472
491
.IP
473
492
The system processes this option as follows:
474
493
.IP
475
-
For \fB<jwt[:secret]>\fR: If no secret is provided, GoAccess generates a JWT locally using the \fBGOACCESS_WSAUTH_SECRET\fR environment variable or a default secret. If a secret is specified, it's used to sign the JWT (either directly or from a file).
494
+
For \fB<jwt[:secret]>\fR: If no secret is provided, GoAccess generates a JWT
495
+
locally using the \fBGOACCESS_WSAUTH_SECRET\fR environment variable or a
496
+
default secret. If a secret is specified, it's used to sign the JWT (either
497
+
directly or from a file).
476
498
.IP
477
-
For \fBjwt:verify:secret\fR: The secret is mandatory and used to verify externally fetched JWTs. It must match the signing key used by the external authentication server (e.g., at \fB\-\-ws-auth-url\fR).
499
+
For \fBjwt:verify:secret\fR: The secret is mandatory and used to verify
500
+
externally fetched JWTs. It must match the signing key used by the external
501
+
authentication server (e.g., at \fB\-\-ws-auth-url\fR).
502
+
.IP
503
+
Requires to build GoAccess with
504
+
.I--with-openssl.
478
505
.TP
479
506
\fB\-\-ws-auth-expire=<secs>
480
-
Set the time after which the JWT expires. Defaults to 8 hours (28800 seconds) if not specified.
507
+
Set the time after which the JWT expires. Defaults to 8 hours (28800 seconds)
508
+
if not specified.
481
509
.IP
482
510
.IOnly
483
511
available for locally generated JWT.
484
512
.IP
485
-
Users can specify the expiration time in various formats. The value is converted to seconds for JWT expiration validation. Supported formats:
513
+
Users can specify the expiration time in various formats. The value is
514
+
converted to seconds for JWT expiration validation. Supported formats:
486
515
.RS
487
516
.IP\(bu4
488
517
"3600" -> 3600 seconds
@@ -496,43 +525,63 @@ Users can specify the expiration time in various formats. The value is converted
496
525
"10d" -> 10 days = 864,000 seconds
497
526
.RE
498
527
.IP
499
-
The expiration time controls how long the JWT remains valid after issuance, ensuring secure WebSocket connections.
528
+
The expiration time controls how long the JWT remains valid after issuance,
529
+
ensuring secure WebSocket connections.
500
530
.TP
501
531
\fB\-\-ws-auth-url=<url>
502
-
Specifies the URL where GoAccess fetches the initial JWT to authenticate the WebSocket connection.
532
+
Specifies the URL where GoAccess fetches the initial JWT to authenticate the
533
+
WebSocket connection.
503
534
.IP
504
-
When this option is used, GoAccess sends a GET request to the specified URL to fetch an initial JWT. The response must be a JSON object containing \fBstatus\fR, \fBaccess_token\fR, \fBrefresh_token\fR, and \fBexpires_in\fR fields.
535
+
When this option is used, GoAccess sends a GET request to the specified URL to
536
+
fetch an initial JWT. The response must be a JSON object containing
537
+
\fBstatus\fR, \fBaccess_token\fR, \fBrefresh_token\fR, and \fBexpires_in\fR
as part of the request to securely retrieve the access token based on the user’s existing authentication session in your system, ensuring token retrieval is safe as long as your users are authenticated.
544
+
as part of the request to securely retrieve the access token based on the
545
+
user’s existing authentication session in your system, ensuring token retrieval
546
+
is safe as long as your users are authenticated.
511
547
.IP
512
-
This option allows you to integrate your existing authentication system with the GoAccess dashboard, using token retrieval endpoints.
548
+
This option allows you to integrate your existing authentication system with
549
+
the GoAccess dashboard, using token retrieval endpoints.
513
550
.TP
514
551
\fB\-\-ws-auth-refresh-url=<url>
515
552
Specifies the URL where GoAccess fetches a new JWT when the current one is about to expire.
516
553
.IP
517
-
GoAccess proactively refreshes the JWT 60 seconds before expiration by sending a POST request with the refresh_token to this URL. If not provided, it defaults to the same URL as \fB\-\-ws-auth-url\fR.
554
+
GoAccess proactively refreshes the JWT 60 seconds before expiration by sending
555
+
a POST request with the refresh_token to this URL. If not provided, it defaults
If authentication fails, the endpoint should return:
@@ -546,22 +595,30 @@ If authentication fails, the endpoint should return:
546
595
\fBTokenRefreshing:\fR
547
596
.RS
548
597
.IP\(bu4
549
-
GoAccess refreshes the JWT 60 seconds before expiration by sending a POST request:
598
+
GoAccess refreshes the JWT 60 seconds before expiration by sending a POST
599
+
request to the specified URL (defaults to \fB--ws-auth-url\fR if
600
+
\fB--ws-auth-refresh-url\fR is not set):
550
601
.IP
551
-
{
552
-
"refresh_token": "refresh123xyz"
553
-
}
602
+
{ "refresh_token": "refresh123xyz" }
603
+
.IP
604
+
GoAccess supports both stateless and stateful authentication. For stateless, no
605
+
cookies or CSRF are required; your backend validates the refresh token
606
+
signature. For stateful, include a \fBcsrf_token\fR in the initial response;
607
+
GoAccess sends it as \fBX-CSRF-TOKEN\fR in the refresh request, which your
608
+
backend must validate against the session.
554
609
.RE
555
610
.IP
556
611
\fBPeriodicTokenValidation:\fR
557
612
.RS
558
613
.IP\(bu4
559
-
When GoAccess sends a refresh request to the endpoint, it confirms the validity of the updated JWT with the WebSocket server by transmitting this JSON object:
614
+
After refreshing, GoAccess confirms the updated JWT’s validity with the
0 commit comments