default-bare #203
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: default-bare | |
on: | |
push: | |
pull_request: | |
schedule: # run weekly, every monday 03:00 | |
- cron: '0 3 * * 1' | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
max-parallel: 4 | |
matrix: | |
os: [ubuntu-24.04, ubuntu-22.04, ubuntu-20.04] | |
env: | |
ANSIBLE_CALLBACKS_ENABLED: profile_tasks | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: juju4.auditd | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
pip3 install ansible-lint flake8 yamllint | |
which ansible | |
pip3 install ansible | |
pip3 show ansible | |
ls -l $HOME/.local/bin || true | |
ls -l /opt/hostedtoolcache/Python/3.9.1/x64/bin || true | |
echo "/opt/hostedtoolcache/Python/3.9.1/x64/bin" >> $GITHUB_PATH | |
ansible --version | |
cd $GITHUB_WORKSPACE/juju4.auditd | |
[ -f get-dependencies.sh ] && sh -x get-dependencies.sh | |
{ echo '[defaults]'; echo 'callbacks_enabled = profile_tasks, timer'; echo 'roles_path = ../'; echo 'ansible_python_interpreter: /usr/bin/python3'; } >> ansible.cfg | |
- name: Environment | |
run: | | |
pwd | |
env | |
find -ls | |
- name: run test | |
run: | | |
cd $GITHUB_WORKSPACE/juju4.auditd && ansible-playbook -i localhost, --connection=local --become -vvv test/integration/default/default.yml | |
env: | |
PY_COLORS: '1' | |
ANSIBLE_FORCE_COLOR: '1' | |
- name: idempotency run | |
run: | | |
cd $GITHUB_WORKSPACE/juju4.auditd && ansible-playbook -i localhost, --connection=local --become -vvv test/integration/default/default.yml | tee /tmp/idempotency.log | grep -q 'changed=0.*failed=0' && (echo 'Idempotence test: pass' && exit 0) || (echo 'Idempotence test: fail' && cat /tmp/idempotency.log && exit 1) | |
- name: On failure | |
run: | | |
systemctl -l --no-pager status auditd | |
if: env.WORKFLOW_CONCLUSION == 'failure' # notify only if failure | |
- name: After script - systemd | |
run: | | |
set -x | |
systemctl status auditd -l --no-pager | |
continue-on-error: true | |
- name: After script - journalctl auditd | |
run: | | |
set -x | |
journalctl -xe -l --no-pager -u auditd | tail -200 | |
continue-on-error: true | |
- name: After script - journalctl | |
run: | | |
set -x | |
journalctl -xe -l --no-pager | tail -200 | |
continue-on-error: true | |
- name: After script - rules | |
run: | | |
set -x | |
sudo ls /etc/audit/rules.d | |
sudo cat /etc/audit/audit.rules | |
sudo auditctl -l | |
continue-on-error: true | |
- name: After script - laurel | |
run: | | |
set -x | |
sudo cat /etc/laurel/config.toml | |
sudo cat /etc/audisp/plugins.d/laurel.conf || true | |
sudo cat /etc/audit/plugins.d/laurel.conf || true | |
/usr/local/sbin/laurel -d -c /etc/laurel/config.toml; echo $? | |
continue-on-error: true | |
- name: After script - rsyslog | |
run: | | |
set -x | |
cat /etc/rsyslog.d/30-audispd.conf | |
sudo cat /etc/audisp/plugins.d/syslog.conf || true | |
sudo cat /etc/audit/plugins.d/syslog.conf || true | |
sleep 60 | |
sudo tail -100 /var/log/audit/audit.log | |
sudo -u _laurel tail -100 /var/log/laurel/audit.log | |
sudo -u _laurel tail -5 /var/log/laurel/audit.log | jq | |
continue-on-error: true | |
- name: After script - report | |
run: | | |
set -x | |
sudo ls -l /var/log/audispd/ | |
sudo /usr/local/scripts/audispd_report.sh | |
sudo ls -l /var/log/laurel/ | |
sudo -u _laurel /usr/local/scripts/auditd_laurel_report.sh | |
sudo -u _laurel cat /var/tmp/auditd-laurel-report-* | |
continue-on-error: true |