Skip to contentSkip to conversation

restorecon / matchpathcon

DISCUSSION LC Bruzenak 2 participants 5 messages Nov 6, 2008 SELinux security module

lore
Share & tools
lore
#0 lore raw

I see no way to recursively/silently check path context.

The matchpathcon command has a silent but no recursive option. It does return non-zero if something doesn't match.

The restorecon command has both recursive and don't change options but no silent. It does not return non-zero if there is a change to be made, so a redirect of stdout to /dev/null wouldn't suffice.

Is there another way/command?

Thx,
LCB.

Signature · 8 lines
LC (Lenny) Bruzenak
[email protected]


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 5 lines · LC Bruzenak

I see no way to recursively/silently check path context.

The matchpathcon command has a silent but no recursive option. It does return non-zero if something doesn't match.

Quoted 9 lines

The restorecon command has both recursive and don't change options but no silent. It does not return non-zero if there is a change to be made, so a redirect of stdout to /dev/null wouldn't suffice.

Is there another way/command?

Thx,
LCB.

find | xargs matchpathcon?

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAkkTHNcACgkQrlYvE4MpobNdUACguPKVCvd8tG7bF8YIROetLbpT GVcAoIEWXVxZW4yAdSWj4eEgsOzL4PpR
=jnXd
-----END PGP SIGNATURE-----

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#2 lore raw
Quoted 13 lines · Daniel J Walsh

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 9 lines · LC Bruzenak

I see no way to recursively/silently check path context.

The matchpathcon command has a silent but no recursive option. It does return non-zero if something doesn't match.

The restorecon command has both recursive and don't change options but no silent. It does not return non-zero if there is a change to be made, so a redirect of stdout to /dev/null wouldn't suffice.

Quoted 6 lines
Quoted 5 lines

Is there another way/command?

Thx,
LCB.

find | xargs matchpathcon?

I think in this case the $? return value would refer to the find not matchpathcon right?

LCB.

Signature · 8 lines
LC (Lenny) Bruzenak
[email protected]


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#3 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 19 lines · LC Bruzenak
Quoted 18 lines · Daniel J Walsh

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 14 lines · LC Bruzenak

I see no way to recursively/silently check path context.

The matchpathcon command has a silent but no recursive option. It does return non-zero if something doesn't match.

The restorecon command has both recursive and don't change options but no silent. It does not return non-zero if there is a change to be made, so a redirect of stdout to /dev/null wouldn't suffice.

Is there another way/command?

Thx,
LCB.

Quoted 7 lines
Quoted 1 line

find | xargs matchpathcon?

I think in this case the $? return value would refer to the find not matchpathcon right?

LCB.

matchpathcon -V PATH

Checks the context on disk versus the default, and sets the exit status I believe.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAkkTIlQACgkQrlYvE4MpobMqgQCfRK/l0bIFWcmCENRN5EAamm7K TnoAoOvhSz4nTk6fLso9rGJypGs9g6mT
=4hGy
-----END PGP SIGNATURE-----

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#4 lore raw

Thanks Dan, I think that works:

[root@hugo ICM]# find pwd | xargs matchpathcon -Vq
[root@hugo ICM]# echo $?
123
[root@hugo ICM]# restorecon -rv pwd
restorecon reset /var/opt/jcdx/ICM/Labeled context system_u:object_r:jcdx_icm_var_t:s0->system_u:object_r:jcdx_icm_var_t:s15:c0.c1023 [root@hugo ICM]# find pwd | xargs matchpathcon -Vq
[root@hugo ICM]# echo $?
0

Signature · 8 lines
LC (Lenny) Bruzenak
[email protected]


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.