๐ก๏ธ WAF ์๋ IP ์ฐจ๋จ์ด ์ด์ ์ค์ ๋ก ๋ฐ๋ํฉ๋๋ค
โ ๏ธ ์ ๊ทธ๋ ์ด๋ ํ ์ฐจ๋จ์ด ๋์ด๋ ์ ์์ต๋๋ค
WAF ์๋ ์ฐจ๋จ์ ์ผ ๋์ จ๋ค๋ฉด, ์ง๊ธ๊น์ง ๊ฑฐ์ ๋ฐ๋ํ์ง ์์์ ๊ฐ๋ฅ์ฑ์ด ํฝ๋๋ค. ์ ๊ทธ๋ ์ด๋ํ๋ฉด ์ค์ ํ์ ์๊ณ๊ฐ๋๋ก ๋์ํ๊ธฐ ์์ํ๋ฏ๋ก, ์๊ณ๊ฐ์ด ์๋๋ณด๋ค ๋ฎ๊ฒ ์กํ ์์ง ์์์ง ํ ๋ฒ ํ์ธํด ์ฃผ์ธ์.
๋ฌด์์ด ๋ฌธ์ ์๋์ง ์ค๋ช ๋๋ฆฝ๋๋ค. ์๋ ์ฐจ๋จ์ "WAF ์ด๋ฒคํธ ์"๋ฅผ ์ผ๋ค๊ณ ์๋ดํ์ง๋ง, ์ค์ ๋ก๋ ์๋ต์ด 403์ด์๋ ์ด๋ฒคํธ๋ง ์ ์ต๋๋ค. ๊ทธ๋ฐ๋ฐ ์ฐจ๋จ ๋ชจ๋์ธ ํธ์คํธ๋ผ๋ ๋ค์ ๊ฒฝ์ฐ์๋ 403์ด ์๋ ์๋ต์ด ๋๊ฐ๋๋ค.
- ์ง์ค ์ฐจ๋จ์ ์ฑ๋ฆฐ์ง ๋ชจ๋๋ก ์ฐ๋ ๊ฒฝ์ฐ โ 302 (CAPTCHA ํ์ด์ง๋ก ์ด๋)
- ์์ฒญ ์ ์ ํ์ ๊ฑธ๋ฆฐ ๊ฒฝ์ฐ โ 429
- ํ์ฉํ์ง ์์ HTTP ๋ฉ์๋ โ 405
์ด๋ฐ ์์ฒญ๋ค๋ WAF ๊ท์น์๋ ๋ถ๋ช ํ ๊ฑธ๋ ธ๋๋ฐ ์นด์ดํฐ๋ 0์ ๋ํ์ต๋๋ค. ๊ฐ๋ฐ ํ๊ฒฝ์์ ํ์ธํด ๋ณด๋ ์ฐจ๋จ ๋ชจ๋์์ ๋ฐ์ํ ์ค์ ๊ท์น ๋งค์น 4,424๊ฑด์ด ์นด์ดํฐ์ ์๋ฌด๊ฒ๋ ๊ธฐ์ฌํ์ง ๋ชปํ์ต๋๋ค. ์๊ณ๊ฐ์ด 5๋ 1์ด๋ ๋๋ฌํ ์ ์๋ ์ํ์์ต๋๋ค.
์ด์ "WAF๊ฐ ์ฐจ๋จ ๋ชจ๋๋ก ๋์ ์ค์ด์๋๊ฐ" ๋ฅผ ๊ธฐ์ค์ผ๋ก ์ ๋๋ค. ํ์ง ๋ชจ๋์์๋ ์ฌ์ ํ ์ฐจ๋จํ์ง ์๊ณ (ํ์ง๋ ๊ด์ฐฐ๋ง ํด์ผ ํ๋ฏ๋ก), ์ง์ ์ ์ธ ์ฒ๋ฆฌํ์ ๊ท์น๋ ์ธ์ง ์์ต๋๋ค.
๐ก๏ธ ์ ์ญ WAF๋ฅผ ์์ํ๋ ํธ์คํธ๊ฐ ์กฐ์ฉํ ํ์ง ๋ชจ๋๋ก ๋ฐ๋๋ ๋ฌธ์
์ ์ญ WAF ์ค์ ์ ์์(inherit) ํ๋๋ก ๋ ํธ์คํธ์์, ์๋ ์ธ ๊ฐ์ง ์ค ํ๋๋ง ํด๋ ๊ทธ ํธ์คํธ์ WAF ์ค์ ํ์ผ์ด ์๊ธฐ ํ์ ๋จ์ ์๋ ์ ๊ฐ์ผ๋ก ๋ค์ ์ฐ์์ต๋๋ค.
- WAF ๋ก๊ทธ ํ๋ฉด์์ ์๋๋ฌ์ด ๊ท์น ํ๋๋ฅผ ๋นํ์ฑํ
- ์ ์ญ WAF ๊ท์น์ ์ผ๊ฑฐ๋ ๋๊ธฐ (์ด ๊ฒฝ์ฐ ๋ชจ๋ ํธ์คํธ์ ํ์ผ์ด ๋ค์ ์ฐ์)
- ๋ฐฑ์ ๋ณต์
๊ทธ ๊ฒฐ๊ณผ ์ฐจ๋จ ๋ชจ๋๋ก ๋ณด์ด๋ ํธ์คํธ๊ฐ ํ์ง ๋ชจ๋๋ก ๋ด๋ ค์๊ณ , ๋ค์๋ฒ ์ ์ฒด ๋๊ธฐํ ๋ ๋ค์ ๋์์ค๋ ํ์์ด ์๊ธธ ์ ์์์ต๋๋ค. ์ด์ ์ธ ๊ฒฝ๋ก ๋ชจ๋ ์ ์ญ ์ค์ ์ ๋ฐ์ํ ์คํจ๊ฐ์ผ๋ก ํ์ผ์ ์๋๋ค.
ํ๋ฉด ํ์๋ ํจ๊ป ๊ณ ์ณค์ต๋๋ค. WAF ๋ชฉ๋ก๊ณผ ์์ธ ํ๋ฉด์ด ํธ์คํธ์ ์ ์ฅ๋ ๊ฐ์ ๊ทธ๋๋ก ๋ณด์ฌ ์ฃผ๊ณ ์์ด์, ์์ ํธ์คํธ๊ฐ ์ค์ ๋ก๋ ์ ์ญ ์ค์ (๊ธฐ๋ณธ๊ฐ: ํ์ง)์ผ๋ก ๋์๊ฐ๋๋ฐ๋ ํ๋ฉด์๋ "์ฐจ๋จ" ์ด๋ผ๊ณ ํ์๋์ต๋๋ค. ์ด์์๊ฐ ์ฐจ์ด๋ฅผ ์์์ฑ ๋ฐฉ๋ฒ์ด ์์์ต๋๋ค. ์ด์ ์ค์ ๋ก ์ ์ฉ ์ค์ธ ์ค์ ์ ํ์ํฉ๋๋ค.
๐ GeoIP ๋ฐ์ดํฐ๋ฒ ์ด์ค ๊ฐฑ์ ํ ๊ตญ๊ฐ ์ฐจ๋จ์ด ์ ์ ์ด๋ ค ์๋ ๋ฌธ์
GeoIP ๋ฐ์ดํฐ๋ฒ ์ด์ค๋ฅผ ์๋ก ๋ฐ์ผ๋ฉด ์ค์ ํ์ผ์ด ์ค์ GeoIP ๋ธ๋ก์ผ๋ก ๊ต์ฒด๋๋๋ฐ, nginx๋ฅผ ๋ค์ ๋ถ๋ฌ์ค์ง ์์์ต๋๋ค. ๊ทธ๋๊น์ง nginx๋ ์ด์ ์ "๋นํ์ฑ ์ํ" ์ค์ ์ ๊ทธ๋๋ก ์ฐ๊ณ , ์ด ์ค์ ์ ๋ชจ๋ IP์ ๊ตญ๊ฐ๋ฅผ "์ ์ ์์"์ผ๋ก ๋ง๋ญ๋๋ค.
๊ตญ๊ฐ ํ์ดํธ๋ฆฌ์คํธ๋ "์ ์ ์์"์ ์๋์ ์ผ๋ก ํ์ฉํฉ๋๋ค(์ฌ์ค๋ง ๋ฑ์ ๋ง์ง ์๊ธฐ ์ํด์์ ๋๋ค). ๊ทธ๋์ ๋ฐ์ดํฐ๋ฒ ์ด์ค ์ค์น๊ฐ ์ฑ๊ณตํ ๋ค๋ถํฐ ๋ค๋ฅธ ์ด์ ๋ก nginx๊ฐ ๋ค์ ๋ถ๋ฌ์์ง ๋๊น์ง, ํ๊ตญ๋ง ํ์ฉํ๋๋ก ์ค์ ํ ํธ์คํธ๊ฐ ์ฌ์ค์ ์ ์ธ๊ณ์ ์ด๋ ค ์์์ต๋๋ค.
์ด์ ๊ฐฑ์ ์ด ๋๋๋ฉด ๊ณง๋ฐ๋ก nginx๋ฅผ ๋ค์ ๋ถ๋ฌ์ต๋๋ค. ์คํจํ๋ฉด "์ด์ ๋ฐ์ดํฐ๋ฒ ์ด์ค๋ฅผ ๊ณ์ ์ฌ์ฉ ์ค"์ด๋ผ๊ณ ๋ก๊ทธ์ ๋จ๊น๋๋ค.
๐ข ์๋ชป๋ ์ ๋ ฅ์ 500 ๋์ 400์ ๋๋ ค์ค๋๋ค
API๊ฐ "์๋ฒ ๋ด๋ถ ์ค๋ฅ"๋ผ๊ณ ๋ตํ๋ ๊ฒ๋ค์ด ์ฌ์ค์ ์ ๋ ฅ์ ๊ณ ์น๋ฉด ๋๋ ๋ฌธ์ ์์ต๋๋ค.
- ์ธ์ฆ ๊ณต๊ธ์ ์ถ๊ฐ โ
type์ ํ์ฉ๋์ง ์์ ๊ฐ์ ๋ฃ์ผ๋ฉด ๋ฐ์ดํฐ๋ฒ ์ด์ค ์ ์ฝ ์๋ฐ ๋ฉ์์ง๊ฐ ๊ทธ๋๋ก ๋์์ต๋๋ค. ์ด์ ํ์ฉ๊ฐ์ ์๋ ค ์ฃผ๋ 400์ ๋๋ ค์ค๋๋ค. - DNS ๊ณต๊ธ์ ์ถ๊ฐ/์์ โ ์๊ฒฉ ์ฆ๋ช ์ด ๊ฑฐ๋ถ๋๋ฉด Cloudflare์ ์๋ต ์๋ฌธ์ด ๊ทธ๋๋ก ๋ ธ์ถ๋์ต๋๋ค. ์ด์ ์กฐ์นํ ์ ์๋ ์๋ด์ ํจ๊ป 400์ ๋๋ ค์ฃผ๊ณ , ์๋ฌธ์ ์๋ฒ ๋ก๊ทธ์๋ง ๋จ์ต๋๋ค. Cloudflare์ ์ฐ๊ฒฐ ์์ฒด๊ฐ ์คํจํ ๊ฒฝ์ฐ๋ ๊ทธ๋๋ก 500์ ๋๋ค โ ์ฅ์ ๋ฅผ "์๊ฒฉ ์ฆ๋ช ์ด ํ๋ ธ๋ค"๊ณ ์๋ดํ์ง ์๊ธฐ ์ํด์์ ๋๋ค.
- ์ง์ํ์ง ์๋ DNS ๊ณต๊ธ์ ์ข ๋ฅ โ ์ง๊ธ๊น์ง๋ ์กฐ์ฉํ ์์ฑ๋๋ค๊ฐ ์ธ์ฆ์ ๋ฐ๊ธ ๋ ์คํจํ๊ณ , ์ข ๋ฅ๋ ์์ ํ ์ ์์ด ์ญ์ ์ธ์ ๋ฐฉ๋ฒ์ด ์์์ต๋๋ค. ์ด์ ์ง์ ๋ชฉ๋ก๊ณผ ํจ๊ป ์ฆ์ ๊ฑฐ์ ํฉ๋๋ค.
- ํํฐ ๊ตฌ๋ ์ถ๊ฐ โ ๊ตฌ๋ URL์ด 404๋ฅผ ๋๋ ค์ฃผ๊ฑฐ๋ ์ด๋ฆ์ ๋ชป ์ฐพ์ผ๋ฉด "๋ฐ์ดํฐ๋ฒ ์ด์ค ์ค๋ฅ"๋ผ๊ณ ํ์๋์ต๋๋ค(๋ฐ์ดํฐ๋ฒ ์ด์ค๋ ๊ด์ฌํ์ง๋ ์์์ต๋๋ค). ์ด์ ์์ธ์ ์๋ ค ์ฃผ๋ 400์ ๋๋ค.
์์ธํ ์ฌํ ์ ์ฐจ์ ์์ธ ๋ถ์์ ๋ณด๋ด ์ฃผ์ @four2mis ๋, ๊ทธ๋ฆฌ๊ณ WAF ๋์์ ์ง์ด ์ฃผ์ @re-birkin ๋ ๊ฐ์ฌํฉ๋๋ค. (#268, #269, #270, #272)
api ์ด๋ฏธ์ง๋ฅผ ๋ฐ์ ๋ค์ ์ฌ๋ ค ์ฃผ์ธ์.
docker compose pull && docker compose up -d
๐ก๏ธ WAF auto-ban now actually fires
โ ๏ธ Expect more bans after upgrading
If you have WAF auto-ban enabled, it has probably almost never fired. After upgrading it starts working at the threshold you configured โ worth a quick check that the threshold is not lower than you intended.
Here is what was wrong. Auto-ban is described as counting "WAF events", but it only counted events whose response was 403. A host in blocking mode still answers something else in these cases:
- Geo restriction in challenge mode โ 302 (redirect to the CAPTCHA page)
- Rate limit โ 429
- A disallowed HTTP method โ 405
Those requests tripped WAF rules all the same, and the counter added zero for every one of them. On our development stack, 4,424 real rule matches in genuine blocking mode contributed nothing at all โ a threshold of 5, or even 1, was unreachable.
The counter now asks whether the WAF was enforcing, not whether the response happened to be 403. Detection mode still never bans (observing must not enforce), and rules you excluded still do not count.
๐ก๏ธ Hosts inheriting the global WAF could silently drop to detection mode
For a host set to inherit the global WAF settings, any one of these rewrote that host's WAF configuration file from the stale values stored on its own row:
- Disabling a noisy rule from the WAF log view
- Toggling a global WAF rule (this rewrites every host's file)
- Restoring a backup
A host that read as "blocking" could land in detection mode until the next full sync flipped it back. All three paths now write the effective, global-resolved settings.
The display is fixed too. The WAF list and detail views reported the host's stored columns, so an inheriting host showed "blocking" while actually running the global default (detection, by default). There was no way to notice. They now report what is actually in effect.
๐ Country blocking was briefly open after a GeoIP database update
When a new GeoIP database is installed, the configuration switches to the real GeoIP blocks โ but nginx was never reloaded. Until then nginx kept the previous "disabled" configuration, which resolves every address to an unknown country.
Country whitelists deliberately allow "unknown" (so private addresses are not blocked). The result: from a successful database install until some unrelated reload, a host restricted to one country was effectively open to everyone.
The update now reloads nginx immediately, and logs that the previous database is still in use if the reload fails.
๐ข Bad input answers 400 instead of 500
Several endpoints reported an internal server error for problems the caller can fix.
- Creating an auth provider โ an out-of-enum
typesurfaced the raw database constraint message. It now answers 400 naming the allowed values. - Creating/updating a DNS provider โ rejected credentials echoed Cloudflare's raw response body. It now answers 400 with something actionable, and the upstream text stays in the server log. Failing to reach Cloudflare is still a 500, so an outage is never reported as bad credentials.
- Unsupported DNS provider type โ previously created silently, then failed at certificate issuance; the type cannot be edited, so the row could only be deleted. It is now refused up front with the supported list.
- Adding a filter subscription โ a URL that answers 404, or a host that does not resolve, was reported as "a database error" (the database was never involved). It now answers 400 with the reason.
Thanks to @four2mis for the detailed reproductions and root-cause analysis, and to @re-birkin for the WAF report. (#268, #269, #270, #272)
Pull the api image and restart.
docker compose pull && docker compose up -d