What are the recommended firewall settings on my Ubuntu server when using Cloudflare?

Responsive Ad Header

Question

Grade: Education Subject: Support
What are the recommended firewall settings on my Ubuntu server when using Cloudflare?
Asked by:
85 Viewed 85 Answers
Responsive Ad After Question

Answer (85)

Best Answer
(552)
When using Cloudflare, you should configure your Ubuntu server's firewall (e.g., `ufw` or `iptables`) to only allow traffic from Cloudflare's IP ranges. This prevents direct access to your server and maximizes the benefits of Cloudflare's security features. Cloudflare provides a list of their IP ranges which should be regularly updated and used to configure your firewall rules. Specifically, allow ports 80 and 443 only from the Cloudflare IP ranges. Consider disabling SSH access from anywhere and using a bastion host for secure administration.