Skip to content

Commit 05e07de

Browse files
committed
Resolves issue herenow#2 adding --allow option to wsProxy
An adhoc solution was added, I've added an `--allow` option, which accepts a list of comma separated IP:HOST to wsProxy, it will overwrite the global allowed.js exported object.
1 parent e8e921f commit 05e07de

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,20 @@ Usage
1818
```
1919
wsproxy [-p PORT] [-t THREADS (# of threads to spawn)] [-s ENABLE_SSL] [-k KEY_FILE] [-c CERT_FILE]
2020
```
21-
* If no `port` is specified it will default to process.env.PORT or port 5999.
21+
* `-p` Port to bind wsProxy to
22+
* If no `port` is specified it will default to `process.env.PORT` or port 5999.
23+
* `-a` List of allowed servers to proxy to
24+
* By default wsProxy will proxy to any ip:port, this is a major risk, since malicous users may use your
25+
wsProxy server for illegal activity, or any other use other then connecting to your athena server.
26+
* The list of IP:PORT's should be separate by comma! Ex:
27+
```bash
28+
wsproxy -a 127.0.0.1:6900,127.0.0.1:6121,127.0.0.1:5121
29+
```
30+
* Note: Use the same IP's you configured your server address at ROConfig at roBrowser.
31+
* `-t` Number of cpu cores that wsProxy should use
32+
* `-s` Enable SSL
33+
* `-k` Path to ssl key file
34+
* `-c` Path to ssl cert file
2235
* Use `wsproxy --help` for a list of available commands.
2336

2437

@@ -29,6 +42,7 @@ When connecting to this websocket you will give it an IP:PORT uri, for example:
2942
ws://websocket.example.com:5999/127.0.0.1:6900
3043
```
3144
* You can edit allowed.js to only allow proxy to certain IP:PORT
45+
* Note: if you pass in the `-a` or `--allow` option when starting the `wsproxy` this file will be ignored.
3246
* We will soon release a version, with better standards for this.
3347

3448

index.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
var args = require('optimist').argv;
55
var main = require('./src/main');
66
var modules = require('./src/modules');
7+
var allowed = require('./allowed');
78

89

910
// Arguments
1011
if(args.h || args.help) {
1112
console.log('Example usage:');
1213
console.log('wsproxy -p 5999');
1314
console.log('-p, --port port to run wsProxy on. [Default: 5999]');
15+
console.log('-a, --allow list of allowed ip:port to proxy to (comma separated) [Default: none] [Example: 127.0.0.1:6900,127.0.0.1:5121,127.0.0.1:6121]');
1416
console.log('-t, --threads number of \"threads\" to spawn, set it to the number of cpu\'s you have. [Default: 1]');
1517
console.log('-s, --ssl enable ssl.');
1618
console.log('-k, --key path to ssl key file. [Default: ./default.key]');
@@ -20,7 +22,15 @@ if(args.h || args.help) {
2022

2123

2224
// Load modules
23-
modules.load('allow')
25+
modules.load('allow');
26+
27+
28+
// Parse allowed ip:port option into array
29+
// Overrides the default allowed.js file
30+
// TODO: remove this allowed.js file, and write a standard way to handle this allowed_ip option.
31+
if(args.a || args.allow) {
32+
allowed = (args.a || args.allow).split(',');
33+
}
2434

2535

2636
// Init

0 commit comments

Comments
 (0)