1cattunnel 0.3.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,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Global npm wrapper for the 1Cat Tunnel client.
|
|
4
4
|
|
|
5
|
-
Version 0.3.
|
|
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
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
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,22 @@ 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)) {
|
|
85
100
|
if (!isWindows) {
|
|
86
101
|
fs.chmodSync(target, 0o600);
|
|
87
102
|
}
|
|
88
103
|
return target;
|
|
89
104
|
}
|
|
90
|
-
|
|
91
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
92
105
|
const config = JSON.parse(fs.readFileSync(templatePath, 'utf8'));
|
|
93
106
|
config.node_name = safeNodeName();
|
|
94
107
|
fs.writeFileSync(target, `${JSON.stringify(config, null, 2)}\n`, { mode: 0o600 });
|
|
@@ -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
|