{"id":13772490,"url":"https://github.com/zliuva/ktlswrapper","last_synced_at":"2025-05-11T04:31:31.137Z","repository":{"id":137521794,"uuid":"232002510","full_name":"zliuva/ktlswrapper","owner":"zliuva","description":"A wrapper that enables TLS support (TLS 1.2 with AES 128 GCM) for existing applications without code change.","archived":false,"fork":false,"pushed_at":"2020-01-06T16:37:12.000Z","size":6,"stargazers_count":23,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-17T07:34:37.600Z","etag":null,"topics":["c","kernel","ld-preload","sockets","tls"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zliuva.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-06T01:40:30.000Z","updated_at":"2023-10-31T08:15:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"ee8cea50-fea5-4a55-a911-1ab36e1e28fb","html_url":"https://github.com/zliuva/ktlswrapper","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zliuva%2Fktlswrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zliuva%2Fktlswrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zliuva%2Fktlswrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zliuva%2Fktlswrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zliuva","download_url":"https://codeload.github.com/zliuva/ktlswrapper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253518941,"owners_count":21921074,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","kernel","ld-preload","sockets","tls"],"created_at":"2024-08-03T17:01:04.624Z","updated_at":"2025-05-11T04:31:26.197Z","avatar_url":"https://github.com/zliuva.png","language":"C","funding_links":[],"categories":["C","Libraries"],"sub_categories":[],"readme":"# KTLS Wrapper [![Build Status](https://travis-ci.com/zliuva/ktlswrapper.svg?token=3u2VrXJmVG2X8YDf7p67\u0026branch=master)](https://travis-ci.com/zliuva/ktlswrapper)[![](https://github.com/zliuva/ktlswrapper/workflows/build/badge.svg)](https://github.com/zliuva/ktlswrapper/actions?query=workflow%3Abuild)\n\nA wrapper that enables TLS support (TLS 1.2 with AES 128 GCM) for existing applications without code change.\n\n## Requirements\n\nKernel `4.17` or above, module `tls` loaded.\n\n## Usage\n\n```bash\nLD_PRELOAD=\u003c/full/path/to/libktlswrapper.so\u003e \\\nKTLS_WRAPPER_CERT=\u003c/full/path/to/tls/cert (PEM format)\u003e \\\nKTLS_WRAPPER_KEY=\u003c/full/path/to/tls/private-key (PEM format)\u003e \\\nKTLS_WRAPPER_PORT=\u003cport existing application listens on\u003e \\\n\u003cexisting application\u003e\n```\n\nor any other ways to specify environment variables such as systemd unit files; be aware of `LD_PRELOAD` limitations on setuid executables.\n\n## How does it work?\n\nThe wrapper hooks into `accept`/`accept4`. Before returning the client socket, the wrapper initiates an SSL handshake using [mbedtls](https://github.com/ARMmbed/mbedtls) and enables [Kernel TLS](https://www.kernel.org/doc/html/latest/networking/tls.html) on the socket for both sending and receiving, using the established secrets from mbedtls. Any subsequent `read`s/`write`s to the socket would have decryption and encryption working transparently.\n\n## Why?\n\nWhy not?\n\n## Is this safe to use on production?\n\n~Definitely not.~ ~Maybe.~ Worse things have happened.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzliuva%2Fktlswrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzliuva%2Fktlswrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzliuva%2Fktlswrapper/lists"}