Compare commits
1
Commits
161ce95e7e
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
227bb41259
|
No files matched your search
@@ -5,23 +5,8 @@
|
|||||||
ansible_user: root
|
ansible_user: root
|
||||||
alt_ssh_port: 1023
|
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
|
|
||||||
include_role:
|
|
||||||
name: kevinnlsamuel.galaxy.sshd.disablepasswd
|
|
||||||
- name: change ssh port
|
|
||||||
when: false
|
|
||||||
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
|
|
||||||
- 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,5 @@
|
|||||||
|
---
|
||||||
|
- name: restart sshd
|
||||||
|
service:
|
||||||
|
name: sshd
|
||||||
|
state: restarted
|
||||||
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
/home/kevins/Projects/galaxy/roles/sshd/_handlers
|
||||||
@@ -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
@@ -0,0 +1 @@
|
|||||||
|
/home/kevins/Projects/galaxy/roles/sshd/_handlers
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
galaxy_info:
|
|
||||||
author: kevinnlsamuel
|
|
||||||
description: sayin hello
|
|
||||||
dependencies:
|
|
||||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
|
||||||
# if you add dependencies to this list.
|
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
- name: disable password auth
|
- name: disable password auth
|
||||||
|
notify: restart sshd
|
||||||
copy:
|
copy:
|
||||||
src: 00-nopasswd.conf
|
src: 00-nopasswd.conf
|
||||||
dest: /etc/ssh/sshd_config.d/00-nopasswd.conf
|
dest: /etc/ssh/sshd_config.d/00-nopasswd.conf
|
||||||
- name: restart sshd
|
|
||||||
service:
|
|
||||||
name: sshd
|
|
||||||
state: restarted
|
|
||||||
Reference in new issue
Block a user