|
176 | 176 | path: /usr/local/sbin/nowo-health-watchdog |
177 | 177 | register: watchdog |
178 | 178 |
|
179 | | - - name: Require watchdog script and cron |
| 179 | + - name: Health watchdog timer present |
| 180 | + ansible.builtin.stat: |
| 181 | + path: /etc/systemd/system/nowo-health-watchdog.timer |
| 182 | + register: watchdog_timer |
| 183 | + |
| 184 | + - name: Require watchdog script and timer |
180 | 185 | ansible.builtin.assert: |
181 | 186 | that: |
182 | 187 | - watchdog.stat.exists |
183 | 188 | - watchdog.stat.mode == '0755' |
| 189 | + - watchdog_timer.stat.exists |
| 190 | + |
| 191 | + - name: Health watchdog timer is active |
| 192 | + ansible.builtin.command: systemctl is-active nowo-health-watchdog.timer |
| 193 | + changed_when: false |
184 | 194 |
|
185 | | - - name: Health watchdog cron present |
| 195 | + - name: Legacy watchdog cron must be absent |
186 | 196 | ansible.builtin.stat: |
187 | 197 | path: /etc/cron.d/nowo-health-watchdog |
188 | 198 | register: watchdog_cron |
189 | 199 |
|
190 | | - - name: Require watchdog cron |
| 200 | + - name: Require no legacy cron |
191 | 201 | ansible.builtin.assert: |
192 | 202 | that: |
193 | | - - watchdog_cron.stat.exists |
| 203 | + - not watchdog_cron.stat.exists |
| 204 | + |
| 205 | + - name: node_exporter systemd hardening drop-in present |
| 206 | + ansible.builtin.command: grep -F 'ProtectSystem=strict' /etc/systemd/system/prometheus-node-exporter.service.d/nowo-hardening.conf |
| 207 | + changed_when: false |
| 208 | + |
| 209 | + - name: Monit systemd hardening drop-in present |
| 210 | + ansible.builtin.command: grep -F 'ProtectSystem=full' /etc/systemd/system/monit.service.d/nowo-hardening.conf |
| 211 | + changed_when: false |
194 | 212 |
|
195 | 213 | - name: Monit package present |
196 | 214 | ansible.builtin.command: dpkg -s monit |
|
218 | 236 | ansible.builtin.command: grep -E '^User=webhook-deploy' /etc/systemd/system/nowo-webhook-deploy.service |
219 | 237 | changed_when: false |
220 | 238 |
|
| 239 | + - name: Webhook unit has ProtectSystem=strict |
| 240 | + ansible.builtin.command: grep -E '^ProtectSystem=strict' /etc/systemd/system/nowo-webhook-deploy.service |
| 241 | + changed_when: false |
| 242 | + |
| 243 | + - name: Webhook unit has MemoryDenyWriteExecute |
| 244 | + ansible.builtin.command: grep -E '^MemoryDenyWriteExecute=true' /etc/systemd/system/nowo-webhook-deploy.service |
| 245 | + changed_when: false |
| 246 | + |
221 | 247 | - name: Webhook healthz responds |
222 | 248 | ansible.builtin.command: curl -fsS --max-time 5 http://127.0.0.1:9000/hooks/deploy/healthz |
223 | 249 | register: wh_health |
|
0 commit comments