Server Scout uses unique API keys to authenticate your monitoring agents with the centralised monitoring service. Each server receives a 64-character hexadecimal API key during initial setup, which serves as its primary authentication credential. Understanding how to properly manage and rotate these keys is essential for maintaining the security of your monitoring infrastructure.
How API Keys Work in Server Scout
When you set up a new server in Server Scout, the system automatically generates a unique 64-character hexadecimal API key. This key looks something like a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6a7b8c9d0e1f2g3h4i5j6k7l8 and serves as your server's digital identity.
The Server Scout agent uses this key for all communications with the monitoring service by including it in the X-API-Key HTTP header with every request. This approach ensures that only authorised agents can submit monitoring data to your account whilst keeping the authentication process lightweight and efficient.
When to Rotate API Keys
Regular API key rotation is a fundamental security practice that helps protect your monitoring infrastructure. Consider rotating keys in the following scenarios:
- Staff departure - When team members with access to server configurations leave your organisation
- Suspected compromise - If you believe an API key may have been exposed or accessed by unauthorised parties
- Periodic security policy - As part of your organisation's regular security maintenance schedule (typically every 90-180 days)
- After security incidents - Following any breach or security event that may have exposed configuration files
- Server decommissioning - When removing servers from service to prevent potential key reuse
Rotating Keys Without Downtime
Server Scout's management API includes a regenerate action that allows you to rotate keys seamlessly. The process creates a new API key whilst immediately invalidating the previous one, ensuring no overlap period where both keys remain valid.
Here's how to rotate an API key without service interruption:
1. Generate the New Key
Access your Server Scout dashboard and navigate to the server management section. Locate the target server and click the "Regenerate API Key" option. The system will immediately create a new 64-character key and display it securely.
Important: Copy the new key immediately, as it won't be displayed again for security reasons.
2. Update Agent Configuration
Locate your Server Scout agent configuration file (typically /opt/scout-agent/agent.env.yml or /opt/serverscout/config.yml) and update the API key field:
api:
key: "your-new-64-character-api-key-here"
endpoint: "https://app.serverscout.ie"
Alternatively, if you're using environment variables:
export SERVERSCOUT_API_KEY="your-new-64-character-api-key-here"
3. Restart the Agent
Restart the Server Scout agent to apply the new configuration:
sudo systemctl restart scout-agent
Or if you're using the standalone binary:
sudo pkill scout-agent
sudo /opt/serverscout/scout-agent --daemon
4. Verify Connectivity
Check the agent logs to confirm successful authentication with the new key:
sudo journalctl -u scout-agent -f
Look for successful connection messages and ensure no authentication errors appear.
API Key Security Best Practices
Protecting your API keys requires implementing proper security measures throughout their lifecycle:
Store keys securely - Never commit API keys to version control systems or include them in publicly accessible configuration files. Use secure configuration management tools or environment variables instead.
Limit access - Restrict API key access to essential personnel only. Implement role-based access controls in your configuration management systems.
Monitor usage - Regularly review API key activity through Server Scout's dashboard to identify unusual patterns or unauthorised usage.
Rotate proactively - Don't wait for security incidents to rotate keys. Establish a regular rotation schedule and stick to it.
Document procedures - Ensure your team understands the key rotation process and maintains up-to-date documentation for emergency situations.
By following these practices and regularly rotating your Server Scout API keys, you'll maintain a robust security posture whilst ensuring continuous monitoring coverage for your infrastructure.
Frequently Asked Questions
How do I set up API keys for ServerScout monitoring agents?
How often should I rotate my ServerScout API keys?
How does ServerScout API key authentication work?
Can I rotate API keys without causing monitoring downtime?
What should I do if my ServerScout API key stops working?
Where should I store ServerScout API keys securely?
What happens to the old API key when I regenerate a new one?
Was this article helpful?