Commit Graph

132 Commits

Author SHA1 Message Date
5fd4ae842c Add new (optional) auto script to be optionally included in frontend sites, will auto solve POW when low time left
Allow bot-check to return json format to be compatible with that
Update challenge script
2023-04-14 01:42:56 +10:00
a6f3613b6a More concise wording, offer a .min.js for scripts 2023-04-11 21:13:25 +10:00
8b361f89c5 Image on bot-check adn css tweak, change footers to basedflare link in template, maintenance, bot-check 2023-04-10 17:48:44 +10:00
37bbec9f3b add missing map 2023-04-06 22:47:21 +10:00
40da57544a Support multiple backends per domain with the help of some lua 2023-04-06 22:40:03 +10:00
35668c9b58 adjust dummytime logic and start time 2023-03-23 01:13:41 +11:00
94567f69ff Improve appearance and affordance of challenge pages with some template and js tweaks 2023-03-19 13:07:41 +11:00
9478892614 Allow proper ssl verification for backends (With a privately managed CA of course) 2023-03-18 15:21:21 +11:00
521e4ab335 not bold h3, hide generic favicon, white bg instead off offwhite 2023-03-06 19:47:50 +11:00
4c97df8fb1 test ssl verify none to backends 2023-03-02 22:18:25 +11:00
3cc7482084 Fully convert to data plane api
Change global ACL to a map to realtime update with data plane api
Change how on setartup servers are registered in lua
2023-02-18 15:14:40 +11:00
80e966b6d4 Revert to 3 dots loader and adjust page style slightly 2023-02-14 00:07:06 +11:00
87f66479d8 - Change to using domain instead of resolving, because cloudflare blocked this even with the host header, and haproxy 2.7 appears to no longer need this 'hack'
- Fix issue with matched_expiry being 0 and breaking captcha cookie
- Spacing
2023-02-13 21:59:02 +11:00
4e3beaf66d use 2 threads at least 2023-02-12 09:09:17 +11:00
f231b86544 Ability to choose between sha256 or argon2 with env var close #21 2023-02-11 23:38:59 +11:00
eb92f6c31b Add back dummy time, shorter (3000ms) 2023-02-11 21:46:29 +11:00
9531049aa9 Update haproxy config, scripts & docker-compose to use simpler mroe organised files layout
Make cookies sent from captcha/pow response be httponly
2023-02-11 21:39:38 +11:00
9f4c8e8fbb increase the throttle from 100 -> 1 back to 10 to prevent crashing 2023-02-11 21:05:47 +11:00
1612e342ee rename BUCKET_DURATION since its now an expiry time 2023-02-11 21:05:10 +11:00
6e5cf2af31 Make cookie expiry based on issued expiry date from challenge date instead of all expiring on bucket.
Fixes potential issue of challenges being incorrect if solved right on the bucket change
Allows to solve a challenge at any time (even in the background) and not see the challenge page twice in a small period
Allows for backend to make dynamic expiry of tokens e.g make tor tokens or based on IP reputation not last as long (not implemented atm)
Close #20
2023-02-11 20:57:21 +11:00
a303689641 Close #18 make answers and redirect calls shared between tabs with localstorage to not solve and submit answer multiple times when opening multiple tabs/bookmarks, etc 2023-02-11 16:08:44 +11:00
08a966c121 Reorganise, move code to not be split between haproxy and src folder 2023-02-11 15:06:35 +11:00
0d56079960 Rename POW vars to separately argon_ for argon2 stuff, improve readme and split out INSTALLATION into separate file 2023-02-11 14:43:55 +11:00
45bc67fae4 Move everything under paths like /.basedflare/ instead of putting stuff in paths where it might conflict
Move templates to own file instead of in main lua script
Rename some stuff from "hcatpcha" to more correct "captcha" and "bot-check" because we no longer only have hcaptcha
Clean some code and add a few comments
2023-02-11 14:16:51 +11:00
b593be8627 Add some reasonable limits to cookie parsing, reduce impact of possible attack 2023-01-06 19:02:20 +11:00
9c17d5b8fc update url lib, change default settings 2022-11-06 13:42:26 +11:00
4dd6eec87e Show pow speed, and estimate remaining time 2022-10-02 22:11:38 +11:00
64e26f65b5 - Add ability to communicate with Tor control port and close circuits. Can be called from lua or as a http-request lua... call to do it based off an ACL. close #16
- Make POW checked before captcha in POST handler, since they both must be submittedin captcha mode, we don't want to send POST to /siteverify if they didnt even solve the POW

