diff options
author | Armin Kuster <akuster808@gmail.com> | 2022-05-30 14:08:07 -0700 |
---|---|---|
committer | Armin Kuster <akuster808@gmail.com> | 2022-06-07 16:58:24 -0700 |
commit | 3e5502a31c58e1b2dc7d9bbd1b446c96c474b119 (patch) | |
tree | 88f2e30f83088e168a58b9dc862efb65a99c20a1 | |
parent | 98df792565c958195f5fa03869ade195ae8d1f18 (diff) | |
download | meta-security-3e5502a31c58e1b2dc7d9bbd1b446c96c474b119.tar.gz |
oeqa/smack: consolidate classes
Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r-- | lib/oeqa/runtime/cases/smack.py | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/lib/oeqa/runtime/cases/smack.py b/lib/oeqa/runtime/cases/smack.py index 35e87ef..b8255c7 100644 --- a/lib/oeqa/runtime/cases/smack.py +++ b/lib/oeqa/runtime/cases/smack.py | |||
@@ -29,8 +29,6 @@ class SmackBasicTest(OERuntimeTestCase): | |||
29 | status,output = self.target.run("cat /proc/self/attr/current") | 29 | status,output = self.target.run("cat /proc/self/attr/current") |
30 | self.current_label = output.strip() | 30 | self.current_label = output.strip() |
31 | 31 | ||
32 | class SmackAccessLabel(SmackBasicTest): | ||
33 | |||
34 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) | 32 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) |
35 | def test_add_access_label(self): | 33 | def test_add_access_label(self): |
36 | ''' Test if chsmack can correctly set a SMACK label ''' | 34 | ''' Test if chsmack can correctly set a SMACK label ''' |
@@ -54,8 +52,6 @@ class SmackAccessLabel(SmackBasicTest): | |||
54 | "%s %s" %(LABEL,label_retrieved)) | 52 | "%s %s" %(LABEL,label_retrieved)) |
55 | 53 | ||
56 | 54 | ||
57 | class SmackExecLabel(SmackBasicTest): | ||
58 | |||
59 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) | 55 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) |
60 | def test_add_exec_label(self): | 56 | def test_add_exec_label(self): |
61 | '''Test if chsmack can correctly set a SMACK Exec label''' | 57 | '''Test if chsmack can correctly set a SMACK Exec label''' |
@@ -79,8 +75,6 @@ class SmackExecLabel(SmackBasicTest): | |||
79 | "%s %s" %(LABEL,label_retrieved)) | 75 | "%s %s" %(LABEL,label_retrieved)) |
80 | 76 | ||
81 | 77 | ||
82 | class SmackMmapLabel(SmackBasicTest): | ||
83 | |||
84 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) | 78 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) |
85 | def test_add_mmap_label(self): | 79 | def test_add_mmap_label(self): |
86 | '''Test if chsmack can correctly set a SMACK mmap label''' | 80 | '''Test if chsmack can correctly set a SMACK mmap label''' |
@@ -104,8 +98,6 @@ class SmackMmapLabel(SmackBasicTest): | |||
104 | "%s %s" %(LABEL,label_retrieved)) | 98 | "%s %s" %(LABEL,label_retrieved)) |
105 | 99 | ||
106 | 100 | ||
107 | class SmackTransmutable(SmackBasicTest): | ||
108 | |||
109 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) | 101 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) |
110 | def test_add_transmutable(self): | 102 | def test_add_transmutable(self): |
111 | '''Test if chsmack can correctly set a SMACK transmutable mode''' | 103 | '''Test if chsmack can correctly set a SMACK transmutable mode''' |
@@ -128,8 +120,6 @@ class SmackTransmutable(SmackBasicTest): | |||
128 | "%s %s" %(LABEL,label_retrieved)) | 120 | "%s %s" %(LABEL,label_retrieved)) |
129 | 121 | ||
130 | 122 | ||
131 | class SmackChangeSelfLabelPrivilege(SmackBasicTest): | ||
132 | |||
133 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) | 123 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) |
134 | def test_privileged_change_self_label(self): | 124 | def test_privileged_change_self_label(self): |
135 | '''Test if privileged process (with CAP_MAC_ADMIN privilege) | 125 | '''Test if privileged process (with CAP_MAC_ADMIN privilege) |
@@ -145,8 +135,6 @@ class SmackChangeSelfLabelPrivilege(SmackBasicTest): | |||
145 | self.assertIn("PRIVILEGED", output, | 135 | self.assertIn("PRIVILEGED", output, |
146 | "Privilege process did not change label.Output: %s" %output) | 136 | "Privilege process did not change label.Output: %s" %output) |
147 | 137 | ||
148 | class SmackChangeSelfLabelUnprivilege(SmackBasicTest): | ||
149 | |||
150 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) | 138 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) |
151 | def test_unprivileged_change_self_label(self): | 139 | def test_unprivileged_change_self_label(self): |
152 | '''Test if unprivileged process (without CAP_MAC_ADMIN privilege) | 140 | '''Test if unprivileged process (without CAP_MAC_ADMIN privilege) |
@@ -163,8 +151,6 @@ class SmackChangeSelfLabelUnprivilege(SmackBasicTest): | |||
163 | "Unprivileged process should not be able to change its label") | 151 | "Unprivileged process should not be able to change its label") |
164 | 152 | ||
165 | 153 | ||
166 | class SmackChangeFileLabelPrivilege(SmackBasicTest): | ||
167 | |||
168 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) | 154 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) |
169 | def test_unprivileged_change_file_label(self): | 155 | def test_unprivileged_change_file_label(self): |
170 | '''Test if unprivileged process cannot change file labels''' | 156 | '''Test if unprivileged process cannot change file labels''' |
@@ -183,8 +169,6 @@ class SmackChangeFileLabelPrivilege(SmackBasicTest): | |||
183 | self.target.run("rm %s" % filename) | 169 | self.target.run("rm %s" % filename) |
184 | self.assertEqual( status, 0, "Unprivileged process changed label for %s" %filename) | 170 | self.assertEqual( status, 0, "Unprivileged process changed label for %s" %filename) |
185 | 171 | ||
186 | class SmackLoadRule(SmackBasicTest): | ||
187 | |||
188 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) | 172 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) |
189 | def test_load_smack_rule(self): | 173 | def test_load_smack_rule(self): |
190 | '''Test if new smack access rules can be loaded''' | 174 | '''Test if new smack access rules can be loaded''' |
@@ -211,8 +195,6 @@ class SmackLoadRule(SmackBasicTest): | |||
211 | self.target.run('echo -n "%s" > %s/load' %(clean, self.smack_path)) | 195 | self.target.run('echo -n "%s" > %s/load' %(clean, self.smack_path)) |
212 | 196 | ||
213 | 197 | ||
214 | class SmackOnlycap(SmackBasicTest): | ||
215 | |||
216 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) | 198 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) |
217 | def test_smack_onlycap(self): | 199 | def test_smack_onlycap(self): |
218 | '''Test if smack onlycap label can be set | 200 | '''Test if smack onlycap label can be set |
@@ -223,7 +205,6 @@ class SmackOnlycap(SmackBasicTest): | |||
223 | status, output = self.target.run("sh /usr/sbin/test_smack_onlycap.sh") | 205 | status, output = self.target.run("sh /usr/sbin/test_smack_onlycap.sh") |
224 | self.assertEqual(status, 0, output) | 206 | self.assertEqual(status, 0, output) |
225 | 207 | ||
226 | class SmackNetlabel(SmackBasicTest): | ||
227 | 208 | ||
228 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) | 209 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) |
229 | def test_smack_netlabel(self): | 210 | def test_smack_netlabel(self): |
@@ -246,7 +227,6 @@ class SmackNetlabel(SmackBasicTest): | |||
246 | test_label, output, | 227 | test_label, output, |
247 | "Did not find expected label in output: %s" %output) | 228 | "Did not find expected label in output: %s" %output) |
248 | 229 | ||
249 | class SmackCipso(SmackBasicTest): | ||
250 | 230 | ||
251 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) | 231 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) |
252 | def test_smack_cipso(self): | 232 | def test_smack_cipso(self): |
@@ -287,7 +267,6 @@ class SmackCipso(SmackBasicTest): | |||
287 | self.assertEqual(status, 0, "Cipso rule C was not set") | 267 | self.assertEqual(status, 0, "Cipso rule C was not set") |
288 | self.assertIn("/17,33", output, "Rule C was not set correctly") | 268 | self.assertIn("/17,33", output, "Rule C was not set correctly") |
289 | 269 | ||
290 | class SmackDirect(SmackBasicTest): | ||
291 | 270 | ||
292 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) | 271 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) |
293 | def test_smack_direct(self): | 272 | def test_smack_direct(self): |
@@ -308,8 +287,6 @@ class SmackDirect(SmackBasicTest): | |||
308 | "Smack direct label does not match.") | 287 | "Smack direct label does not match.") |
309 | 288 | ||
310 | 289 | ||
311 | class SmackAmbient(SmackBasicTest): | ||
312 | |||
313 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) | 290 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) |
314 | def test_smack_ambient(self): | 291 | def test_smack_ambient(self): |
315 | test_ambient = "test_ambient" | 292 | test_ambient = "test_ambient" |
@@ -330,8 +307,6 @@ class SmackAmbient(SmackBasicTest): | |||
330 | "Ambient label does not match") | 307 | "Ambient label does not match") |
331 | 308 | ||
332 | 309 | ||
333 | class SmackloadBinary(SmackBasicTest): | ||
334 | |||
335 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) | 310 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) |
336 | def test_smackload(self): | 311 | def test_smackload(self): |
337 | '''Test if smackload command works''' | 312 | '''Test if smackload command works''' |
@@ -345,8 +320,6 @@ class SmackloadBinary(SmackBasicTest): | |||
345 | self.assertEqual(status, 0, "Smackload rule was loaded correctly") | 320 | self.assertEqual(status, 0, "Smackload rule was loaded correctly") |
346 | 321 | ||
347 | 322 | ||
348 | class SmackcipsoBinary(SmackBasicTest): | ||
349 | |||
350 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) | 323 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) |
351 | def test_smackcipso(self): | 324 | def test_smackcipso(self): |
352 | '''Test if smackcipso command works''' | 325 | '''Test if smackcipso command works''' |
@@ -362,8 +335,6 @@ class SmackcipsoBinary(SmackBasicTest): | |||
362 | self.assertIn( "2/2", output, "Rule was not set correctly. Got: %s" %output) | 335 | self.assertIn( "2/2", output, "Rule was not set correctly. Got: %s" %output) |
363 | 336 | ||
364 | 337 | ||
365 | class SmackEnforceFileAccess(SmackBasicTest): | ||
366 | |||
367 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) | 338 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) |
368 | def test_smack_enforce_file_access(self): | 339 | def test_smack_enforce_file_access(self): |
369 | '''Test if smack file access is enforced (rwx) | 340 | '''Test if smack file access is enforced (rwx) |
@@ -375,8 +346,6 @@ class SmackEnforceFileAccess(SmackBasicTest): | |||
375 | self.assertEqual(status, 0, output) | 346 | self.assertEqual(status, 0, output) |
376 | 347 | ||
377 | 348 | ||
378 | class SmackEnforceMmap(SmackBasicTest): | ||
379 | |||
380 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) | 349 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) |
381 | def test_smack_mmap_enforced(self): | 350 | def test_smack_mmap_enforced(self): |
382 | '''Test if smack mmap access is enforced''' | 351 | '''Test if smack mmap access is enforced''' |
@@ -449,8 +418,6 @@ class SmackEnforceMmap(SmackBasicTest): | |||
449 | "Output: %s" %output) | 418 | "Output: %s" %output) |
450 | 419 | ||
451 | 420 | ||
452 | class SmackEnforceTransmutable(SmackBasicTest): | ||
453 | |||
454 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) | 421 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) |
455 | def test_smack_transmute_dir(self): | 422 | def test_smack_transmute_dir(self): |
456 | '''Test if smack transmute attribute works | 423 | '''Test if smack transmute attribute works |
@@ -473,8 +440,6 @@ class SmackEnforceTransmutable(SmackBasicTest): | |||
473 | "Did not get expected label. Output: %s" % output) | 440 | "Did not get expected label. Output: %s" % output) |
474 | 441 | ||
475 | 442 | ||
476 | class SmackTcpSockets(SmackBasicTest): | ||
477 | |||
478 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) | 443 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) |
479 | def test_smack_tcp_sockets(self): | 444 | def test_smack_tcp_sockets(self): |
480 | '''Test if smack is enforced on tcp sockets | 445 | '''Test if smack is enforced on tcp sockets |
@@ -485,8 +450,6 @@ class SmackTcpSockets(SmackBasicTest): | |||
485 | self.assertEqual(status, 0, output) | 450 | self.assertEqual(status, 0, output) |
486 | 451 | ||
487 | 452 | ||
488 | class SmackUdpSockets(SmackBasicTest): | ||
489 | |||
490 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) | 453 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) |
491 | def test_smack_udp_sockets(self): | 454 | def test_smack_udp_sockets(self): |
492 | '''Test if smack is enforced on udp sockets | 455 | '''Test if smack is enforced on udp sockets |
@@ -497,8 +460,6 @@ class SmackUdpSockets(SmackBasicTest): | |||
497 | self.assertEqual(status, 0, output) | 460 | self.assertEqual(status, 0, output) |
498 | 461 | ||
499 | 462 | ||
500 | class SmackFileLabels(SmackBasicTest): | ||
501 | |||
502 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) | 463 | @OETestDepends(['smack.SmackBasicTest.test_smack_basic']) |
503 | def test_smack_labels(self): | 464 | def test_smack_labels(self): |
504 | '''Check for correct Smack labels.''' | 465 | '''Check for correct Smack labels.''' |