Commit Graph

34 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 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
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 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
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
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
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 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 6b1d42e643 Merge branch 'empty-message' of https://github.com/andersk/websockify 2017-11-13 10:44:57 +01:00
Anders Kaseorg a29946e978 Do not confuse an empty message with a closed connection
Fixes #312.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2017-11-10 06:26:48 -05:00
Anders Kaseorg 3c1655322d Do not use base except: clauses
https://docs.python.org/2/howto/doanddont.html#except

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2017-11-10 05:48:20 -05:00
wention ade9d61c22 fixed: ssl call error at function load_cert_chain.
If option '--key' is not specified. 'WebSockifyServer class' will
       inital self.key as empty string. but ssl load_cert_chain function
       will raise error 'no such file' with keyfile param empty string.
2017-11-09 16:13:15 +08:00
Pierre Ossman 8b2a949276 Merge branch 'ssl_clientdn_validation' of https://github.com/hoehermann/websockify 2017-10-30 13:12:18 +01:00
Pierre Ossman 5f7d28aeb6 Only start termination process once
We can't deal with the exception once we've started to shut down so
make sure it's only raised once.
2017-10-27 08:41:32 +02:00
Pierre Ossman 0a6e0c2d87 Don't log clients that don't send any request
They just fill up the logs with confusing data.
2017-10-27 08:25:35 +02:00
Hermann Höhne 914609fb5f Added SSL-certificate-based client authentication.
* Incorporates #190 without breaking compatibility towards old Python versions.
* A new plugin allows authenticating clients by the "common name" defined in their certificate.
* Added manual for certificate-based client authentication, including hints to which Python versions allow client certificate authentication.
* Adjusted test to work with new ssl.create_default_context.
2017-10-26 15:17:11 +02:00
Pierre Ossman 5e19bc3f96 Merge branch 'master' of https://github.com/michalsrb/websockify 2017-08-14 17:12:19 +02:00
Michal Srb 2c0e8cb8f4 Fix inetd mode on Python 2.
In python 2 the ssl.wrap_socket doesn't work on sockets created using socket.fromfd.
The workaround is to wrap the socket returned by socket.fromfd into another socket
object using the private _sock constructor parameter.
2017-08-14 16:59:54 +02:00
Michal Srb 867cb21ba0 Add support for inetd.
With the --inetd parameter, websockify doesn't require the source_addr and
source_port paramters and it expects that stdin is already opened and listening
socket.

This way websockify can be used with (x)inetd or as a systemd socket-activated
service.
2017-08-14 16:59:54 +02:00
Pierre Ossman bfd7394cae Remove stray comma in signal handler setup
It was causing the handlers to be set up improperly.
2017-08-14 16:51:55 +02:00
Pierre Ossman 518e6e0e56 Prevent startup on Windows
There's way too many things to fix before this has any chance of working.
2017-06-15 15:18:29 +02:00
Solly Ross ddcec961ec Work around lack of SIGCHLD on Windows
This only enables the SIGCHLD handler if SIGCHLD
exists, such that platforms without SIGCHLD (such
as windows) can still run websockify natively.

See #108
2017-06-15 14:23:29 +02:00
Pierre Ossman df317822d6 Be backwards compatible with older websockify clients
They will specify a sub-protocol, and the specification requires
us to choose one of the specified protocols.
2017-02-08 16:06:14 +01:00
Pierre Ossman 10e13d7a7e Remove last bits of Flash WebSocket emulation
We require native support from the browsers now.
2017-02-03 16:09:08 +01:00
Pierre Ossman e47591f4aa Split out basic WebSocket server template 2017-02-01 08:33:07 +01:00