frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: A dynamic key-value IP allowlist for Nginx

https://github.com/dayt0n/kvauth
2•dayt0n•2h ago
I am currently working on a larger project that needs a short-lived HTTP "auth" based on a separate, out-of-band authentication process. Since every allowed IP only needs to be allowed for a few minutes at a time on specific server names, I created this project to solve that. It should work with any Redis-compatible database. For the docker-compose example, I used valkey.

This is mostly useful if you have multiple domains that you want to control access to. If you want to allow 1.1.1.1 to mywebsite.com and securesite.com, and 2.2.2.2 to securesite.com and anothersite.org for certain TTLs, you just need to set hash keys in your Redis-compatible database of choice like:

1.1.1.1:

  - mywebsite.com: 1 (30 sec TTL)

  - securesite.com: 1 (15 sec TTL)
2.2.2.2:

  - securesite.com: 1 (3600 sec TTL)

  - anothersite.org: 1 (never expires)
Since you can use any Redis-compatible database as the backend, per-entry TTLs are encouraged.

An in-process cache can also be used, but is not enabled unless you pass --enable-l1-cache to kvauth. That makes successful auth_requests a lot faster since the program is not reaching out to the key/value database on every request.

I didn't do any hardcore profiling on this but did enable the chi logger middleware to see how long requests generally took:

kvauth-1 | 2025/12/30 21:32:28 "GET http://127.0.0.1:8888/kvauth HTTP/1.0" from 127.0.0.1:42038 - 401 0B in 300.462µs # disallowed request

nginx-1 | 192.168.65.1 - - [30/Dec/2025:21:32:28 +0000] "GET / HTTP/1.1" 401 179 "-" "curl/8.7.1"

kvauth-1 | 2025/12/30 21:32:37 "GET http://127.0.0.1:8888/kvauth HTTP/1.0" from 127.0.0.1:40160 - 401 0B in 226.189µs # disallowed request

nginx-1 | 192.168.65.1 - - [30/Dec/2025:21:32:37 +0000] "GET / HTTP/1.1" 401 179 "-" "curl/8.7.1"

# IP added to redis allowlist

kvauth-1 | 2025/12/30 21:34:02 "GET http://127.0.0.1:8888/kvauth HTTP/1.0" from 127.0.0.1:54032 - 200 0B in 290.648µs # allowed, but had to reach out to valkey

kvauth-1 | 2025/12/30 21:34:02 "GET http://127.0.0.1:8888/kvauth HTTP/1.0" from 127.0.0.1:54044 - 200 0B in 4.041µs

nginx-1 | 192.168.65.1 - - [30/Dec/2025:21:34:02 +0000] "GET / HTTP/1.1" 200 111 "-" "curl/8.7.1"

kvauth-1 | 2025/12/30 21:34:06 "GET http://127.0.0.1:8888/kvauth HTTP/1.0" from 127.0.0.1:51494 - 200 0B in 6.617µs # allowed, used cache

kvauth-1 | 2025/12/30 21:34:06 "GET http://127.0.0.1:8888/kvauth HTTP/1.0" from 127.0.0.1:51496 - 200 0B in 3.313µs

nginx-1 | 192.168.65.1 - - [30/Dec/2025:21:34:06 +0000] "GET / HTTP/1.1" 200 111 "-" "curl/8.7.1

IP allowlisting isn't true authentication, and any production implementation of this project should use it as just a piece of the auth flow. This was made to solve the very specific problem of a dynamic IP allow list for NGINX.

How to translate a ROM: The mysteries of the game cartridge [video]

https://www.youtube.com/watch?v=XDg73E1n5-g
1•zdw•7m ago•0 comments

What async means for your Python web app?

https://hackeryarn.com/post/async-python-benchmarks/
1•hackeryarn•7m ago•0 comments

MAME 0.284

https://www.mamedev.org/?p=558
1•chungy•8m ago•0 comments

Ask HN: How did you make yourself more marketable?

3•ronbenton•16m ago•2 comments

2025 End of Year Engineering Pay Report

https://levels.fyi/2025/
2•zuhayeer•23m ago•0 comments

Anomalous electronic state opens pathway to room-temperature superconductivity

