summaryrefslogtreecommitdiff
path: root/meta-security/lib/oeqa/runtime/cases/tripwire.py
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2019-04-05 22:28:33 +0300
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2019-04-05 22:31:28 +0300
commit193236933b0f4ab91b1625b64e2187e2db4e0e8f (patch)
treee12769d7c76d8b0517d6de3d3c72189753d253ed /meta-security/lib/oeqa/runtime/cases/tripwire.py
parentbd93df9478f2f56ffcbc8cb88f1709c735dcd85b (diff)
downloadopenbmc-193236933b0f4ab91b1625b64e2187e2db4e0e8f.tar.xz
reset upstream subtrees to HEAD
Reset the following subtrees on HEAD: poky: 8217b477a1(master) meta-xilinx: 64aa3d35ae(master) meta-openembedded: 0435c9e193(master) meta-raspberrypi: 490a4441ac(master) meta-security: cb6d1c85ee(master) Squashed patches: meta-phosphor: drop systemd 239 patches meta-phosphor: mrw-api: use correct install path Change-Id: I268e2646d9174ad305630c6bbd3fbc1a6105f43d Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'meta-security/lib/oeqa/runtime/cases/tripwire.py')
-rw-r--r--meta-security/lib/oeqa/runtime/cases/tripwire.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/meta-security/lib/oeqa/runtime/cases/tripwire.py b/meta-security/lib/oeqa/runtime/cases/tripwire.py
new file mode 100644
index 0000000000..659724d0aa
--- /dev/null
+++ b/meta-security/lib/oeqa/runtime/cases/tripwire.py
@@ -0,0 +1,47 @@
+# Copyright (C) 2019 Armin Kuster <akuster808@gmail.com>
+#
+import re
+
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.core.decorator.depends import OETestDepends
+from oeqa.runtime.decorator.package import OEHasPackage
+
+
+class TripwireTest(OERuntimeTestCase):
+
+ @OEHasPackage(['tripwire'])
+ @OETestDepends(['ssh.SSHTest.test_ssh'])
+ def test_tripwire_help(self):
+ status, output = self.target.run('tripwire --help')
+ msg = ('tripwire command does not work as expected. '
+ 'Status and output:%s and %s' % (status, output))
+ self.assertEqual(status, 8, msg = msg)
+
+ @OETestDepends(['tripwire.TripwireTest.test_tripwire_help'])
+ def test_tripwire_twinstall(self):
+ status, output = self.target.run('/etc/tripwire/twinstall.sh')
+ match = re.search('The database was successfully generated.', output)
+ if not match:
+ msg = ('/etc/tripwire/twinstall.sh failed. '
+ 'Status and output:%s and %s' % (status, output))
+ self.assertEqual(status, 0, msg = msg)
+
+ @OETestDepends(['tripwire.TripwireTest.test_tripwire_twinstall'])
+ def test_tripwire_twadmin(self):
+ status, output = self.target.run('twadmin --create-cfgfile --cfgfile /etc/tripwire/twcfg.enc --site-keyfile /etc/tripwire/site.key -Q tripwire /etc/tripwire/twcfg.txt')
+ status, output = self.target.run('twadmin --create-polfile --cfgfile /etc/tripwire/twcfg.enc --polfile /etc/tripwire/twpol.enc --site-keyfile /etc/tripwire/site.key -Q tripwire /etc/tripwire/twpol.txt')
+ match = re.search('Wrote policy file: /etc/tripwire/twpol.enc', output)
+ if not match:
+ msg = ('twadmin --create-profile ; failed. '
+ 'Status and output:%s and %s' % (status, output))
+ self.assertEqual(status, 0, msg = msg)
+
+ @OETestDepends(['tripwire.TripwireTest.test_tripwire_twadmin'])
+ def test_tripwire_init(self):
+ status, hostname = self.target.run('hostname')
+ status, output = self.target.run('tripwire --init --cfgfile /etc/tripwire/twcfg.enc --polfile /etc/tripwire/tw.pol --site-keyfile /etc/tripwire/site.key --local-keyfile /etc/tripwire/%s-local.key -P tripwire' % hostname)
+ match = re.search('The database was successfully generated.', output)
+ if not match:
+ msg = ('tripwire --init; Failed for host: %s. '
+ 'Status and output:%s and %s' % (hostname, status, output))
+ self.assertEqual(status, 0, msg = msg)