~ubuntu-branches/ubuntu/wily/apparmor/wily

« back to all changes in this revision

Viewing changes to tests/regression/subdomain/access.sh

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2011-04-27 10:38:07 UTC
  • mfrom: (5.1.118 natty)
  • Revision ID: james.westby@ubuntu.com-20110427103807-ym3rhwys6o84ith0
Tags: 2.6.1-2
debian/copyright: clarify for some full organization names.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/bash
2
 
# $Id: access.sh 61 2006-05-19 18:32:14Z steve-beattie $
3
 
 
4
 
#       Copyright (C) 2002-2005 Novell/SUSE
5
 
#
6
 
#       This program is free software; you can redistribute it and/or
7
 
#       modify it under the terms of the GNU General Public License as
8
 
#       published by the Free Software Foundation, version 2 of the
9
 
#       License.
10
 
 
11
 
#=NAME access
12
 
#=DESCRIPTION
13
 
# Verify that the access syscall is correctly managed for confined profiles
14
 
#=END
15
 
 
16
 
pwd=`dirname $0`
17
 
pwd=`cd $pwd ; /bin/pwd`
18
 
 
19
 
bin=$pwd
20
 
 
21
 
. $bin/prologue.inc
22
 
 
23
 
file=$tmpdir/file
24
 
 
25
 
dir=$tmpdir/dir
26
 
rperm=r
27
 
rwxperm=rwix
28
 
wxperm=wix
29
 
 
30
 
touch $file
31
 
chmod 777 $file # full perms so discretionary access checks succeed
32
 
 
33
 
# PASS TEST 
34
 
genprofile $file:$rwxperm
35
 
runchecktest "ACCESS file r (rwx)" pass $file r
36
 
runchecktest "ACCESS file rx (rwx)" pass $file rx
37
 
runchecktest "ACCESS file rwx (rwx)" pass $file rwx
38
 
 
39
 
genprofile $file:$rperm
40
 
runchecktest "ACCESS file r (r)" pass $file r
41
 
runchecktest "ACCESS file rx (r)" fail $file rx
42
 
runchecktest "ACCESS file rwx (r)" fail $file rwx
43
 
 
44
 
genprofile $file:$wxperm
45
 
runchecktest "ACCESS file x (wx)" pass $file x
46
 
runchecktest "ACCESS file w (wx)" pass $file w
47
 
runchecktest "ACCESS file wx (wx)" pass $file wx
48
 
 
49
 
genprofile $file:$wxperm
50
 
runchecktest "ACCESS file r (wx)" fail $file r
51
 
runchecktest "ACCESS file rx (wx)" fail $file rx
52
 
runchecktest "ACCESS file rwx (wx)" fail $file rwx
53
 
 
54
 
# wx are not necessary for directory write or traverse
55
 
# only r is required
56
 
mkdir $dir
57
 
chmod 777 $dir  # full perms so discretionary access checks succeed
58
 
 
59
 
genprofile $dir:$rwxperm
60
 
runchecktest "ACCESS dir r (rwx)" pass $dir r
61
 
runchecktest "ACCESS dir rx (rwx)" pass $dir rx
62
 
runchecktest "ACCESS dir rwx (rwx)" pass $dir rwx
63
 
 
64
 
genprofile $dir:$rperm
65
 
runchecktest "ACCESS dir r (r)" pass $dir r
66
 
runchecktest "ACCESS dir rx (r)" pass $dir rx
67
 
runchecktest "ACCESS dir rwx (r)" pass $dir rwx
68
 
 
69
 
genprofile $dir:$wxperm
70
 
runchecktest "ACCESS dir x (wx)" pass $dir x
71
 
runchecktest "ACCESS dir w (wx)" pass $dir w
72
 
runchecktest "ACCESS dir wx (wx)" pass $dir wx
73
 
 
74
 
genprofile $dir:$wxperm
75
 
runchecktest "ACCESS dir r (wx)" fail $dir r
76
 
runchecktest "ACCESS dir rx (wx)" fail $dir rx
77
 
runchecktest "ACCESS dir rwx (wx)" fail $dir rwx