暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

ufw.yml 846B

12345678910111213141516171819202122232425262728293031
  1. ---
  2. # Installs and configures ufw, which in turn uses iptables for firewall management
  3. # ufw includes sensible icmp defaults
  4. - name: Install ufw
  5. apt: pkg=ufw state=present
  6. - name: Deny everything and enable UFW
  7. ufw: state=enabled policy=deny
  8. - name: Set firewall rule for DNS
  9. ufw: rule=allow port=domain
  10. - name: Set firewall rule for mosh
  11. ufw: rule=allow port=60000:61000 proto=udp
  12. - name: Set firewall rules for web traffic and SSH
  13. ufw: rule=allow port={{ item }} proto=tcp
  14. with_items:
  15. - ssh
  16. - http
  17. - https
  18. - name: Check config of ufw
  19. command: cat /etc/ufw/ufw.conf
  20. register: ufw_config
  21. changed_when: False # never report as "changed"
  22. - name: Disable logging (workaround for known bug in Debian 7)
  23. ufw: logging=off
  24. when: "ansible_lsb['codename'] == 'wheezy' and 'LOGLEVEL=off' not in ufw_config.stdout"