how to compile te with checkpolicy.
Hi all,
These days I tried to compile te with tools named checkpolicy. I have searched the process with google and chatgpt, and I followed the steps they told me but I failed.
The following is my te file, cmd and response and other infomation.
My te file(my_policy.te):
----------------------------------------------policy_module(my_mypolicy, 1.0)
# Define types
type my_type_t;
type my_type_exec_t, file_type;
# Allow rules
allow my_type_t my_type_exec_t:file execute;
----------------------------------------------
The command:
----------------------------------------------
sudo checkpolicy -M -o my_policy.pp my_policy.te
----------------------------------------------
The response from command:
----------------------------------------------
my_policy.te:1:ERROR 'syntax error' at token 'policy_module' on line 1:
checkpolicy: error(s) encountered while parsing configuration
----------------------------------------------
OS information: 6.11.0-29-generic, ubuntu 24.10.
Would you like help me to compile te with checkpolicy please? Or which URL should I read please?
Best regards
BOBx
Quoted 5 lines · BOBx
Hi all,
These days I tried to compile te with tools named checkpolicy. I have searched the process with google and chatgpt, and I followed the steps they told me but I failed.
Hi,
checkpolicy is for monolithic policy. see below for modular policy:
Quoted 5 lines
The following is my te file, cmd and response and other infomation.
My te
file(my_policy.te):
----------------------------------------------
This is modular policy that should be compiled with checkmodule and then packaged with semodule_package:
checkmodule -M -m my_policy.te -o my_policy.modsemodule_package -o my_policy.pp -m my_policy.mod
semodule -i my_policy.pp
for more information see:
man checkpolicy
man checkmodule
man semodule_package
man semodule
Quoted 34 lines
policy_module(my_mypolicy, 1.0)# Define types
typemy_type_t;
typemy_type_exec_t,file_type;# Allow rules
allowmy_type_tmy_type_exec_t:file execute;
----------------------------------------------The command:
----------------------------------------------
sudo checkpolicy -M -o my_policy.pp my_policy.te
----------------------------------------------The response from command:
----------------------------------------------
my_policy.te:1:ERROR 'syntax error' at token 'policy_module' on line 1:checkpolicy: error(s) encountered while parsing configuration
----------------------------------------------OS information: 6.11.0-29-generic, ubuntu 24.10.
Would you like help me to compile te with checkpolicy please? Or which URL should I read please?
Best regards
BOBx
Signature · 4 lines
gpg --locate-keys [email protected] (wkd) Key fingerprint = FCD2 3660 5D6B 9D27 7FC6 E0FF DA7E 521F 10F6 4098 Dominick Grift Mastodon: @[email protected]
Quoted 13 lines · Dominick Grift
Quoted 5 lines · BOBx
Hi all,
These days I tried to compile te with tools named checkpolicy. I have searched the process with google and chatgpt, and I followed the steps they told me but I failed.
Hi,
checkpolicy is for monolithic policy. see below for modular policy:
Quoted 1 line
Quoted 7 lines
Quoted 4 lines
The following is my te file, cmd and response and other infomation.
My te
file(my_policy.te):
----------------------------------------------This is modular policy that should be compiled with checkmodule and then packaged with
semodule_package:
Oops.
Actually I am wrong. This is reference policy.
I should be compiled with the reference policy makefile. I am not sure what package provides this Makefile in ubuntu but probably package selinux-policy-dev:
https://packages.ubuntu.com/questing/all/selinux-policy-dev/filelist
/usr/share/selinux/devel/Makefile
So this should work:
make -f /usr/share/selinux/devel/Makefile my_policy.pp
Quoted 46 lines
checkmodule -M -m my_policy.te -o my_policy.mod
semodule_package-o my_policy.pp -m my_policy.mod
semodule -i my_policy.ppfor more information see:
man checkpolicy
man checkmodule
mansemodule_package
man semoduleQuoted 34 lines
policy_module(my_mypolicy, 1.0)# Define types
typemy_type_t;
typemy_type_exec_t,file_type;# Allow rules
allowmy_type_tmy_type_exec_t:file execute;
----------------------------------------------The command:
----------------------------------------------
sudo checkpolicy -M -o my_policy.pp my_policy.te
----------------------------------------------The response from command:
----------------------------------------------
my_policy.te:1:ERROR 'syntax error' at token 'policy_module' on line 1:checkpolicy: error(s) encountered while parsing configuration
----------------------------------------------OS information: 6.11.0-29-generic, ubuntu 24.10.
Would you like help me to compile te with checkpolicy please? Or which URL should I read please?
Best regards
BOBx
Signature · 4 lines
gpg --locate-keys [email protected] (wkd) Key fingerprint = FCD2 3660 5D6B 9D27 7FC6 E0FF DA7E 521F 10F6 4098 Dominick Grift Mastodon: @[email protected]
Quoted 25 lines · Dominick Grift
Quoted 9 lines · Dominick Grift
Quoted 5 lines · BOBx
Hi all,
These days I tried to compile te with tools named checkpolicy. I have searched the process with google and chatgpt, and I followed the steps they told me but I failed.
Hi,
Quoted 8 lines
checkpolicy is for monolithic policy. see below for modular policy:
Quoted 4 lines
The following is my te file, cmd and response and other infomation.
My te
file(my_policy.te):
----------------------------------------------This is modular policy that should be compiled with checkmodule and then packaged with
semodule_package:Oops.
Actually I am wrong. This is reference policy.
I should be compiled with the reference policy makefile. I am not sure what package provides thisMakefilein ubuntu but probably package selinux-policy-dev:
Quoted 7 lines
https://packages.ubuntu.com/questing/all/selinux-policy-dev/filelist
/usr/share/selinux/devel/MakefileSo this should work:
make -f
/usr/share/selinux/devel/Makefilemy_policy.pp
I use this command generate pp file well.
Quoted 1 line
Quoted 1 line
checkmodule -M -m my_policy.te -o my_policy.mod
This command doesn't work. The response is :
----------------------------------------------------
my_policy.te:1:ERROR 'Building a policy module, but no module specification found. ' at token 'policy_module' on line 1:
checkmodule: error(s) encountered while parsing configuration
--------------------------------------------------
It seems the articles from search engine are not wrong.
Quoted 44 lines
Quoted 44 lines
semodule_package-o my_policy.pp -m my_policy.mod
semodule -i my_policy.ppfor more information see:
man checkpolicy
man checkmodule
mansemodule_package
man semoduleQuoted 34 lines
policy_module(my_mypolicy, 1.0)# Define types
typemy_type_t;
typemy_type_exec_t,file_type;# Allow rules
allowmy_type_tmy_type_exec_t:file execute;
----------------------------------------------The command:
----------------------------------------------
sudo checkpolicy -M -o my_policy.pp my_policy.te
----------------------------------------------The response from command:
----------------------------------------------
my_policy.te:1:ERROR 'syntax error' at token 'policy_module' on line 1:checkpolicy: error(s) encountered while parsing configuration
----------------------------------------------OS information: 6.11.0-29-generic, ubuntu 24.10.
Would you like help me to compile te with checkpolicy please? Or which URL should I read please?
Best regards
BOBx
Quoted 33 lines · Fei Shao
Quoted 25 lines · Dominick Grift
Quoted 9 lines · Dominick Grift
Quoted 5 lines · BOBx
Hi all,
These days I tried to compile te with tools named checkpolicy. I have searched the process with google and chatgpt, and I followed the steps they told me but I failed.
Hi,
Quoted 8 lines
checkpolicy is for monolithic policy. see below for modular policy:
Quoted 4 lines
The following is my te file, cmd and response and other infomation.
My te
file(my_policy.te):
----------------------------------------------This is modular policy that should be compiled with checkmodule and then packaged with
semodule_package:Oops.
Actually I am wrong. This is reference policy.
I should be compiled with the reference policy makefile. I am not sure what package provides thisMakefilein ubuntu but probably package selinux-policy-dev:Quoted 7 lines
https://packages.ubuntu.com/questing/all/selinux-policy-dev/filelist
/usr/share/selinux/devel/MakefileSo this should work:
make -f
/usr/share/selinux/devel/Makefilemy_policy.pp
Quoted 8 lines
I use this command generate pp file well.
Quoted 1 line
Quoted 1 line
checkmodule -M -m my_policy.te -o my_policy.mod
This command doesn't work. The response is :
----------------------------------------------------
my_policy.te:1:ERROR 'Building a policy module, but no module specification found.
' at token 'policy_module' on line 1:
Yes the policy_module() macro is reference policy specific and checkmodule does not understand reference policy.
For reference policy use the reference policy Makefile.
Quoted 52 lines
checkmodule: error(s) encountered while parsing configuration
--------------------------------------------------
It seems the articles from search engine are not wrong.Quoted 44 lines
Quoted 44 lines
semodule_package-o my_policy.pp -m my_policy.mod
semodule -i my_policy.ppfor more information see:
man checkpolicy
man checkmodule
mansemodule_package
man semoduleQuoted 34 lines
policy_module(my_mypolicy, 1.0)# Define types
typemy_type_t;
typemy_type_exec_t,file_type;# Allow rules
allowmy_type_tmy_type_exec_t:file execute;
----------------------------------------------The command:
----------------------------------------------
sudo checkpolicy -M -o my_policy.pp my_policy.te
----------------------------------------------The response from command:
----------------------------------------------
my_policy.te:1:ERROR 'syntax error' at token 'policy_module' on line 1:checkpolicy: error(s) encountered while parsing configuration
----------------------------------------------OS information: 6.11.0-29-generic, ubuntu 24.10.
Would you like help me to compile te with checkpolicy please? Or which URL should I read please?
Best regards
BOBx
Signature · 4 lines
gpg --locate-keys [email protected] (wkd) Key fingerprint = FCD2 3660 5D6B 9D27 7FC6 E0FF DA7E 521F 10F6 4098 Dominick Grift Mastodon: @[email protected]
Quoted 43 lines · Dominick Grift
Quoted 33 lines · BOBx
Quoted 25 lines · Dominick Grift
Quoted 9 lines · Dominick Grift
Quoted 5 lines · BOBx
Hi all,
These days I tried to compile te with tools named checkpolicy. I have searched the process with google and chatgpt, and I followed the steps they told me but I failed.
Hi,
Quoted 8 lines
checkpolicy is for monolithic policy. see below for modular policy:
Quoted 4 lines
The following is my te file, cmd and response and other infomation.
My te
file(my_policy.te):
----------------------------------------------This is modular policy that should be compiled with checkmodule and then packaged with
semodule_package:Oops.
Actually I am wrong. This is reference policy.
I should be compiled with the reference policy makefile. I am not sure what package provides thisMakefilein ubuntu but probably package selinux-policy-dev:Quoted 7 lines
https://packages.ubuntu.com/questing/all/selinux-policy-dev/filelist
/usr/share/selinux/devel/MakefileSo this should work:
make -f
/usr/share/selinux/devel/Makefilemy_policy.ppQuoted 8 lines
I use this command generate pp file well.
Quoted 1 line
Quoted 1 line
checkmodule -M -m my_policy.te -o my_policy.mod
This command doesn't work. The response is :
----------------------------------------------------
my_policy.te:1:ERROR 'Building a policy module, but no module specification found.
' at token 'policy_module' on line 1:
Quoted 4 lines
Yes the
policy_module()macro is reference policy specific and checkmodule does not understand reference policy.For reference policy use the reference policy
Makefile.
Got it。Thanks。
Quoted 50 lines
Quoted 50 lines
checkmodule: error(s) encountered while parsing configuration
--------------------------------------------------
It seems the articles from search engine are not wrong.Quoted 44 lines
Quoted 44 lines
semodule_package-o my_policy.pp -m my_policy.mod
semodule -i my_policy.ppfor more information see:
man checkpolicy
man checkmodule
mansemodule_package
man semoduleQuoted 34 lines
policy_module(my_mypolicy, 1.0)# Define types
typemy_type_t;
typemy_type_exec_t,file_type;# Allow rules
allowmy_type_tmy_type_exec_t:file execute;
----------------------------------------------The command:
----------------------------------------------
sudo checkpolicy -M -o my_policy.pp my_policy.te
----------------------------------------------The response from command:
----------------------------------------------
my_policy.te:1:ERROR 'syntax error' at token 'policy_module' on line 1:checkpolicy: error(s) encountered while parsing configuration
----------------------------------------------OS information: 6.11.0-29-generic, ubuntu 24.10.
Would you like help me to compile te with checkpolicy please? Or which URL should I read please?
Best regards
BOBx