Commit Graph

210 Commits

Author SHA1 Message Date
Joshua Ashton bdcd685f8e
Add support for FTEQW protocol
It's the same as binary really, Quake servers use this to distinguish what client type is being used.
2021-08-29 08:51:11 +01:00
Joshua Ashton 5d8f5ccfab
Support for UDP socket forwarding
Allow forwarding WS->UDP. Useful for experiments and hobby projects.
2021-08-29 08:49:30 +01:00
Pierre Ossman da130946eb Merge branch 'sisou/split-tokens-tab' of https://github.com/sisou/websockify 2021-04-16 13:00:36 +02:00
Pierre Ossman 8b724074e0 Use older PROTOCOL_SSLv23 instead of PROTOCOL_TLS
We need to support Python older than 3.6, so use the older name.
2021-02-08 15:47:29 +01:00
PexMor 9dab8b360b add details on format of redis and leave port as number 2021-02-07 20:39:02 +01:00
Javier Prieto 1f618c8f41 Added JWT nbf, not before 2021-01-27 16:50:19 +01:00
Javier Prieto e9367b03be Added exp claim for JWT token 2021-01-27 15:16:08 +01:00
Pierre Ossman 33710b3972 Use frombytes() instead of fromstring()
Both the Python library and NumPy have changed the names of these
functions to better match the new bytes data type it actually uses.
2020-12-14 16:08:16 +01:00
Pierre Ossman 96eda1a5c7 Remove support for older Python
All active distributions should now support at least Python 3.4, so
let's clean things up by removing older compatibility code.
2020-12-14 13:48:54 +01:00
Pierre Ossman e80739b296 Add more search paths for rebind.so
If we're run as a module then sys.argv[0] will be the main module, not
some startup script.
2020-12-04 13:57:21 +01:00
Ryo Ota d2155697fc
fix a typo 2020-11-18 08:53:09 +09:00
JasonYang 2b44803f83 fixed a bug in the function of send_frames. 2020-11-10 13:14:54 +01:00
Pierre Ossman 01ef6a6a55 Require same arguments on insufficient socket space
This matches the behaviour of SSLSocket, which we are trying to mimic.
It also closely matches the behaviour of normal Socket which can be
assumed to not have sent anything if an error occurs. We might actually
send some data, but the caller cannot really see that and must call us
again as if no data was sent.
2020-09-30 14:58:19 +02:00
Pierre Ossman 6caf23c067 Add type checking when sendning data
We use this in various ways so add an early check to make things clear
in case anything is called incorrectly.
2020-09-30 14:53:19 +02:00
Pierre Ossman d72ace2ae6 Allow sending empty messages
This is perfectly valid in the protocol, and may be meningful to some
applications. However send() is still stream oriented so it will ignore
an empty buffer.
2020-09-30 14:51:07 +02:00
Pierre Ossman 9b1780f068 Fix bad reset of fragmented frame
The Python 2/3 binary data type compatibility hack was backwards here.
2020-08-21 10:58:55 +02:00
Sören Schwert 663b39cd38
Split token file by any whitespace after the colon, not just a space
With the current parser logic, only tokens and servers that are separated by _exactly_ a colon and a space `: ` are detected as tokens. But when formatting one's token file with tabs, this breaks.

This commit changes the split characters to be a regular expression that matches all forms of whitespace, including spaces and tabs.
2020-07-28 14:40:42 +02:00
Sören Schwert 57be17d7f5
Convert old print statement into function
For Python 3 compatibility.
2020-07-28 14:35:49 +02:00
Feng Ye 7bd955a379 Add UnixDomainSocketDirectory token plugin 2020-03-18 10:40:18 +08:00
Pierre Ossman 6d48b1507e Make sure port is a simple string (again)
The redis token plugin also needs to make sure the port string isn't
unicode for compatibility with Python 2.x.
2020-02-27 15:55:35 +01:00
Pierre Ossman 76897b5093 Log connection errors better 2020-02-27 15:54:29 +01:00
Pierre Ossman b46fab5608 Make sure the port is a simple string
getaddrinfo() gladly allows unicode for the host, but the port must
be in ascii (e.g. "https"). Make sure this is properly converted
before we pass it on.

