Skip to content
This repository was archived by the owner on Oct 7, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5071736
Merge pull request #2654 from codeenigma/Gitlab-stop-fix-PR-2.x
drazenCE Sep 2, 2025
a8ba8e4
Fixing-email-title-for-backup-validation (#2657)
matej5 Sep 4, 2025
057138d
Adding-task-to-create-aurora-cluster (#2659)
matej5 Sep 8, 2025
2b30a78
Fixing truthy variable mistakes. (#2662)
gregharvey Sep 10, 2025
cb63668
feat(php): Add FPM slow logrotate (#2625)
klausi Sep 10, 2025
9f05b90
r73458-install-php-gmp-by-default2 (#2667)
nfawbert Sep 10, 2025
a89ae45
Wazuh-mitre-report-setup (#2588)
drazenCE Sep 11, 2025
71278e9
Wazuh mitre report setup pr 2.x (#2669)
drazenCE Sep 11, 2025
65a6a0d
pin_ansible_version (#2671)
tymofiisobchenko Sep 12, 2025
854a245
Fixing-ce-provision-vars (#2678)
drazenCE Sep 16, 2025
1850230
Updating-string (#2507)
matej5 Sep 17, 2025
d62d4e6
Added-tasks-to-backup-Aurora-and-copy-AMI-to-safe-region (#2682)
matej5 Sep 18, 2025
6717286
SG-creation-update (#2605)
matej5 Sep 18, 2025
3bcee17
Fixing-copy-AMI-to-backup-region (#2684)
matej5 Sep 18, 2025
7bd773f
Fixing-ami-copy-task (#2686)
matej5 Sep 19, 2025
88851ce
Bug fixes pr 2.x (#2690)
gregharvey Sep 22, 2025
cf6129b
73569 allowing webp nginx pr 2.x (#2692)
filiprupic Sep 22, 2025
72021af
extending provision.sh to support tags in plays (#2431)
filiprupic Sep 24, 2025
e783690
Adding-option-for-Aurora-RDS-for-backup-validation (#2635)
matej5 Sep 24, 2025
572f4b0
Fixing-aws_vpc-override (#2688)
matej5 Sep 24, 2025
ef10642
Updating-pam-ldap-condition (#2695)
drazenCE Sep 24, 2025
e630bcb
Nslcd-nscd-restart (#2693)
drazenCE Sep 30, 2025
3a2b4b3
Fixing-varnish-pinning (#2710)
drazenCE Oct 1, 2025
6657bcc
Bug fixes pr 2.x (#2698)
gregharvey Oct 1, 2025
3986a6f
Adding-cyphers-nginx-template (#2679)
drazenCE Oct 1, 2025
dd4c3c9
Fixing-when-statement (#2700)
matej5 Oct 1, 2025
7cb9bae
Bug fixes pr 2.x (#2714)
gregharvey Oct 1, 2025
60a1d39
Bug fixes pr 2.x (#2717)
gregharvey Oct 1, 2025
6a4b3a5
Fixing python venv vars. (#2724)
gregharvey Oct 2, 2025
976485a
Updating-aws-iam-tasks (#2727)
matej5 Oct 2, 2025
cc4b0a3
r73510-apt-reboot-alerts
nfawbert Oct 3, 2025
fba2913
Merge branch 'r73510-apt-reboot-alerts' into r73510-apt-reboot-alerts…
nfawbert Oct 3, 2025
b79a954
fix linting error
nfawbert Oct 3, 2025
4e8deb5
Merge branch 'r73510-apt-reboot-alerts' into r73510-apt-reboot-alerts…
nfawbert Oct 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions roles/debian/apt_unattended_upgrades/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ apt_unattended_upgrades:
automatic_reboot_with_users: "false" # reboot even if users are logged in
automatic_reboot_time: "02:00"
enable_syslog: "false" # make apt log upgrades to syslog as well as apt history
rebootnotifyallow: false # Send email when reboot is required
rebootnotifymailfrom: "sysadmins@example.com" # Send reboot notify email from address
rebootnotifymailto: "sysadmins@example.com" # Send reboot notify email to address
71 changes: 71 additions & 0 deletions roles/debian/apt_unattended_upgrades/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,74 @@
state: restarted
enabled: true
when: apt_unattended_upgrades.enable

- name: Deploy apt reboot hook
ansible.builtin.copy:
dest: /etc/apt/apt.conf.d/99notify-reboot
owner: root
group: root
mode: "0644"
content: 'DPkg::Post-Invoke { "/usr/local/sbin/apt-reboot-notify-hook"; };'
backup: true
force: true
when:
- apt_unattended_upgrades.enable
- apt_unattended_upgrades.rebootnotifyallow

- name: Deploy apt-reboot-notify-hook script
ansible.builtin.template:
src: apt-reboot-notify-hook.j2
dest: /usr/local/sbin/apt-reboot-notify-hook
owner: root
group: root
mode: "0755"
force: true
when:
- apt_unattended_upgrades.enable
- apt_unattended_upgrades.rebootnotifyallow

- name: Install reboot-required daily reminder script
ansible.builtin.template:
src: reboot-required-notify.j2
dest: /usr/local/sbin/reboot-required-notify
owner: root
group: root
mode: "0755"
force: true
when:
- apt_unattended_upgrades.enable
- apt_unattended_upgrades.rebootnotifyallow

- name: Install reboot-required systemd service
ansible.builtin.template:
src: reboot-required-notify.service.j2
dest: /etc/systemd/system/reboot-required-notify.service
owner: root
group: root
mode: "0644"
force: true
when:
- apt_unattended_upgrades.enable
- apt_unattended_upgrades.rebootnotifyallow

- name: Install reboot-required systemd timer
ansible.builtin.template:
src: reboot-required-notify.timer.j2
dest: /etc/systemd/system/reboot-required-notify.timer
owner: root
group: root
mode: "0644"
force: true
when:
- apt_unattended_upgrades.enable
- apt_unattended_upgrades.rebootnotifyallow

- name: Reload systemd and enable reboot-required timer
ansible.builtin.systemd_service:
state: restarted
enabled: true
daemon_reload: true
name: reboot-required-notify.timer
when:
- apt_unattended_upgrades.enable
- apt_unattended_upgrades.rebootnotifyallow
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
set -eu
if [ -f /run/reboot-required ] && [ ! -f /run/reboot-mail-sent ]; then
HOST=$(/bin/hostname -f)
printf 'A reboot is required on %s\n\nFlag: /run/reboot-required\n' "$HOST" \
| /usr/bin/mail -s "Reboot required on $HOST" -r "{{ apt_unattended_upgrades.rebootnotifymailfrom }}" "{{ apt_unattended_upgrades.rebootnotifymailto }}"
/usr/bin/touch /run/reboot-mail-sent
fi
exit 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
set -eu
HOST="$(/bin/hostname -f)"
STAMP_DIR="/var/lib/reboot-notify"
STAMP_FILE="${STAMP_DIR}/last-notified"
TODAY="$(/bin/date +%F)"
if [ ! -f /run/reboot-required ]; then exit 0; fi
/bin/mkdir -p "$STAMP_DIR"
if [ -f "$STAMP_FILE" ] && [ "$(cat "$STAMP_FILE")" = "$TODAY" ]; then exit 0; fi
(
echo "A reboot is still required on ${HOST}."
echo
echo "Flag present: /run/reboot-required"
) | /usr/bin/mail -s "Reminder: reboot required on ${HOST}" -r "{{ apt_unattended_upgrades.rebootnotifymailfrom }}" "{{ apt_unattended_upgrades.rebootnotifymailto }}"
echo "$TODAY" > "$STAMP_FILE"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[Unit]
Description=Send daily email reminder if /run/reboot-required exists
[Service]
Type=oneshot
ExecStart=/usr/local/sbin/reboot-required-notify
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Unit]
Description=Daily reminder for reboot-required
[Timer]
OnCalendar=08:30
Persistent=true
Unit=reboot-required-notify.service
[Install]
WantedBy=timers.target
10 changes: 6 additions & 4 deletions roles/debian/wazuh/templates/generate_weekly_report.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
REPORT_DATE=$(date +"%Y-%m-%d")
REPORT_NAME="weekly-report-${REPORT_DATE}"
LOG_FILE="/var/log/opensearch-reports.log"
USERNAME="{{ wazuh.mitre_report.username | default('') }}"
PASSWORD="{{ _wazuh_filebeat_password.stdout | default('') }}"
USERNAME= {{ wazuh.mitre_report.username }}
PASSWORD= {{ _wazuh_filebeat_password }}

# Function to log messages
log_message() {
Expand All @@ -17,14 +17,16 @@ log_message() {
log_message "Starting weekly report generation"

# Generate and send the report
/usr/local/bin/opensearch-reporting-cli \
opensearch-reporting-cli \
-u "{{ wazuh.mitre_report.visualization_url }}" \
-a basic \
-c "$USERNAME:$PASSWORD" \
--selfsignedcerts true \
-f pdf \
-n "$REPORT_NAME" \
-e smtp \
-s "{{ wazuh.mitre_report.e_mail_from }}" \
-r "{{ wazuh.manager.wazuh_manager_mailto }}" \
-r "{{ wazuh.manager.wazuh_manager_mailto}}" \
--subject "Weekly OpenSearch Report - $(date '+%B %d, %Y')" \
--note "Hi,\n\nPlease find attached the weekly Wazuh Mitre report covering the last 7 days.\n\nReport generated on: $(date '+%Y-%m-%d %H:%M:%S')\n\nBest regards,\nAutomated Reporting System" \
--smtphost localhost \
Expand Down