Chat
Ask me anything
Ithy Logo

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

  1. Identify the OpenVPN container using:

    docker ps
    Look for a container name like amnezia-openvpn.

  2. Access the OpenVPN container:

    docker exec -it amnezia-openvpn /bin/bash

  3. Check 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.

  4. Exit the container:

    exit

For WireGuard

  1. Navigate to the WireGuard configuration directory:

    cd /etc/wireguard

  2. Use 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.

For IKEv2

  1. Identify the IKEv2 container using:

    docker ps
    Look for a container name like amnezia-ikev2.

  2. Access the IKEv2 container:

    docker exec -it amnezia-ikev2 /bin/bash

  3. View the logs to find connected clients:

    cat /var/log/charon.log
    Look for entries indicating active connections, including IP addresses and connection times.

  4. Exit the container:

    exit

Checking AmneziaVPN Client Logs

AmneziaVPN logs client activity, which can help identify connected users and devices. To access these logs:

  1. Identify the AmneziaVPN client container using:

    docker ps
    Look for a container name like amnezia-client.

  2. Access the container:

    docker exec -it amnezia-client /bin/bash

  3. Check 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.

  4. Exit the container:

    exit

Monitoring Docker Containers

AmneziaVPN runs its services in Docker containers. To monitor active containers and their logs:

  1. List all running containers:

    docker ps

  2. View logs for a specific container (e.g., amnezia-openvpn):

    docker logs amnezia-openvpn

  3. Monitor 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

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
Ask Ithy AI
Download Article
Delete Article