added ntfy alerts and removed sudo
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
- import_tasks: system_setup/package_hardening.yml
|
- import_tasks: system_setup/package_hardening.yml
|
||||||
- import_tasks: system_setup/user_hardening.yml
|
- import_tasks: system_setup/user_hardening.yml
|
||||||
- import_tasks: system_setup/aide.yml
|
- import_tasks: system_setup/aide.yml
|
||||||
|
- import_tasls: system_setup/ntfy_alerts.yml
|
||||||
|
|
||||||
rescue:
|
rescue:
|
||||||
- set_fact: task_failed=true
|
- set_fact: task_failed=true
|
||||||
|
|||||||
22
roles/bastionhost/tasks/system_setup/ntfy_alerts.yml
Normal file
22
roles/bastionhost/tasks/system_setup/ntfy_alerts.yml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
- name: system setup | ntfy alerts | install curl
|
||||||
|
tags: ntfy,hardening,system
|
||||||
|
package:
|
||||||
|
name: curl
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: system setup | ntfy alerts | create ssh login alert script
|
||||||
|
tags: ntfy,hardening,system
|
||||||
|
copy:
|
||||||
|
dest: /etc/ssh/sshrc
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: '0755'
|
||||||
|
content: |
|
||||||
|
#!/bin/sh
|
||||||
|
# Managed by Ansible
|
||||||
|
# Send SSH login alert to ntfy topic.
|
||||||
|
|
||||||
|
MESSAGE="{{ ntfy_ssh_login_message }}"
|
||||||
|
|
||||||
|
curl -s -d "$MESSAGE" "{{ ntfy_url }}" > /dev/null
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
- postfix
|
- postfix
|
||||||
- cups*
|
- cups*
|
||||||
- avahi-daemon
|
- avahi-daemon
|
||||||
|
- sudo
|
||||||
# Common utilities not required for a minimal system
|
# Common utilities not required for a minimal system
|
||||||
- popularity-contest
|
- popularity-contest
|
||||||
- whoopsie
|
- whoopsie
|
||||||
@@ -37,6 +38,7 @@
|
|||||||
- postfix
|
- postfix
|
||||||
- cups*
|
- cups*
|
||||||
- avahi
|
- avahi
|
||||||
|
- sudo
|
||||||
state: absent
|
state: absent
|
||||||
notify: Update_aide_database
|
notify: Update_aide_database
|
||||||
when: ansible_os_family == "RedHat"
|
when: ansible_os_family == "RedHat"
|
||||||
4
roles/bastionhost/vars/main.yml
Normal file
4
roles/bastionhost/vars/main.yml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
# Variables for ntfy alerts
|
||||||
|
ntfy_url: "https://ntfy.sh/YOUR_TOPIC_HERE"
|
||||||
|
ntfy_ssh_login_message: "SSH login on $(hostname) for user $USER from $(echo $SSH_CONNECTION | cut -d ' ' -f 1)"
|
||||||
Reference in New Issue
Block a user