1cattunnel 0.1.2-b.3 → 0.3.0

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 CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Global npm wrapper for the 1Cat Tunnel client.
4
4
 
5
+ Version 0.3.0 uses TLS 1.3 by default and persists the dedicated per-node credential after first enrollment.
6
+
5
7
  ## Install
6
8
 
7
9
  ```bash
@@ -21,15 +23,26 @@ On first run it creates a writable user config and the Go client wizard asks for
21
23
  - a WebUI bootstrap token; or
22
24
  - the enrollment password from the administrator.
23
25
 
24
- The entered enrollment password is saved locally so later runs can reconnect automatically.
26
+ The enrollment password is saved only until the first successful connection. It is then replaced by the dedicated node token. On Windows, choose `Manual custom ports` in the wizard to expose one or more custom TCP/UDP local ports.
25
27
 
26
28
  Config path:
27
29
 
28
30
  - Windows: `%APPDATA%\\1cat-tunnel\\client-windows.json`
29
31
  - Linux: `~/.config/1cat-tunnel/client-linux.json`
30
32
 
33
+ Linux clients also expose a loopback-only API for submitting blocked IPs to the server:
34
+
35
+ ```bash
36
+ curl -u admin:YOUR_ADMIN_PASSWORD \
37
+ -H "Content-Type: application/json" \
38
+ -d '{"ip":"203.0.113.10","reason":"scan"}' \
39
+ http://127.0.0.1:51888/api/block-ip
40
+ ```
41
+
42
+ The server validates the same WebUI administrator username/password before adding the IP to the persistent blocklist.
43
+
31
44
  Use a custom config if needed:
32
45
 
33
46
  ```bash
34
47
  1cattunnel -config ./client-linux.json
35
- ```
48
+ ```
package/bin/1cattunnel.js CHANGED
@@ -82,13 +82,16 @@ function ensureUserConfig() {
82
82
  const dir = configRoot();
83
83
  const target = path.join(dir, configName);
84
84
  if (fs.existsSync(target)) {
85
+ if (!isWindows) {
86
+ fs.chmodSync(target, 0o600);
87
+ }
85
88
  return target;
86
89
  }
87
90
 
88
91
  fs.mkdirSync(dir, { recursive: true });
89
92
  const config = JSON.parse(fs.readFileSync(templatePath, 'utf8'));
90
93
  config.node_name = safeNodeName();
91
- fs.writeFileSync(target, `${JSON.stringify(config, null, 2)}\n`);
94
+ fs.writeFileSync(target, `${JSON.stringify(config, null, 2)}\n`, { mode: 0o600 });
92
95
  console.log(`1cattunnel: created default config at ${target}`);
93
96
  return target;
94
97
  }
@@ -109,4 +112,4 @@ if (result.error) {
109
112
  fail(result.error.message);
110
113
  }
111
114
 
112
- process.exit(typeof result.status === 'number' ? result.status : 1);
115
+ process.exit(typeof result.status === 'number' ? result.status : 1);
@@ -1,8 +1,11 @@
1
1
  {
2
- "server_addr": "dx.1catai.com:50001",
3
- "node_name": "cust-linux-01",
4
- "reconnect_interval_sec": 5,
5
- "presets": [
2
+ "server_addr": "dx.1catai.com:32001",
3
+ "tls_enabled": true,
4
+ "tls_server_name": "dx.1catai.com",
5
+ "node_name": "cust-linux-01",
6
+ "reconnect_interval_sec": 5,
7
+ "block_ip_api_listen_addr": "127.0.0.1:51888",
8
+ "presets": [
6
9
  {
7
10
  "name": "ssh",
8
11
  "local_addr": "0.0.0.0:22",
@@ -1,5 +1,7 @@
1
1
  {
2
- "server_addr": "dx.1catai.com:50001",
2
+ "server_addr": "dx.1catai.com:32001",
3
+ "tls_enabled": true,
4
+ "tls_server_name": "dx.1catai.com",
3
5
  "node_name": "cust-win-01",
4
6
  "reconnect_interval_sec": 5,
5
7
  "presets": [
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "1cattunnel",
3
- "version": "0.1.2-b.3",
3
+ "version": "0.3.0",
4
4
  "description": "1Cat Tunnel client with bundled Windows/Linux amd64 binaries",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -27,4 +27,4 @@
27
27
  "scripts": {
28
28
  "postinstall": "node scripts/postinstall.js"
29
29
  }
30
- }
30
+ }