Skip to content

Commit

Permalink
(SIMP-3928) AIDE should retain the output database (#32)
Browse files Browse the repository at this point in the history
SIMP-3928 #close
SIMP-1708 #comment code chanbe
  • Loading branch information
lnemsick-simp authored and jeannegreulich committed Oct 27, 2017
1 parent 0845576 commit 0fa24f4
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 45 deletions.
120 changes: 80 additions & 40 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# The testing matrix considers ruby/puppet versions supported by SIMP and PE:
# ------------------------------------------------------------------------------
# release pup ruby eol
Expand All @@ -8,48 +9,87 @@
# PE 2017.2 4.10 2.1.9 TBD
---
language: ruby
sudo: false
cache: bundler
before_script:
- bundle update
sudo: false

bundler_args: --without development system_tests --path .vendor
before_install: rm Gemfile.lock || true
script:
- bundle exec rake test

notifications:
email: false
rvm:
- 2.1.9
env:
global:
- STRICT_VARIABLES=yes
matrix:
- PUPPET_VERSION="~> 4.8.2" FORGE_PUBLISH=true
- PUPPET_VERSION="~> 4.10.0"
- PUPPET_VERSION="~> 4.9.2"
- PUPPET_VERSION="~> 4.7.0"
matrix:
fast_finish: true

before_deploy:
- 'bundle exec rake metadata_lint'
- 'bundle exec rake clobber'
- 'bundle exec rake spec_clean'
- "export PUPMOD_METADATA_VERSION=`ruby -r json -e \"puts JSON.parse(File.read('metadata.json')).fetch('version')\"`"
- '[[ $TRAVIS_TAG =~ ^simp-${PUPMOD_METADATA_VERSION}$|^${PUPMOD_METADATA_VERSION}$ ]]'
deploy:
- provider: puppetforge
user: simp
password:
secure: "Os40yaNVVU3ypsLac11cu7PYfv0mdilx1qBA8euk12xoJxhYzrLz7n4Zlp/Bx+6knmMOeucUy6U0PKg3XCasTGFKKImw3h4X3kTOby0xcxGj4BAsxySv10JcB9x7MrIT5+Q9rx+vOef/kotNSMMWxNNVniV5VjrjuX+qOK4NtzhtyQLIpleZZ02geYSPLBCe+R5pPaf5D/zsWMu+v7oaqI9VM0XuvSGQAHNbSO97/trNgJP/nDeK/zWBzkGD/EP9wmJj9lfNSl9oa50uclqNkgHZ91SXmYv7f+YlqxpsbDKsoFs2HGPnGiipyIA0EEJXHTiknJ3v7XLveH3/ENE6hem3nJ+82WeQyMbsJTEmvb0vmTsiRTgls8GlpInG/ykBSGhqQdY21oYMS4PCvS2+CCZUw6qjaDokiTk5AeSugQNSiU1lqcRXUacYDwn0F8LR49ixDsPtoCsnvy/FRU87tr10ZyrnBtIGqgChJUsLhBA9s4FIzP9WmO6rUxZ0qufDq/wMHDRyPBPHNch5yTURGbOkGYzGkZ3u8cL5ezmGCteSKBOYsRNr45F9/ld1Rg+XfJ68UX8nysHs+GLMnaoD5l8vHHZu/nqcZbc2fEivQQ3OP2g2RzPF6WeBX8Fv20EZT9ZuAeGJEQkRySpp6jTjtSFUlhPUMbWXYwEbODESrHU="
on:
tags: true

addons:
apt:
packages:
- rpm

before_install:
- rm -f Gemfile.lock

jobs:
allow_failures:
- env: STRICT_VARIABLES=yes TRUSTED_NODE_DATA=yes PUPPET_VERSION="~> 5.0"

include:
- stage: check
rvm: 2.1.9
script:
- bundle exec rake check:dot_underscore
- bundle exec rake check:test_file
- bundle exec rake pkg:check_version
- bundle exec rake metadata_lint
- bundle exec rake compare_latest_tag

- stage: spec
rvm: 2.1.9
env: STRICT_VARIABLES=yes TRUSTED_NODE_DATA=yes PUPPET_VERSION="~> 5.0"
script:
- bundle exec rake spec

- stage: spec
rvm: 2.1.9
env: STRICT_VARIABLES=yes TRUSTED_NODE_DATA=yes PUPPET_VERSION="~> 4.10.0"
script:
- bundle exec rake spec

- stage: spec
rvm: 2.1.9
env: STRICT_VARIABLES=yes TRUSTED_NODE_DATA=yes PUPPET_VERSION="~> 4.9.2"
script:
- bundle exec rake spec

- stage: spec
rvm: 2.1.9
env: STRICT_VARIABLES=yes TRUSTED_NODE_DATA=yes PUPPET_VERSION="~> 4.8.2"
script:
- bundle exec rake spec

- stage: spec
rvm: 2.1.9
env: STRICT_VARIABLES=yes TRUSTED_NODE_DATA=yes PUPPET_VERSION="~> 4.7.0"
script:
- bundle exec rake spec

# This needs to be last since we have an acceptance test
- stage: deploy
rvm: 2.1.9
condition: '($SKIP_FORGE_PUBLISH != true) && ($FORGE_PUBLISH = true)'
- provider: releases
api_key:
secure: "uyCxePK5tGP2+F2JhSsHb2jdtA3ZCpv4U5F8zfsDiPIhgOj8EiH0rtCeb22jjFijZLACNFzfGu1YnXbzr4GUWg3036mkRiuhTeC+zMt00ZeRrWJq9bYM4Nc3b+odFmt1Kj+wA8t6b0AJOVswfsFDolVPzg2K1Xp8rl8h/aQRn6j3I4mgdrMiq9YFnbDhgqY4FiaBg48tPnnYlDA3YZXL/KW3tcQcD8BySoQ39/dAIgevF594bCPZC+gox4+sezc/47wA7Qn/Nvht9clguVMP1f78YHnBJKfOuyMuRhr6wrIB3WC1ydXUe8wYUHkt58d8eX2Qo/wD+8+7MXZVQifX0dr4xbiBcJV9MpJllqFnQ4LGbRIHWU09qTCc5UQa+0p9/MBW8pvBv2ZuYvA/kVe00mm3LicSAiVgrsU4bDBBswV6IFUnmB6t0XBJ3+Y03efKhrqX38+LeSqRPxNn3QP2rZ4fEwtJG6z64uao/ZuQHNxi53rMtz31f9fDM/pL55xeogM0WcPS4SJPm0YC7Y3H98jBu8+nOei4ucyWps8ghtW85SidHIp41TFzNfMYCmwDH/CL5w7xegtqel7k1u3Eoi2+EL1lW6cMEanr151vgzHyr+gA9Ec+cVSzE9160szv9LNVIEgDBSPDonH89CAyK/VEHiiOZ9PIyRWgPMfsdfc="
skip_cleanup: true
on:
tags: true
condition: '($SKIP_FORGE_PUBLISH != true) && ($FORGE_PUBLISH = true)'
script:
- true
before_deploy:
- "export PUPMOD_METADATA_VERSION=`ruby -r json -e \"puts JSON.parse(File.read('metadata.json')).fetch('version')\"`"
- '[[ $TRAVIS_TAG =~ ^simp-${PUPMOD_METADATA_VERSION}$|^${PUPMOD_METADATA_VERSION}$ ]]'
deploy:
- provider: releases
api_key:
secure: "uyCxePK5tGP2+F2JhSsHb2jdtA3ZCpv4U5F8zfsDiPIhgOj8EiH0rtCeb22jjFijZLACNFzfGu1YnXbzr4GUWg3036mkRiuhTeC+zMt00ZeRrWJq9bYM4Nc3b+odFmt1Kj+wA8t6b0AJOVswfsFDolVPzg2K1Xp8rl8h/aQRn6j3I4mgdrMiq9YFnbDhgqY4FiaBg48tPnnYlDA3YZXL/KW3tcQcD8BySoQ39/dAIgevF594bCPZC+gox4+sezc/47wA7Qn/Nvht9clguVMP1f78YHnBJKfOuyMuRhr6wrIB3WC1ydXUe8wYUHkt58d8eX2Qo/wD+8+7MXZVQifX0dr4xbiBcJV9MpJllqFnQ4LGbRIHWU09qTCc5UQa+0p9/MBW8pvBv2ZuYvA/kVe00mm3LicSAiVgrsU4bDBBswV6IFUnmB6t0XBJ3+Y03efKhrqX38+LeSqRPxNn3QP2rZ4fEwtJG6z64uao/ZuQHNxi53rMtz31f9fDM/pL55xeogM0WcPS4SJPm0YC7Y3H98jBu8+nOei4ucyWps8ghtW85SidHIp41TFzNfMYCmwDH/CL5w7xegtqel7k1u3Eoi2+EL1lW6cMEanr151vgzHyr+gA9Ec+cVSzE9160szv9LNVIEgDBSPDonH89CAyK/VEHiiOZ9PIyRWgPMfsdfc="
skip_cleanup: true
on:
tags: true
condition: '($SKIP_FORGE_PUBLISH != true)'
- provider: puppetforge
user: simp
password:
secure: "Os40yaNVVU3ypsLac11cu7PYfv0mdilx1qBA8euk12xoJxhYzrLz7n4Zlp/Bx+6knmMOeucUy6U0PKg3XCasTGFKKImw3h4X3kTOby0xcxGj4BAsxySv10JcB9x7MrIT5+Q9rx+vOef/kotNSMMWxNNVniV5VjrjuX+qOK4NtzhtyQLIpleZZ02geYSPLBCe+R5pPaf5D/zsWMu+v7oaqI9VM0XuvSGQAHNbSO97/trNgJP/nDeK/zWBzkGD/EP9wmJj9lfNSl9oa50uclqNkgHZ91SXmYv7f+YlqxpsbDKsoFs2HGPnGiipyIA0EEJXHTiknJ3v7XLveH3/ENE6hem3nJ+82WeQyMbsJTEmvb0vmTsiRTgls8GlpInG/ykBSGhqQdY21oYMS4PCvS2+CCZUw6qjaDokiTk5AeSugQNSiU1lqcRXUacYDwn0F8LR49ixDsPtoCsnvy/FRU87tr10ZyrnBtIGqgChJUsLhBA9s4FIzP9WmO6rUxZ0qufDq/wMHDRyPBPHNch5yTURGbOkGYzGkZ3u8cL5ezmGCteSKBOYsRNr45F9/ld1Rg+XfJ68UX8nysHs+GLMnaoD5l8vHHZu/nqcZbc2fEivQQ3OP2g2RzPF6WeBX8Fv20EZT9ZuAeGJEQkRySpp6jTjtSFUlhPUMbWXYwEbODESrHU="
on:
tags: true
rvm: 2.1.9
condition: '($SKIP_FORGE_PUBLISH != true)'
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
* Thu Oct 26 2017 Liz Nemsick <[email protected]> - 6.1.1-0
- Retain output database upon AIDE database update for SCAP
Security Guide OVAL check
xccdf_org.ssgproject.content_rule_aide_build_database

* Tue Sep 05 2017 Liz Nemsick <[email protected]> - 6.1.0-0
- Fixed bug whereby aide reports/errors were not being sent to syslog.
AIDE can now be configured to report to syslog, itself.
Expand Down
6 changes: 4 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@
notify => Exec['update_aide_db']
}

