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
Added WebSocket authentication options --ws-auth and --ws-auth-expire.
This commit introduces two new command-line options to enhance WebSocket
security in GoAccess:
--ws-auth=<jwt[:secret]>: Enables JWT-based authentication for WebSocket
connections. Supports an optional secret (as a string or file path) for token
verification. Without a secret, it falls back to the GOACCESS_WSAUTH_SECRET
environment variable or generates an HS256-compatible secret. When enabled, the
HTML report delays bootstrapping initial data until authentication succeeds.
--ws-auth-expire=<secs>: Sets the JWT expiration time, defaulting to 3600
seconds (1 hour). Supports flexible formats like "24h", "10m", or "10d" for
user convenience.
These options strengthen real-time HTML output security by ensuring only
authenticated clients access the WebSocket feed.
Closes#2794, #1133, #2411
goaccess \- fast web log analyzer and interactive viewer.
4
4
.SH SYNOPSIS
@@ -460,6 +460,37 @@ Enable real-time HTML output.
460
460
GoAccess uses its own WebSocket server to push the data from the server to the
461
461
client. See http://gwsocket.io for more details how the WebSocket server works.
462
462
.TP
463
+
\fB\-\-ws-auth=<jwt[:secret]>
464
+
465
+
Enable WebSocket authentication using a JSON Web Token (JWT). Optionally, a secret key can be provided for verification.
466
+
467
+
.IP
468
+
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.
469
+
.IP
470
+
The system processes this option as follows: if the argument starts with "jwt:", the part after the colon is treated as either a file path (if it exists, the secret is read from the file) or a direct secret string. If only "jwt" is provided, the secret is sourced from the environment variable \fBGOACCESS_WSAUTH_SECRET\fR, or a default HS256-compatible secret is generated if the variable is unset. See http://gwsocket.io for more details on the underlying WebSocket server.
471
+
472
+
.TP
473
+
\fB\-\-ws-auth-expire=<secs>
474
+
475
+
Set the time after which the JWT expires. Defaults to 8 hours (28800 seconds) if not specified.
476
+
477
+
.IP
478
+
Users can specify the expiration time in various formats. The value is converted to seconds for JWT expiration validation. Supported formats:
479
+
480
+
.RS
481
+
.IP\(bu4
482
+
"3600" -> 3600 seconds
483
+
.IP\(bu4
484
+
"24h" -> 24 hours = 86,400 seconds
485
+
.IP\(bu4
486
+
"10m" -> 10 minutes = 600 seconds
487
+
.IP\(bu4
488
+
"10d" -> 10 days = 864,000 seconds
489
+
.RE
490
+
491
+
.IP
492
+
The expiration time controls how long the JWT remains valid after issuance, ensuring secure WebSocket connections.
493
+
.TP
463
494
\fB\-\-ws-url=<[scheme://]url[:port]>
464
495
URL to which the WebSocket server responds. This is the URL supplied to the
0 commit comments