{"id":19662705,"url":"https://github.com/brunexgeek/net-bouncer","last_synced_at":"2026-06-17T10:32:14.617Z","repository":{"id":247504473,"uuid":"825941328","full_name":"brunexgeek/net-bouncer","owner":"brunexgeek","description":"Honeypot program that logs connection attempts and refuses them","archived":false,"fork":false,"pushed_at":"2024-07-11T00:03:20.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-22T10:13:26.221Z","etag":null,"topics":["fail2ban","honeypot","security"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brunexgeek.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":"2024-07-08T19:57:34.000Z","updated_at":"2024-07-11T00:03:23.000Z","dependencies_parsed_at":"2024-07-09T05:10:01.071Z","dependency_job_id":"10501e15-c640-4093-b217-d014893f21b0","html_url":"https://github.com/brunexgeek/net-bouncer","commit_stats":null,"previous_names":["brunexgeek/net-bouncer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/brunexgeek/net-bouncer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunexgeek%2Fnet-bouncer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunexgeek%2Fnet-bouncer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunexgeek%2Fnet-bouncer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunexgeek%2Fnet-bouncer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brunexgeek","download_url":"https://codeload.github.com/brunexgeek/net-bouncer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunexgeek%2Fnet-bouncer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34445179,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-17T02:00:05.408Z","response_time":127,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["fail2ban","honeypot","security"],"created_at":"2024-11-11T16:12:09.771Z","updated_at":"2026-06-17T10:32:14.594Z","avatar_url":"https://github.com/brunexgeek.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# net-bouncer\n\nThis is a honeypot program that logs connection attempts to a specified port (any address) and then disconnects. No data is received or sent.\n\nThe idea is to use it in conjunction with [fail2ban](https://github.com/fail2ban/fail2ban) to block IP addresses attempting to exploit known services, such as SSH, while the authentic service is offered on a non-standard port. This way, you can prevent malicious or unknown actors from having any type of communication with your services.\n\n## Build\n\nTo build the software, all you need is a C99-compatible compiler and `make`.\n\nFirst, clone the repository using `git` or download the source code in the [project's GitHub page](https://github.com/brunexgeek/net-bouncer):\n\n```sh\n$ git clone https://github.com/brunexgeek/net-bouncer.git\n```\n\nGo to the source directory and run `make`:\n\n```sh\n$ cd net-bouncer\n$ make\n```\n\nThe executable `net-bouncer` will ge created. Use `make install` to install the program in the system or any other location.\n\n## Running\n\nTo start the honeypot, run `net-bouncer` specifying the port to listen on using the `-p` parameter. At least one port must be provided. The destination file for the log can be specified with `-l`; if no log file is provided, the output will go to `stderr`.\n\n```sh\n$ net-bouncer -p 22 -p 23 -l /var/log/net-bouncer.log\n```\n\nThe command above will listen on ports 22 (SSH) and 23 (Telnet) and store logs in `/var/log/net-bouncer.log`. The log looks like the following:\n\n```\nnet-bouncer 0.1.0\n2024-07-08 21:26:44.730 [INFO] Listening to any address on the port 22\n2024-07-08 21:26:44.730 [INFO] Listening to any address on the port 23\n2024-07-08 21:26:48.474 [INFO] Connection from 127.0.0.1 on port 22\n2024-07-08 21:26:50.114 [INFO] Connection from 3.3.1.20 on port 23\n2024-07-08 21:26:50.738 [INFO] Connection from 64.25.33.120 on port 22\n```\n\nThe program will generate a log entry for each connection, displaying the remote address and the local port that the remote actor attempted to access.\n\n## Running as service with systemd\n\nThe best way to run *net-bouncer* is using *systemd*. You can use a service description like the following:\n\n```\n[Unit]\nWants=network-online.target\nAfter=network-online.target\n\n[Service]\nUser=net-bouncer\nGroup=net-bouncer\nExecStart=net-bouncer -p 22 -p 23 -l /var/log/net-bouncer.log\n\n[Install]\nWantedBy=default.target\n```\n\nThe service above assumes you have a user and group named `net-bouncer`, which is the recomended thing to do. If you don't want to create a specific user to run `net-bouncer`, you can omit the fields `User` and `Group`.\n\n## Monitoring the log with fail2ban\n\nYou can use the information from the *net-bouncer*'s log to instruct *fail2ban* to block the IP addresses of machines that triggered the honeypot. I'll assume you already have *fail2ban* installed and operational in your environment. For detailed configuration instructions, refer to the official *fail2ban* documentation.\n\nFirst, set up a filter that correctly identifies the relevant lines in your log. To do this, create a file named `filter.d/net-bouncer.conf` in the *fail2ban* configuration directory (usually located at `/etc/fail2ban`). Here’s the content for that file:\n\n```\n[Definition]\nfailregex = ^.*Connection from \u003cHOST\u003e.*$\nignoreregex =\ndatepattern = ^%%Y-%%m-%%d %%H:%%M:%%S\n```\n\nNext, we’ll configure the jail settings to associate the filter with the actual log file. Create a file named `jail.d/net-bouncer.conf` in the same configuration directory, adjusting the content to match your specific scenario:\n\n```\n[net-bouncer]\nenabled = true\nlogpath = /var/log/net-bouncer.log\nbantime = 1w\nmaxretry = 1\n```\n\nIf you’re monitoring multiple logs (for example, if you have more than one instance of *net-bouncer*), you can use wildcards (*) in the log path.\n\nFinally, restart the *fail2ban* service:\n\n```sh\n$ systemd restart fail2ban.service\n```\n\n## License\n\nThis program is distributed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrunexgeek%2Fnet-bouncer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrunexgeek%2Fnet-bouncer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrunexgeek%2Fnet-bouncer/lists"}