aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2019-03-29 18:36:08 -0700
committerArmin Kuster <akuster808@gmail.com>2019-03-31 10:37:09 -0700
commit7d014432c7a3e9b3b8cb8f17562071375f915e8e (patch)
treeabba4a24879ad4805ec2d66cbeb9f601c4005be3
parent1fae87cd1c3e64bd89cfe8ecbe4d01ed2a342a43 (diff)
downloadmeta-security-7d014432c7a3e9b3b8cb8f17562071375f915e8e.tar.gz
meta-security-7d014432c7a3e9b3b8cb8f17562071375f915e8e.tar.bz2
meta-security-7d014432c7a3e9b3b8cb8f17562071375f915e8e.zip
tripwire: add runtime test
Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--lib/oeqa/runtime/cases/tripwire.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/lib/oeqa/runtime/cases/tripwire.py b/lib/oeqa/runtime/cases/tripwire.py
new file mode 100644
index 0000000..659724d
--- /dev/null
+++ b/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)