To view a list of users, devices, or clients connected to your self-hosted AmneziaVPN server, you'll need to access your server and utilize command-line tools and logs. AmneziaVPN does not offer a single, straightforward method for this, so you'll need to combine information from different sources. The specific steps depend on the VPN protocol you are using (OpenVPN, WireGuard, or IKEv2) and your server setup.
Accessing Your Server
First, you need to connect to your server via SSH. Use the following command, replacing username with your server's username and your_server_ip with your server's IP address:
ssh username@your_server_ip
If necessary, switch to the root user:
sudo -i
Identifying Your VPN Protocol
AmneziaVPN supports multiple protocols. Determine which protocol your server is using by reviewing your AmneziaVPN configuration file or logs. The most common protocols are:
- OpenVPN
- WireGuard
- IKEv2
Checking Connected Clients Based on Protocol
For OpenVPN
Identify the OpenVPN container using:
Look for a container name likedocker psamnezia-openvpn.Access the OpenVPN container:
docker exec -it amnezia-openvpn /bin/bashCheck the OpenVPN status file:
This file contains information such as client IP addresses, connection start times, and data transferred.cat /etc/openvpn/server/status.logExit the container:
exit
For WireGuard
Navigate to the WireGuard configuration directory:
cd /etc/wireguardUse the
wg showcommand to list connected clients:
This will display peer public keys, allowed IPs, last handshake times, and data transfer information.wg show
For IKEv2
Identify the IKEv2 container using:
Look for a container name likedocker psamnezia-ikev2.Access the IKEv2 container:
docker exec -it amnezia-ikev2 /bin/bashView the logs to find connected clients:
Look for entries indicating active connections, including IP addresses and connection times.cat /var/log/charon.logExit the container:
exit
Checking AmneziaVPN Client Logs
AmneziaVPN logs client activity, which can help identify connected users and devices. To access these logs:
Identify the AmneziaVPN client container using:
Look for a container name likedocker psamnezia-client.Access the container:
docker exec -it amnezia-client /bin/bashCheck the logs for connection details:
Look for entries related to client connections, including usernames, IP addresses, and connection timestamps.cat /var/log/amnezia-client.logExit the container:
exit
Monitoring Docker Containers
AmneziaVPN runs its services in Docker containers. To monitor active containers and their logs:
List all running containers:
docker psView logs for a specific container (e.g.,
amnezia-openvpn):docker logs amnezia-openvpnMonitor logs in real-time:
docker logs -f amnezia-openvpn
Automating Monitoring (Optional)
You can automate the process of monitoring connected clients by setting up a script or cron job to periodically query the status of your VPN server and log the output to a file. For example, for WireGuard:
#!/bin/bash
wg show > /var/log/wireguard-connections.log
Schedule it with cron:
crontab -e
Add the following line to run the script every 5 minutes:
*/5 * * * * /path/to/script.sh
Additional Information
- AmneziaVPN does not have a built-in user management system that tracks individual users separately from devices. The setup typically involves sharing the VPN connection details, which can be used by multiple devices without distinguishing between individual users.
- The official documentation does not provide a method for generating a detailed list of connected users and devices. However, you can refer to the setup guides and troubleshooting sections for more information on managing your VPN server.
- Ensure you have root or administrative access to the server for these steps.
- The exact file paths and commands may vary depending on your server's configuration and the version of AmneziaVPN you are using. Always refer to the official documentation for the most accurate information.
Official Resources
- https://docs.amnezia.org
- https://github.com/amnezia-vpn/amnezia-client
- Telegram Support Channels
By combining the information from server logs, protocol-specific commands, and client logs, you can get a comprehensive view of connected users, devices, and clients on your AmneziaVPN server. Keep in mind that real-time monitoring and detailed user management are not currently supported features, and you may need to use a combination of these methods to get the information you need.
December 24, 2024