{"id":16860067,"url":"https://github.com/dav1dde/njail","last_synced_at":"2026-03-16T08:02:05.937Z","repository":{"id":146055823,"uuid":"92593760","full_name":"Dav1dde/njail","owner":"Dav1dde","description":"utility scripts to manage network namespaces `ip netns`, e.g. creating a VPN-Jail","archived":false,"fork":false,"pushed_at":"2017-05-28T10:37:02.000Z","size":3,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-03T18:22:53.261Z","etag":null,"topics":["iptables","jail","netns","network","vpn"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Dav1dde.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2017-05-27T11:11:33.000Z","updated_at":"2022-09-26T01:12:22.000Z","dependencies_parsed_at":"2023-05-03T17:36:49.877Z","dependency_job_id":null,"html_url":"https://github.com/Dav1dde/njail","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/Dav1dde%2Fnjail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dav1dde%2Fnjail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dav1dde%2Fnjail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dav1dde%2Fnjail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dav1dde","download_url":"https://codeload.github.com/Dav1dde/njail/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239580714,"owners_count":19662809,"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":["iptables","jail","netns","network","vpn"],"created_at":"2024-10-13T14:21:00.675Z","updated_at":"2026-03-16T08:02:05.853Z","avatar_url":"https://github.com/Dav1dde.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"Njail\n=====\n\nSimple wrapper to manage network namespaces `ip netns`, useful to run certain programs through a vpn or completly disallow any network access.\n\n## Example\n\n### Drop all traffic\n\n```\n------------------------------------------------------------\n~/workspaces/bash/njail(master) » sudo ./njail.sh -i enp+ -n test -q\n------------------------------------------------------------\n~/workspaces/bash/njail(master) » sudo ip netns exec test pin 8.8.8.8\nPING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.\n64 bytes from 8.8.8.8: icmp_seq=1 ttl=43 time=34.2 ms\n^C\n--- 8.8.8.8 ping statistics ---\n1 packets transmitted, 1 received, 0% packet loss, time 0ms\nrtt min/avg/max/mdev = 34.232/34.232/34.232/0.000 ms\n------------------------------------------------------------\n~/workspaces/bash/njail(master) » sudo ip netns exec test curl -I google.com \nHTTP/1.1 302 Found\nCache-Control: private\n[...]\n------------------------------------------------------------\n~/workspaces/bash/njail(master) » sudo ./dropall.sh test\n------------------------------------------------------------\n~/workspaces/bash/njail(master) » sudo ip netns exec test ping 8.8.8.8\nPING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.\nping: sendmsg: Operation not permitted\n^C\n--- 8.8.8.8 ping statistics ---\n2 packets transmitted, 0 received, 100% packet loss, time 1011ms\n------------------------------------------------------------\n~/workspaces/bash/njail(master) » sudo ip netns exec test curl -I google.com \ncurl: (6) Could not resolve host: google.com\n------------------------------------------------------------\n~/workspaces/bash/njail(master) » sudo ./njail.sh -i enp+ -n test -c -q \n```\n\n### Route traffic through VPN\n\n```\n~/workspaces/bash/njail(master) » sudo ./njail.sh -i enp+ -n vpn -q\n------------------------------------------------------------\n~/workspaces/bash/njail(master) » sudo ./vpn.sh -n vpn -a \"185.100.84.135/32,185.100.84.244/32,185.100.84.245/32,185.100.84.247/32,185.100.84.246/32\" -c \"/etc/openvpn/client/romania_bucharest-aes256-udp.conf\" -d 8.8.8.8\nSun May 28 12:26:30 2017 OpenVPN 2.4.2 x86_64-unknown-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on May 11 2017\nSun May 28 12:26:30 2017 library versions: OpenSSL 1.1.0e  16 Feb 2017, LZO 2.10\nSun May 28 12:26:30 2017 Outgoing Control Channel Authentication: Using 512 bit message hash 'SHA512' for HMAC authentication\nSun May 28 12:26:30 2017 Incoming Control Channel Authentication: Using 512 bit message hash 'SHA512' for HMAC authentication\nSun May 28 12:26:30 2017 TCP/UDP: Preserving recently used remote address: [AF_INET]185.100.84.244:50000\nSun May 28 12:26:30 2017 Socket Buffers: R=[212992-\u003e212992] S=[212992-\u003e212992]\nSun May 28 12:26:30 2017 UDP link local: (not bound)\n[...]\n------------------------------------------------------------\n~/workspaces/bash/njail(master) » curl ifconfig.co/country\nAustria\n------------------------------------------------------------\n~/workspaces/bash/njail(master) » sudo ip netns exec vpn curl ifconfig.co/country\nRomania\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdav1dde%2Fnjail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdav1dde%2Fnjail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdav1dde%2Fnjail/lists"}