Patch by @caderize on GitHub.
2019-07-03 12:29:02 +02:00
Skia f21a7d33a2 Add a __main__.py file for invocation as a module
This file allows an easy invocation of websockify as a module, which is handy when running into shebang issues (https://github.com/pypa/virtualenv/issues/596).
With this patch, `python -m websockify ...` has just the same behavior as `./run ...`.
2019-06-13 17:16:25 +02:00
Pierre Ossman 01a184f4a9 Make TokenRedis optional
Most installations will not have redis or simplejson installed, so
avoid having them as a hard requirement unless actually using the
TokenRedis plugin.
2019-05-24 12:56:23 +02:00
Giuseppe Corbelli 70911c6d6e [websocketproxy] Fixed base class call to process_request() when using
ThreadingMixIn
2019-05-15 14:58:47 +02:00
Pierre Ossman c1edd7818d Merge branch 'master' of https://github.com/PexMor/websockify 2019-05-09 15:51:45 +02:00
PexMor ff3fdd149d novnc redis backed token_plyugins.py 2019-04-29 20:32:04 +02:00
Pierre Ossman be9823bf93 Use client IP in logs, not host
This is the more common behaviour, and it is also more reliable as
it may require some time to look up hostnames and they may change
over time.
2019-04-25 10:05:14 +02:00
Pierre Ossman e4658ada2e Re-enable Windows support
It works well enough now with the recent fixes and a modern Python.
2019-04-02 17:04:19 +02:00
Pierre Ossman 85074b6eb5 Use ThreadingMixIn for the simple server
ForkingMixIn isn't available on Windows. This is the simple server
without features, so use ThreadingMixIn to keep things consistent.
2019-04-02 17:03:08 +02:00
Tommy Brunn 92cb3d8355 Rename certificate key password option 2019-03-04 09:31:01 +01:00
Tommy Brunn 0163e4060b Add option for cert key password 2019-03-02 17:21:28 +01:00
totaam a348b8bf76 fix handling of code: invalid unpacking, undefined variable in error path, missing argument 2019-02-23 12:37:16 +07:00
UXabre f2031eff05 Added JWT/JWS/JWE tokens capability 2019-02-15 03:45:57 -05:00
Pierre Ossman f0bdb0a621 Handle connection failures
The service we're proxying to might not be responding. Make sure
this is caught sanely and we get nice logging and messages back to
the client.
2018-10-23 16:31:57 +02:00
Pierre Ossman 8eb5cb0cdc Explicitly deny text messages
We can't really handle them, but let's respond with an explicit error
rather than "unknown opcode".
2018-10-23 16:31:07 +02:00
Pierre Ossman 7abd7ac4a9 Merge branch 'master' of https://github.com/josedpedroso/websockify 2018-09-10 16:39:32 +02:00
josedpedroso 7e29a36f6a Syslog now RFC 5424 compliant and properly identified. 2018-08-28 19:52:47 +01:00
Pierre Ossman be5d30ad25 Change WebSocket request handler to a mix-in
We can't get the inheritence right in non-trivial cases as a regular
base class, so change it to be a mix-in that is to be combined with
one of the existing request handlers from the Python library.
2018-08-15 17:07:37 +02:00
josedpedroso d80c607cb6 Port no longer included in token when using --host-token 2018-07-12 20:21:08 +01:00
Tomasz Barański 7c816eb207 Added command line options for minum SSL version and SSL ciphers
--ssl-version takes two possible values (tlsv1_1, tlsv1_2). Defaults
to tlsv1_1.
--ssl-ciphers takes allowed ciphers in the same format as
`openssl ciphers`.

Added options for 1.3 and the default ssl config
2018-07-05 21:55:29 +02:00
Tomasz Barański 51ad14d16c Enable setting SSL ciphers and SSL options
The change adds two options to WebSockifyServer. The first is a list of
SSL ciphers. The second is SSL options (intended use is to force a
specific TLS version).

Those two options allow for greater security of WebSocket Proxy.
2018-07-05 21:54:20 +02:00
josedpedroso af85184e28 Added --host-token to allow choosing target by hostname. 2018-07-05 00:54:19 +01:00
josedpedroso 44bb213a72 Improved --help. 2018-07-05 00:53:09 +01:00
josedpedroso 525bfa6bae Added syslog support.
Reworked logging setup.
2018-07-05 00:50:48 +01:00
josedpedroso 8964adf111 Added --web-auth option to require authentication to access the webserver.
BasicHTTPAuth plugin now issues 401 on bad credentials to allow the user to try again.
2018-07-05 00:48:08 +01:00
Pierre Ossman 38b77714a9 Make recording Python 3 compatible
Python 3's bytes objects require a bit more care to get in to the
output format we need.
2018-04-05 16:07:09 +02:00
Pierre Ossman e5e1dcef79 Clean up after request handler
We need to call the base class after a request is finished in
order to clean up things properly. E.g. closing the socket file
descriptor.
2018-03-19 15:31:34 +01:00
Pierre Ossman 3b2a0a5884 Make sure ping/pong data is in the correct type
For Python 3 we need to make sure the data payload is bytes, not str.
2018-02-28 10:58:25 +01:00
Pierre Ossman 3d20cabf40 Fix handling of closed proxy socket
Regression caused by a29946e9. We were no longer detecting a cleanly
closed proxy socket. This is not a WebSocket, but an ordinary one,
so we should be checking for "" rather that None.
2018-01-25 15:46:41 +01:00