1cattunnel 0.2.0 → 0.3.1
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.1 uses TLS 1.3 by default, embeds the project private CA, and persists the dedicated per-node credential after first enrollment.
|
|
6
|
+
|
|
5
7
|
## Install
|
|
6
8
|
|
|
7
9
|
```bash
|
|
@@ -21,7 +23,7 @@ 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
|
|
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
|
|
package/bin/1cattunnel.js
CHANGED
|
@@ -27,8 +27,10 @@ if (!isWindows && !isLinux) {
|
|
|
27
27
|
|
|
28
28
|
const binaryName = isWindows ? 'tunnel-client-windows-amd64.exe' : 'tunnel-client-linux-amd64';
|
|
29
29
|
const configName = isWindows ? 'client-windows.json' : 'client-linux.json';
|
|
30
|
+
const caName = '1cat-tunnel-ca.pem';
|
|
30
31
|
const binaryPath = path.join(packageRoot, 'dist', binaryName);
|
|
31
32
|
const templatePath = path.join(packageRoot, 'dist', configName);
|
|
33
|
+
const bundledCAPath = path.join(packageRoot, 'dist', caName);
|
|
32
34
|
|
|
33
35
|
if (!fs.existsSync(binaryPath)) {
|
|
34
36
|
fail(`bundled client binary not found: ${binaryPath}`);
|
|
@@ -36,6 +38,9 @@ if (!fs.existsSync(binaryPath)) {
|
|
|
36
38
|
if (!fs.existsSync(templatePath)) {
|
|
37
39
|
fail(`bundled default config not found: ${templatePath}`);
|
|
38
40
|
}
|
|
41
|
+
if (!fs.existsSync(bundledCAPath)) {
|
|
42
|
+
fail(`bundled TLS CA not found: ${bundledCAPath}`);
|
|
43
|
+
}
|
|
39
44
|
|
|
40
45
|
function ensureExecutable(filePath) {
|
|
41
46
|
if (isWindows) {
|
|
@@ -81,14 +86,25 @@ function hasConfigArg(args) {
|
|
|
81
86
|
function ensureUserConfig() {
|
|
82
87
|
const dir = configRoot();
|
|
83
88
|
const target = path.join(dir, configName);
|
|
89
|
+
const caTarget = path.join(dir, caName);
|
|
90
|
+
fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
91
|
+
if (!isWindows) {
|
|
92
|
+
fs.chmodSync(dir, 0o700);
|
|
93
|
+
}
|
|
94
|
+
fs.copyFileSync(bundledCAPath, caTarget);
|
|
95
|
+
if (!isWindows) {
|
|
96
|
+
fs.chmodSync(caTarget, 0o644);
|
|
97
|
+
}
|
|
98
|
+
|
|
84
99
|
if (fs.existsSync(target)) {
|
|
100
|
+
if (!isWindows) {
|
|
101
|
+
fs.chmodSync(target, 0o600);
|
|
102
|
+
}
|
|
85
103
|
return target;
|
|
86
104
|
}
|
|
87
|
-
|
|
88
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
89
105
|
const config = JSON.parse(fs.readFileSync(templatePath, 'utf8'));
|
|
90
106
|
config.node_name = safeNodeName();
|
|
91
|
-
fs.writeFileSync(target, `${JSON.stringify(config, null, 2)}\n
|
|
107
|
+
fs.writeFileSync(target, `${JSON.stringify(config, null, 2)}\n`, { mode: 0o600 });
|
|
92
108
|
console.log(`1cattunnel: created default config at ${target}`);
|
|
93
109
|
return target;
|
|
94
110
|
}
|
|
@@ -109,4 +125,4 @@ if (result.error) {
|
|
|
109
125
|
fail(result.error.message);
|
|
110
126
|
}
|
|
111
127
|
|
|
112
|
-
process.exit(typeof result.status === 'number' ? result.status : 1);
|
|
128
|
+
process.exit(typeof result.status === 'number' ? result.status : 1);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
|
2
|
+
MIIBvjCCAWWgAwIBAgIRAPEwUZsLUq6Ta4ZfFQ78uqkwCgYIKoZIzj0EAwIwPzET
|
|
3
|
+
MBEGA1UEChMKMUNhdFR1bm5lbDEoMCYGA1UEAxMfMUNhdFR1bm5lbCBQcml2YXRl
|
|
4
|
+
IFJvb3QgQ0EgMjAyNjAeFw0yNjA3MTMwMjU1NTFaFw0zNjA3MTMwMzA1NTFaMD8x
|
|
5
|
+
EzARBgNVBAoTCjFDYXRUdW5uZWwxKDAmBgNVBAMTHzFDYXRUdW5uZWwgUHJpdmF0
|
|
6
|
+
ZSBSb290IENBIDIwMjYwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAASnmijxN5uE
|
|
7
|
+
/l6K6gvODqgZvckiKzVPxTbMK2fvsM+FKAtcNqaY7tLPH8rqkOngGqC5fol3Zzw0
|
|
8
|
+
qkJqNsUxHPyXo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAd
|
|
9
|
+
BgNVHQ4EFgQUCp1XHwtK+zu6lqmHG4oNhBDP/1cwCgYIKoZIzj0EAwIDRwAwRAIg
|
|
10
|
+
OS8Jgr9SSlfcjlloUXUaOCsWMbLDRC3+i65ztmXj6l4CIBONh91ySok9dgu+9HK2
|
|
11
|
+
prMhRFQKq2DfKDfvQRObgUR9
|
|
12
|
+
-----END CERTIFICATE-----
|
package/dist/client-linux.json
CHANGED
package/dist/client-windows.json
CHANGED
|
Binary file
|
|
Binary file
|