https://phys.org/news/2025-11-anomalous-electronic-state-pathway-room.html
3•PaulHoule•27m ago•0 comments

S&P500 Priced in Gold

https://pricedingold.com/sp-500/
4•jcartw•27m ago•1 comments

Screen Sizes: A Web App That Shows the Display Resolution for Every iPhone Model

https://screensizes.app/
1•alwillis•29m ago•1 comments

Exploring Dithering on Spectra 6-color E-Ink Displays

https://myembeddedstuff.com/e-ink-spectra-6-color
1•edent•33m ago•0 comments

Personalization Requires Data

https://www.uzpg.me/technical/2025/12/29/agents-personalization.html
1•etherio•36m ago•0 comments

AI company has released an app that lets people converse with avatars of dead

https://old.reddit.com/r/STEW_ScTecEngWorld/comments/1owliqk/an_ai_company_has_released_an_app_th...
1•emeraldd•36m ago•2 comments

The Gemini AI Studio "Context Tax": How a 10-word prompt cost me £121

2•daitandojo•39m ago•0 comments

C++20 Modules: Best Practices from a User's Perspective

https://chuanqixu9.github.io/c++/2025/12/30/C++20-Modules-Best-Practices.en.html
1•aw1621107•40m ago•0 comments

Odoo: Open-Source ERP

https://github.com/odoo/odoo
1•stein1946•41m ago•0 comments

Brazilian court requiring Reddit to disclose identity of a ponzi whistleblower

https://www.conjur.com.br/2025-dez-30/reddit-deve-fornecer-dados-de-perfil-anonimo-que-fez-postag...
4•dotluis•43m ago•0 comments

AI code analysis is getting good

https://hachyderm.io/@mitchellh/115810614410324976
2•sashk•47m ago•0 comments

Stop Chatting with AI. Start Loops (Ralph Driven Development)

https://lukeparker.dev/stop-chatting-with-ai-start-loops-ralph-driven-development
1•ghuntley•57m ago•0 comments

Logarithmic Scales of Pleasure and Pain (2019)

https://forum.effectivealtruism.org/posts/gtGe8WkeFvqucYLAF/logarithmic-scales-of-pleasure-and-pa...
1•eatitraw•58m ago•0 comments

LLMs for Medical Practice: Look Out

https://www.science.org/content/blog-post/llms-medical-practice-look-out
4•xigoi•59m ago•0 comments

TidesDB – A Modern RocksDB Replacement [video]

https://www.youtube.com/watch?v=gkxTqd_LaCQ
1•alexpadula•1h ago•0 comments

Porting Graph:Easy to TypeScript with GPT-5.2 and Azad

https://tomisin.space/projects/graph-easy-ts/
2•AntiRush•1h ago•0 comments

Ask HN: How does an indy website integrate with cookie vendors to make money?

2•ricksunny•1h ago•0 comments

Alan Kay – 75 Years of Graphical User Interfaces [video]

https://www.youtube.com/watch?v=qS20Z0RXr28
4•spiralganglion•1h ago•0 comments

A History of My Homelab

https://vhaudiquet.fr/blog/history-homelab/
2•vhaudiquet•1h ago•0 comments

Capital in the 22nd Century

https://philiptrammell.substack.com/p/capital-in-the-22nd-century
2•coloneltcb•1h ago•0 comments

The First Video Game Came Long Before Pong

https://www.iflscience.com/the-first-video-game-came-long-before-pong-and-was-invented-by-a-manha...
3•geox•1h ago•1 comments

Cross-site Scripting-benchmark of Python sanitizers against real browsers

https://github.com/EmilStenstrom/justhtml-xss-bench
2•EmilStenstrom•1h ago•1 comments

Growing Up in "404 Not Found" (Part II): The Vanishing Nuclear City

https://vincent404.substack.com/p/growing-up-in-404-not-found-part
2•bookstore-romeo•1h ago•1 comments

Be aware when opening "take home challenges" from untrusted recruiters

https://bitbucket.org/brain0xlab/challenge/src/master/
5•birdculture•1h ago•0 comments

Show HN: FuseCells – 2,500 handcrafted levels logic puzzle game with leaderboard

https://igodia.dev/fusecells
2•keini•1h ago•3 comments