Authentication Methods
FreeTAKServer uses different authentication methods for different services:| Service | Authentication Method | Port |
|---|---|---|
| REST API | Bearer Token (Flask-HTTPAuth) | 19023 |
| HTTPS TAK API | Mutual TLS (Client Certificates) | 8443 |
| HTTP TAK API | Optional/None | 8080 |
| SSL CoT Service | Client Certificates | 8089 |
| TCP CoT Service | None | 8087 |
REST API Authentication
The REST API service uses Bearer Token authentication implemented with Flask-HTTPAuth.Implementation
The authentication is implemented inFreeTAKServer/services/rest_api_service/controllers/authentication.py:
Token Verification Process
- Extract Token: The
@auth.login_requireddecorator extracts the Bearer token from theAuthorizationheader - Query APIUser Table: First checks if the token exists in the
APIUsertable - Query SystemUser Table: If not found in APIUser, checks the
SystemUsertable - Log Request: For system users, logs the API call with timestamp, content, and endpoint
- Return Identity: Returns the username if valid,
Noneif invalid
Using Bearer Token Authentication
Making Authenticated Requests
Include the Bearer token in theAuthorization header:
Protected Endpoints
All REST API endpoints except/Alive require authentication. Endpoints are decorated with @auth.login_required:
TAK API Authentication
HTTPS TAK API (Port 8443)
The HTTPS TAK API service uses mutual TLS authentication requiring client certificates.Certificate Requirements
- Server Certificate: Server must have a valid SSL certificate signed by the CA
- Client Certificate: Each client must present a valid certificate signed by the same CA
- CA Certificate: Both server and client must trust the Certificate Authority
Certificate Paths
Default certificate locations (configurable viaMainConfig):
- Server Key:
/opt/fts/certs/server.key.unencrypted - Server Certificate:
/opt/fts/certs/server.pem - CA Certificate:
/opt/fts/certs/ca.pem - CA Key:
/opt/fts/certs/ca.key
HTTP TAK API (Port 8080)
The HTTP TAK API service does not require authentication and is intended for development/testing only.System User Management
Creating Users with Tokens
System users can be created with authentication tokens through the REST API:Creating Users with Certificates
When creating users with certificates enabled, FreeTAKServer automatically generates client certificates:- Generate a client certificate using
AtakOfTheCerts().bake(common_name=cert_name) - Create a certificate package (
.p12file) - Generate a platform-specific ZIP package (WinTAK or mobile ATAK)
- Store the package as a data package for download
- Optionally send a CoT message to the client with download information
Certificate generation uses the
FreeTAKServer.core.util.certificate_generation module and creates packages compatible with ATAK, WinTAK, and iTAK clients.User Types
FreeTAKServer supports two types of authenticated users:API Users
Stored in theAPIUser database table, these users are specifically for API access.
Fields:
Username: User identifiertoken: Bearer token for authentication
System Users
Stored in theSystemUser database table, these users represent TAK clients and can access both API and CoT services.
Fields:
name: User/callsigngroup: User group/teamtoken: Bearer token for API authenticationpassword: Password (may be used for alternative auth)uid: Unique user identifiercertificate_package_name: Name of associated certificate packagedevice_type: Device type (“mobile”, “wintak”, etc.)
API Call Logging
When system users authenticate to the REST API, all API calls are logged:WebSocket Authentication
The REST API service provides WebSocket endpoints for real-time updates. WebSocket connections require separate authentication:Security Best Practices
Token Management
-
Generate Strong Tokens: Use cryptographically secure random tokens
- Store Securely: Never commit tokens to version control
-
Rotate Regularly: Update tokens periodically using the update endpoint
- Use HTTPS: Always use HTTPS in production to prevent token interception
Certificate Management
- Protect CA Key: The CA private key should be stored securely with restricted permissions
- Certificate Expiration: Monitor and renew certificates before expiration
-
Revocation: Use the Certificate Revocation List (CRL) to revoke compromised certificates
- Client Certificate Distribution: Use secure channels to distribute client certificates
Configuration Security
-
Change Default Keys: Update
SecretKeyandwebsocketkeyinMainConfig -
Environment Variables: Use environment variables for sensitive configuration:
- Restrict API Access: Use firewall rules to limit REST API access to authorized networks
- Disable HTTP TAK API: In production, disable or firewall the HTTP TAK API service (port 8080)
Troubleshooting Authentication
401 Unauthorized Errors
Symptom: REST API returns 401 Unauthorized Possible Causes:- Missing or invalid Bearer token
- Token not in database
- Incorrect header format (should be
Authorization: Bearer TOKEN)
Certificate Authentication Failures
Symptom: HTTPS TAK API refuses connection or returns SSL errors Possible Causes:- Client certificate not signed by trusted CA
- Certificate expired
- Certificate revoked
- Incorrect certificate format
WebSocket Authentication Fails
Symptom: WebSocket events return no data or connection rejected Solution:- Verify
websocketkeyin MainConfig matches authentication key - Ensure authentication event is sent before other events
- Check that session.authenticated is set to True
Next Steps
- REST API Reference - Explore available REST API endpoints
- Security Configuration - Learn about managing users and certificates
- Configuration - Configure authentication settings