added ssh banner playbook
This commit is contained in:
parent
e311127a98
commit
cbc8b517e8
6
sshbanner-bjphoster.yml
Normal file
6
sshbanner-bjphoster.yml
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
- hosts: all
|
||||
become: true
|
||||
tasks:
|
||||
- import_tasks: tasks/debian-general/sshbanner-bjphoster.yml
|
||||
- import_tasks: tasks/debian-general/sshbanner.yml
|
5
tasks/debian-general/restart-ssh-service.yml
Normal file
5
tasks/debian-general/restart-ssh-service.yml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
- name: Restart SSH service to apply new rules
|
||||
ansible.builtin.systemd:
|
||||
name: ssh
|
||||
state: restarted
|
19
tasks/debian-general/sshbanner-bjphoster.yml
Normal file
19
tasks/debian-general/sshbanner-bjphoster.yml
Normal file
@ -0,0 +1,19 @@
|
||||
---
|
||||
- name: Ensure /etc/banner is populated with BJPHoster Network
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/banner
|
||||
content: |
|
||||
|--------------------------------------|
|
||||
| This is a private system managed |
|
||||
| by the BJPHoster Private Network. |
|
||||
| |
|
||||
| Unless otherwise authorized you are |
|
||||
| to leave this virtual premise |
|
||||
| immediately, otherwise this will be |
|
||||
| considered a security breach attempt |
|
||||
| and will be reported to the |
|
||||
| competent authorities and persecuted |
|
||||
| to the extent permitted by the |
|
||||
| applicable law of the country where |
|
||||
| these systems reside. |
|
||||
|--------------------------------------|
|
7
tasks/debian-general/sshbanner.yml
Normal file
7
tasks/debian-general/sshbanner.yml
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
- name: Ensure SSH banner is uncommented and right path in /etc/ssh/sshd_config
|
||||
ansible.builtin.lineinfile:
|
||||
line: "Banner /etc/banner"
|
||||
path: /etc/ssh/sshd_config
|
||||
regexp: '^#\s*Banner.*$'
|
||||
- import_tasks: restart-ssh-service.yml
|
Loading…
Reference in New Issue
Block a user