In a custom module, is there a way to allow all permissions for files/directories?
up vote
1
down vote
favorite
I've written a custom selinux module that looks something like this:
require {
type my_app_t;
type my_app_file_t;
class file { getattr lock open read write execute execute_no_trans ioctl append setattr };
class dir { write search getattr };
}
allow my_app_t my_app_file_t:file { append setattr write getattr execute read open execute_no_trans lock ioctl};
allow my_app_t my_app_file_t:dir { write search getattr};
This mostly works OK, but I'm tired of adding new perms every time a new deny shows up in audit.log. Is there any way to just allow all permissions for files/directories with a given context? For instance:
require {
type my_app_t;
type my_app_file_t;
class file { * };
class dir { * };
}
allow my_app_t my_app_file_t:file { * };
allow my_app_t my_app_file_t:dir { * };
selinux
add a comment |
up vote
1
down vote
favorite
I've written a custom selinux module that looks something like this:
require {
type my_app_t;
type my_app_file_t;
class file { getattr lock open read write execute execute_no_trans ioctl append setattr };
class dir { write search getattr };
}
allow my_app_t my_app_file_t:file { append setattr write getattr execute read open execute_no_trans lock ioctl};
allow my_app_t my_app_file_t:dir { write search getattr};
This mostly works OK, but I'm tired of adding new perms every time a new deny shows up in audit.log. Is there any way to just allow all permissions for files/directories with a given context? For instance:
require {
type my_app_t;
type my_app_file_t;
class file { * };
class dir { * };
}
allow my_app_t my_app_file_t:file { * };
allow my_app_t my_app_file_t:dir { * };
selinux
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I've written a custom selinux module that looks something like this:
require {
type my_app_t;
type my_app_file_t;
class file { getattr lock open read write execute execute_no_trans ioctl append setattr };
class dir { write search getattr };
}
allow my_app_t my_app_file_t:file { append setattr write getattr execute read open execute_no_trans lock ioctl};
allow my_app_t my_app_file_t:dir { write search getattr};
This mostly works OK, but I'm tired of adding new perms every time a new deny shows up in audit.log. Is there any way to just allow all permissions for files/directories with a given context? For instance:
require {
type my_app_t;
type my_app_file_t;
class file { * };
class dir { * };
}
allow my_app_t my_app_file_t:file { * };
allow my_app_t my_app_file_t:dir { * };
selinux
I've written a custom selinux module that looks something like this:
require {
type my_app_t;
type my_app_file_t;
class file { getattr lock open read write execute execute_no_trans ioctl append setattr };
class dir { write search getattr };
}
allow my_app_t my_app_file_t:file { append setattr write getattr execute read open execute_no_trans lock ioctl};
allow my_app_t my_app_file_t:dir { write search getattr};
This mostly works OK, but I'm tired of adding new perms every time a new deny shows up in audit.log. Is there any way to just allow all permissions for files/directories with a given context? For instance:
require {
type my_app_t;
type my_app_file_t;
class file { * };
class dir { * };
}
allow my_app_t my_app_file_t:file { * };
allow my_app_t my_app_file_t:dir { * };
selinux
selinux
asked Dec 5 at 20:02
jayhendren
5,31721444
5,31721444
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
You should consider using reference policy macros. Using reference policy macros, you can then use manage_files_pattern
macro to allow all access, for example:
manage_files_pattern(my_app_t, my_app_file_t, my_app_file_t)
There are also macros for other commonly used patterns, located at /policy/support
in the reference policy source.
If my_app_t
is defined by a reference policy module, there likely already exists an interface, which you can use to allow access. Interfaces are documented in reference policy API documentation (provided by selinux-policy-doc
package) and are also available online (however a bit outdated).
The easiest way to build a reference policy module is by using the makefile in SELinux policy development package (selinux-policy-devel
or similar) of your distribution, for example: make -f /usr/share/selinux/devel/Makefile my_app.pp
.
Thanks. I didn't know themanage_files_pattern
macro existed. In my particular case,my_app_t
andmy_app_file_t
are actually defined in my module, I just didn't include them in my question because it didn't seem relevant.
– jayhendren
yesterday
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
You should consider using reference policy macros. Using reference policy macros, you can then use manage_files_pattern
macro to allow all access, for example:
manage_files_pattern(my_app_t, my_app_file_t, my_app_file_t)
There are also macros for other commonly used patterns, located at /policy/support
in the reference policy source.
If my_app_t
is defined by a reference policy module, there likely already exists an interface, which you can use to allow access. Interfaces are documented in reference policy API documentation (provided by selinux-policy-doc
package) and are also available online (however a bit outdated).
The easiest way to build a reference policy module is by using the makefile in SELinux policy development package (selinux-policy-devel
or similar) of your distribution, for example: make -f /usr/share/selinux/devel/Makefile my_app.pp
.
Thanks. I didn't know themanage_files_pattern
macro existed. In my particular case,my_app_t
andmy_app_file_t
are actually defined in my module, I just didn't include them in my question because it didn't seem relevant.
– jayhendren
yesterday
add a comment |
up vote
1
down vote
You should consider using reference policy macros. Using reference policy macros, you can then use manage_files_pattern
macro to allow all access, for example:
manage_files_pattern(my_app_t, my_app_file_t, my_app_file_t)
There are also macros for other commonly used patterns, located at /policy/support
in the reference policy source.
If my_app_t
is defined by a reference policy module, there likely already exists an interface, which you can use to allow access. Interfaces are documented in reference policy API documentation (provided by selinux-policy-doc
package) and are also available online (however a bit outdated).
The easiest way to build a reference policy module is by using the makefile in SELinux policy development package (selinux-policy-devel
or similar) of your distribution, for example: make -f /usr/share/selinux/devel/Makefile my_app.pp
.
Thanks. I didn't know themanage_files_pattern
macro existed. In my particular case,my_app_t
andmy_app_file_t
are actually defined in my module, I just didn't include them in my question because it didn't seem relevant.
– jayhendren
yesterday
add a comment |
up vote
1
down vote
up vote
1
down vote
You should consider using reference policy macros. Using reference policy macros, you can then use manage_files_pattern
macro to allow all access, for example:
manage_files_pattern(my_app_t, my_app_file_t, my_app_file_t)
There are also macros for other commonly used patterns, located at /policy/support
in the reference policy source.
If my_app_t
is defined by a reference policy module, there likely already exists an interface, which you can use to allow access. Interfaces are documented in reference policy API documentation (provided by selinux-policy-doc
package) and are also available online (however a bit outdated).
The easiest way to build a reference policy module is by using the makefile in SELinux policy development package (selinux-policy-devel
or similar) of your distribution, for example: make -f /usr/share/selinux/devel/Makefile my_app.pp
.
You should consider using reference policy macros. Using reference policy macros, you can then use manage_files_pattern
macro to allow all access, for example:
manage_files_pattern(my_app_t, my_app_file_t, my_app_file_t)
There are also macros for other commonly used patterns, located at /policy/support
in the reference policy source.
If my_app_t
is defined by a reference policy module, there likely already exists an interface, which you can use to allow access. Interfaces are documented in reference policy API documentation (provided by selinux-policy-doc
package) and are also available online (however a bit outdated).
The easiest way to build a reference policy module is by using the makefile in SELinux policy development package (selinux-policy-devel
or similar) of your distribution, for example: make -f /usr/share/selinux/devel/Makefile my_app.pp
.
edited 15 hours ago
answered 2 days ago
sebasth
8,00331846
8,00331846
Thanks. I didn't know themanage_files_pattern
macro existed. In my particular case,my_app_t
andmy_app_file_t
are actually defined in my module, I just didn't include them in my question because it didn't seem relevant.
– jayhendren
yesterday
add a comment |
Thanks. I didn't know themanage_files_pattern
macro existed. In my particular case,my_app_t
andmy_app_file_t
are actually defined in my module, I just didn't include them in my question because it didn't seem relevant.
– jayhendren
yesterday
Thanks. I didn't know the
manage_files_pattern
macro existed. In my particular case, my_app_t
and my_app_file_t
are actually defined in my module, I just didn't include them in my question because it didn't seem relevant.– jayhendren
yesterday
Thanks. I didn't know the
manage_files_pattern
macro existed. In my particular case, my_app_t
and my_app_file_t
are actually defined in my module, I just didn't include them in my question because it didn't seem relevant.– jayhendren
yesterday
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f486229%2fin-a-custom-module-is-there-a-way-to-allow-all-permissions-for-files-directorie%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown