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.
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
AmneziaVPN supports multiple protocols. Determine which protocol your server is using by reviewing your AmneziaVPN configuration file or logs. The most common protocols are:
Identify the OpenVPN container using:
docker ps
Look for a container name like amnezia-openvpn.Access the OpenVPN container:
docker exec -it amnezia-openvpn /bin/bashCheck the OpenVPN status file:
cat /etc/openvpn/server/status.log
This file contains information such as client IP addresses, connection start times, and data transferred.Exit the container:
exitNavigate to the WireGuard configuration directory:
cd /etc/wireguardUse the wg show command to list connected clients:
wg show
This will display peer public keys, allowed IPs, last handshake times, and data transfer information.Identify the IKEv2 container using:
docker ps
Look for a container name like amnezia-ikev2.Access the IKEv2 container:
docker exec -it amnezia-ikev2 /bin/bashView the logs to find connected clients:
cat /var/log/charon.log
Look for entries indicating active connections, including IP addresses and connection times.Exit the container:
exitAmneziaVPN logs client activity, which can help identify connected users and devices. To access these logs:
Identify the AmneziaVPN client container using:
docker ps
Look for a container name like amnezia-client.Access the container:
docker exec -it amnezia-client /bin/bashCheck the logs for connection details:
cat /var/log/amnezia-client.log
Look for entries related to client connections, including usernames, IP addresses, and connection timestamps.Exit the container:
exitAmneziaVPN 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-openvpnYou 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
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.