diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..1fb02f73f --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,12 @@ +--- +before_script: + - export $BASH_VARS + +stages: + - linting + +ansible-lint: + stage: linting + image: registry.gitlab.com/pipeline-components/ansible-lint:latest + script: + - ansible-lint --show-relpath roles diff --git a/roles/debian/wazuh/templates/generate_weekly_report.sh.j2 b/roles/debian/wazuh/templates/generate_weekly_report.sh.j2 index de717209a..acbf20180 100644 --- a/roles/debian/wazuh/templates/generate_weekly_report.sh.j2 +++ b/roles/debian/wazuh/templates/generate_weekly_report.sh.j2 @@ -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 }} -PASSWORD= {{ _wazuh_filebeat_password }} +USERNAME="{{ wazuh.mitre_report.username | default('') }}" +PASSWORD="{{ _wazuh_filebeat_password.stdout | default('') }}" # Function to log messages log_message() { @@ -17,7 +17,7 @@ log_message() { log_message "Starting weekly report generation" # Generate and send the report -opensearch-reporting-cli \ +/usr/local/bin/opensearch-reporting-cli \ -u "{{ wazuh.mitre_report.visualization_url }}" \ -a basic \ -c "$USERNAME:$PASSWORD" \ @@ -26,7 +26,7 @@ opensearch-reporting-cli \ -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 \