mirror of
https://git.coolaj86.com/coolaj86/telebit.js.git
synced 2025-04-21 19:40:37 +00:00
Compare commits
No commits in common. "master" and "v0.20.6" have entirely different histories.
@ -1,7 +1,8 @@
|
|||||||
# Telebit™ Remote | a [Root](https://rootprojects.org) project
|
# Telebit™ Remote
|
||||||
|
|
||||||
Because friends don't let friends localhost™
|
Because friends don't let friends localhost™
|
||||||
|
|
||||||
|
| Sponsored by [ppl](https://ppl.family)
|
||||||
| **Telebit Remote**
|
| **Telebit Remote**
|
||||||
| [Telebit Relay](https://git.coolaj86.com/coolaj86/telebit-relay.js)
|
| [Telebit Relay](https://git.coolaj86.com/coolaj86/telebit-relay.js)
|
||||||
| [sclient](https://telebit.cloud/sclient)
|
| [sclient](https://telebit.cloud/sclient)
|
||||||
@ -120,8 +121,8 @@ Windows & Node.js
|
|||||||
1. Install [node.js](https://nodejs.org)
|
1. Install [node.js](https://nodejs.org)
|
||||||
2. Open _Node.js_
|
2. Open _Node.js_
|
||||||
2. Run the command `npm install -g telebit`
|
2. Run the command `npm install -g telebit`
|
||||||
2. Copy the example daemon config to your user folder `.config/telebit/telebitd.yml` (such as `/Users/John/.config/telebit/telebitd.yml`)
|
2. Copy the example daemon conifg to your user folder `.config/telebit/telebitd.yml` (such as `/Users/John/.config/telebit/telebitd.yml`)
|
||||||
2. Copy the example remote config to your user folder `.config/telebit/telebit.yml` (such as `/Users/John/.config/telebit/telebit.yml`)
|
2. Copy the example remote conifg to your user folder `.config/telebit/telebit.yml` (such as `/Users/John/.config/telebit/telebit.yml`)
|
||||||
2. Change the email address
|
2. Change the email address
|
||||||
2. Run `npx telebit init` and follow the instructions
|
2. Run `npx telebit init` and follow the instructions
|
||||||
2. Run `npx telebit list`
|
2. Run `npx telebit list`
|
||||||
|
@ -98,7 +98,16 @@ function askForConfig(state, mainCb) {
|
|||||||
var firstSet = [
|
var firstSet = [
|
||||||
function askEmail(cb) {
|
function askEmail(cb) {
|
||||||
if (state.config.email) { cb(); return; }
|
if (state.config.email) { cb(); return; }
|
||||||
console.info(TPLS.remote.setup.email);
|
//console.info("");
|
||||||
|
console.info("Welcome!");
|
||||||
|
console.info("");
|
||||||
|
console.info("By using Telebit you agree to:");
|
||||||
|
console.info("");
|
||||||
|
console.info(" [x] Accept the Telebit™ terms of service");
|
||||||
|
console.info(" [x] Accept the Let's Encrypt™ terms of service");
|
||||||
|
console.info("");
|
||||||
|
console.info("Enter your email to agree and login/create your account:");
|
||||||
|
console.info("");
|
||||||
// TODO attempt to read email from npmrc or the like?
|
// TODO attempt to read email from npmrc or the like?
|
||||||
rl.question('email: ', function (email) {
|
rl.question('email: ', function (email) {
|
||||||
email = /@/.test(email) && email.trim();
|
email = /@/.test(email) && email.trim();
|
||||||
@ -539,7 +548,7 @@ function getToken(err, state) {
|
|||||||
console.error(err);
|
console.error(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.info(TPLS.remote.waiting.replace(/{email}/, state.config.email));
|
console.info("waiting...");
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -574,12 +583,18 @@ function getToken(err, state) {
|
|||||||
, end: function () {
|
, end: function () {
|
||||||
utils.putConfig('enable', [], function (err) {
|
utils.putConfig('enable', [], function (err) {
|
||||||
if (err) { console.error(err); return; }
|
if (err) { console.error(err); return; }
|
||||||
console.info(TPLS.remote.success);
|
console.info("Success");
|
||||||
|
|
||||||
// workaround for https://github.com/nodejs/node/issues/21319
|
// workaround for https://github.com/nodejs/node/issues/21319
|
||||||
if (state._useTty) {
|
if (state._useTty) {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
console.info(TPLS.remote.next_steps);
|
console.info("Some fun things to try first:\n");
|
||||||
|
console.info(" ~/telebit http ~/public");
|
||||||
|
console.info(" ~/telebit tcp 5050");
|
||||||
|
console.info(" ~/telebit ssh auto");
|
||||||
|
console.info();
|
||||||
|
console.info("Press any key to continue...");
|
||||||
|
console.info();
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}, 0.5 * 1000);
|
}, 0.5 * 1000);
|
||||||
return;
|
return;
|
||||||
|
0
bin/telebit.js
Executable file → Normal file
0
bin/telebit.js
Executable file → Normal file
@ -6,7 +6,7 @@ Telebit Remote is the T-Rex long-arm of the Internet. UNSTOPPABLE!
|
|||||||
|
|
||||||
Using reliable HTTPS tunneling to establishing peer-to-peer connections,
|
Using reliable HTTPS tunneling to establishing peer-to-peer connections,
|
||||||
Telebit is empowering the next generation of tinkerers. Access your devices.
|
Telebit is empowering the next generation of tinkerers. Access your devices.
|
||||||
Share your stuff. Be UNSTOPPABLE! (Join us at https://rootprojects.org)
|
Share your stuff. Be UNSTOPPABLE! (Join us at https://ppl.family)
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ Use \"telebit help [command]\" for more information about a command, including f
|
|||||||
|
|
||||||
Copyright 2015-2018 AJ ONeal https://telebit.cloud MPL-2.0 Licensed (RAWR!)"
|
Copyright 2015-2018 AJ ONeal https://telebit.cloud MPL-2.0 Licensed (RAWR!)"
|
||||||
|
|
||||||
status = "usage: telebit status
|
status = "usage: telebit status <path/port/none> [subdomain]
|
||||||
|
|
||||||
'telebit status' shows details about the current connections (or lack thereof).
|
'telebit status' shows details about the current connections (or lack thereof).
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ usage: telebit http <path/port/none> [subdomain]
|
|||||||
|
|
||||||
Use cases:
|
Use cases:
|
||||||
|
|
||||||
- Lazy man's AirDrop (works for lazy women too!)
|
- Lazy man's AirDrop (works or lazy women too!)
|
||||||
- Testing dev sites on a phone
|
- Testing dev sites on a phone
|
||||||
- Sharing indie music and movies with friends"
|
- Sharing indie music and movies with friends"
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ usage: telebit ssh <auto|port|none>
|
|||||||
|
|
||||||
All https traffic will be inspected to see if it looks like ssh Once enabled all traffic that looks
|
All https traffic will be inspected to see if it looks like ssh Once enabled all traffic that looks
|
||||||
|
|
||||||
ssh auto Make ssh Just Work™ (on port 22)
|
ssh auto Make ssh Just Works™ (on port 22)
|
||||||
|
|
||||||
ssh <port> forward ssh traffic to non-standard port
|
ssh <port> forward ssh traffic to non-standard port
|
||||||
ex: telebit ssh 22 ex: explicitly forward ssh-looking packets to localhost:22
|
ex: telebit ssh 22 ex: explicitly forward ssh-looking packets to localhost:22
|
||||||
@ -452,42 +452,5 @@ The secret flags are:
|
|||||||
[remote]
|
[remote]
|
||||||
version = "telebit remote v{version}"
|
version = "telebit remote v{version}"
|
||||||
|
|
||||||
code = "
|
|
||||||
==============================================
|
|
||||||
Hey, Listen!
|
|
||||||
==============================================
|
|
||||||
|
|
||||||
GO CHECK YOUR EMAIL!
|
|
||||||
|
|
||||||
DEVICE PAIR CODE: 0000
|
|
||||||
|
|
||||||
==============================================
|
|
||||||
"
|
|
||||||
|
|
||||||
waiting = "waiting for you to check your email..."
|
|
||||||
|
|
||||||
success = "Success"
|
|
||||||
|
|
||||||
next_steps = "Some fun things to try first:
|
|
||||||
|
|
||||||
~/telebit http ~/Public
|
|
||||||
~/telebit tcp 5050
|
|
||||||
~/telebit ssh auto
|
|
||||||
|
|
||||||
Press any key to continue...
|
|
||||||
"
|
|
||||||
|
|
||||||
[remote.setup]
|
|
||||||
|
|
||||||
email = "Welcome!
|
|
||||||
|
|
||||||
By using Telebit you agree to:
|
|
||||||
|
|
||||||
[x] Accept the Telebit™ terms of service
|
|
||||||
[x] Accept the Let's Encrypt™ terms of service
|
|
||||||
|
|
||||||
Enter your email to agree and login/create your account:
|
|
||||||
"
|
|
||||||
|
|
||||||
[daemon]
|
[daemon]
|
||||||
version = "telebit daemon v{version}"
|
version = "telebit daemon v{version}"
|
||||||
|
@ -51,24 +51,18 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<h2>You've claimed <span class="js-servername">{{servername}}</span></h2>
|
<h2>You've claimed <span class="js-servername">{{servername}}</span></h2>
|
||||||
<p>Here are some ways you can use Telebit via Terminal or other Command Line Interface:</p>
|
<p>Here's some ways you can use it:</p>
|
||||||
<div class="code-block">
|
<div class="code-block">
|
||||||
<br />
|
<pre><code>telebit http ~/Public # serve a public folder
|
||||||
<pre><code>~/telebit ssh auto # allows you to connect to your computer with <br /> ssh-over-https from a different computer</span></code></pre>
|
telebit http 3000 # forward all https traffic to localhost:3000
|
||||||
<pre><code>~/telebit http ~/Public # serve a public folder
|
telebit http none # remove all https handlers</code></pre>
|
||||||
~/telebit http 3000 # forward all https traffic to localhost:3000
|
|
||||||
~/telebit http none # remove all https handlers</code></pre>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p>And remember you can <em>always</em> tunnel <strong>SSH over HTTPS</strong>,
|
<p>You can <em>always</em> tunnel <strong>SSH over HTTPS</strong>,
|
||||||
even while you're using it for something else:</p>
|
even while you're using it for something else:</p>
|
||||||
<p> </p>
|
<div class="code-block"><pre><code>telebit ssh auto</code></pre>
|
||||||
|
|
||||||
<details>
|
|
||||||
<p><summary><strong>Here are some examples for those of you that want to access files and folders remotely. </strong></summary></p>
|
|
||||||
<p><strong>This function allows you to connect one computer to another computer you also have SSH on.</strong></p>
|
|
||||||
<div class="code-block"><pre><code>~/telebit ssh <span class="js-servername">{{servername}}</span></code></pre>
|
|
||||||
<br>
|
<br>
|
||||||
|
<pre><code>telebit ssh <span class="js-servername">{{servername}}</span></code></pre>
|
||||||
- or -
|
- or -
|
||||||
<pre><code>ssh -o ProxyCommand='<a href="https://telebit.cloud/sclient">sclient</a> %h' <span class="js-servername">{{servername}}</span></code></pre>
|
<pre><code>ssh -o ProxyCommand='<a href="https://telebit.cloud/sclient">sclient</a> %h' <span class="js-servername">{{servername}}</span></code></pre>
|
||||||
- or -
|
- or -
|
||||||
@ -76,7 +70,8 @@
|
|||||||
ssh -o ProxyCommand="$proxy_cmd" <span class="js-servername">{{servername}}</span></code></pre>
|
ssh -o ProxyCommand="$proxy_cmd" <span class="js-servername">{{servername}}</span></code></pre>
|
||||||
</div>
|
</div>
|
||||||
<pre><code>ssh -o ProxyCommand='openssl s_client -connect %h:443 -servername %h -quiet' <span class="js-servername">{{servername}}</span></code></pre>
|
<pre><code>ssh -o ProxyCommand='openssl s_client -connect %h:443 -servername %h -quiet' <span class="js-servername">{{servername}}</span></code></pre>
|
||||||
</details>
|
|
||||||
|
|
||||||
<!--div class="js-port" hidden>
|
<!--div class="js-port" hidden>
|
||||||
<h2>You've claimed port <span class="js-serviceport">{{serviceport}}</span></h2>
|
<h2>You've claimed port <span class="js-serviceport">{{serviceport}}</span></h2>
|
||||||
<p>Here's some ways you can use it:</p>
|
<p>Here's some ways you can use it:</p>
|
||||||
@ -92,4 +87,4 @@ ssh <span class="js-servername">{{servername}}</span> -p <span class="js-service
|
|||||||
|
|
||||||
<script src="js/app.js"></script>
|
<script src="js/app.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
document.body.hidden = false;
|
document.body.hidden = false;
|
||||||
|
|
||||||
var hash = window.location.hash.replace(/^[\/#?]+/, '');
|
var hash = window.location.hash.substr(1);
|
||||||
var query = window.location.search;
|
var query = window.location.search;
|
||||||
|
|
||||||
function parseQuery(search) {
|
function parseQuery(search) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "telebit",
|
"name": "telebit",
|
||||||
"version": "0.20.8",
|
"version": "0.20.6",
|
||||||
"description": "Break out of localhost. Connect to any device from anywhere over any tcp port or securely in a browser. A secure tunnel. A poor man's reverse VPN.",
|
"description": "Break out of localhost. Connect to any device from anywhere over any tcp port or securely in a browser. A secure tunnel. A poor man's reverse VPN.",
|
||||||
"main": "lib/remote.js",
|
"main": "lib/remote.js",
|
||||||
"files": [
|
"files": [
|
||||||
|
@ -114,8 +114,8 @@ Launcher.install = function (things, fn) {
|
|||||||
};
|
};
|
||||||
vars.telebitBinTpl = path.join(telebitRoot, 'usr/share/dist/bin/telebit.tpl');
|
vars.telebitBinTpl = path.join(telebitRoot, 'usr/share/dist/bin/telebit.tpl');
|
||||||
vars.telebitNpm = path.resolve(vars.telebitNode, '../npm');
|
vars.telebitNpm = path.resolve(vars.telebitNode, '../npm');
|
||||||
vars.nodePath = path.resolve(vars.telebitNode, '../../lib/node_modules');
|
vars.nodePath = path.resolve(vars.telebitNode, '../lib/node_modules');
|
||||||
vars.npmConfigPrefix = path.resolve(vars.telebitNode, '..', '..');
|
vars.npmConfigPrefix = path.resolve(vars.telebitNode, '..');
|
||||||
vars.userspace = (!things.telebitUser || (things.telebitUser === os.userInfo().username)) ? true : false;
|
vars.userspace = (!things.telebitUser || (things.telebitUser === os.userInfo().username)) ? true : false;
|
||||||
if (-1 === vars.telebitRwDirs.indexOf(vars.npmConfigPrefix)) {
|
if (-1 === vars.telebitRwDirs.indexOf(vars.npmConfigPrefix)) {
|
||||||
vars.telebitRwDirs.push(vars.npmConfigPrefix);
|
vars.telebitRwDirs.push(vars.npmConfigPrefix);
|
||||||
|
@ -133,11 +133,8 @@ my_tmp="$(mktemp -d -t telebit.XXXXXXXX)"
|
|||||||
#TELEBIT_TMP="$my_tmp/telebit"
|
#TELEBIT_TMP="$my_tmp/telebit"
|
||||||
|
|
||||||
echo "Installing $my_name to '$TELEBIT_REAL_PATH'"
|
echo "Installing $my_name to '$TELEBIT_REAL_PATH'"
|
||||||
# v10.2+ has much needed networking fixes, but breaks ursa.
|
# v10.2+ has much needed networking fixes, but breaks ursa. v9.x has severe networking bugs. v8.x has working ursa, but requires tls workarounds"
|
||||||
# v9.x has severe networking bugs.
|
NODEJS_VER="${NODEJS_VER:-v10.6}"
|
||||||
# v8.x has working ursa, but requires tls workarounds"
|
|
||||||
# v10.13 seems to work for me locally (new greenlock)
|
|
||||||
NODEJS_VER="${NODEJS_VER:-v10.13}"
|
|
||||||
export NODEJS_VER
|
export NODEJS_VER
|
||||||
export NODE_PATH="$TELEBIT_TMP/lib/node_modules"
|
export NODE_PATH="$TELEBIT_TMP/lib/node_modules"
|
||||||
export NPM_CONFIG_PREFIX="$TELEBIT_TMP"
|
export NPM_CONFIG_PREFIX="$TELEBIT_TMP"
|
||||||
@ -227,20 +224,16 @@ pushd $TELEBIT_TMP >/dev/null
|
|||||||
else
|
else
|
||||||
echo -n "."
|
echo -n "."
|
||||||
fi
|
fi
|
||||||
set +e
|
|
||||||
$tmp_npm install >/dev/null 2>/dev/null &
|
$tmp_npm install >/dev/null 2>/dev/null &
|
||||||
|
# ursa is now an entirely optional dependency for key generation
|
||||||
|
# but very much needed on ARM devices
|
||||||
|
$tmp_npm install ursa >/dev/null 2>/dev/null &
|
||||||
tmp_npm_pid=$!
|
tmp_npm_pid=$!
|
||||||
while [ -n "$tmp_npm_pid" ]; do
|
while [ -n "$tmp_npm_pid" ]; do
|
||||||
sleep 2
|
sleep 2
|
||||||
echo -n "."
|
echo -n "."
|
||||||
kill -s 0 $tmp_npm_pid >/dev/null 2>/dev/null || tmp_npm_pid=""
|
kill -s 0 $tmp_npm_pid >/dev/null 2>/dev/null || tmp_npm_pid=""
|
||||||
done
|
done
|
||||||
set -e
|
|
||||||
echo -n "."
|
|
||||||
$tmp_npm install >/dev/null 2>/dev/null
|
|
||||||
# ursa is now an entirely optional dependency for key generation
|
|
||||||
# but very much needed on ARM devices
|
|
||||||
$tmp_npm install ursa >/dev/null 2>/dev/null || true
|
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
|
|
||||||
if [ -n "${TELEBIT_DEBUG}" ]; then
|
if [ -n "${TELEBIT_DEBUG}" ]; then
|
||||||
@ -432,8 +425,8 @@ if [ -d "/Library/LaunchDaemons" ]; then
|
|||||||
|
|
||||||
if [ -n "${TELEBIT_DEBUG}" ]; then
|
if [ -n "${TELEBIT_DEBUG}" ]; then
|
||||||
echo " > launchctl unload -w $my_app_launchd_service >/dev/null 2>/dev/null"
|
echo " > launchctl unload -w $my_app_launchd_service >/dev/null 2>/dev/null"
|
||||||
|
launchctl unload -w "$my_app_launchd_service" >/dev/null 2>/dev/null
|
||||||
fi
|
fi
|
||||||
launchctl unload -w "$my_app_launchd_service" >/dev/null 2>/dev/null
|
|
||||||
else
|
else
|
||||||
my_app_launchd_service_skel="usr/share/dist/Library/LaunchDaemons/${my_app_pkg_name}.plist"
|
my_app_launchd_service_skel="usr/share/dist/Library/LaunchDaemons/${my_app_pkg_name}.plist"
|
||||||
my_app_launchd_service="$my_root/Library/LaunchDaemons/${my_app_pkg_name}.plist"
|
my_app_launchd_service="$my_root/Library/LaunchDaemons/${my_app_pkg_name}.plist"
|
||||||
@ -496,30 +489,23 @@ elif [ "systemd" == "$my_system_launcher" ]; then
|
|||||||
else
|
else
|
||||||
echo -n "."
|
echo -n "."
|
||||||
fi
|
fi
|
||||||
set +e
|
systemctl --user daemon-reload
|
||||||
if systemctl --user daemon-reload; then
|
# enable also puts success output to stderr... why?
|
||||||
# enable also puts success output to stderr... why?
|
systemctl --user enable $my_app >/dev/null 2>/dev/null
|
||||||
systemctl --user enable $my_app >/dev/null 2>/dev/null
|
#echo " > systemctl --user enable systemd-tmpfiles-setup.service systemd-tmpfiles-clean.timer"
|
||||||
#echo " > systemctl --user enable systemd-tmpfiles-setup.service systemd-tmpfiles-clean.timer"
|
#systemctl --user enable systemd-tmpfiles-setup.service systemd-tmpfiles-clean.timer
|
||||||
#systemctl --user enable systemd-tmpfiles-setup.service systemd-tmpfiles-clean.timer
|
if [ -n "${TELEBIT_DEBUG}" ]; then
|
||||||
if [ -n "${TELEBIT_DEBUG}" ]; then
|
echo " > systemctl --user start $my_app"
|
||||||
echo " > systemctl --user start $my_app"
|
fi
|
||||||
fi
|
systemctl --user stop $my_app >/dev/null 2>/dev/null
|
||||||
systemctl --user stop $my_app >/dev/null 2>/dev/null
|
systemctl --user start $my_app >/dev/null
|
||||||
systemctl --user start $my_app >/dev/null
|
sleep 2; # give it time to start
|
||||||
|
_is_running=$(systemctl --user status --no-pager $my_app 2>/dev/null | grep "active.*running")
|
||||||
sleep 2; # give it time to start
|
if [ -z "$_is_running" ]; then
|
||||||
_is_running=$(systemctl --user status --no-pager $my_app 2>/dev/null | grep "active.*running")
|
echo "Something went wrong:"
|
||||||
if [ -z "$_is_running" ]; then
|
systemctl --user status --no-pager $my_app
|
||||||
echo "Something went wrong:"
|
exit 1
|
||||||
systemctl --user status --no-pager $my_app
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "libpam-systemd is missing, which is required on Linux to register Telebit with the user launcher."
|
|
||||||
echo "sudo apt-get install -y libpam-systemd"
|
|
||||||
sudo apt-get install -y libpam-systemd
|
|
||||||
fi
|
fi
|
||||||
set -e
|
|
||||||
echo -n "."
|
echo -n "."
|
||||||
else
|
else
|
||||||
|
|
||||||
|
@ -79,8 +79,8 @@ function run() {
|
|||||||
, TELEBIT_LOG_DIR: process.env.TELEBIT_LOG_DIR || path.join(os.homedir(), '.local/share/telebit/var/log')
|
, TELEBIT_LOG_DIR: process.env.TELEBIT_LOG_DIR || path.join(os.homedir(), '.local/share/telebit/var/log')
|
||||||
};
|
};
|
||||||
vars.telebitNpm = process.env.TELEBIT_NPM || path.resolve(vars.telebitNode, '../npm');
|
vars.telebitNpm = process.env.TELEBIT_NPM || path.resolve(vars.telebitNode, '../npm');
|
||||||
vars.nodePath = process.env.NODE_PATH || path.resolve(vars.telebitNode, '../../lib/node_modules');
|
vars.nodePath = process.env.NODE_PATH || path.resolve(vars.telebitNode, '../lib/node_modules');
|
||||||
vars.npmConfigPrefix = process.env.NPM_CONFIG_PREFIX || path.resolve(vars.telebitNode, '..', '..');
|
vars.npmConfigPrefix = process.env.NPM_CONFIG_PREFIX || path.resolve(vars.telebitNode, '..');
|
||||||
if (-1 === vars.telebitRwDirs.indexOf(vars.npmConfigPrefix)) {
|
if (-1 === vars.telebitRwDirs.indexOf(vars.npmConfigPrefix)) {
|
||||||
vars.telebitRwDirs.push(vars.npmConfigPrefix);
|
vars.telebitRwDirs.push(vars.npmConfigPrefix);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user