Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix useless use of grep #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lab03-running-testprog-for-the-first-time/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ abcdefghij^C
Normally SELinux Enforcing mode strikes fear into people - otherwise they wouldn't turn it off when it comes to running bespoke applications. So the natural question here is, if SELinux is in **Enforcing** mode, Why did this work? Let's look at the process table:

```
[james@selinux-dev selinux-hands-on-labs]$ ps -efZ | grep $(cat /var/run/testprog.pid)
[james@selinux-dev selinux-hands-on-labs]$ ps -fZp $(cat /var/run/testprog.pid)
unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 root 11666 11665 0 16:04 pts/0 00:00:00 /usr/bin/testprog /etc/testprog.conf /var/run/testprog.pid
```

Expand Down Expand Up @@ -109,7 +109,7 @@ Sep 07 16:17:04 selinux-dev testprog[11695]: Iteration count: -1
Once again it's working! However note this time:

```
[james@selinux-dev selinux-hands-on-labs]$ ps -efZ | grep $(cat /var/run/testprog.pid)
[james@selinux-dev selinux-hands-on-labs]$ ps -fZp $(cat /var/run/testprog.pid)
system_u:system_r:unconfined_service_t:s0 root 11695 1 0 16:17 ? 00:00:00 /usr/bin/testprog /etc/testprog.conf /var/run/testprog.pid
```

Expand Down Expand Up @@ -204,10 +204,10 @@ Using configuration file: /etc/testprog.conf
Wrote PID to /var/run/testprog.pid
Writing output to: /var/testprog/testprg.txt
Iteration count: -1
[james@selinux-dev selinux-hands-on-labs]$ ps -efZ | grep $(cat /var/run/testprog.pid)
[james@selinux-dev selinux-hands-on-labs]$ ps -fZp $(cat /var/run/testprog.pid)
unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 root 11819 11818 0 16:49 pts/0 00:00:00 /usr/bin/testprog /etc/testprog.conf /var/run/testprog.pid
...
[james@selinux-dev selinux-hands-on-labs]$ ps -efZ | grep 11818
[james@selinux-dev selinux-hands-on-labs]$ ps -fZp 11818
unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 root 11818 1221 0 16:49 pts/0 00:00:00 sudo /usr/bin/testprog /etc/testprog.conf /var/run/testprog.pid
...
[james@selinux-dev selinux-hands-on-labs]$ ps -efZ | grep bash
Expand All @@ -222,7 +222,7 @@ And through systemd:
sudo /usr/bin/testprog /etc/testprog.conf /var/run/testprog.pid
^C
[james@selinux-dev selinux-hands-on-labs]$ sudo systemctl start testprog
[james@selinux-dev selinux-hands-on-labs]$ ps -efZ | grep $(cat /var/run/testprog.pid)
[james@selinux-dev selinux-hands-on-labs]$ ps -fZp $(cat /var/run/testprog.pid)
system_u:system_r:unconfined_service_t:s0 root 11836 1 0 16:53 ? 00:00:00 /usr/bin/testprog /etc/testprog.conf /var/run/testprog.pid
...
[james@selinux-dev selinux-hands-on-labs]$ ps -efZ | grep systemd
Expand Down