Token-Based Security
Hash-Based Tokens
Hash-based tokens provide secure, one-time access control using HMAC signatures.Enable hash-based access control for publishing streams.When enabled, publishers must provide a valid hash token to start streaming.
Enable hash-based access control for playing streams.When enabled, viewers must provide a valid hash token to watch streams.
Secret key used for generating and validating hash-based tokens.Important: Keep this secret secure and never expose it in client-side code.Usage:
One-Time Tokens
One-time tokens provide session-specific access that expires after use.Enable one-time token control for publishing.Tokens must be generated via REST API and are valid for a single publish session.
Enable one-time token control for playing.Tokens must be generated via REST API and are valid for a single play session.
Time-Based Tokens (TOTP)
TOTP (Time-based One-Time Password) tokens provide time-limited access without requiring server-side token storage.Enable TOTP authentication for publishing streams.
TOTP secret for publishing authentication.If subscriber is not in database, the server validates TOTP code against this secret.
Enable TOTP authentication for playing streams.
TOTP secret for play authentication.If subscriber is not in database, the server validates TOTP code against this secret.
TOTP token validity period in seconds.Standard TOTP implementations use 30 or 60 seconds.
JWT Authentication
Application-Level JWT
Enable JWT authentication for REST API access at the application level.
JWT secret key for application-level authentication.Used to sign and validate JWT tokens for REST API endpoints.
JWKS (JSON Web Key Set) URL for JWT validation.If set, JWKS is used for validation instead of the secret key. Effective only if jwtControlEnabled is true.
Stream-Level JWT
Enable JWT token filter for publishing streams.
Enable JWT token filter for playing streams.
JWT secret key for stream-level authentication.Important: Must be at least 32 characters long.
Server-Level JWT
Configured in server settings (red5.properties):
Enable JWT authentication for server-level REST API and web panel access.
JWT secret key for server-level authentication.
IP Filtering
Application Access Control
Enable IP filtering for the application.
Comma-separated CIDR addresses allowed to access the REST API.Format:
a.b.c.d/xExamples:192.168.1.0/24- Entire subnet10.0.0.5/32- Single IP192.168.1.0/24,10.0.0.5/32- Multiple ranges
Comma-separated CIDR addresses allowed to publish streams.Empty string means accept publishers from anywhere.Examples:
192.168.0.0/16- Private network only203.0.113.0/24- Specific public subnet
Dashboard Access Control
Configured in server settings:IP addresses allowed to access the web panel.Production recommendation: Restrict to admin IP addresses only.Example:
Webhook Authentication
Webhook URL called to authenticate publishing attempts.The server sends a POST request with stream details. The webhook should return:
- HTTP 200 - Allow publishing
- HTTP 403 - Deny publishing
Webhook URL for WebRTC play authentication.Similar to webhookAuthenticateURL but for play requests.
Subscriber Authentication
Secret key for subscriber JWT authentication (push notifications).JWT tokens for subscribers should be generated with:Default value is a randomly generated 32-character string.
Require JWT token for analytics events.Uses
jwtSecretKey for validation.Stream Access Control
Only accept streams that are pre-registered in the database.When enabled:
- Create stream via REST API:
POST /broadcast/create - Only streams with matching stream IDs can publish
- Attempts to publish unregistered streams are rejected
Only accept conference rooms that are pre-registered in the database.
SSL/TLS Configuration
HTTPS
Configured in server settings:- Obtains Let’s Encrypt certificate
- Configures HTTPS on port 5443
- Enables automatic certificate renewal
- Sets
sslEnabled=true
RTMPS
Enable RTMPS (RTMP over SSL/TLS).Requires SSL certificate to be installed first.
Content Security Policy
Value for Content-Security-Policy HTTP response header.Helps reduce XSS risks by declaring which resources can be loaded.Example:See MDN CSP documentation for details.
Security Best Practices
1. Enable Multiple Security Layers
For production environments, use multiple security mechanisms:2. Secure Secret Keys
- Use cryptographically random keys (at least 32 characters)
- Never commit secrets to version control
- Rotate secrets periodically
- Use different secrets for different purposes
3. Restrict Access by IP
4. Use HTTPS/RTMPS in Production
5. Implement Webhook Authentication
6. Use JWT for API Access
7. Monitor and Audit
- Enable logging for security events
- Monitor failed authentication attempts
- Review access logs regularly
- Set up alerts for suspicious activity
Security Configuration Examples
Minimal Security (Development)
Moderate Security (Staging)
Maximum Security (Production)
Troubleshooting
Unable to Publish/Play
- Check if token control is enabled
- Verify token is valid and not expired
- Check IP is in allowedPublisherCIDR (for publishing)
- Review webhook response (if enabled)
- Check server logs for rejection reason
JWT Validation Failures
- Verify secret key is correct
- Check token hasn’t expired
- Ensure token signature algorithm matches (HS256)
- Validate token payload includes required claims
IP Filter Issues
- Verify CIDR notation is correct
- Check client IP (may be proxy IP if behind load balancer)
- Temporarily disable to test:
ipFilterEnabled=false - Review server logs for rejected IPs
