lobsters / lobsters-ansible

Ansible playbook for lobste.rs
ISC License
79 stars 26 forks source link

Add firewalling rules #9

Closed jstoja closed 11 months ago

jstoja commented 6 years ago

I quickly looked at the playbook and I didn't see any firewalling rules in it. It's a thing to have them here so it won't be forgotten in a future deployment.

pushcx commented 6 years ago

What would you recommend? It's single box serving ssh and nginx, there's no other servers connecting privately to it or anything. I guess to prevent errors like accidentally exposing mariadb to all interfaces, that sort of thing?

jstoja commented 6 years ago

Exactly. It's not mandatory, but it sometimes cover mistakes. I'd understand if you'd find this to be too much for the size of the deployment! The simplest way would be to add ufw tasks in each role.

jstoja commented 6 years ago

Now that I have a clearer vision about how this project could improve, firewalling rules could be a very interesting thing to have to larger deployments.

Right now there is just 1 host for DB/LB/worker so there is no added value, but if we correctly implement the project to handle a multi-host deployment, the firewalling rules could:

pushcx commented 6 years ago

Sounds good, if it can be simply expressed in the current roles. It's going to be some time before we outgrow a single box, so I don't want to take on something oriented around a multi-host setup. Off the top of my head, three rules permitting incoming traffic to tcp 22, 80, and 443 might be all the config we need for quite some time.

pushcx commented 11 months ago

This feels like too much of a footgun with how unreliable ansible is. I think it'd be a matter of weeks before a run was interrupted in such a way that the firewall was enabled with all ports closed.

I've been using unix domain sockets with puma and redis to avoid the risk things start listening to all interfaces.