# In update_aide, retain output database for the SCAP Security Guide
# OVAL check xccdf_org.ssgproject.content_rule_aide_build_database
file { '/usr/local/sbin/update_aide':
ensure => 'file',
owner => 'root',
Expand All @@ -190,12 +192,12 @@
fi
wait;
mv ${dbdir}/${database_out_name} ${dbdir}/${database_name}
cp ${dbdir}/${database_out_name} ${dbdir}/${database_name}
# Need to report aide initialize/update failure. Since aide
# update returns non-zero error codes even upon success, (return
# codes 0 - 7), an easy way to determine an aide failure for
# either initialization or update is to detect a move failure. The
# either initialization or update is to detect a copy failure. The
# database out will not be created if the initialize/update fails.
exit $?"
}
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simp-aide",
"version": "6.1.0",
"version": "6.1.1",
"author": "SIMP Team",
"summary": "manages AIDE",
"license": "Apache-2.0",
Expand Down
4 changes: 4 additions & 0 deletions spec/acceptance/suites/default/class_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ class { 'aide': }
on(host, 'ls /var/lib/aide/aide.db.gz')
end

it 'should retain the output database for SCAP xccdf_org.ssgproject.content_rule_aide_build_database' do
on(host, 'ls /var/lib/aide/aide.db.new.gz')
end

it 'should generate an empty report when no problems are found' do
on(host, '/usr/local/sbin/update_aide')
on(host, '/usr/sbin/aide --check')
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@
fi
wait;
mv /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz
cp /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz
# Need to report aide initialize/update failure. Since aide
# update returns non-zero error codes even upon success, (return
# codes 0 - 7), an easy way to determine an aide failure for
# either initialization or update is to detect a move failure. The
# either initialization or update is to detect a copy failure. The
# database out will not be created if the initialize/update fails.
exit $?
EOM
Expand Down

0 comments on commit 0fa24f4

Please sign in to comment.