Compare commits

..
5 Commits
9 changed files with 35 additions and 18 deletions

No files matched your search

+5 -17
View File
@@ -3,22 +3,10 @@
- tmp.kevinnlsamuel.com - tmp.kevinnlsamuel.com
vars: vars:
ansible_user: root ansible_user: root
alt_ssh_port: 1023
name: setup server natsuco name: setup server natsuco
roles:
- kevinnlsamuel.galaxy.sshd.disablepasswd
- kevinnlsamuel.galaxy.sshd.altport
tasks: tasks:
- name: harden ssh
block:
- name: disable password auth
file:
src: sshd/00-nopasswd.conf
dest: /etc/ssh/ssh_config.d/00-altport.conf
- name: change ssh port
vars:
port: 1023
template:
src: sshd/00-altport.conf
dest: /etc/ssh/ssh_config.d/00-altport.conf
- name: install semanage
dnf:
state: present
name: policycoreutils-python-utils
- command: /usr/sbin/semanage port -a -t ssh_port_t -p tcp 1023
@@ -1 +1 @@
Port {{ port }} Port {{ alt_ssh_port }}
+5
View File
@@ -0,0 +1,5 @@
---
- name: restart sshd
service:
name: sshd
state: restarted
+1
View File
@@ -0,0 +1 @@
/home/kevins/Projects/galaxy/roles/sshd/_handlers
+16
View File
@@ -0,0 +1,16 @@
---
- name: change ssh port to {{ alt_ssh_port | mandatory }}
notify: restart sshd
template:
src: 00-altport.conf
dest: /etc/ssh/sshd_config.d/00-altport.conf
- name: install semanage
when: ansible_facts.selinux.status != 'disabled'
dnf:
state: present
name: policycoreutils-python-utils
- name: give sshd access to alt port on selinux
register: result_change_to_alt_port
ignore_errors: true
changed_when: "'already defined' not in result_change_to_alt_port.stdout"
command: semanage port -a -t ssh_port_t -p tcp {{ alt_ssh_port }}
@@ -0,0 +1 @@
Port {{ alt_ssh_port }}
+1
View File
@@ -0,0 +1 @@
/home/kevins/Projects/galaxy/roles/sshd/_handlers
+5
View File
@@ -0,0 +1,5 @@
- name: disable password auth
notify: restart sshd
copy:
src: 00-nopasswd.conf
dest: /etc/ssh/sshd_config.d/00-nopasswd.conf