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.
Files changed (2) hide show
  1. package/README.md +74 -24
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,33 +1,64 @@
1
- # wgm - Simplified WireGuard Peer Management
1
+ # wgm
2
+
3
+ [![npm version](https://img.shields.io/npm/v/wgm.svg)](https://www.npmjs.com/package/wgm)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](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 addition without manual config editing
8
- - Automatic IP address allocation
9
- - Automatic config backup
10
- - Client config file generation with QR code
11
- - Support for manual or auto key generation
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 inquirer qrcode ini
19
+ npm install -g wgm
17
20
  ```
18
21
 
19
- Or use directly with npx:
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 add # Add a new peer interactively
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
- ❯ I provide the client public key (recommended)
40
- Auto-generate key pair
41
- ? Paste client publicKey: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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
- Peer "macbook" added successfully
44
- 📄 Config saved: macbook.conf
45
- 📱 QR Code:
46
- [QR code displayed]
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
- ## Requirements
84
+ ## Client Setup
50
85
 
51
- - WireGuard installed (`wg` command available)
52
- - Node.js >= 16
53
- - Root privileges
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)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wgm",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Simplified WireGuard Peer Management Tool",
5
5
  "main": "bin/wgm",
6
6
  "bin": {