summaryrefslogtreecommitdiffstats
path: root/features/step_definitions/checks.rb
diff options
context:
space:
mode:
Diffstat (limited to 'features/step_definitions/checks.rb')
-rw-r--r--features/step_definitions/checks.rb29
1 files changed, 17 insertions, 12 deletions
diff --git a/features/step_definitions/checks.rb b/features/step_definitions/checks.rb
index b05486d..76cfe67 100644
--- a/features/step_definitions/checks.rb
+++ b/features/step_definitions/checks.rb
@@ -14,7 +14,7 @@ Then /^the shipped Tails signing key is not outdated$/ do
"--list-key #{sig_key_fingerprint}", $live_user).stdout
shipped_sig_key_info = @vm.execute("gpg --batch --list-key #{sig_key_fingerprint}",
$live_user).stdout
- assert(shipped_sig_key_info == fresh_sig_key_info,
+ assert_equal(fresh_sig_key_info, shipped_sig_key_info,
"The Tails signing key shipped inside Tails is outdated:\n" +
"Shipped key:\n" +
shipped_sig_key_info +
@@ -28,8 +28,7 @@ Then /^the live user has been setup by live\-boot$/ do
"live-boot failed its user-setup")
actual_username = @vm.execute(". /etc/live/config/username.conf; " +
"echo $LIVE_USERNAME").stdout.chomp
- assert(actual_username == $live_user,
- "The live username is '#{actual_username}', not '#{$live_user}'")
+ assert_equal($live_user, actual_username)
end
Then /^the live user is a member of only its own group and "(.*?)"$/ do |groups|
@@ -38,9 +37,9 @@ Then /^the live user is a member of only its own group and "(.*?)"$/ do |groups|
actual_groups = @vm.execute("groups #{$live_user}").stdout.chomp.sub(/^#{$live_user} : /, "").split(" ")
unexpected = actual_groups - expected_groups
missing = expected_groups - actual_groups
- assert(unexpected.size == 0,
+ assert_equal(0, unexpected.size,
"live user in unexpected groups #{unexpected}")
- assert(missing.size == 0,
+ assert_equal(0, missing.size,
"live user not in expected groups #{missing}")
end
@@ -51,10 +50,8 @@ Then /^the live user owns its home dir and it has normal permissions$/ do
"The live user's home doesn't exist or is not a directory")
owner = @vm.execute("stat -c %U:%G #{home}").stdout.chomp
perms = @vm.execute("stat -c %a #{home}").stdout.chomp
- assert(owner == "#{$live_user}:#{$live_user}",
- "The live user's home has unexpected ownership '#{owner}'")
- assert(perms == "700",
- "The live user's home has unexpected permissions '#{perms}'")
+ assert_equal("#{$live_user}:#{$live_user}", owner)
+ assert_equal("700", perms)
end
Given /^I wait between (\d+) and (\d+) seconds$/ do |min, max|
@@ -106,7 +103,7 @@ Then /^the VirtualBox guest modules are available$/ do
end
def shared_pdf_dir_on_guest
- "/tmp/shared_dir"
+ "/tmp/shared_pdf_dir"
end
Given /^I setup a filesystem share containing a sample PDF$/ do
@@ -119,8 +116,7 @@ Then /^MAT can clean some sample PDF file$/ do
for pdf_on_host in Dir.glob("#{$misc_files_dir}/*.pdf") do
pdf_name = File.basename(pdf_on_host)
pdf_on_guest = "/home/#{$live_user}/#{pdf_name}"
- @vm.execute("cp #{shared_pdf_dir_on_guest}/#{pdf_name} #{pdf_on_guest}",
- $live_user)
+ step "I copy \"#{shared_pdf_dir_on_guest}/#{pdf_name}\" to \"#{pdf_on_guest}\" as user \"#{$live_user}\""
@vm.execute("mat --display '#{pdf_on_guest}'",
$live_user).stdout
check_before = @vm.execute("mat --check '#{pdf_on_guest}'",
@@ -136,3 +132,12 @@ Then /^MAT can clean some sample PDF file$/ do
"MAT failed to clean '#{pdf_on_host}'")
end
end
+
+Then /^AppArmor is enabled$/ do
+ assert(@vm.execute("aa-status").success?, "AppArmor is not enabled")
+end
+
+Then /^some AppArmor profiles are enforced$/ do
+ assert(@vm.execute("aa-status --enforced").stdout.chomp.to_i > 0,
+ "No AppArmor profile is enforced")
+end