In a discussion titled “IPTables and UFW problems” under the Installation category, users explore securing a Discourse instance behind Cloudflare to hide the backend IP from public scanners like Censys or Shodan. Arnold shares scripts for Cloudflare + UFW and IPTables but reports they don’t work with Discourse. pfaffman explains Docker interferes with IPTables and suggests modifying NGINX configs to accept only Cloudflare IPs, referencing a guide on allowing Cloudflare IPs in NGINX here. Genisis agrees, arguing that blocking direct IP access improves security by preventing IP exposure via DNS or scanners. They express difficulty editing NGINX configs inside Docker and ask if restricting to Cloudflare IPs interferes with real IP headers — pfaffman confirms it does not. He also shares Docker’s official docs on restricting host access via DOCKER-USER chain. Genisis admits the complexity and hopes for a documented solution. pfaffman advises against overinvesting unless DDOS is a known threat, noting he’s never needed it in years of Discourse setups. Genisis clarifies their forum has been targeted before and wants proactive security. pfaffman suggests combining ChatGPT with Arnold’s script might solve it, and Genisis thanks him and plans to revisit the issue.
I also agree with him, wish discourse works like this: if you visit direct ip you see a white screen or literally anything, drop the connection without a domain idk
It sure would, prevents ip being found by dns , censys/shodan etc.
I tried googling how to only allow cf but not much help, I don’t remember what the outcome was, plus if only allowing cf ip’s and im using the cf config to get real ip, would that mess it up? I’d really love if there was a doc.
and I don’t know how to edit the nginx config, when I enter app, can’t edit anything, im a bit of a noob sorry lol
this is way above my brain power, I do appreciate your response, will read those docs soon, hope someone sees this who have time and could write something up, ive seen quite a few posts here already regarding this issue
Unless you run a community that has a history of DDOS attacks for some particular reason and you expect more, I’d not use any more of your brain on it. It would take me an hour or three to figure it out and document it. I have been setting up Discourse for people for a long time and have never worked with someone for whom DDOS was an actual problem.
I do run a forum thats been targeted before, thanks to cf they helped (using pro plan), but it would be great to “prepare” for it before it happens, gotta have the best security right? but yeah I get it, its a lot of work.