All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ondrej Mosnacek <omosnace@redhat.com>
To: selinux@vger.kernel.org
Subject: [PATCH testsuite] tests/atsecure: avoid running bash under test domains
Date: Tue, 14 Mar 2023 17:58:58 +0100	[thread overview]
Message-ID: <20230314165858.498705-1-omosnace@redhat.com> (raw)

The 'env' utility can be used just as well. This avoids the "bash:
/root/.bashrc: Permission denied" error message that appears when the
testsuite is ran with a terminal attached to the stdout/stdin and the
corresponding AVC denials.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
---
 tests/atsecure/test | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/atsecure/test b/tests/atsecure/test
index 59ba3a4..4079a1b 100755
--- a/tests/atsecure/test
+++ b/tests/atsecure/test
@@ -20,12 +20,12 @@ ok( $result, 0 );
 
 # Verify that LD_PRELOAD is ignored when noatsecure permission is not allowed.
 $result = system(
-"runcon -t test_atsecure_denied_t -- bash -c 'LD_PRELOAD=$basedir/evil.so runcon -t test_atsecure_newdomain_t $basedir/good'"
+"runcon -t test_atsecure_denied_t -- env LD_PRELOAD=$basedir/evil.so runcon -t test_atsecure_newdomain_t $basedir/good"
 );
 ok( $result, 0 );
 
 # Verify that LD_PRELOAD is honored when noatsecure permission is allowed.
 $result = system(
-"runcon -t test_atsecure_allowed_t -- bash -c 'LD_PRELOAD=$basedir/evil.so runcon -t test_atsecure_newdomain_t $basedir/good'"
+"runcon -t test_atsecure_allowed_t -- env LD_PRELOAD=$basedir/evil.so runcon -t test_atsecure_newdomain_t $basedir/good"
 );
 ok($result);
-- 
2.39.2


             reply	other threads:[~2023-03-14 16:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-14 16:58 Ondrej Mosnacek [this message]
2023-03-16  9:25 ` [PATCH testsuite] tests/atsecure: avoid running bash under test domains Ondrej Mosnacek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230314165858.498705-1-omosnace@redhat.com \
    --to=omosnace@redhat.com \
    --cc=selinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.