Other:
- Change (improve) split util to leave empty table entries for repeated delimiters
- Minor frontend script bugfix so error messages display properly in captcha mode
- Wrap submit button of noscript pow form to next line
2022-10-02 04:57:59 +11:00
eede92d47d Allow a bit better granularity for the difficulty. Recommend an "easier" challenge in terms of memory and iterations, but higher diff.
Make failed request for captcha/bot form show a little error text.
Make CHALLENGE_INCLUDES_IP "1" = on, anything else = off instead of needing to be unset.
2022-10-01 15:33:48 +10:00
434756a7a1 If this fixes what I think it fixes, ill eat my fucking shoe 2022-09-29 21:54:58 +10:00
b43d207847 Make cookie apply to all subdomains 2022-09-28 00:41:04 +10:00
a6b6bc1510 word-break:break-all on header which can contain long domain name 2022-09-25 00:40:52 +10:00
a50b35b65d argon2 implementation
- memory and time params customisable as well as "difficulty", default 1 iteration, 6000KB, 3 difficulty.
- updated the noscript bash method to work with argon2
- works in webworkers or main thread, capped at 8 threads (doesn't seem to crash firefox anymore -- we could go higher)
2022-09-24 22:56:55 +10:00
d019440bc0 Move POW proof checking to POST and sign a cookie there, kinda like captcha flow, so we can do a more intensive one without it happening on every request. We just check the hmac now.
Still TODO actually converting it to argon, but should be straightforward from this point.
Another advantage of making POW check use POST is a better noscript experience. We now provide a box and "submit" button, so they don't have to mess with setting a cookie.
2022-09-23 00:26:20 +10:00
614b437667 Add ability to include IPs in challenge hash generation, to lock cookies to IPs (like the pre-sig mode) 2022-09-21 21:31:48 +10:00
20a04f23c2 Change wording for public branch 2022-09-21 19:47:47 +10:00
0af1a740ab Make captcha submission automatic and not require clicking a "submit" form button 2022-09-18 01:41:02 +10:00
d115ca6f46 ref #15 2022-09-17 19:06:37 +10:00
194c5bb96c Check ssl_fc for whether to set captcha cookie as secure close #15 2022-09-17 18:48:28 +10:00
3f7e48def6 update the nojs terminal script 2022-09-17 04:38:42 +10:00
598790cb4f - Fix some docker-compose issues close #14
- Move to new scheme with some hashing, sigs, and a random user key. close #13
- Change to sha256 rather than sha1 (temporary, but i guess its slightly more secure which is nice for now) ref #10
- Change POW output checked value
- Add lib for randombytes, udpate lua sha lib
- Remove outdated difficulty checks in frontend (was hardcoded 0 anyway) and since algo change is coming soon, there is no need to keep it
2022-09-17 02:45:27 +10:00
0d991770cf google recaptcha v2 support 2022-09-12 23:37:21 +10:00
c9e007639e - Make the "checking your browser for robots" look more like cloudflare
- Reduce the default concurrency of the frontend script to 2 threads because any higher seems to crash firefox (and its quick enough even with 2 threads anyway)
- Remove the footerlogo from challenge and maintenance page, and update the link
2022-09-10 08:23:09 +10:00
d3d4b12607 fix in some situations useragent can be nil 2022-04-26 13:07:12 +10:00
d5a83be478 Change last stage of the noscript command option to bash instead of sh.
Even if a lot of distros just symlink sh > bash the script needs to do some substitutions not supported in sh, so it's more correct. Who doesnt have bash these days anyway?
2022-02-20 23:14:39 +11:00
640f80bb56 for noscript users, in pow only mode (not when hcaptcha enabled), the page now includes a small encoded script that will get the correct captcha value. Slower than javascript, but good enough. 2022-02-20 01:01:40 +11:00
1bf8992371 link to repo until new site ready 2022-01-27 22:39:13 +11:00
7ea0fe7dc8 improve check for captcha map fetches by domain and domain+path.
old code was just dumb, dunno what i was thinking.
now domain+path takes priority and can be lower or hight level, not just higher level than domain only.
2022-01-19 23:15:18 +11:00
e406ac46ca Merge branch 'lua-httpclient-test' 2022-01-19 18:09:30 +11:00
d38713b4cb haproxy snapshot fixes bug, and use url biuld query to make body for hcaptcha post 2022-01-19 18:01:08 +11:00