-
Notifications
You must be signed in to change notification settings - Fork 2
Home
- python 3.4+ on Unix-like system
- openssl (optional, required to generate certificate and key)
- Download 'src' directory to both your server and client.
-
cd to 'src' directory
-
Run make_key.sh
- You will be prompted for some information. For most of them, the default values should do just fine. However, when prompted for 'Common Name', you should enter a arbitrary string and remember it.
-
Edit config.py
config.py may look something like:
SERVER = dict( run = False, listen = ('0.0.0.0', 443), connect = ('127.0.0.1', 22), password = b'this is a example password', certfile = 'cert.pem' ) CLIENT = dict( run = True, listen = ('127.0.0.1', 22), connect = ('1.2.3.4', 443), password = b'this is a example password', hostname = 'server', cafile = 'ca.crt' )As you may see, there are two sections of configuration:
SERVERCLIENT.This section, except field
run, will be ignored by client code.-
run = Truefor server configuration,run = Falsefor client configuration. -
listen = (host, port)Specifies what internet address the server should use to communicate with clients. Use
443forportfor better obfuscation. This may, however, require root privilege. Use a number greater then443if you could-not/would-not grant root privilege.'0.0.0.0'for host usually suffice for ordinary use. -
connect = (host, port)Specifies what internet address the server should redirect clients' traffic to. To illustrate, lets take an example. Suppose your server is hosting a website which is blocked by firewall, you can set
connect = ('127.0.0.1', 80)to unblock your website ('127.0.0.1'is the IP address of your server, with respect to your server itself, and80is the port where HTTP is served). Generally speaking, if some service is provided at(host, port)and is accessible for your server, you can make it accessible at your client, by settingconnectto that(host, port). -
password = b'something'This is a password for client authentication. Just don't forget the
bprefix! -
certfile = 'cert.pem'Path to certificate file. No need to modify if you generate certificate using
make_key.sh.
This section, except field
run, will be ignored by server code.-
run = Truefor client configuration,run = Falsefor server configuration. -
listen = (host, port)Listen on the specified address and forward any traffic to server. This address will exhibit (almost) the same behavior as the address specified by
SERVER['connect']. SeeSERVER``connectfor further understanding. -
connect = (host, port)hostshould be the IP address of your server, andportshould be the same as specified inSERVER``listen -
password = b'something'Should be the same as
SERVER``password, obviously. -
hostname = 'yourserver.com'Recall that I told you to remember the 'Common Name' you entered when running
make_key.sh? Now plug it here! -
cafile = 'ca.crt'Path to certificate file. No need to modify if you generate certificate using
make_key.sh.
Note:
config.pyis different on server and client -
-
cd to the directory containing all files
-
type
python3 main.pyhitEnter