awg-manager/README.md

103 lines
2.9 KiB
Markdown
Raw Normal View History

2024-02-12 06:01:15 +00:00
# awg-manager
2022-11-03 15:37:53 +00:00
2024-02-12 06:01:15 +00:00
AmneziaWG manager allow initialize AmneziaWG server and manage users.
2022-11-03 15:37:53 +00:00
2024-02-12 06:01:15 +00:00
You can start the AmneziaWG server with one command, and then create (and delete) users.
2022-11-03 15:53:56 +00:00
2022-11-03 15:37:53 +00:00
```bash
2024-02-12 06:01:15 +00:00
Usage: ./awg-manager.sh [<options>] [command [arg]]
2022-11-03 15:37:53 +00:00
Options:
-i : Init (Create server keys and configs)
-c : Create new user
-d : Delete user
2022-12-13 19:07:37 +00:00
-L : Lock user
-U : Unlock user
2022-11-03 15:37:53 +00:00
-p : Print user config
2024-04-24 22:35:14 +00:00
-q : Print user QR code
2022-11-03 15:37:53 +00:00
-u <user> : User identifier (uniq field for vpn account)
-s <server> : Server host for user connection
2022-12-13 19:07:37 +00:00
-I : Interface (default auto)
2022-11-03 15:37:53 +00:00
-h : Usage
```
## Quick start
2024-02-12 06:01:15 +00:00
Run server (bare-metal or VPS) with Ubuntu 20.02, 22.02
2022-11-03 15:37:53 +00:00
2024-04-24 22:52:50 +00:00
## Build AmneziaWG and Install additional packages
2022-11-03 15:37:53 +00:00
```bash
2024-02-12 06:01:15 +00:00
apt update && apt upgrade -y
2024-04-24 22:21:55 +00:00
apt install build-essential curl make git wget qrencode python3 python3-pip -y
2024-02-12 06:01:15 +00:00
#install Golang
mkdir -p /opt/go
cd /opt/go
wget https://go.dev/dl/go1.22.0.linux-amd64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.22.0.linux-amd64.tar.gz
echo "export PATH=$PATH:/usr/local/go/bin" >> /etc/profile
2024-02-25 20:32:06 +00:00
source /etc/profile
2024-02-12 06:01:15 +00:00
# if the go version does not show, then update the session
#Install amnezia-go
git clone https://github.com/amnezia-vpn/amneziawg-go.git /opt/amnezia-go
cd /opt/amnezia-go
make
#copy to amneziawg-go
2024-02-19 13:22:25 +00:00
cp /opt/amnezia-go/amneziawg-go /usr/bin/amneziawg-go
2024-02-12 06:01:15 +00:00
#Install amnezia-tools
git clone https://github.com/amnezia-vpn/amneziawg-tools.git /opt/amnezia-tools
cd /opt/amnezia-tools/src
make
make install
2024-04-24 22:21:55 +00:00
#Install PyQt6
pip3 install PyQt6
2022-11-03 15:37:53 +00:00
```
2024-04-24 21:37:26 +00:00
Or
```
apt update && apt upgrade -y
apt install wget -y
wget -O- https://raw.githubusercontent.com/bkeenke/awg-manager/master/init.sh | sh
```
```
wget -O- https://raw.githubusercontent.com/bkeenke/awg-manager/master/awg-manager.sh > /etc/amnezia/amneziawg/awg-manager.sh
```
```
cd /etc/amnezia/amneziawg/
chmod 700 ./awg-manager.sh
./awg-manager.sh -i -s $(curl https://ipinfo.io/ip) -I $(ip route | awk '/default/ { print $5 }')
```
## Usage awg-manager
```
./awg-manager.sh -u Username -c
```
2022-11-03 15:37:53 +00:00
2024-04-24 21:37:26 +00:00
## Usage amneziawg-go
2024-02-12 06:06:05 +00:00
Simply run:
```
amneziawg-go awg0
```
This will create an interface and fork into the background. To remove the interface, use the usual ip link del wg0, or if your system does not support removing interfaces directly, you may instead remove the control socket via rm -f /var/run/amneziawg/wg0.sock, which will result in amneziawg-go shutting down.
To run amneziawg-go without forking to the background, pass -f or --foreground:
```
2024-02-24 14:02:05 +00:00
amneziawg-go -f awg0
2024-02-12 06:06:05 +00:00
```
When an interface is running, you may use amnezia-wg-tools `awg-quick` to configure it, as well as the usual ip(8) and ifconfig(8) commands.
## Setup
2022-11-03 15:37:53 +00:00
2024-02-12 06:08:31 +00:00
- Download this script [awg-manager.sh](https://raw.githubusercontent.com/bkeenke/awg-manager/master/awg-manager.sh) from GitHub
2024-02-19 13:23:24 +00:00
- Initialize Annezia-WG server: `./awg-manager.sh -i -s YOUR_SERVER_IP`
2024-02-12 06:08:31 +00:00
- Add your user: `./awg-manager.sh -c -u my_user -p > awg-client.conf`
2024-02-19 13:23:24 +00:00
- Install AmneziaVPN on the client
2024-02-12 06:08:31 +00:00
- Start client with config `awg-client.conf`
2022-11-03 16:12:23 +00:00