geerlingguy / ansible-role-firewall

Ansible Role - iptables Firewall configuration.
https://galaxy.ansible.com/geerlingguy/firewall/
MIT License
529 stars 219 forks source link

Locks me out of server #53

Closed ghost closed 3 years ago

ghost commented 5 years ago

When using this role, I get to TASK [geerlingguy.firewall : Copy firewall script into place.] and I have been locked out of the server on port 22 which ansible is using to run tasks.

It seems that TASK [geerlingguy.firewall : Flush iptables the first time playbook runs.] is locking the server down to no open ports.

ghost commented 5 years ago

I reads this comment on digitalocean, and I wonder if it would be better with this functionality?

https://www.digitalocean.com/community/questions/help-with-iptables-causing-disconnection-and-blocking?answer=25822

designermonkey commented 5 years ago

FYI, this was me from another account.

jduarter commented 5 years ago

This is probably because the default policy of any of the chains was likely set to DROP/REJECT before the first execution of the role (probably you had some active rules before). I wrote a patch to fix it, pull request: #61

A solution before this pull request is merged is to manually perform this commands on the host before running the playbook by first time: iptables -P INPUT ACCEPT iptables -P FORWARD ACCEPT iptables -P OUTPUT ACCEPT iptables -F

leonsp commented 5 years ago

I have the same issue.

Another solution to avoid lockout would be something like this:

iptables -F && iptables -I INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

Can #61 or something similar be merged?

lenguyenthanh commented 4 years ago

I'm also facing this problem. Please resolve this thanks!

eugeneoden commented 3 years ago

Ran into the same issue. PR #61 resolves

stale[bot] commented 3 years ago

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

stale[bot] commented 3 years ago

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.