Last active
January 11, 2016 15:25
-
-
Save matt-hensley/d86c279aa66a5aa5ee30 to your computer and use it in GitHub Desktop.
Ansible sshd/ufw
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: all | |
tasks: | |
- ufw: rule=allow port={{ item.port }} proto={{ item.proto }} | |
with_items: | |
- { port: 22, proto: tcp } | |
- { port: 80, proto: tcp } | |
- { port: 8080, proto: tcp } | |
- { port: 1953, proto: tcp } | |
- ufw: policy=deny state=enabled | |
- name: Disable SSH password auth | |
lineinfile: destfile=/etc/ssh/sshd_config regexp="^(#)?PasswordAuthentication" line="PasswordAuthentication no" state=present | |
notify: | |
- restart ssh | |
handlers: | |
- name: restart ssh | |
service: name=ssh state=restarted enabled=yes | |
- name: restart fail2ban | |
service: name=fail2ban state=restarted | |
- name: reload fail2ban | |
service: name=fail2ban state=reloaded |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment