Asterisk on SELinux
Subsystems (2)
Hi,
apparently, the following statements are needed in net_contexts:
portcon udp 2727 system_u:object_r:asterisk_port_t
(sorry, i do not know what port udp/2727 is. google found "media gateway control protocol call agent (MGCP)" and "broadband voice")
and in in domains/asterisk.te:
# needed to have asterisk start allow asterisk_t self:process setsched;
# probably for talking to a running instance allow asterisk_t self:fifo_file rw_file_perms;
# the debian standard installation hasn't got all dirs needed allow asterisk_t asterisk_spool_t:dir create_dir_perms;
# not sure what is stored in tmp, but IAX related tmp_domain(asterisk)
# asterisk will need to allocate additional non-priv ports
# for VoIP voice channels. Yes i know this line is ugly.
# suggestions
allow asterisk_t port_t:{ udp_socket tcp_socket } name_bind;# for /proc/net/route it seems allow asterisk_t proc_t:file r_file_perms;
# demo files installed in /usr/share/asterisk/sounds/demo-instruct.gsm # are labeled usr_t allow asterisk_t usr_t:file r_file_perms;
# some helper apps are probably there
allow asterisk_t { bin_t sbin_t }:dir search;Unfortunately, while asterisk does now start (as root only, not as non-root-user... not sure why, but i think the user/group setup isn't right yet... how do i change a unix users primary group in selinux?) my test SIP call didn't get properly accepted.
Greetings,
Erich Schubert
Signature · 10 lines
erich@(vitavonni.de|debian.org) -- GPG Key ID: 4B3A135C (o_
There was never a good war or a bad peace. - Benjamin Franklin //\
Es ist besser, geliebt und verloren zu haben, V_/_
als niemals geliebt zu haben.
--
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.Hi,
Quoted 4 lines
Unfortunately, while asterisk does now start (as root only, not as non-root-user... not sure why, but i think the user/group setup isn't right yet... how do i change a unix users primary group in selinux?) my test SIP call didn't get properly accepted.
Some log files had wrong permissions. Now asterisk works and i can call it using SIP. The echo test is fine, as is the AIX test to a remote site.
Greetings,
Erich Schubert
Signature · 11 lines
erich@(vitavonni.de|debian.org) -- GPG Key ID: 4B3A135C (o_
Go away or i'll replace you with a very small shell script. //\
Die Stärke eines Menschen kann man daran messen, V_/_
wie er mit seinen Schwächen fertig wird!
--
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.[NB: repost, since the other address was not subscribed]
Hi,
One further rule is missing for asterisk console mode (use "asterisk -c -r" to attach) :
allow sysadm_t asterisk_t:unix_stream_socket { connectto rw_stream_socket_perms };
Allows sysadm to use the asterisk console (i.e. show status etc.)
Greetings,
Erich Schubert
Signature · 11 lines
erich@(vitavonni.de|debian.org) -- GPG Key ID: 4B3A135C (o_
To understand recursion you first need to understand recursion. //\
Die einzige Hoffnung auf Freude liegt in den menschlichen V_/_
Beziehungen. --- Antoine de Saint-Exupéry
--
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 2 lines · Erich Schubert
# the debian standard installation hasn't got all dirs needed allow asterisk_t asterisk_spool_t:dir create_dir_perms;
This is what create_dir_file() is for.
Quoted 2 lines
# some helper apps are probably there
allow asterisk_t { bin_t sbin_t }:dir search;There seems little point in allowing directory search without allowing it to do anything under that directory. This needs more investigation.
Quoted 4 lines
Unfortunately, while asterisk does now start (as root only, not as non-root-user... not sure why, but i think the user/group setup isn't right yet... how do i change a unix users primary group in selinux?) my test SIP call didn't get properly accepted.
UID/GID stuff works the same way in SE Linux as in regular Linux, except that sometimes what you want is not permitted. ;)
vipw/vigr do the usual stuff.
I've attached a patch for asterisk which includes the parts of your policy changes that I think are ready for inclusion. I don't think that the sbin_t part is complete and therefore it shouldn't go in yet.
Signature · 4 lines
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark http://www.coker.com.au/postal/ Postal SMTP/POP benchmark http://www.coker.com.au/~russell/ My home page
net_contexts renamed from usr/src/se/policy/net_contexts +1 -0
@@ -145,6 +145,7 @@ portcon tcp 1720 system_u:object_r:asterisk_port_t portcon tcp 2000 system_u:object_r:asterisk_port_t portcon udp 2427 system_u:object_r:asterisk_port_t +portcon udp 2727 system_u:object_r:asterisk_port_t portcon udp 4569 system_u:object_r:asterisk_port_t portcon udp 5060 system_u:object_r:asterisk_port_t ')
program/unused/asterisk.te renamed from usr/src/se/policy/domains/program/unused/asterisk.te +16 -2
@@ -10,24 +10,37 @@ allow asterisk_t asterisk_var_run_t:{ sock_file fifo_file } create_file_perms; allow initrc_t asterisk_var_run_t:fifo_file unlink; +allow asterisk_t self:process setsched; +allow asterisk_t self:fifo_file rw_file_perms; + +allow asterisk_t proc_t:file { getattr read }; + etcdir_domain(asterisk) logdir_domain(asterisk) var_lib_domain(asterisk) -allow asterisk_t asterisk_port_t:{ udp_socket tcp_socket } name_bind; +allow asterisk_t asterisk_port_t:{ udp_socket tcp_socket } name_bind; + +# for VOIP voice channels. +aollow asterisk_t port_t:{ udp_socket tcp_socket } name_bind; allow asterisk_t device_t:lnk_file read; allow asterisk_t sound_device_t:chr_file rw_file_perms; type asterisk_spool_t, file_type, sysadmfile; -rw_dir_create_file(asterisk_t, asterisk_spool_t) +create_dir_file(asterisk_t, asterisk_spool_t) allow asterisk_t var_spool_t:dir search; +# demo files installed in /usr/share/asterisk/sounds/demo-instruct.gsm +# are labeled usr_t +allow asterisk_t usr_t:file r_file_perms; + can_network(asterisk_t) can_ypbind(asterisk_t) allow asterisk_t etc_t:file { getattr read }; allow asterisk_t self:unix_stream_socket { connectto create_stream_socket_perms }; +allow sysadm_t asterisk_t:unix_stream_socket { connectto rw_stream_socket_perms }; allow asterisk_t self:sem create_sem_perms; allow asterisk_t self:shm create_shm_perms;
@@ -35,3 +48,4 @@ allow asterisk_t self:capability dac_override; tmpfs_domain(asterisk) +tmp_domain(asterisk)
Merged.
Quoted 25 lines · Russell Coker
Quoted 2 lines · Erich Schubert
# the debian standard installation hasn't got all dirs needed allow asterisk_t asterisk_spool_t:dir create_dir_perms;This is what
create_dir_file()is for.Quoted 2 lines
# some helper apps are probably there allow asterisk_t { bin_t sbin_t }:dir search;There seems little point in allowing directory search without allowing it to do anything under that directory. This needs more investigation.
Quoted 4 lines
Unfortunately, while asterisk does now start (as root only, not as non-root-user... not sure why, but i think the user/group setup isn't right yet... how do i change a unix users primary group in selinux?) my test SIP call didn't get properly accepted.
UID/GID stuff works the same way in SE Linux as in regular Linux, except that sometimes what you want is not permitted. ;)
vipw/vigr do the usual stuff.
I've attached a patch for asterisk which includes the parts of your policy changes that I think are ready for inclusion. I don't think that the
sbin_tpart is complete and therefore it shouldn't go in yet.
Signature · 7 lines
James Carter <[email protected]> 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.