~ubuntu-branches/ubuntu/raring/apparmor/raring

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2007-03-23 16:42:01 UTC
  • Revision ID: james.westby@ubuntu.com-20070323164201-jkax6f0oku087b7l
Tags: upstream-2.0.1+510.dfsg
ImportĀ upstreamĀ versionĀ 2.0.1+510.dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/bash
 
2
# $Id$
 
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 environ
 
12
#=DESCRIPTION
 
13
# verify bprm_unsafe filtering occurs for Px and Ux.
 
14
#
 
15
#=END
 
16
 
 
17
pwd=`dirname $0`
 
18
pwd=`cd $pwd ; /bin/pwd`
 
19
 
 
20
bin=$pwd
 
21
 
 
22
. $bin/prologue.inc
 
23
 
 
24
helper=$pwd/env_check
 
25
setuid_helper=${tmpdir}/env_check
 
26
helper_sh=$pwd/env_check.sh
 
27
 
 
28
# TEST environment filtering on elf binaries
 
29
genprofile $helper:ux
 
30
runchecktest "ENVIRON (elf): ux & regular env" pass $helper FOO=BAR
 
31
runchecktest "ENVIRON (elf): ux & sensitive env" pass $helper LD_LIBRARY_PATH=.
 
32
 
 
33
genprofile $helper:Ux
 
34
runchecktest "ENVIRON (elf): Ux & regular env" pass $helper FOO=BAR
 
35
runchecktest "ENVIRON (elf): Ux & sensitive env" fail $helper LD_LIBRARY_PATH=.
 
36
 
 
37
genprofile $helper:rix
 
38
runchecktest "ENVIRON (elf): ix & regular env" pass $helper FOO=BAR
 
39
runchecktest "ENVIRON (elf): ix & sensitive env" pass $helper LD_LIBRARY_PATH=.
 
40
 
 
41
genprofile $helper:px -- image=$helper
 
42
runchecktest "ENVIRON (elf): px & regular env" pass $helper FOO=BAR
 
43
runchecktest "ENVIRON (elf): px & sensitive env" pass $helper LD_LIBRARY_PATH=.
 
44
 
 
45
genprofile $helper:Px -- image=$helper
 
46
runchecktest "ENVIRON (elf): Px & regular env" pass $helper FOO=BAR
 
47
runchecktest "ENVIRON (elf): Px & sensitive env" fail $helper LD_LIBRARY_PATH=.
 
48
 
 
49
genprofile image=$helper
 
50
runchecktest "ENVIRON (elf): unconfined --> confined & regular env" pass $helper FOO=BAR
 
51
runchecktest "ENVIRON (elf): unconfined --> confined & sensitive env" pass $helper LD_LIBRARY_PATH=.
 
52
 
 
53
genprofile -C
 
54
runchecktest "ENVIRON (elf): confined/complain & regular env" pass $helper FOO=BAR
 
55
runchecktest "ENVIRON (elf): confined/complain & sensitive env" pass $helper LD_LIBRARY_PATH=.
 
56
 
 
57
# TEST environment filtering on shell scripts
 
58
genprofile ${helper_sh}:ux
 
59
runchecktest "ENVIRON (shell script): ux & regular env" pass ${helper_sh} FOO=BAR
 
60
runchecktest "ENVIRON (shell script): ux & sensitive env" pass ${helper_sh} LD_LIBRARY_PATH=.
 
61
 
 
62
genprofile ${helper_sh}:Ux
 
63
runchecktest "ENVIRON (shell script): Ux & regular env" pass ${helper_sh} FOO=BAR
 
64
runchecktest "ENVIRON (shell script): Ux & sensitive env" fail ${helper_sh} LD_LIBRARY_PATH=.
 
65
 
 
66
genprofile ${helper_sh}:px -- image=${helper_sh} /bin/bash:rix "/lib*/lib*:mr"
 
67
runchecktest "ENVIRON (shell script): px & regular env" pass ${helper_sh} FOO=BAR
 
68
runchecktest "ENVIRON (shell script): px & sensitive env" pass ${helper_sh} LD_LIBRARY_PATH=.
 
69
 
 
70
genprofile ${helper_sh}:Px -- image=${helper_sh} /bin/bash:rix "/lib*/lib*:mr"
 
71
runchecktest "ENVIRON (shell script): Px & regular env" pass ${helper_sh} FOO=BAR
 
72
runchecktest "ENVIRON (shell script): Px & sensitive env" fail ${helper_sh} LD_LIBRARY_PATH=.
 
73
 
 
74
genprofile ${helper_sh}:rix /bin/bash:rix "/lib*/lib*:mr"
 
75
runchecktest "ENVIRON (shell script): ix & regular env" pass ${helper_sh} FOO=BAR
 
76
runchecktest "ENVIRON (shell script): ix & sensitive env" pass ${helper_sh} LD_LIBRARY_PATH=.
 
77
 
 
78
genprofile image=${helper_sh} /bin/bash:rix "/lib*/lib*:mr"
 
79
runchecktest "ENVIRON (shell script): unconfined --> confined & regular env" pass ${helper_sh} FOO=BAR
 
80
runchecktest "ENVIRON (shell script): unconfined --> confined & sensitive env" pass ${helper_sh} LD_LIBRARY_PATH=.
 
81
 
 
82
genprofile -C
 
83
runchecktest "ENVIRON (shell script): confined/complain & regular env" pass ${helper_sh} FOO=BAR
 
84
runchecktest "ENVIRON (shell script): confined/complain & sensitive env" pass ${helper_sh} LD_LIBRARY_PATH=.
 
85
 
 
86
# TEST environment filtering still works on setuid apps
 
87
removeprofile
 
88
 
 
89
cp $helper ${setuid_helper}
 
90
chown nobody ${setuid_helper}
 
91
chmod u+s ${setuid_helper}
 
92
runchecktest "ENVIRON (elf): unconfined setuid helper" pass ${setuid_helper} FOO=BAR
 
93
runchecktest "ENVIRON (elf): unconfined setuid helper" fail ${setuid_helper} LD_LIBRARY_PATH=.