adding a new security class
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
---------- Forwarded message ----------
From: Daniel J Walsh <[email protected]>
Date: Thu, Apr 17, 2008 at 7:17 AM
Subject: Re: adding a new security class
To: Xavier Toth <[email protected]>
Cc: Eamon Walsh <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 8 lines · Xavier Toth
I'm trying to add a new security class for x copy/paste but I'm not sure if I doing it right. I patched some headers in libselinux but then I noticed the "Do not edit..." how are they generated, it doesn't happen when I build from the source rpm? At this point I'm a bit confused about how the connection is made between the policy class definition and libselinux.
Ted
You need to add the code to selinux-policy/module/flask directory and then use the Makefile to generate these files.
You should ask questions like this on the list, so others would learn, and more knowledgeable people can answer. :^)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
iEYEARECAAYFAkgHP8IACgkQrlYvE4MpobMTswCeLROTHlz9qQXCe9X5t9Kt7xJA rhwAnjHUvTkdftQiqOKd9t4HRs1q+LjA
=VfvF
-----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.
Quoted 21 lines · Xavier Toth
---------- Forwarded message ----------
From: Daniel J Walsh <[email protected]>
Date: Thu, Apr 17, 2008 at 7:17 AM
Subject: Re: adding a new security class
To: Xavier Toth <[email protected]>
Cc: Eamon Walsh <[email protected]>-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 7 lines · Xavier Toth
I'm trying to add a new security class for x copy/paste but I'm not sure if I doing it right. I patched some headers in libselinux but then I noticed the "Do not edit..." how are they generated, it doesn't happen when I build from the source rpm? At this point I'm a bit confused about how the connection is made between the policy class definition and libselinux.
Quoted 6 lines
Quoted 1 line
Ted
You need to add the code to selinux-policy/module/flask directory and then use the
Makefileto generate these files.You should ask questions like this on the list, so others would learn, and more knowledgeable people can answer. :^)
James captured my response to a prior instance of this question on the selinuxproject wiki:
http://selinuxproject.org/page/Adding_New_Permissions
Signature · 8 lines
Stephen Smalley National Security Agency -- 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.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 2 lines · Xavier Toth
If the new security class is a userspace object manager related class do I still need to rebuild the kernel?
No. You should find that the regenerated kernel headers are no different, as they no longer include userspace classes (if annotated as such in the security_classes file).
I assume though that you are adding your new class to the end of the security_classes list. Inserting a class before an existing one can perturb the values of the existing classes, which isn't a good idea (forbidden for kernel classes and any userspace object managers that use the old libselinux API; permissible for new userspace object classes when they use the dynamic class/permission discovery support but can still break running applications until we have support for remapping upon reload there).
Signature · 8 lines
Stephen Smalley National Security Agency -- 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.
I appended the class declaration to the security_classes files.
I have installed the new policy and libselinux. However now when trying to use this new class in a te file the build fails with an 'unknown class' error. Do I need to rebuild any other packages before I can use this class? I tried rebuilding checkpolicy but that didn't help.
Quoted 18 lines · Stephen Smalley
Quoted 2 lines · Xavier Toth
If the new security class is a userspace object manager related class do I still need to rebuild the kernel?
No. You should find that the regenerated kernel headers are no different, as they no longer include userspace classes (if annotated as such in the
security_classesfile).I assume though that you are adding your new class to the end of the
security_classeslist. Inserting a class before an existing one can perturb the values of the existing classes, which isn't a good idea (forbidden for kernel classes and any userspace object managers that use the old libselinux API; permissible for new userspace object classes when they use the dynamic class/permission discovery support but can still break running applications until we have support for remapping upon reload there).
Quoted 7 lines
--
Stephen Smalley
National Security Agency
--
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.
Quoted 7 lines · Xavier Toth
I appended the class declaration to the
security_classesfiles.I have installed the new policy and libselinux. However now when trying to use this new class in a te file the build fails with an 'unknown class' error. Do I need to rebuild any other packages before I can use this class? I tried rebuilding checkpolicy but that didn't help.
Rebuilding checkpolicy isn't necessary. In fact, you don't even really need the rebuilt libselinux if using the dynamic object class/permission discovery support, since that will map the class and permission strings to values via the kernel's selinuxfs interface.
I'm guessing that you are trying to build a policy module using the policy headers provided by the Fedora policy rather than the ones provided by your rebuilt policy, and those headers lack the new definitions.
Quoted 27 lines · Stephen Smalley
Quoted 25 lines · Xavier Toth
Quoted 2 lines
If the new security class is a userspace object manager related class do I still need to rebuild the kernel?
No. You should find that the regenerated kernel headers are no different, as they no longer include userspace classes (if annotated as such in the
security_classesfile).I assume though that you are adding your new class to the end of the
security_classeslist. Inserting a class before an existing one can perturb the values of the existing classes, which isn't a good idea (forbidden for kernel classes and any userspace object managers that use the old libselinux API; permissible for new userspace object classes when they use the dynamic class/permission discovery support but can still break running applications until we have support for remapping upon reload there).--
Stephen Smalley
National Security Agency
Signature · 8 lines
Stephen Smalley National Security Agency -- 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.
I installed the corresponding selinux-policy-devel rpm. I see references to my class in /usr/share/selinux/devel/include/support/all_perms.spt Any other ideas on what to look at?
Quoted 48 lines · Stephen Smalley
Quoted 7 lines · Xavier Toth
I appended the class declaration to the
security_classesfiles.I have installed the new policy and libselinux. However now when trying to use this new class in a te file the build fails with an 'unknown class' error. Do I need to rebuild any other packages before I can use this class? I tried rebuilding checkpolicy but that didn't help.
Rebuilding checkpolicy isn't necessary. In fact, you don't even really need the rebuilt libselinux if using the dynamic object class/permission discovery support, since that will map the class and permission strings to values via the kernel's selinuxfs interface.
I'm guessing that you are trying to build a policy module using the policy headers provided by the Fedora policy rather than the ones provided by your rebuilt policy, and those headers lack the new definitions.
Quoted 20 lines · Stephen Smalley
Quoted 18 lines · Xavier Toth
Quoted 2 lines
If the new security class is a userspace object manager related class do I still need to rebuild the kernel?
No. You should find that the regenerated kernel headers are no different, as they no longer include userspace classes (if annotated as such in the
security_classesfile).I assume though that you are adding your new class to the end of the
security_classeslist. Inserting a class before an existing one can perturb the values of the existing classes, which isn't a good idea (forbidden for kernel classes and any userspace object managers that use the old libselinux API; permissible for new userspace object classes when they use the dynamic class/permission discovery support but can still break running applications until we have support for remapping upon reload there).Quoted 7 lines
Quoted 7 lines
--
Stephen Smalley
National Security Agency
Quoted 7 lines
--
Stephen Smalley
National Security Agency
--
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.
Quoted 4 lines · Xavier Toth
I installed the corresponding selinux-policy-devel rpm. I see references to my class in
/usr/share/selinux/devel/include/support/all_perms.sptAny other ideas on what to look at?
(don't top-post, and don't trim the cc list, please)
At this point I need to see a copy of the .te file and the precise output from the failed build.
Quoted 56 lines · Stephen Smalley
Quoted 55 lines · Xavier Toth
Quoted 7 lines
I appended the class declaration to the
security_classesfiles.I have installed the new policy and libselinux. However now when trying to use this new class in a te file the build fails with an 'unknown class' error. Do I need to rebuild any other packages before I can use this class? I tried rebuilding checkpolicy but that didn't help.
Rebuilding checkpolicy isn't necessary. In fact, you don't even really need the rebuilt libselinux if using the dynamic object class/permission discovery support, since that will map the class and permission strings to values via the kernel's selinuxfs interface.
I'm guessing that you are trying to build a policy module using the policy headers provided by the Fedora policy rather than the ones provided by your rebuilt policy, and those headers lack the new definitions.
Quoted 20 lines · Stephen Smalley
Quoted 18 lines · Xavier Toth
Quoted 2 lines
If the new security class is a userspace object manager related class do I still need to rebuild the kernel?
No. You should find that the regenerated kernel headers are no different, as they no longer include userspace classes (if annotated as such in the
security_classesfile).I assume though that you are adding your new class to the end of the
security_classeslist. Inserting a class before an existing one can perturb the values of the existing classes, which isn't a good idea (forbidden for kernel classes and any userspace object managers that use the old libselinux API; permissible for new userspace object classes when they use the dynamic class/permission discovery support but can still break running applications until we have support for remapping upon reload there).Quoted 7 lines
Quoted 7 lines
--
Stephen Smalley
National Security Agency--
Stephen Smalley
National Security Agency
Signature · 8 lines
Stephen Smalley National Security Agency -- 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.
Quoted 70 lines · Stephen Smalley
Quoted 4 lines · Xavier Toth
I installed the corresponding selinux-policy-devel rpm. I see references to my class in
/usr/share/selinux/devel/include/support/all_perms.sptAny other ideas on what to look at?(don't top-post, and don't trim the cc list, please)
At this point I need to see a copy of the .te file and the precise output from the failed build.
Quoted 49 lines · Stephen Smalley
Quoted 48 lines · Xavier Toth
Quoted 7 lines
I appended the class declaration to the
security_classesfiles.I have installed the new policy and libselinux. However now when trying to use this new class in a te file the build fails with an 'unknown class' error. Do I need to rebuild any other packages before I can use this class? I tried rebuilding checkpolicy but that didn't help.
Rebuilding checkpolicy isn't necessary. In fact, you don't even really need the rebuilt libselinux if using the dynamic object class/permission discovery support, since that will map the class and permission strings to values via the kernel's selinuxfs interface.
I'm guessing that you are trying to build a policy module using the policy headers provided by the Fedora policy rather than the ones provided by your rebuilt policy, and those headers lack the new definitions.
Quoted 27 lines · Stephen Smalley
Quoted 25 lines · Xavier Toth
Quoted 2 lines
If the new security class is a userspace object manager related class do I still need to rebuild the kernel?
No. You should find that the regenerated kernel headers are no different, as they no longer include userspace classes (if annotated as such in the
security_classesfile).I assume though that you are adding your new class to the end of the
security_classeslist. Inserting a class before an existing one can perturb the values of the existing classes, which isn't a good idea (forbidden for kernel classes and any userspace object managers that use the old libselinux API; permissible for new userspace object classes when they use the dynamic class/permission discovery support but can still break running applications until we have support for remapping upon reload there).--
Stephen Smalley
National Security AgencyQuoted 7 lines
Quoted 7 lines
--
Stephen Smalley
National Security Agency
Quoted 7 lines
--
Stephen Smalley
National Security Agency
I use gmail
This te file is not the finally resting place for copy/paste policy simply a convenient place to try out the class.
[tedx@comms hack-policy]$ make rebuild
rm -f /home/tedx/src2/Linux_i386/OED/policy/hack-policy.pp rm -f *.CKP *.ln *.o core errs ,* *~ .emacs_* tags TAGS make.log *.i
if [ ! -d /usr/share/selinux/devel/include/jcdx ]; then \ sudo mkdir /usr/share/selinux/devel/include/jcdx; \ sudo chmod 777 /usr/share/selinux/devel/include/jcdx; \ fi; \ cp hack-policy.if /usr/share/selinux/devel/include/jcdx;
rm -f /usr/share/selinux/devel/include/jcdx/hack-policy.if
make -f /usr/share/selinux/devel/Makefile
make[1]: Entering directory `/home/tedx/src2/hack-policy' Compiling mls hack-policy module/usr/bin/checkmodule: loading policy configuration from tmp/hack-policy.tmp hack-policy.te":30:ERROR 'unknown class x_application_data used in rule' at token ';' on line 3343:
allow x_rootwindow_t self:x_application_data paste_without_confirm; ;/usr/bin/checkmodule: error(s) encountered while parsing configuration make[1]: *** [tmp/hack-policy.mod] Error 1
make[1]: Leaving directory `/home/tedx/src2/hack-policy'
make: *** [progs] Error 2
Quoted 11 lines · Xavier Toth
This te file is not the finally resting place for copy/paste policy simply a convenient place to try out the class.
[tedx@comms hack-policy]$ make rebuild
rm -f/home/tedx/src2/Linux_i386/OED/policy/hack-policy.pprm -f *.CKP *.ln *.o core errs ,* *~ .emacs_* tags TAGS make.log *.iif [ ! -d /usr/share/selinux/devel/include/jcdx ]; then \ sudo mkdir /usr/share/selinux/devel/include/jcdx; \ sudo chmod 777 /usr/share/selinux/devel/include/jcdx; \ fi; \ cp hack-policy.if /usr/share/selinux/devel/include/jcdx;
Quoted 13 lines
rm -f
/usr/share/selinux/devel/include/jcdx/hack-policy.if
make -f/usr/share/selinux/devel/Makefile
make[1]: Entering directory `/home/tedx/src2/hack-policy' Compiling mls hack-policy module/usr/bin/checkmodule: loading policy configuration from tmp/hack-policy.tmp hack-policy.te":30:ERROR 'unknown classx_application_dataused in rule' at token ';' on line 3343:
allowx_rootwindow_tself:x_application_datapaste_without_confirm; ;/usr/bin/checkmodule: error(s) encountered while parsing configuration make[1]: *** [tmp/hack-policy.mod] Error 1
make[1]: Leaving directory `/home/tedx/src2/hack-policy'
make: *** [progs] Error 2
You need a
require {
class x_application_data { paste_without_confirm };
}statement in your module or one of the interfaces it uses.
policy_module() only automatically imports requires for the kernel classes and perms, I think.
Signature · 8 lines
Stephen Smalley National Security Agency -- 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.
Quoted 37 lines · Stephen Smalley
Quoted 11 lines · Xavier Toth
This te file is not the finally resting place for copy/paste policy simply a convenient place to try out the class.
[tedx@comms hack-policy]$ make rebuild
rm -f/home/tedx/src2/Linux_i386/OED/policy/hack-policy.pprm -f *.CKP *.ln *.o core errs ,* *~ .emacs_* tags TAGS make.log *.iif [ ! -d /usr/share/selinux/devel/include/jcdx ]; then \ sudo mkdir /usr/share/selinux/devel/include/jcdx; \ sudo chmod 777 /usr/share/selinux/devel/include/jcdx; \ fi; \ cp hack-policy.if /usr/share/selinux/devel/include/jcdx;Quoted 13 lines
rm -f
/usr/share/selinux/devel/include/jcdx/hack-policy.if
make -f/usr/share/selinux/devel/Makefile
make[1]: Entering directory `/home/tedx/src2/hack-policy' Compiling mls hack-policy module/usr/bin/checkmodule: loading policy configuration from tmp/hack-policy.tmp hack-policy.te":30:ERROR 'unknown classx_application_dataused in rule' at token ';' on line 3343:
allowx_rootwindow_tself:x_application_datapaste_without_confirm; ;/usr/bin/checkmodule: error(s) encountered while parsing configuration make[1]: *** [tmp/hack-policy.mod] Error 1
make[1]: Leaving directory `/home/tedx/src2/hack-policy'
make: *** [progs] Error 2You need a
require { class x_application_data { paste_without_confirm };}
statement in your module or one of the interfaces it uses.
policy_module()only automatically imports requires for the kernel classes and perms, I think.
Quoted 7 lines
--
Stephen Smalley
National Security Agency
That did it, thanks.
--
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.
Quoted 26 lines · Stephen Smalley
Quoted 11 lines · Xavier Toth
This te file is not the finally resting place for copy/paste policy simply a convenient place to try out the class.
[tedx@comms hack-policy]$ make rebuild
rm -f/home/tedx/src2/Linux_i386/OED/policy/hack-policy.pprm -f *.CKP *.ln *.o core errs ,* *~ .emacs_* tags TAGS make.log *.iif [ ! -d /usr/share/selinux/devel/include/jcdx ]; then \ sudo mkdir /usr/share/selinux/devel/include/jcdx; \ sudo chmod 777 /usr/share/selinux/devel/include/jcdx; \ fi; \ cp hack-policy.if /usr/share/selinux/devel/include/jcdx;Quoted 13 lines
rm -f
/usr/share/selinux/devel/include/jcdx/hack-policy.if
make -f/usr/share/selinux/devel/Makefile
make[1]: Entering directory `/home/tedx/src2/hack-policy' Compiling mls hack-policy module/usr/bin/checkmodule: loading policy configuration from tmp/hack-policy.tmp hack-policy.te":30:ERROR 'unknown classx_application_dataused in rule' at token ';' on line 3343:
allowx_rootwindow_tself:x_application_datapaste_without_confirm; ;/usr/bin/checkmodule: error(s) encountered while parsing configuration make[1]: *** [tmp/hack-policy.mod] Error 1
make[1]: Leaving directory `/home/tedx/src2/hack-policy'
make: *** [progs] Error 2
Quoted 8 lines
You need a
require { class x_application_data { paste_without_confirm }; }statement in your module or one of the interfaces it uses.
policy_module()only automatically imports requires for the kernel classes and perms, I think.
Correct, and it determines what is a kernel class by the userspace notation in security_classes.
Signature · 9 lines
Chris PeBenito Tresys Technology, LLC (410) 290-1411 x150 -- 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.