{"id":48611307,"url":"https://github.com/mora9715/haproxy_ddos_protector","last_synced_at":"2026-04-09T00:34:36.458Z","repository":{"id":49896795,"uuid":"374422004","full_name":"mora9715/haproxy_ddos_protector","owner":"mora9715","description":"DDoS protection system PoC for HaProxy","archived":false,"fork":false,"pushed_at":"2021-06-14T20:00:19.000Z","size":71,"stargazers_count":20,"open_issues_count":0,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-27T16:36:47.399Z","etag":null,"topics":["ddos","ddos-protection","haproxy","lua"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mora9715.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-06T17:25:44.000Z","updated_at":"2024-04-30T02:04:15.000Z","dependencies_parsed_at":"2022-09-21T20:40:48.238Z","dependency_job_id":null,"html_url":"https://github.com/mora9715/haproxy_ddos_protector","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mora9715/haproxy_ddos_protector","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mora9715%2Fhaproxy_ddos_protector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mora9715%2Fhaproxy_ddos_protector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mora9715%2Fhaproxy_ddos_protector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mora9715%2Fhaproxy_ddos_protector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mora9715","download_url":"https://codeload.github.com/mora9715/haproxy_ddos_protector/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mora9715%2Fhaproxy_ddos_protector/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31580187,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["ddos","ddos-protection","haproxy","lua"],"created_at":"2026-04-09T00:34:35.548Z","updated_at":"2026-04-09T00:34:36.438Z","avatar_url":"https://github.com/mora9715.png","language":"Lua","readme":"## HaProxy DDoS protection system PoC\n\nThe system provides functionality to protect certain (or all) resources on HaProxy from L7 DDoS attacks.\n\nIt works by requiring a user to have a specific cookie issued after successful captcha completion. If a user does not have the cookie, he gets redirected to a special captcha page.\n\nIt is by no means a cure for all ills, but should help you mitigate a moderate DDoS attack without disrupting the service.\n\n#### How it works\n\n![alternative text](http://www.plantuml.com/plantuml/proxy?cache=no\u0026src=https://raw.githubusercontent.com/mora9715/haproxy_ddos_protector/master/docs/interaction_diagram.txt)\n\n#### How to test\n\n- export hcaptcha sitekey and secret:\n```bash\nexport HCAPTCHA_SITEKEY=xxxXXxxx\nexport HCAPTCHA_SECRET=xxxXXxxx\n```\nThey can be obtained after creating a free account on https://www.hcaptcha.com/\n\n- run docker compose:\n```bash\ndocker compose up\n```\n\n- visit *http://127.0.0.1*\n\nFor demostration purposes DDoS-protection mode was enabled by default.\n\n#### Installation\nBefore installing the tool, ensure that HaProxy is built with Lua support.\n\n- Copy [scripts](src/scripts) to a folder accessible for HaProxy\n- Copy haproxy config and make sure that `lua-load` directive contains absolute path to [register.lua](src/scripts/register.lua)\n- Copy [libs](src/libs) to a path where Lua looks for modules.\n- Copy [ddos-cli](src/cli/ddos-cli) to any convenient path.\n- Create `/usr/local/etc/haproxy/domains_under_ddos.txt` with write permissions for HaProxy (feel free to change the map file path, update the HaProxy config correspondingly)\n\n#### CLI\nThe system comes with CLI. It can be used to manage global and per-domain protection.\nEnsure that stat socket is configured in HaProxy for CLI support.\n```bash\nUsage: ddos-cli \u003ccommand\u003e [options]\n\nCommand line interface to manage per-domain and global DDoS protection.\n\noptional arguments:\n  -h, --help                         Show this help message and exit.\n\nCommands:\n Global management:\n  ddos-cli global status             Show status of global server ddos mode.\n  ddos-cli global enable             Enable global ddos mode.\n  ddos-cli global disable            Disable global ddos mode.\n\n Domain management:\n  ddos-cli domain list               List all domains with ddos mode on.\n  ddos-cli domain status \u003cdomain\u003e    Get ddos mode status for a domain.\n  ddos-cli domain enable \u003cdomain\u003e    Enable ddos mode for a domain.\n  ddos-cli domain disable \u003cdomain\u003e   Disable ddos mode for a domain.\n\n```\n\n\n#### TO DO\n- [x] Add CLI\n- [x] Organize lua dependencies\n- [x] Make per-user cookie secrets\n- [ ] Add logging to CLI\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmora9715%2Fhaproxy_ddos_protector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmora9715%2Fhaproxy_ddos_protector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmora9715%2Fhaproxy_ddos_protector/lists"}