geerlingguy / ansible-role-firewall

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

stuck after running firewall #102

Closed avenbreaks closed 10 months ago

avenbreaks commented 1 year ago

Description :

does the owner and group have to follow the server? or should it be changed? i getting stuck and cannot login to server again after deploy geerlingguy.firewall.

TASK [geerlingguy.firewall : Copy firewall script into place.] *****

fatal: [example]: UNREACHABLE! => {
    "changed": false,
    "unreachable": true
}

MSG:

Failed to connect to the host via ssh: mux_client_request_session: read from master failed: Broken pipe ssh: connect to host IPADDR port 22: Connection timed out

PLAY RECAP ***** example : ok=70 changed=8 unreachable=1 failed=0 skipped=17 rescued=0 ignored=0

main.yaml :

---
- name: Ensure iptables is present.
  package: name=iptables state=present

- name: Flush iptables the first time playbook runs.
  command: >
    iptables -F
    creates=/etc/firewall.bash

- name: Copy firewall script into place.
  template:
    src: firewall.bash.j2
    dest: /etc/firewall.bash
    owner: root
    group: root
    mode: 0744
  notify: restart firewall

- name: Copy firewall init script into place.
  template:
    src: firewall.init.j2
    dest: /etc/init.d/firewall
    owner: root
    group: root
    mode: 0755
  when: "ansible_service_mgr != 'systemd'"

- name: Copy firewall systemd unit file into place (for systemd systems).
  template:
    src: firewall.unit.j2
    dest: /etc/systemd/system/firewall.service
    owner: root
    group: root
    mode: 0644
  when: "ansible_service_mgr == 'systemd'"

- name: Configure the firewall service.
  service:
    name: firewall
    state: "{{ firewall_state }}"
    enabled: "{{ firewall_enabled_at_boot }}"

- import_tasks: disable-other-firewalls.yml
  when: firewall_disable_firewalld or firewall_disable_ufw
avenbreaks commented 1 year ago

@geerlingguy

lockejan commented 1 year ago

Description :

does the owner and group have to follow the server? or should it be changed? i getting stuck and cannot login to server again after deploy geerlingguy.firewall.

TASK [geerlingguy.firewall : Copy firewall script into place.] *****

fatal: [example]: UNREACHABLE! => {
    "changed": false,
    "unreachable": true
}

MSG:

Failed to connect to the host via ssh: mux_client_request_session: read from master failed: Broken pipe ssh: connect to host IPADDR port 22: Connection timed out

PLAY RECAP ***** example : ok=70 changed=8 unreachable=1 failed=0 skipped=17 rescued=0 ignored=0

main.yaml :

---
- name: Ensure iptables is present.
  package: name=iptables state=present

- name: Flush iptables the first time playbook runs.
  command: >
    iptables -F
    creates=/etc/firewall.bash

- name: Copy firewall script into place.
  template:
    src: firewall.bash.j2
    dest: /etc/firewall.bash
    owner: root
    group: root
    mode: 0744
  notify: restart firewall

- name: Copy firewall init script into place.
  template:
    src: firewall.init.j2
    dest: /etc/init.d/firewall
    owner: root
    group: root
    mode: 0755
  when: "ansible_service_mgr != 'systemd'"

- name: Copy firewall systemd unit file into place (for systemd systems).
  template:
    src: firewall.unit.j2
    dest: /etc/systemd/system/firewall.service
    owner: root
    group: root
    mode: 0644
  when: "ansible_service_mgr == 'systemd'"

- name: Configure the firewall service.
  service:
    name: firewall
    state: "{{ firewall_state }}"
    enabled: "{{ firewall_enabled_at_boot }}"

- import_tasks: disable-other-firewalls.yml
  when: firewall_disable_firewalld or firewall_disable_ufw

You probably locked out yourself. Make sure to keep port 22 open 😉✌️

github-actions[bot] commented 1 year 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.

github-actions[bot] commented 10 months 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.