-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdebian.yml
146 lines (136 loc) · 4.84 KB
/
debian.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
---
- name: Debian | Ensure apt-transport-https is present
ansible.builtin.package:
name: apt-transport-https
state: present
register: pkg_result
until: pkg_result is success
- name: Opensuse repository
## upstream focal 2.5.5/bionic 2.5.3/xenial 2.4.1, opensuse repo zeek/3.0.1 (not available for 16.04) or 2.5.5
when: >
(ansible_distribution == 'Ubuntu' and ansible_distribution_version.split('.')[0]|int < 18)
block:
- name: Ubuntu | Add bro repository key
ansible.builtin.apt_key:
url: >
https://download.opensuse.org/repositories/network:/bro/xUbuntu_{{ ansible_distribution_version }}/Release.key
state: present
register: pkg_result
until: pkg_result is success
- name: Ubuntu | Add bro repository
ansible.builtin.apt_repository:
repo: >
deb https://download.opensuse.org/repositories/network:/bro/xUbuntu_{{ ansible_distribution_version }}/ /
state: present
- name: Opensuse repository2
when: ansible_distribution == 'Debian'
block:
- name: Debian | Add bro repository key
ansible.builtin.apt_key:
url: >
https://download.opensuse.org/repositories/security:/zeek/Debian_{{ ansible_distribution_version }}/Release.key
state: present
register: pkg_result
until: pkg_result is success
- name: Debian | Add bro repository
ansible.builtin.apt_repository:
repo: >
deb https://download.opensuse.org/repositories/security:/zeek/Debian_{{ ansible_distribution_version }}/ /
state: present
## WARNING: The following packages cannot be authenticated! = force
- name: Debian/Ubuntu | Install Bro and dependencies
ansible.builtin.apt:
name: "{{ broids_packages + broids_packages_deps }}"
state: "present"
update_cache: "yes"
cache_valid_time: "3600"
force: "yes"
register: pkg_result
until: pkg_result is success
- name: Init.d
when: ansible_service_mgr != 'systemd'
block:
- name: Check if /etc/init.d/bro-ids is present
ansible.builtin.stat:
path: /etc/init.d/bro-ids
register: initbro
- name: Download startup script for bro
ansible.builtin.get_url:
url: https://raw.githubusercontent.com/lruppert/bro-scripts/master/shell/bro-ids
dest: /etc/init.d/bro-ids
mode: '0755'
checksum: 'sha256:cafc0b8eebae434c4600bc71a4a3448e0e3a59ff306f5ef8408a838f58e33860'
when: >
(ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu') and
not initbro.stat.exists
- name: Update bro path in init.d/bro-ids
ansible.builtin.replace:
dest: /etc/init.d/bro-ids
regexp: '^DAEMON=.*'
replace: "DAEMON={{ broids_broctl }}"
mode: '0644'
backup: yes
when: not use_securityonion_deb and (ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu')
- name: Install startup script for bro - systemd
ansible.builtin.template:
src: systemd-bro.service.j2
dest: /lib/systemd/system/bro.service
mode: '0644'
backup: yes
when: ansible_service_mgr == 'systemd'
- name: Opensuse repository
block:
- name: Update broctl LogDir
ansible.builtin.replace:
dest: "{{ broids_etc }}/broctl.cfg"
regexp: "{{ item.re }}"
replace: "{{ item.rep }}"
mode: '0644'
backup: yes
with_items:
- { re: '^LogDir = .*', rep: "LogDir = {{ broids_log }}" }
## bro 2.1+
- name: Enable broctl MailConnectionSummary
ansible.builtin.replace:
dest: "{{ broids_etc }}/broctl.cfg"
regexp: "^MailConnectionSummary = .*"
replace: "MailConnectionSummary = 1"
mode: '0644'
backup: yes
when: bro_email_notification
- name: Disable broctl MailConnectionSummary
ansible.builtin.replace:
dest: "{{ broids_etc }}/broctl.cfg"
regexp: "^MailConnectionSummary = .*"
replace: "MailConnectionSummary = 0"
mode: '0644'
backup: yes
when: not bro_email_notification
- name: Ensure aide hids directory exists
ansible.builtin.file:
dest: /etc/aide/aide.conf.d
state: directory
mode: '0755'
- name: Add custom configuration for aide HIDS
ansible.builtin.copy:
src: "{{ item }}"
dest: "/etc/aide/aide.conf.d"
owner: "root"
mode: "0644"
with_items:
- aide-criticalstack
## from https://github.com/geerlingguy/drupal-vm/pull/456/files#diff-b1546b21a9366075f1e1245d7551eee6R11
- name: Detect if AppArmor is installed.
ansible.builtin.stat:
path: /etc/init.d/apparmor
register: apparmor_installed
when: travisci is defined and travisci
- name: Ensure MySQL AppArmor profile is disabled (for slow query log).
ansible.builtin.file:
path: /etc/apparmor.d/disable/usr.sbin.mysqld
src: /etc/apparmor.d/usr.sbin.mysqld
mode: '0644'
state: link
when: travisci is defined and travisci and apparmor_installed.stat.exists
notify:
- Restart apparmor