Skip to content

Commit

Permalink
Added sudoers-ids.yml (WIP)
Browse files Browse the repository at this point in the history
Relates to #59
  • Loading branch information
pyllyukko committed Dec 27, 2022
1 parent 38df939 commit 72ee7c7
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions tasks/sudoers-ids.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
# https://github.com/mwlucas/books/tree/master/sudo_mastery
- name: sudo IDS
become: true
block:
- name: Create /etc/sudoers.d.tmp
ansible.builtin.file:
path: /etc/sudoers.d.tmp
state: directory
mode: '0700'
owner: root
group: root
- name: Download tools
ansible.builtin.get_url:
url: https://raw.githubusercontent.com/mwlucas/books/master/sudo_mastery/{{ item }}
dest: /etc/sudoers.d.tmp/{{ item }}
owner: root
group: root
mode: '0700'
with_items:
- sudodigest.pl
- digest-everything.pl
- backup-alias.pl
- name: Run sudodigest.pl
ansible.builtin.shell: /usr/bin/perl /etc/sudoers.d.tmp/sudodigest.pl 1>/etc/sudoers.d.tmp/00-digests
args:
creates: /etc/sudoers.d.tmp/00-digests
- name: Run digest-everything.pl
ansible.builtin.shell: /usr/bin/perl /etc/sudoers.d.tmp/digest-everything.pl /etc/sudoers.d.tmp/00-digests 1>/etc/sudoers.d.tmp/10-everything
args:
creates: /etc/sudoers.d.tmp/10-everything
- name: Run backup-alias.pl
ansible.builtin.shell: /usr/bin/perl /etc/sudoers.d.tmp/backup-alias.pl /etc/sudoers.d.tmp/00-digests 1>/etc/sudoers.d.tmp/10-backup
args:
creates: /etc/sudoers.d.tmp/10-backup
#- name: Copy generated files to /etc/sudoers.d/
# ansible.builtin.copy:
# src: /etc/sudoers.d.tmp/{{ item }}
# dest: /etc/sudoers.d/{{ item }}
# owner: root
# group: root
# mode: '0400'
# remote_src: true
# with_items:
# - 00-digests
# - 10-everything
# - 10-backup
#- name: Remove /etc/sudoers.d.tmp/
# ansible.builtin.file:
# path: /etc/sudoers.d.tmp
# state: absent

0 comments on commit 72ee7c7

Please # to comment.