Question

Looking for help with firewalld configuration for restricting access to an IP

Running CentOS 7

I’d like to make sure I understand the zones correctly and how this all functions.

My case is via firewalld to allow only a specific IP ssh access but allow the http https to go through normally

the default zone is public, so if I remove ssh access from there and all other zones, then on one zone allowing the ssh service and add the rich rules for my IP would that be the ideal setup for that and other services that I want to allow only from my IP?

Or do I have to specify the service in the rich-rule?

Also the How To Set Up a Firewall Using FirewallD on CentOS 7 tutorial referenced interfaces and I’m not seeing the eth0 eth1 as interfaces on any of the zones. (if I do remove a service from the default zone though, that access is removed) so I don’t think this is a problem and just something to note.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @hdtroll

I don’t know much about FirewallD, but you need to move the ssh service to a different rule and create allowed sources on that - have a look at this: https://serverfault.com/questions/680780/block-all-but-a-few-ips-with-firewalld#680789