[Spacewalk-list] spacewalk selinux context on files/directories

Marcelo Moreira de Mello mmello at redhat.com
Wed Jun 13 14:27:10 UTC 2012


On 06/13/2012 07:25 AM, Michel Hendriks wrote:
> Hi,
>
> Thanks for your reply !
>
> Uploading "new" files without selinux context is pretty difficult as we use
> "custom info" information in many config files :-(
>
> / Michel
Hello Michel,

  I wrote an script which you can use to handle this.

  Actually my script remove the SELinux contexts from a given
configuration channel, but you can modify the code to address your needs.

  Look my example below:

Configuration Channel:  selinux_test_channel
Files: /etc/hosts

-------

 Example:

$ python remove-selinux-ctx.py
Enter the configuration channel name: selinux_test_channel
--------------------

1 item(s) provided by channel selinux_test_channel
    Path: /etc/hosts     SELinux Context: system_u:object_r:net_conf_t:s0

Want to clean the SELinux context for all items listed above? [Y/n] Y


    Cleaning SELinux context for /etc/hosts

$ python remove-selinux-ctx.py
Enter the configuration channel name: selinux_test_channel
--------------------

1 item(s) provided by channel selinux_test_channel
    Path: /etc/hosts     (no SELinux context)

The items provided by configuration channel selinux_test_channel does
not have any SELinux context set

As you can see, using the script you can overwrite the SELinux Context.

Hope this is useful.

Best Regards,
mmello


-- 
Marcelo Moreira de Mello
RHCA RHCSS RHCVA 
Senior Software Maintenance Engineer/SEG           

gpg id: 2048R/FDB110E5
gpg fingerprint: 3BE7 EF71 4DD7 6812 D309  8F18 BD42 D095 FDB1 10E5

-------------- next part --------------
A non-text attachment was scrubbed...
Name: remove-selinux-ctx.py
Type: text/x-python
Size: 3167 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20120613/827f2e89/attachment.py>


More information about the Spacewalk-list mailing list