@serve.zone/remoteingress 1.0.4
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/cli.js +4 -0
- package/dist_ts/00_commitinfo_data.d.ts +8 -0
- package/dist_ts/00_commitinfo_data.js +9 -0
- package/dist_ts/connector.private.d.ts +6 -0
- package/dist_ts/connector.private.js +31 -0
- package/dist_ts/connector.public.d.ts +6 -0
- package/dist_ts/connector.public.js +40 -0
- package/dist_ts/index.d.ts +4 -0
- package/dist_ts/index.js +9 -0
- package/dist_ts/plugins.d.ts +7 -0
- package/dist_ts/plugins.js +8 -0
- package/npmextra.json +38 -0
- package/package.json +67 -0
- package/readme.hints.md +3 -0
- package/readme.md +107 -0
- package/ts/00_commitinfo_data.ts +8 -0
- package/ts/connector.private.ts +38 -0
- package/ts/connector.public.ts +45 -0
- package/ts/index.ts +14 -0
- package/ts/plugins.ts +15 -0
package/cli.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* autocreated commitinfo by @pushrocks/commitinfo
|
|
3
|
+
*/
|
|
4
|
+
export const commitinfo = {
|
|
5
|
+
name: '@serve.zone/remoteingress',
|
|
6
|
+
version: '1.0.4',
|
|
7
|
+
description: 'Provides a service for creating private tunnels and reaching private clusters from the outside, facilitating secure remote access as part of the @serve.zone stack.'
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSwyQkFBMkI7SUFDakMsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLHFLQUFxSztDQUNuTCxDQUFBIn0=
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
export class ConnectorPrivate {
|
|
3
|
+
constructor(targetHost, targetPort = 4000) {
|
|
4
|
+
this.targetHost = targetHost;
|
|
5
|
+
this.targetPort = targetPort;
|
|
6
|
+
this.connectToPublicRemoteConnector();
|
|
7
|
+
}
|
|
8
|
+
connectToPublicRemoteConnector() {
|
|
9
|
+
const options = {
|
|
10
|
+
// Include CA certificate if necessary, for example:
|
|
11
|
+
// ca: fs.readFileSync('path/to/ca.pem'),
|
|
12
|
+
rejectUnauthorized: true // Only set this to true if you are sure about the server's certificate
|
|
13
|
+
};
|
|
14
|
+
const tunnel = plugins.tls.connect(this.targetPort, options, () => {
|
|
15
|
+
console.log('Connected to PublicRemoteConnector on port 4000');
|
|
16
|
+
});
|
|
17
|
+
tunnel.on('data', (data) => {
|
|
18
|
+
const targetConnection = plugins.tls.connect({
|
|
19
|
+
host: this.targetHost,
|
|
20
|
+
port: this.targetPort,
|
|
21
|
+
// Include necessary options for the target connection
|
|
22
|
+
}, () => {
|
|
23
|
+
targetConnection.write(data);
|
|
24
|
+
});
|
|
25
|
+
targetConnection.on('data', (backData) => {
|
|
26
|
+
tunnel.write(backData); // Send data back through the tunnel
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29ubmVjdG9yLnByaXZhdGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9jb25uZWN0b3IucHJpdmF0ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLGNBQWMsQ0FBQztBQUV4QyxNQUFNLE9BQU8sZ0JBQWdCO0lBSTNCLFlBQVksVUFBa0IsRUFBR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BQUMsQ0FBQztRQUNMLENBQUMsQ0FBQyxDQUFDO0lBQ0wsQ0FBQztDQUNGIn0=
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
export class ConnectorPublic {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.tunnel = null;
|
|
5
|
+
this.createTunnel();
|
|
6
|
+
this.listenOnPorts();
|
|
7
|
+
}
|
|
8
|
+
createTunnel() {
|
|
9
|
+
const options = {
|
|
10
|
+
key: plugins.fs.readFileSync('path/to/key.pem'),
|
|
11
|
+
cert: plugins.fs.readFileSync('path/to/cert.pem'),
|
|
12
|
+
};
|
|
13
|
+
const server = plugins.tls.createServer(options, (socket) => {
|
|
14
|
+
this.tunnel = socket;
|
|
15
|
+
console.log('Tunnel established with LocalConnector');
|
|
16
|
+
});
|
|
17
|
+
server.listen(4000, () => {
|
|
18
|
+
console.log('PublicRemoteConnector listening for tunnel on port 4000');
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
listenOnPorts() {
|
|
22
|
+
// Example for port 80, adapt for port 443 similarly
|
|
23
|
+
// Note: TLS for the initial connection might not apply directly for HTTP/HTTPS traffic without additional setup
|
|
24
|
+
const options = {
|
|
25
|
+
key: plugins.fs.readFileSync('path/to/key.pem'),
|
|
26
|
+
cert: plugins.fs.readFileSync('path/to/cert.pem'),
|
|
27
|
+
};
|
|
28
|
+
plugins.tls.createServer(options, (socket) => {
|
|
29
|
+
console.log('Received connection, tunneling to LocalConnector');
|
|
30
|
+
if (this.tunnel) {
|
|
31
|
+
socket.pipe(this.tunnel).pipe(socket);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
console.log('Tunnel to LocalConnector not established');
|
|
35
|
+
socket.end();
|
|
36
|
+
}
|
|
37
|
+
}).listen(80); // Repeat this block for any other ports you wish to listen on
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjoz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UFHO1lBQ2QsR0FBRyxFQUFFLE9BQU8sQ0FBQyxFQUFFLENBQUMsWUFBWSxDQUFDLGlCQUFpQixDQUFDO1lBQy9DLElBQUksRUFBRSxPQUFPLENBQUMsRUFBRSxDQUFDLFlBQVksQ0FBQyxrQkFBa0IsQ0FBQztTQUNsRCxDQUFDO1FBRUYsT0FBTyxDQUFDLEdBQUcsQ0FBQyxZQUFZLENBQUMsT0FBTyxFQUFFLENBQUMsTUFBNkIsRUFBRSxFQUFFO1lBQ2xFLE9BQU8sQ0FBQyxHQUFHLENBQUMsa0RBQWtELENBQUMsQ0FBQztZQUNoRSxJQUFJLElBQUksQ0FBQyxNQUFNLEVBQUUsQ0FBQztnQkFDaEIsTUFBTSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDLENBQUMsSUFBSSxDQUFDLE1BQU0sQ0FBQyxDQUFDO1lBQ3hDLENBQUM7aUJBQU0sQ0FBQztnQkFDTixPQUFPLENBQUMsR0FBRyxDQUFDLDBDQUEwQyxDQUFDLENBQUM7Z0JBQ3hELE1BQU0sQ0FBQyxHQUFHLEVBQUUsQ0FBQztZQUNmLENBQUM7UUFDSCxDQUFDLENBQUMsQ0FBQyxNQUFNLENBQUMsRUFBRSxDQUFDLENBQUMsQ0FBQyw4REFBOEQ7SUFDL0UsQ0FBQztDQUNGIn0=
|
package/dist_ts/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
import { ConnectorPublic } from './connector.public.js';
|
|
3
|
+
import { ConnectorPrivate } from './connector.private.js';
|
|
4
|
+
export { ConnectorPublic, ConnectorPrivate };
|
|
5
|
+
export const runCli = async () => {
|
|
6
|
+
const qenv = new plugins.qenv.Qenv();
|
|
7
|
+
const mode = await qenv.getEnvVarOnDemand('MODE');
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLGNBQWMsQ0FBQztBQUV4QyxPQUFPLEVBQUUsZUFBZSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFDeEQsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFMUQsT0FBTyxFQUNMLGVBQWUsRUFDZixnQkFBZ0IsRUFDakIsQ0FBQTtBQUVELE1BQU0sQ0FBQyxNQUFNLE1BQU0sR0FBRyxLQUFLLElBQUksRUFBRTtJQUMvQixNQUFNLElBQUksR0FBRyxJQUFJLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxFQUFFLENBQUM7SUFDckMsTUFBTSxJQUFJLEdBQUcsTUFBTSxJQUFJLENBQUMsaUJBQWlCLENBQUMsTUFBTSxDQUFDLENBQUM7QUFDcEQsQ0FBQyxDQUFBIn0=
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// node native scope
|
|
2
|
+
import * as tls from 'tls';
|
|
3
|
+
import * as fs from 'fs';
|
|
4
|
+
export { tls, fs, };
|
|
5
|
+
// @push.rocks scope
|
|
6
|
+
import * as qenv from '@push.rocks/qenv';
|
|
7
|
+
export { qenv, };
|
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3BsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsb0JBQW9CO0FBQ3BCLE9BQU8sS0FBSyxHQUFHLE1BQU0sS0FBSyxDQUFDO0FBQzNCLE9BQU8sS0FBSyxFQUFFLE1BQU0sSUFBSSxDQUFDO0FBRXpCLE9BQU8sRUFDTCxHQUFHLEVBQ0gsRUFBRSxHQUNILENBQUE7QUFFRCxvQkFBb0I7QUFDcEIsT0FBTyxLQUFLLElBQUksTUFBTSxrQkFBa0IsQ0FBQztBQUV6QyxPQUFPLEVBQ0wsSUFBSSxHQUNMLENBQUEifQ==
|
package/npmextra.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"gitzone": {
|
|
3
|
+
"projectType": "npm",
|
|
4
|
+
"module": {
|
|
5
|
+
"githost": "code.foss.global",
|
|
6
|
+
"gitscope": "serve.zone",
|
|
7
|
+
"gitrepo": "remoteingress",
|
|
8
|
+
"description": "Provides a service for creating private tunnels and reaching private clusters from the outside, facilitating secure remote access as part of the @serve.zone stack.",
|
|
9
|
+
"npmPackagename": "@serve.zone/remoteingress",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"projectDomain": "serve.zone",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"remote access",
|
|
14
|
+
"private tunnels",
|
|
15
|
+
"network security",
|
|
16
|
+
"TLS encryption",
|
|
17
|
+
"connector",
|
|
18
|
+
"serve.zone stack",
|
|
19
|
+
"private clusters access",
|
|
20
|
+
"public access management",
|
|
21
|
+
"TypeScript application",
|
|
22
|
+
"node.js package",
|
|
23
|
+
"secure communications",
|
|
24
|
+
"TLS/SSL certificates",
|
|
25
|
+
"development tools",
|
|
26
|
+
"software development",
|
|
27
|
+
"private network integration"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"npmci": {
|
|
32
|
+
"npmGlobalTools": [],
|
|
33
|
+
"npmAccessLevel": "public"
|
|
34
|
+
},
|
|
35
|
+
"tsdoc": {
|
|
36
|
+
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
|
37
|
+
}
|
|
38
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@serve.zone/remoteingress",
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Provides a service for creating private tunnels and reaching private clusters from the outside, facilitating secure remote access as part of the @serve.zone stack.",
|
|
6
|
+
"main": "dist_ts/index.js",
|
|
7
|
+
"typings": "dist_ts/index.d.ts",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"author": "Task Venture Capital GmbH",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"@git.zone/tsbuild": "^2.1.25",
|
|
13
|
+
"@git.zone/tsbundle": "^2.0.5",
|
|
14
|
+
"@git.zone/tsrun": "^1.2.46",
|
|
15
|
+
"@git.zone/tstest": "^1.0.44",
|
|
16
|
+
"@push.rocks/tapbundle": "^5.0.15",
|
|
17
|
+
"@types/node": "^20.8.7"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@push.rocks/qenv": "^6.0.5"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://code.foss.global/serve.zone/remoteingress.git"
|
|
25
|
+
},
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://code.foss.global/serve.zone/remoteingress/issues"
|
|
28
|
+
},
|
|
29
|
+
"homepage": "https://code.foss.global/serve.zone/remoteingress#readme",
|
|
30
|
+
"browserslist": [
|
|
31
|
+
"last 1 chrome versions"
|
|
32
|
+
],
|
|
33
|
+
"files": [
|
|
34
|
+
"ts/**/*",
|
|
35
|
+
"ts_web/**/*",
|
|
36
|
+
"dist/**/*",
|
|
37
|
+
"dist_*/**/*",
|
|
38
|
+
"dist_ts/**/*",
|
|
39
|
+
"dist_ts_web/**/*",
|
|
40
|
+
"assets/**/*",
|
|
41
|
+
"cli.js",
|
|
42
|
+
"npmextra.json",
|
|
43
|
+
"readme.md"
|
|
44
|
+
],
|
|
45
|
+
"keywords": [
|
|
46
|
+
"remote access",
|
|
47
|
+
"private tunnels",
|
|
48
|
+
"network security",
|
|
49
|
+
"TLS encryption",
|
|
50
|
+
"connector",
|
|
51
|
+
"serve.zone stack",
|
|
52
|
+
"private clusters access",
|
|
53
|
+
"public access management",
|
|
54
|
+
"TypeScript application",
|
|
55
|
+
"node.js package",
|
|
56
|
+
"secure communications",
|
|
57
|
+
"TLS/SSL certificates",
|
|
58
|
+
"development tools",
|
|
59
|
+
"software development",
|
|
60
|
+
"private network integration"
|
|
61
|
+
],
|
|
62
|
+
"scripts": {
|
|
63
|
+
"test": "(tstest test/ --web)",
|
|
64
|
+
"build": "(tsbuild --web --allowimplicitany)",
|
|
65
|
+
"buildDocs": "(tsdoc)"
|
|
66
|
+
}
|
|
67
|
+
}
|
package/readme.hints.md
ADDED
package/readme.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# @serve.zone/remoteingress
|
|
2
|
+
|
|
3
|
+
Provides a service for creating private tunnels and reaching private clusters from the outside as part of the @serve.zone stack.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
To install `@serve.zone/remoteingress`, run the following command in your terminal:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @serve.zone/remoteingress
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
This command will download and install the remoteingress package and its dependencies into your project.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
`@serve.zone/remoteingress` is designed to facilitate the creation of secure private tunnels and enable access to private clusters from external sources, offering an integral part of the @serve.zone stack infrastructure. Below, we illustrate how to employ this package within your project, leveraging TypeScript and ESM syntax for modern, type-safe, and modular code.
|
|
18
|
+
|
|
19
|
+
### Prerequisites
|
|
20
|
+
|
|
21
|
+
Ensure that you have Node.js and TypeScript installed in your environment. Your project should be set up with TypeScript support, and you might want to familiarize yourself with basic networking concepts and TLS/SSL for secure communication.
|
|
22
|
+
|
|
23
|
+
### Importing and Initializing Connectors
|
|
24
|
+
|
|
25
|
+
`@serve.zone/remoteingress` offers two primary components: `ConnectorPublic` and `ConnectorPrivate`. Here's how to use them:
|
|
26
|
+
|
|
27
|
+
#### Setup ConnectorPublic
|
|
28
|
+
|
|
29
|
+
`ConnectorPublic` acts as a gateway, accepting incoming tunnel connections from `ConnectorPrivate` instances and facilitating secure communication between the internet and your private network.
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { ConnectorPublic } from '@serve.zone/remoteingress';
|
|
33
|
+
|
|
34
|
+
// Initialize ConnectorPublic
|
|
35
|
+
const publicConnector = new ConnectorPublic({
|
|
36
|
+
tlsOptions: {
|
|
37
|
+
key: fs.readFileSync("<path-to-your-tls/key.pem>"),
|
|
38
|
+
cert: fs.readFileSync("<path-to-your-cert/cert.pem>"),
|
|
39
|
+
// Consider including 'ca' and 'passphrase' if required for your setup
|
|
40
|
+
},
|
|
41
|
+
listenPort: 443 // Example listen port; adjust based on your needs
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
#### Setup ConnectorPrivate
|
|
46
|
+
|
|
47
|
+
`ConnectorPrivate` establishes a secure tunnel to `ConnectorPublic`, effectively bridging your internal services with the external point of access.
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
import { ConnectorPrivate } from '@serve.zone/remoteingress';
|
|
51
|
+
|
|
52
|
+
// Initialize ConnectorPrivate pointing to your ConnectorPublic instance
|
|
53
|
+
const privateConnector = new ConnectorPrivate({
|
|
54
|
+
publicHost: 'your.public.domain.tld',
|
|
55
|
+
publicPort: 443, // Ensure this matches the listening port of ConnectorPublic
|
|
56
|
+
tlsOptions: {
|
|
57
|
+
// You might want to specify TLS options here, similar to ConnectorPublic
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Secure Communication
|
|
63
|
+
|
|
64
|
+
It's imperative to ensure that the communication between `ConnectorPublic` and `ConnectorPrivate` is secure:
|
|
65
|
+
|
|
66
|
+
- Always use valid TLS certificates.
|
|
67
|
+
- Prefer using certificates issued by recognized Certificate Authorities (CA).
|
|
68
|
+
- Optionally, configure mutual TLS (mTLS) by requiring client certificates for an added layer of security.
|
|
69
|
+
|
|
70
|
+
### Advanced Usage
|
|
71
|
+
|
|
72
|
+
Both connectors can be finely tuned:
|
|
73
|
+
|
|
74
|
+
- **Logging and Monitoring:** Integrate with your existing logging and monitoring systems to keep tabs on tunnel activity, performance metrics, and potential security anomalies.
|
|
75
|
+
|
|
76
|
+
- **Custom Handlers:** Implement custom traffic handling logic for specialized routing, filtering, or protocol-specific processing.
|
|
77
|
+
|
|
78
|
+
- **Automation:** Automate the deployment and scaling of both `ConnectorPublic` and `ConnectorPrivate` instances using infrastructure-as-code (IAC) tools and practices, ensuring that your tunneling infrastructure can dynamically adapt to the ever-changing needs of your services.
|
|
79
|
+
|
|
80
|
+
### Example Scenarios
|
|
81
|
+
|
|
82
|
+
1. **Securing Application APIs:** Use `@serve.zone/remoteingress` to expose private APIs to your frontend deployed on a public cloud, ensuring that only your infrastructure can access these endpoints.
|
|
83
|
+
|
|
84
|
+
2. **Remote Database Access:** Securely access databases within a private VPC from your local development machine without opening direct access to the internet.
|
|
85
|
+
|
|
86
|
+
3. **Service Mesh Integration:** Integrate `@serve.zone/remoteingress` as part of a service mesh setup to securely connect services across multiple clusters with robust identity and encryption at the tunnel level.
|
|
87
|
+
|
|
88
|
+
For detailed documentation, API references, and additional use cases, please refer to the inline documentation and source code within the package. Always prioritize security and robustness when dealing with network ingress to protect your infrastructure and data from unauthorized access and threats.
|
|
89
|
+
|
|
90
|
+
## License and Legal Information
|
|
91
|
+
|
|
92
|
+
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
|
93
|
+
|
|
94
|
+
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
|
95
|
+
|
|
96
|
+
### Trademarks
|
|
97
|
+
|
|
98
|
+
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
|
|
99
|
+
|
|
100
|
+
### Company Information
|
|
101
|
+
|
|
102
|
+
Task Venture Capital GmbH
|
|
103
|
+
Registered at District court Bremen HRB 35230 HB, Germany
|
|
104
|
+
|
|
105
|
+
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
|
106
|
+
|
|
107
|
+
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* autocreated commitinfo by @pushrocks/commitinfo
|
|
3
|
+
*/
|
|
4
|
+
export const commitinfo = {
|
|
5
|
+
name: '@serve.zone/remoteingress',
|
|
6
|
+
version: '1.0.4',
|
|
7
|
+
description: 'Provides a service for creating private tunnels and reaching private clusters from the outside, facilitating secure remote access as part of the @serve.zone stack.'
|
|
8
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
|
|
3
|
+
export class ConnectorPrivate {
|
|
4
|
+
private targetHost: string;
|
|
5
|
+
private targetPort: number;
|
|
6
|
+
|
|
7
|
+
constructor(targetHost: string, targetPort: number = 4000) {
|
|
8
|
+
this.targetHost = targetHost;
|
|
9
|
+
this.targetPort = targetPort;
|
|
10
|
+
this.connectToPublicRemoteConnector();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
private connectToPublicRemoteConnector(): void {
|
|
14
|
+
const options = {
|
|
15
|
+
// Include CA certificate if necessary, for example:
|
|
16
|
+
// ca: fs.readFileSync('path/to/ca.pem'),
|
|
17
|
+
rejectUnauthorized: true // Only set this to true if you are sure about the server's certificate
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const tunnel = plugins.tls.connect(this.targetPort, options, () => {
|
|
21
|
+
console.log('Connected to PublicRemoteConnector on port 4000');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
tunnel.on('data', (data: Buffer) => {
|
|
25
|
+
const targetConnection = plugins.tls.connect({
|
|
26
|
+
host: this.targetHost,
|
|
27
|
+
port: this.targetPort,
|
|
28
|
+
// Include necessary options for the target connection
|
|
29
|
+
}, () => {
|
|
30
|
+
targetConnection.write(data);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
targetConnection.on('data', (backData: Buffer) => {
|
|
34
|
+
tunnel.write(backData); // Send data back through the tunnel
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
|
|
3
|
+
export class ConnectorPublic {
|
|
4
|
+
private tunnel: plugins.tls.TLSSocket | null = null;
|
|
5
|
+
|
|
6
|
+
constructor() {
|
|
7
|
+
this.createTunnel();
|
|
8
|
+
this.listenOnPorts();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
private createTunnel(): void {
|
|
12
|
+
const options = {
|
|
13
|
+
key: plugins.fs.readFileSync('path/to/key.pem'),
|
|
14
|
+
cert: plugins.fs.readFileSync('path/to/cert.pem'),
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const server = plugins.tls.createServer(options, (socket: plugins.tls.TLSSocket) => {
|
|
18
|
+
this.tunnel = socket;
|
|
19
|
+
console.log('Tunnel established with LocalConnector');
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
server.listen(4000, () => {
|
|
23
|
+
console.log('PublicRemoteConnector listening for tunnel on port 4000');
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
private listenOnPorts(): void {
|
|
28
|
+
// Example for port 80, adapt for port 443 similarly
|
|
29
|
+
// Note: TLS for the initial connection might not apply directly for HTTP/HTTPS traffic without additional setup
|
|
30
|
+
const options = {
|
|
31
|
+
key: plugins.fs.readFileSync('path/to/key.pem'),
|
|
32
|
+
cert: plugins.fs.readFileSync('path/to/cert.pem'),
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
plugins.tls.createServer(options, (socket: plugins.tls.TLSSocket) => {
|
|
36
|
+
console.log('Received connection, tunneling to LocalConnector');
|
|
37
|
+
if (this.tunnel) {
|
|
38
|
+
socket.pipe(this.tunnel).pipe(socket);
|
|
39
|
+
} else {
|
|
40
|
+
console.log('Tunnel to LocalConnector not established');
|
|
41
|
+
socket.end();
|
|
42
|
+
}
|
|
43
|
+
}).listen(80); // Repeat this block for any other ports you wish to listen on
|
|
44
|
+
}
|
|
45
|
+
}
|
package/ts/index.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
|
|
3
|
+
import { ConnectorPublic } from './connector.public.js';
|
|
4
|
+
import { ConnectorPrivate } from './connector.private.js';
|
|
5
|
+
|
|
6
|
+
export {
|
|
7
|
+
ConnectorPublic,
|
|
8
|
+
ConnectorPrivate
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const runCli = async () => {
|
|
12
|
+
const qenv = new plugins.qenv.Qenv();
|
|
13
|
+
const mode = await qenv.getEnvVarOnDemand('MODE');
|
|
14
|
+
}
|