wgm 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,33 +1,64 @@
|
|
|
1
|
-
# wgm
|
|
1
|
+
# wgm
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/wgm)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
2
5
|
|
|
3
6
|
A lightweight CLI tool for managing WireGuard peers with interactive prompts.
|
|
4
7
|
|
|
5
8
|
## Features
|
|
6
9
|
|
|
7
|
-
- Interactive peer
|
|
8
|
-
- Automatic IP
|
|
9
|
-
-
|
|
10
|
-
- Client config
|
|
11
|
-
- Support for manual
|
|
10
|
+
- **Interactive peer management** - Add/remove peers without manual config editing
|
|
11
|
+
- **Automatic IP allocation** - Finds next available IP in your network range
|
|
12
|
+
- **Config backup** - Automatically backs up your WireGuard config before changes
|
|
13
|
+
- **Client config generation** - Creates ready-to-use `.conf` files with QR codes
|
|
14
|
+
- **Flexible key generation** - Support for both manual (secure) and auto-generated keys
|
|
12
15
|
|
|
13
16
|
## Installation
|
|
14
17
|
|
|
15
18
|
```bash
|
|
16
|
-
npm install -g
|
|
19
|
+
npm install -g wgm
|
|
17
20
|
```
|
|
18
21
|
|
|
19
|
-
Or use
|
|
22
|
+
Or use with npx (no installation):
|
|
20
23
|
|
|
21
24
|
```bash
|
|
22
25
|
sudo npx wgm add
|
|
23
26
|
```
|
|
24
27
|
|
|
28
|
+
## Requirements
|
|
29
|
+
|
|
30
|
+
- WireGuard installed (`wg` and `wg-quick` commands available)
|
|
31
|
+
- Node.js >= 16
|
|
32
|
+
- Root privileges (for reading/writing `/etc/wireguard/`)
|
|
33
|
+
|
|
25
34
|
## Usage
|
|
26
35
|
|
|
36
|
+
### Add a new peer
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
sudo wgm add
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Interactive workflow:
|
|
43
|
+
1. Enter peer name (e.g., `laptop`, `phone`)
|
|
44
|
+
2. Choose key generation method:
|
|
45
|
+
- **Manual** (recommended): Client generates keys locally, you paste the public key
|
|
46
|
+
- **Auto**: Tool generates keys on server (less secure)
|
|
47
|
+
3. Configure AllowedIPs (default: server VPN IP only)
|
|
48
|
+
4. Tool generates `peername.conf` file and QR code
|
|
49
|
+
|
|
50
|
+
### List all peers
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
wgm list
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Shows online/offline status and assigned IPs.
|
|
57
|
+
|
|
58
|
+
### Remove a peer
|
|
59
|
+
|
|
27
60
|
```bash
|
|
28
|
-
wgm
|
|
29
|
-
wgm list # List all peers
|
|
30
|
-
wgm rm <name> # Remove a peer
|
|
61
|
+
sudo wgm rm <name>
|
|
31
62
|
```
|
|
32
63
|
|
|
33
64
|
## Example
|
|
@@ -35,23 +66,42 @@ wgm rm <name> # Remove a peer
|
|
|
35
66
|
```bash
|
|
36
67
|
$ sudo wgm add
|
|
37
68
|
? Peer name: macbook
|
|
38
|
-
? Key generation method:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
69
|
+
? Key generation method: I provide the client public key (recommended)
|
|
70
|
+
|
|
71
|
+
On the client device, run:
|
|
72
|
+
wg genkey | tee privatekey | wg pubkey
|
|
73
|
+
Send the PUBLIC KEY to the server admin.
|
|
74
|
+
|
|
75
|
+
? Paste client public key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
42
76
|
Assigned IP: 10.0.0.3/24
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
[QR
|
|
77
|
+
? AllowedIPs (traffic to route through VPN): 10.0.0.1/32
|
|
78
|
+
[OK] Peer "macbook" added successfully
|
|
79
|
+
[FILE] Config saved: macbook.conf
|
|
80
|
+
[QR] QR Code:
|
|
81
|
+
[QR code displayed here]
|
|
47
82
|
```
|
|
48
83
|
|
|
49
|
-
##
|
|
84
|
+
## Client Setup
|
|
50
85
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
86
|
+
1. Copy the generated `.conf` file to your client device
|
|
87
|
+
2. Import into WireGuard app, or use command line:
|
|
88
|
+
```bash
|
|
89
|
+
sudo wg-quick up ./macbook.conf
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## How It Works
|
|
93
|
+
|
|
94
|
+
- Reads/writes `/etc/wireguard/<interface>.conf`
|
|
95
|
+
- Automatically detects available WireGuard interfaces
|
|
96
|
+
- Creates timestamped backups before modifications
|
|
97
|
+
- Reloads WireGuard configuration after changes
|
|
98
|
+
|
|
99
|
+
## Security Notes
|
|
100
|
+
|
|
101
|
+
- **Manual key generation** (recommended): Private key never leaves the client device
|
|
102
|
+
- **Auto key generation**: Private key is generated on the server; use only in trusted environments
|
|
103
|
+
- Always verify peer public keys before adding
|
|
54
104
|
|
|
55
105
|
## License
|
|
56
106
|
|
|
57
|
-
MIT
|
|
107
|
+
MIT © [justyining](https://github.com/justyining)
|