{"id":13826256,"url":"https://github.com/primaryobjects/vpndemon","last_synced_at":"2025-06-22T00:41:35.239Z","repository":{"id":20018496,"uuid":"23286258","full_name":"primaryobjects/vpndemon","owner":"primaryobjects","description":"Monitor a VPN connection on Linux and kill a process upon disconnect","archived":false,"fork":false,"pushed_at":"2023-01-16T16:28:05.000Z","size":57,"stargazers_count":99,"open_issues_count":0,"forks_count":15,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-06-04T00:02:56.171Z","etag":null,"topics":["bash","disconnect","dns-leak","linux","monitoring","networkmanager","prevent-dns-leaks","security","shell","vpn","vpn-connections"],"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/primaryobjects.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["primaryobjects"]}},"created_at":"2014-08-24T16:37:35.000Z","updated_at":"2025-01-26T19:11:07.000Z","dependencies_parsed_at":"2023-02-10T04:40:17.786Z","dependency_job_id":null,"html_url":"https://github.com/primaryobjects/vpndemon","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/primaryobjects/vpndemon","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primaryobjects%2Fvpndemon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primaryobjects%2Fvpndemon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primaryobjects%2Fvpndemon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primaryobjects%2Fvpndemon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/primaryobjects","download_url":"https://codeload.github.com/primaryobjects/vpndemon/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primaryobjects%2Fvpndemon/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261217473,"owners_count":23126259,"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":["bash","disconnect","dns-leak","linux","monitoring","networkmanager","prevent-dns-leaks","security","shell","vpn","vpn-connections"],"created_at":"2024-08-04T09:01:34.620Z","updated_at":"2025-06-22T00:41:30.223Z","avatar_url":"https://github.com/primaryobjects.png","language":"Shell","readme":"VPNDemon\n=========\n### for Linux\n\n\nVPNDemon monitors your VPN connection and kills a target program upon disconnect. It's the safest and easiest way to help prevent DNS leaks and enhance your security while connected over a VPN.\n\n![Screenshot 1](https://raw.githubusercontent.com/primaryobjects/vpndemon/master/screenshots/screenshot4.png)\n\nIt's as simple as this:\n\n- Run vpndemon.sh.\n- Enter the name of the target process to kill when the VPN disconnects.\n\nThat's it!\n\nInstall\n---\n\n1. Download [vpndemon.sh](https://raw.githubusercontent.com/primaryobjects/vpndemon/master/vpndemon.sh) and place it in a folder, such as ~/Documents/vpndemon.\n ```sh\n cd ~/Documents/vpndemon\n bash vpndemon.sh\n ```\n\n2. Enter the name of a program to kill when the VPN disconnects. This can be a substring of the name, such as \"chrome\", \"firefox\", etc.\n\n ![Enter a target process to kill upon VPN disconnect](https://raw.githubusercontent.com/primaryobjects/vpndemon/master/screenshots/screenshot1.png)\n\n3. Click OK to start monitoring.\n\n ![Monitoring VPN connection](https://raw.githubusercontent.com/primaryobjects/vpndemon/master/screenshots/screenshot2.png)\n\n3. VPNDemon is now monitoring your VPN connection. If your not already connected to your VPN, go ahead and connect now.\n\n ![Detecting a VPN connection](https://raw.githubusercontent.com/primaryobjects/vpndemon/master/screenshots/screenshot3.png)\n\n4. Try disconnecting your VPN. VPNDemon will detect the disconnect, kill all instances of the target program, and update its status.\n\n ![Detecting a VPN disconnect](https://raw.githubusercontent.com/primaryobjects/vpndemon/master/screenshots/screenshot4.png)\n\nInstalling as an Application\n---\n\n1. Download [vpndemon.sh](https://raw.githubusercontent.com/primaryobjects/vpndemon/master/vpndemon.sh) and [install.sh](https://raw.githubusercontent.com/primaryobjects/vpndemon/master/install.sh). Run install.sh.\n ```sh\n cd ~/Documents/vpndemon\n sudo bash install.sh\n ```\n\n2. After installing, open the start menu and search for VPNDemon. Right-click the result and select \"Add to Panel\" or \"Add to Desktop\".\n\nTechnical Details\n---\n\nVPNDemon monitors the VPN connection by listening to events from the linux [NetworkManager](https://wiki.archlinux.org/index.php/NetworkManager). When a VPN connect/disconnect event is received, the signal is checked to see which state it relates to. If it's a connect state, the status is simply displayed in the main window. If it's a disconnect state, VPNDemon immediately issues a kill command for all processes that match the target process name:\n\n```sh\nfor i in `pgrep $killProgramName`\ndo\n    kill $i\ndone\n```\n\nSince the NetworkManager is being listened to, directly via the [dbus-monitor](http://dbus.freedesktop.org/doc/dbus-monitor.1.html), disconnect events are detected almost instantly. Likewise, the target process is killed almost instantly.\n\nVPNDemon should be compatible with any linux system that uses NetworkManager for VPN connections.\n\nTroubleshooting\n---\n\n1. A log file is saved to /tmp/vpndemon, which contains the list of VPN connect/disconnect events and a list of processes terminated. The log is cleared each time the app is run. However, you can review the log during or after running the app, to help determine any troubleshooting issues.\n\nPreventing DNS Leaks with IPv6\n---\n\nIf you want even tighter privacy, you can disable IPv6. This is easy to do. IPv6 incorporates hardware MAC addresses, and since many VPN services do not yet route IPv6 traffic, it creates a potential leak for network activity.\n\nTo disable IPv6, edit the file /etc/sysctl.conf and add the following lines:\n```sh\nnet.ipv6.conf.all.disable_ipv6 = 1\nnet.ipv6.conf.default.disable_ipv6 = 1\nnet.ipv6.conf.lo.disable_ipv6 = 1\n```\nAfter making these changes, refresh the file by running:\n```sh\nsudo sysctl -p\n```\nTo verify IPv6 is actually disabled, run ifconfig and verify that \"inet6\" is not present in the output:\n```sh\nifconfig | grep inet6\n```\n\nLicense\n----\n\nMIT\n\nAuthor\n----\nKory Becker\nhttp://www.primaryobjects.com/kory-becker\n","funding_links":["https://github.com/sponsors/primaryobjects"],"categories":["\u003ca id=\"d62a971d37c69db9f3b9187318c3921a\"\u003e\u003c/a\u003e工具"],"sub_categories":["\u003ca id=\"8ea8f890cf767c3801b5e7951fca3570\"\u003e\u003c/a\u003e公网访问局域网"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprimaryobjects%2Fvpndemon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprimaryobjects%2Fvpndemon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprimaryobjects%2Fvpndemon/lists"}