{"id":18151304,"url":"https://github.com/msantos/libsockfilter","last_synced_at":"2025-07-17T20:37:49.095Z","repository":{"id":136621433,"uuid":"219312756","full_name":"msantos/libsockfilter","owner":"msantos","description":"Connection filtering for dynamically linked applications","archived":false,"fork":false,"pushed_at":"2023-07-06T10:38:12.000Z","size":24,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-13T05:30:15.747Z","etag":null,"topics":["cdb","firewall","ldpreload"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/msantos.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":"2019-11-03T14:24:26.000Z","updated_at":"2024-08-22T22:11:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"f7622d6a-2ccd-4d34-af56-717ec0c66df9","html_url":"https://github.com/msantos/libsockfilter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msantos%2Flibsockfilter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msantos%2Flibsockfilter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msantos%2Flibsockfilter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msantos%2Flibsockfilter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/msantos","download_url":"https://codeload.github.com/msantos/libsockfilter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247568929,"owners_count":20959754,"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":["cdb","firewall","ldpreload"],"created_at":"2024-11-02T01:07:18.011Z","updated_at":"2025-04-06T23:29:33.132Z","avatar_url":"https://github.com/msantos.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nlibsockfilter - connection filtering for dynamically linked applications\n\n# SYNOPSIS\n\n* server\n\nLD_PRELOAD=libsockfilter_accept.so *COMMAND* *ARG* *...*\n\n* client\n\nLD_PRELOAD=libsockfilter_connect.so *COMMAND* *ARG* *...*\n\n# DESCRIPTION\n\nAn experimental library for adding connection\nfiltering to any dynamically linked application using\n[tcprules](https://cr.yp.to/ucspi-tcp/tcprules.html) rules.\n\nIn contrast to managing a firewall, `libsockfilter` allows applications\nto enforce network access without requiring any special privileges.\n\nlibsockfilter requires [libcdb](https://www.corpit.ru/mjt/tinycdb.html).\n\n# BUILD\n\n```\napt install libcdb-dev\napt install ucspi-tcp-ipv6 # or ucspi-tcp\nmake\n```\n\n# ENVIRONMENT VARIABLES\n\n## common\n\n`LIBSOCKFILTER_DEBUG`\n: Write errors to stdout (default: disabled).\n\n## libsockfilter_accept\n\n`LIBSOCKFILTER_ACCEPT`\n: Path to rules database. If the rules database is not accessible,\nall connections are dropped.\n\n## libsockfilter_connect\n\n`LIBSOCKFILTER_CONNECT`\n: Path to rules database. If the rules database is not accessible,\nall connections are dropped.\n\n# EXAMPLES\n\n```\n$ sudo apt install ucspi-tcp-ipv6 # or ucspi-tcp\n\n# default is deny\n# 192.168.1.1: deny specific match\n# 127: deny any IP beginning with 127\n# reset default to allow\ncat \u003c\u003cEOF \u003e rules.txt\n192.168.1.1:deny\n127:deny\n::1:deny\n:allow\nEOF\n\ncat rules.txt | tcprules rules.cdb rules.cdb.tmp\n\nLD_PRELOAD=./libsockfilter_connect.so \\\n LIBSOCKFILTER_CONNECT=./rules.cdb \\\n nc -vvv 127.0.0.1 22\n\nLD_PRELOAD=./libsockfilter_accept.so \\\n LIBSOCKFILTER_ACCEPT=./rules.cdb \\\n nc -vvv -k -l 9999\n```\n\n## ipsum\n\nUsing [ipsum](https://github.com/stamparm/ipsum):\n\n```\n(\ncurl --compressed https://raw.githubusercontent.com/stamparm/ipsum/master/ipsum.txt 2\u003e/dev/null | awk '/^#/{ next } $2 ~ /^[1-2]$/{next} {print $1 \":deny\"}'\necho :allow\n) | tcprules rules.cdb rules.cdb.tmp\n```\n\n# SEE ALSO\n\n*connect*(2), *accept*(2), *tcprules*(1), *hosts.allow*(5), *hosts.deny*(5)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsantos%2Flibsockfilter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmsantos%2Flibsockfilter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsantos%2Flibsockfilter/lists"}