1.7 KiB
1.7 KiB
Authentication Token
This guide covers token-based authentication for securing socktop agent connections.
- Access Control - Only authorized clients can connect
- Security - Prevent unauthorized monitoring of your systems
- Auditability - Track which tokens are in use
- Flexibility - Revoke and rotate tokens as needed
Configuring Token Authentication
Agent Configuration
APT Installation
Edit /etc/default/socktop-agent:
sudo nano /etc/default/socktop-agent
Add your token:
# Authentication token
TOKEN=7KJ9m3LnP4qR8sT2vW5xY6zA1bC3dE4fG7hI9jK0lM8=
Restart the service:
sudo systemctl restart socktop-agent
Cargo Installation
Start the agent with the token:
socktop_agent --token "7KJ9m3LnP4qR8sT2vW5xY6zA1bC3dE4fG7hI9jK0lM8="
Or with systemd service:
sudo systemctl edit socktop-agent
Add environment variable:
[Service]
Environment="TOKEN=7KJ9m3LnP4qR8sT2vW5xY6zA1bC3dE4fG7hI9jK0lM8="
sudo systemctl daemon-reload
sudo systemctl restart socktop-agent
Client Configuration
Command Line
# Pass token via command line
socktop ws://server:3000 -t "7KJ9m3LnP4qR8sT2vW5xY6zA1bC3dE4fG7hI9jK0lM8="
Connection Profile
Add token to profile (~/.config/socktop/profiles.json):
{
"profiles": {
"secure-server": {
"url": "ws://server.example.com:3000/ws?token=7KJ9m3LnP4qR8sT2vW5xY6zA1bC3dE4fG7hI9jK0lM8="
}
},
"version": 0
}
Then connect:
socktop -P secure-server
Environment Variable
# Set token in environment
export SOCKTOP_TOKEN="7KJ9m3LnP4qR8sT2vW5xY6zA1bC3dE4fG7hI9jK0lM8="
# Connect without specifying token
socktop ws://server:3000