Websocket Proxy Lib
Library that contains a Proxy for KubeVirts VNC Websockets. It uses JWT Tokens for Authentication and to transfer data.
Installation
pip3 install lab-orchestrator-ws-proxy-lib
Documentation
Check out the developer documentation at websocketproxylib.readthedocs.io.
Usage
The library contains one module called ws_proxy_lib that contains one class. This class contains a run and a run_in_thread method that can be used to start the proxy.
First you need to initialize an object of the class. For that you need to pass some parameters:
remote_url: The base URL to the Kubernetes api (for example"ws://localhost:8001")api_path: The path in the api that points to a VMI. This needs to contain the variables{namespace}and{vmi_name}(for example"/apis/subresources.kubevirt.io/v1alpha3/namespaces/{namespace}/virtualmachineinstances/{vmi_name}/vnc")local_dev_mode: This is a boolean that indicated if you are running the lib locally in a development mode or running it in a Kubernetes cluster. Running it locally disables ssl. Running it in Kubernetes will automatically include the TLS client certificate from/var/run/secrets/kubernetes.io/serviceaccount/ca.crtand use the token from/var/run/secrets/kubernetes.io/serviceaccount/token.secret_key: The key that is used to decrypt the token.
After that you can just start the proxy with the run and a run_in_thread method. Use the parameters host and port to specify on which host and port this runs.
The proxy works as follows:
It creates a websocket at the given host and port. Then when you want to access a VM you need to call the websocket with a path that contains the token and the VM-name divided by a slash. Example: localhost:5001/ABCTOKENDEF/ubuntu. The example contains the token ABCTOKENDEF and tries to access the VM with the name ubuntu. The token contains a list of allowed VM-names and if the given VM-name is part of the token you will be able to access the VM.
See more at: websocketproxylib.readthedocs.io.
Examples
For an example on how to use this library you can take a look at the WebsocketProxy Project which uses this library and integrates it into a docker image.
Contributing
Issues
Feel free to open issues.
Project Structure
The src folder contains the source code of the library. The tests folder contains the test cases. There is a makefile that contains some shortcuts for example to run the test cases and to make a release. Run make help to see all targets. The docs folder contains rst docs that are used in websocketproxylib.readthedocs.io.
Developer Dependencies
- Python 3.8
- Make
pip install -r requirements.txtpip install -r requirements-dev.txt
Releases
Your part:
- Create branch for your feature (
issue/ISSUE_ID-SHORT_DESCRIPTION) - Code
- Make sure test cases are running and add new ones for your feature
- Create MR into master
- Increase version number in
src/lab_orchestrator_ws_proxy_lib/__init__.py(semantic versioning)
Admin part:
- Check and accept MR
- Merge MR
- Run
make release
Docs
To generate the docs run: cd docs && make html.
Metadata
Release files for lab-orchestrator-ws-proxy-lib 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lab-orchestrator-ws-proxy-lib-1.0.0.tar.gz | 10.7 kB | Without provenance | Details for lab-orchestrator-ws-proxy-lib-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lab_orchestrator_ws_proxy_lib-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for lab_orchestrator_ws_proxy_lib-1.0.0-py3-none-any.whl |
Total release size: 21.7 kB
Release files / lab-orchestrator-ws-proxy-lib-1.0.0.tar.gz
| Download URL | lab-orchestrator-ws-proxy-lib-1.0.0.tar.gz |
|---|---|
| Size | 10.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2b3576e54582021e6300764f6bf23382826c8f7ae130a09383653f3388bc930c
|
|
BLAKE2b-256 checksum How to use checksums |
abc73b482af3ff391407c941a1d6aa9ac0fb4efc6a354d40bb98757ec7ec0060
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.10
|
Release files / lab_orchestrator_ws_proxy_lib-1.0.0-py3-none-any.whl
| Download URL | lab_orchestrator_ws_proxy_lib-1.0.0-py3-none-any.whl |
|---|---|
| Size | 11.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
058de99334eeec7ca3ba676521cee43414e54f1dfe65b39f82279c1e6a5cadd0
|
|
BLAKE2b-256 checksum How to use checksums |
428d4f702a93506602e8ee4586426fee510ff122a5bb84984d1030ec893fe26b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.10
|
Security for lab-orchestrator-ws-proxy-lib 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.