hadoop 1/10 -- unconfined
PATCH 1/1 hadoop 1/10 -- unconfined
Well ive rewritten the policy as much as i ca with the information that i currently have.
Because of the use of the hadoop domain attributes i cannot determine whether it is the initrc script doing something or the application, and so i cannot currently finish the hadoop_domain_template policy. Also i have no clue what transitions to the hadoop_t domain. It does not own an initrc script so i gather it is no init daemon domain. Must be an application domain then? A lot of other things that arent, clear and/ or make no sense.
I have also left out things that i think, should be handled differently.
It would be cool if someone could test this policy and provide feedback in the shape of avc denials.
Some properties of this policy:
The hadoop init script domains must be started by the system, or by unconfined or sysadm_t by using run_init server <hadoop service>
To use the zookeeper client domain, the zookeeper_run_client domain must be called for a domain. (for example if you wish to run it as unconfined_t, you would call zookeeper_run_client(unconfined_t, unconfined_r) The zookeeper server seems to be an ordinary init daemon domain.
Since i do not know what kind of dommain hadoop_t is, it is currently pretty much unreachable. I have created an hadoop_domtrans interface that can be called but currently no role is allowed the hadoop_t domain.
---
:100644 100644 2ecdde8... 7a1b5de... M policy/modules/kernel/corenetwork.te.in
:000000 100644 0000000... bce5d29... A policy/modules/services/hadoop.fc
:000000 100644 0000000... 462d851... A policy/modules/services/hadoop.if
:000000 100644 0000000... 880f09a... A policy/modules/services/hadoop.te
policy/modules/kernel/corenetwork.te.in | 4 + policy/modules/services/hadoop.fc | 34 +++ policy/modules/services/hadoop.if | 294 +++++++++++++++++++++++++++ policy/modules/services/hadoop.te | 339 +++++++++++++++++++++++++++++++ 4 files changed, 671 insertions(+), 0 deletions(-)
policy/modules/kernel/corenetwork.te.in +4 -0
@@ -105,6 +105,7 @@ network_port(giftd, tcp,1213,s0) network_port(git, tcp,9418,s0, udp,9418,s0) network_port(gopher, tcp,70,s0, udp,70,s0) network_port(gpsd, tcp,2947,s0) +network_port(hadoop_namenode, tcp, 8020,s0) network_port(hddtemp, tcp,7634,s0) network_port(howl, tcp,5335,s0, udp,5353,s0) network_port(hplip, tcp,1782,s0, tcp,2207,s0, tcp,2208,s0, tcp, 8290,s0, tcp,50000,s0, tcp,50002,s0, tcp,8292,s0, tcp,9100,s0, tcp,9101,s0, tcp,9102,s0, tcp,9220,s0, tcp,9221,s0, tcp,9222,s0, tcp,9280,s0, tcp,9281,s0, tcp,9282,s0, tcp,9290,s0, tcp,9291,s0, tcp,9292,s0)
@@ -211,6 +212,9 @@ network_port(xdmcp, udp,177,s0, tcp,177,s0) network_port(xen, tcp,8002,s0) network_port(xfs, tcp,7100,s0) network_port(xserver, tcp,6000-6020,s0) +network_port(zookeeper_client, tcp, 2181,s0) +network_port(zookeeper_election, tcp, 3888,s0) +network_port(zookeeper_leader, tcp, 2888,s0) network_port(zebra, tcp,2600-2604,s0, tcp,2606,s0, udp,2600-2604,s0, udp,2606,s0) network_port(zope, tcp,8021,s0)
policy/modules/services/hadoop.fc new file +34 -0
@@ -0,0 +1,34 @@ +/etc/hadoop.*(/.*)? gen_context(system_u:object_r:hadoop_etc_t,s0) +/etc/zookeeper(/.*)? gen_context(system_u:object_r:zookeeper_etc_t,s0) +/etc/zookeeper\.dist(/.*)? gen_context(system_u:object_r:zookeeper_etc_t,s0) + +/etc/rc\.d/init\.d/hadoop-(.*)?-datanode -- gen_context(system_u:object_r:hadoop_datanode_initrc_exec_t,s0) +/etc/rc\.d/init\.d/hadoop-(.*)?-jobtracker -- gen_context(system_u:object_r:hadoop_jobtracker_initrc_exec_t,s0) +/etc/rc\.d/init\.d/hadoop-(.*)?-namenode -- gen_context(system_u:object_r:hadoop_namenode_initrc_exec_t,s0) +/etc/rc\.d/init\.d/hadoop-(.*)?-secondarynamenode -- gen_context(system_u:object_r:hadoop_secondarynamenode_initrc_exec_t,s0) +/etc/rc\.d/init\.d/hadoop-(.*)?-tasktracker -- gen_context(system_u:object_r:hadoop_tasktracker_initrc_exec_t,s0) +/etc/rc\.d/init\.d/hadoop-zookeeper -- gen_context(system_u:object_r:zookeeper_server_initrc_exec_t,s0) + +/usr/lib/hadoop(.*)?/bin/hadoop -- gen_context(system_u:object_r:hadoop_exec_t,s0) + +/usr/bin/zookeeper-client -- gen_context(system_u:object_r:zookeeper_exec_t,s0) +/usr/bin/zookeeper-server -- gen_context(system_u:object_r:zookeeper_server_exec_t,s0) + +/var/zookeeper(/.*)? gen_context(system_u:object_r:zookeeper_server_var_t,s0) + +/var/lib/hadoop(.*)? gen_context(system_u:object_r:hadoop_var_lib_t,s0) +/var/lib/hadoop(.*)?/cache/hadoop/dfs/data(/.*)? gen_context(system_u:object_r:hadoop_datanode_var_lib_t,s0) +/var/lib/hadoop(.*)?/cache/hadoop/mapred/local/jobTracker(/.*)? gen_context(system_u:object_r:hadoop_jobtracker_var_lib_t,s0) +/var/lib/hadoop(.*)?/cache/hadoop/dfs/name(/.*)? gen_context(system_u:object_r:hadoop_namenode_var_lib_t,s0) +/var/lib/hadoop(.*)?/cache/hadoop/dfs/namesecondary(/.*)? gen_context(system_u:object_r:hadoop_secondarynamenode_var_lib_t,s0) +/var/lib/hadoop(.*)?/cache/hadoop/mapred/local/taskTracker(/.*)? gen_context(system_u:object_r:hadoop_tasktracker_data_t,s0) + +/var/log/hadoop(.*)? gen_context(system_u:object_r:hadoop_log_t,s0) +/var/log/hadoop(.*)?/hadoop-hadoop-datanode-(.*)? gen_context(system_u:object_r:hadoop_datanode_log_t,s0) +/var/log/hadoop(.*)?/hadoop-hadoop-jobtracker-(.*)? gen_context(system_u:object_r:hadoop_jobtracker_log_t,s0) +/var/log/hadoop(.*)?/hadoop-hadoop-namenode-(.*)? gen_context(system_u:object_r:hadoop_namenode_log_t,s0) +/var/log/hadoop(.*)?/hadoop-hadoop-secondarynamenode-(.*)? gen_context(system_u:object_r:hadoop_secondarynamenode_log_t,s0) +/var/log/hadoop(.*)?/hadoop-hadoop-tasktracker-(.*)? gen_context(system_u:object_r:hadoop_tasktracker_log_t,s0) +/var/log/zookeeper(/.*)? gen_context(system_u:object_r:zookeeper_log_t,s0) + +/var/run/hadoop(.*)? gen_context(system_u:object_r:hadoop_var_run_t,s0)
policy/modules/services/hadoop.if new file +294 -0
294 lines not on this page · raw message
policy/modules/services/hadoop.te new file +339 -0
339 lines not on this page · raw message
Signature · 9 lines
1.7.2.3 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20100921/58913164/attachment.bin
PATCH 1/1 hadoop 1/10 -- unconfined
Quoted 2 lines · Dominick Grift
Well ive rewritten the policy as much as i ca with the information that i currently have.
Because of the use of the hadoop domain attributes i cannot determine whether it is the initrc script doing something or the application, and so i cannot currently finish thehadoop_domain_templatepolicy.
The hadoop_domain policy is basic stuff that most programs share, plus a few hadoop specific things. I initially had separate functions for initrc and hadoop type policy. Since we are not exporting hadoop specific functionality to other modules I removed them from the .if file.
Quoted 3 lines
Also i have no clue what transitions to the
hadoop_tdomain. It does not own an initrc script so i gather it is no init daemon domain. Must be an application domain then? A lot of other things that arent, clear and/ or make no sense.
I have also left out things that i think, should be handled differently.
hadoop_t is for the hadoop executable which is /usr/bin/hadoop. It does basic file system stuff, submits jobs and administers the cluster.
Quoted 1 line
It would be cool if someone could test this policy and provide feedback in the shape of avc denials.
I was able to get zookeeper server and client to run. Here is the audit2allow in permissive mode. Ignore the networking avcs. I didn't port the networking functions since it was built as a module. Zookeeper client doesn't domtrans into a domain. There is an semodule insert error. hadoop_tasktracker_data_t needs to be modified.
#============= zookeeper_server_t ==============
allow zookeeper_server_t java_exec_t:file { read getattr open execute execute_no_trans };
allow zookeeper_server_t net_conf_t:file { read getattr open };
allow zookeeper_server_t port_t:tcp_socket { name_bind name_connect };
allow zookeeper_server_t self:process execmem;
allow zookeeper_server_t self:tcp_socket { setopt read bind create accept write getattr connect shutdown listen };
Quoted 12 lines
Some properties of this policy:
The hadoop init script domains must be started by the system, or by unconfined or
sysadm_tby usingrun_initserver <hadoop service>
To use the zookeeper client domain, thezookeeper_run_clientdomain must be called for a domain. (for example if you wish to run it asunconfined_t, you would callzookeeper_run_client(unconfined_t, unconfined_r)The zookeeper server seems to be an ordinary init daemon domain.
Since i do not know what kind of dommainhadoop_tis, it is currently pretty much unreachable. I have created anhadoop_domtransinterface that can be called but currently no role is allowed thehadoop_tdomain.Signed-off-by Dominick Grift <[email protected]>_______________________________________________
refpolicy mailing list
refpolicy at oss.tresys.com
http://oss.tresys.com/mailman/listinfo/refpolicy
PATCH 1/1 hadoop 1/10 -- unconfined
Quoted 6 lines · Paul Nuzzi
Quoted 2 lines · Dominick Grift
Well ive rewritten the policy as much as i ca with the information that i currently have.
Because of the use of the hadoop domain attributes i cannot determine whether it is the initrc script doing something or the application, and so i cannot currently finish thehadoop_domain_templatepolicy.The
hadoop_domainpolicy is basic stuff that most programs share, plus a few hadoop specific things. I initially had separate functions for initrc and hadoop type policy. Since we are not exporting hadoop specific functionality to other modules I removed them from the .if file.
With that in mind, it looks like the policy has some duplicate rules.
Quoted 5 lines
Quoted 3 lines
Also i have no clue what transitions to the
hadoop_tdomain. It does not own an initrc script so i gather it is no init daemon domain. Must be an application domain then? A lot of other things that arent, clear and/ or make no sense.
I have also left out things that i think, should be handled differently.
hadoop_tis for the hadoop executable which is/usr/bin/hadoop. It does basic file system stuff, submits jobs and administers the cluster.
And who what runs it? who or/and what transitions to the hadoop_t domain?
Quoted 4 lines
Quoted 1 line
It would be cool if someone could test this policy and provide feedback in the shape of avc denials.
I was able to get zookeeper server and client to run. Here is the audit2allow in permissive mode. Ignore the networking avcs. I didn't port the networking functions since it was built as a module. Zookeeper client doesn't domtrans into a domain. There is an semodule insert error.
hadoop_tasktracker_data_tneeds to be modified.
Thanks i fixed that file context specification now.
Were you able to run the init script domains in permissive mode? Does it work when you use run_init? Do the initrc domains properly transition to the main domains in permissive mode?
Could you provides some avc denials of that?
You should also specify file contexts for the pid files and lock files.
Quoted 5 lines
#=============
zookeeper_server_t==============
allowzookeeper_server_tjava_exec_t:file { read getattr open executeexecute_no_trans}; allowzookeeper_server_tnet_conf_t:file { read getattr open };
allowzookeeper_server_tport_t:tcp_socket {name_bindname_connect};
What port is it connecting and binding sockets to? Why are they not labelled?
Quoted 3 lines
allow
zookeeper_server_tself:process execmem;
allowzookeeper_server_tself:tcp_socket { setopt read bind create accept write getattr connect shutdown listen };
I will add the above rules to the policy that i have, except for the bind/connect to generic port types as this seems like a bad idea to me.
Were there no denials left for the zookeeper client? Did you use zookeeper_run_client() to transition to the zookeeper_t domain?
Quoted 7 lines
Quoted 7 lines
Some properties of this policy:
The hadoop init script domains must be started by the system, or by unconfined or
sysadm_tby usingrun_initserver <hadoop service>
To use the zookeeper client domain, thezookeeper_run_clientdomain must be called for a domain. (for example if you wish to run it asunconfined_t, you would callzookeeper_run_client(unconfined_t, unconfined_r)The zookeeper server seems to be an ordinary init daemon domain.
Since i do not know what kind of dommainhadoop_tis, it is currently pretty much unreachable. I have created anhadoop_domtransinterface that can be called but currently no role is allowed thehadoop_tdomain.
Quoted 5 lines
Quoted 5 lines
Signed-off-by Dominick Grift <[email protected]>_______________________________________________
refpolicy mailing list
refpolicy at oss.tresys.com
http://oss.tresys.com/mailman/listinfo/refpolicy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20100921/d41757b3/attachment.bin
PATCH 1/1 hadoop 1/10 -- unconfined
Quoted 10 lines · Dominick Grift
Quoted 6 lines · Paul Nuzzi
Quoted 2 lines · Dominick Grift
Well ive rewritten the policy as much as i ca with the information that i currently have.
Because of the use of the hadoop domain attributes i cannot determine whether it is the initrc script doing something or the application, and so i cannot currently finish thehadoop_domain_templatepolicy.The
hadoop_domainpolicy is basic stuff that most programs share, plus a few hadoop specific things. I initially had separate functions for initrc and hadoop type policy. Since we are not exporting hadoop specific functionality to other modules I removed them from the .if file.With that in mind, it looks like the policy has some duplicate rules.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Also i have no clue what transitions to the
hadoop_tdomain. It does not own an initrc script so i gather it is no init daemon domain. Must be an application domain then? A lot of other things that arent, clear and/ or make no sense.
I have also left out things that i think, should be handled differently.
hadoop_tis for the hadoop executable which is/usr/bin/hadoop. It does basic file system stuff, submits jobs and administers the cluster.And who what runs it? who or/and what transitions to the
hadoop_tdomain?
All of the users run it. Users and the sysadm need to transition to the hadoop_t domain.
Quoted 10 lines
Quoted 4 lines
Quoted 1 line
It would be cool if someone could test this policy and provide feedback in the shape of avc denials.
I was able to get zookeeper server and client to run. Here is the audit2allow in permissive mode. Ignore the networking avcs. I didn't port the networking functions since it was built as a module. Zookeeper client doesn't domtrans into a domain. There is an semodule insert error.
hadoop_tasktracker_data_tneeds to be modified.Thanks i fixed that file context specification now.
Were you able to run the init script domains in permissive mode? Does it work when you use
run_init? Do the initrc domains properly transition to the main domains in permissive mode?
None of the pseudo initrc domains transitioned to the target domain using run_init.
Quoted 1 line
Could you provides some avc denials of that?
There doesn't seem to be any denials for the domtrans.
Quoted 1 line
You should also specify file contexts for the pid files and lock files.
system_u:system_r:hadoop_datanode_initrc_t:s0 0 S 489 3125 1 1 80 0 - 579640 futex_ ? 00:00:02 java system_u:system_r:hadoop_namenode_initrc_t:s0 0 S 489 3376 1 2 80 0 - 581189 futex_ ? 00:00:02 java system_u:system_r:zookeeper_server_t:s0 0 S 488 3598 1 0 80 0 - 496167 futex_ ? 00:00:00 java
-rw-r--r--. hadoop hadoop system_u:object_r:hadoop_datanode_var_run_t:s0 hadoop-hadoop-datanode.pid -rw-r--r--. hadoop hadoop system_u:object_r:hadoop_namenode_var_run_t:s0 hadoop-hadoop-namenode.pid
-rw-r--r--. root root system_u:object_r:hadoop_datanode_initrc_lock_t:s0 /var/lock/subsys/hadoop-datanode -rw-r--r--. root root system_u:object_r:hadoop_namenode_initrc_lock_t:s0 /var/lock/subsys/hadoop-namenode
Quoted 8 lines
Quoted 5 lines
#=============
zookeeper_server_t==============
allowzookeeper_server_tjava_exec_t:file { read getattr open executeexecute_no_trans}; allowzookeeper_server_tnet_conf_t:file { read getattr open };
allowzookeeper_server_tport_t:tcp_socket {name_bindname_connect};What port is it connecting and binding sockets to? Why are they not labelled?
I left out the networking since I built it as a module. I haven't had luck running refpolicy on Fedora. The corenet_* functions might need to be written if refpolicy doesn't want all the ports permanently defined.
Quoted 6 lines
Quoted 3 lines
allow
zookeeper_server_tself:process execmem;
allowzookeeper_server_tself:tcp_socket { setopt read bind create accept write getattr connect shutdown listen };I will add the above rules to the policy that i have, except for the bind/connect to generic port types as this seems like a bad idea to me.
I think I left out binding to generic ports in my policy.
Quoted 2 lines
Were there no denials left for the zookeeper client? Did you use
zookeeper_run_client()to transition to thezookeeper_tdomain?
zookeeper_client transitioned to the unconfined_java_t domain so there were no denials. I ran your patched policy without any modifications.
Quoted 20 lines
Quoted 7 lines
Quoted 7 lines
Some properties of this policy:
The hadoop init script domains must be started by the system, or by unconfined or
sysadm_tby usingrun_initserver <hadoop service>
To use the zookeeper client domain, thezookeeper_run_clientdomain must be called for a domain. (for example if you wish to run it asunconfined_t, you would callzookeeper_run_client(unconfined_t, unconfined_r)The zookeeper server seems to be an ordinary init daemon domain.
Since i do not know what kind of dommainhadoop_tis, it is currently pretty much unreachable. I have created anhadoop_domtransinterface that can be called but currently no role is allowed thehadoop_tdomain.Quoted 5 lines
Quoted 5 lines
Signed-off-by Dominick Grift <[email protected]>_______________________________________________
refpolicy mailing list
refpolicy at oss.tresys.com
http://oss.tresys.com/mailman/listinfo/refpolicy_______________________________________________
refpolicy mailing list
refpolicy at oss.tresys.com
http://oss.tresys.com/mailman/listinfo/refpolicy
PATCH 1/1 hadoop 1/10 -- unconfined
Quoted 15 lines · Paul Nuzzi
Quoted 14 lines · Dominick Grift
Quoted 6 lines · Paul Nuzzi
Quoted 2 lines · Dominick Grift
Well ive rewritten the policy as much as i ca with the information that i currently have.
Because of the use of the hadoop domain attributes i cannot determine whether it is the initrc script doing something or the application, and so i cannot currently finish thehadoop_domain_templatepolicy.The
hadoop_domainpolicy is basic stuff that most programs share, plus a few hadoop specific things. I initially had separate functions for initrc and hadoop type policy. Since we are not exporting hadoop specific functionality to other modules I removed them from the .if file.With that in mind, it looks like the policy has some duplicate rules.
Quoted 4 lines
Quoted 3 lines
Also i have no clue what transitions to the
hadoop_tdomain. It does not own an initrc script so i gather it is no init daemon domain. Must be an application domain then? A lot of other things that arent, clear and/ or make no sense.
I have also left out things that i think, should be handled differently.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
hadoop_tis for the hadoop executable which is/usr/bin/hadoop. It does basic file system stuff, submits jobs and administers the cluster.And who what runs it? who or/and what transitions to the
hadoop_tdomain?All of the users run it. Users and the sysadm need to transition to the
hadoop_tdomain.
ok so you can transition to it by creating a custom module with the following:
hadoop_run(sysadm_t, sysadm_r)
Can you confirm that this works?
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
It would be cool if someone could test this policy and provide feedback in the shape of avc denials.
I was able to get zookeeper server and client to run. Here is the audit2allow in permissive mode. Ignore the networking avcs. I didn't port the networking functions since it was built as a module. Zookeeper client doesn't domtrans into a domain. There is an semodule insert error.
hadoop_tasktracker_data_tneeds to be modified.
Quoted 7 lines
Quoted 5 lines
Thanks i fixed that file context specification now.
Were you able to run the init script domains in permissive mode? Does it work when you use
run_init? Do the initrc domains properly transition to the main domains in permissive mode?None of the pseudo initrc domains transitioned to the target domain using
run_init.
Any avc denials related to this? Because the domain transitions are specified in policy (example: hadoop_datanode_initrc_t -> hadoop_exec_t -> hadoop_datanode_t)
Quoted 4 lines
Quoted 2 lines
Could you provides some avc denials of that?
There doesn't seem to be any denials for the domtrans.
So the domain transition does not occur but no avc denials are showed? that is strange.
maybe semodule -DB will expose some related information. Also check for SELINUX_ERR (grep -i SELINUX_ERR /var/log/audit/audit.log)
Are the executables properly labelled?
Quoted 20 lines
Quoted 2 lines
You should also specify file contexts for the pid files and lock files.
system_u:system_r:hadoop_datanode_initrc_t:s0 0 S 489 3125 1 1 80 0 - 579640 futex_ ? 00:00:02 java system_u:system_r:hadoop_namenode_initrc_t:s0 0 S 489 3376 1 2 80 0 - 581189 futex_ ? 00:00:02 java system_u:system_r:zookeeper_server_t:s0 0 S 488 3598 1 0 80 0 - 496167 futex_ ? 00:00:00 java(quoted diff) +0
-4-rw-r--r--. hadoop hadoop system_u:object_r:hadoop_datanode_var_run_t:s0 hadoop-hadoop-datanode.pid -rw-r--r--. hadoop hadoop system_u:object_r:hadoop_namenode_var_run_t:s0 hadoop-hadoop-namenode.pid -rw-r--r--. root root system_u:object_r:hadoop_datanode_initrc_lock_t:s0 /var/lock/subsys/hadoop-datanode -rw-r--r--. root root system_u:object_r:hadoop_namenode_initrc_lock_t:s0 /var/lock/subsys/hadoop-namenodeQuoted 7 lines
Quoted 6 lines
#=============
zookeeper_server_t==============
allowzookeeper_server_tjava_exec_t:file { read getattr open executeexecute_no_trans}; allowzookeeper_server_tnet_conf_t:file { read getattr open };
allowzookeeper_server_tport_t:tcp_socket {name_bindname_connect};
Quoted 4 lines
Quoted 2 lines
What port is it connecting and binding sockets to? Why are they not labelled?
I left out the networking since I built it as a module. I haven't had luck running refpolicy on Fedora. The corenet_* functions might need to be written if refpolicy doesn't want all the ports permanently defined.
You could patch fedoras selinux-policy rpm that is what i usually do. Anyways i will just assume its the ports we declared.
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
allow
zookeeper_server_tself:process execmem;
allowzookeeper_server_tself:tcp_socket { setopt read bind create accept write getattr connect shutdown listen };I will add the above rules to the policy that i have, except for the bind/connect to generic port types as this seems like a bad idea to me.
Quoted 7 lines
I think I left out binding to generic ports in my policy.
Quoted 2 lines
Were there no denials left for the zookeeper client? Did you use
zookeeper_run_client()to transition to thezookeeper_tdomain?
zookeeper_clienttransitioned to theunconfined_java_tdomain so there were no denials. I ran your patched policy without any modifications.
Because you probably ran is in the unconfined domain. You should use the zookeeper_run_client() that my patch provides, so that you can transition to the confined domain.
I will add file context specifications for the locks and pids you have reported.
Quoted 16 lines
Quoted 16 lines
Quoted 12 lines
Quoted 12 lines
Some properties of this policy:
The hadoop init script domains must be started by the system, or by unconfined or
sysadm_tby usingrun_initserver <hadoop service>
To use the zookeeper client domain, thezookeeper_run_clientdomain must be called for a domain. (for example if you wish to run it asunconfined_t, you would callzookeeper_run_client(unconfined_t, unconfined_r)The zookeeper server seems to be an ordinary init daemon domain.
Since i do not know what kind of dommainhadoop_tis, it is currently pretty much unreachable. I have created anhadoop_domtransinterface that can be called but currently no role is allowed thehadoop_tdomain.Signed-off-by Dominick Grift <[email protected]>_______________________________________________
refpolicy mailing list
refpolicy at oss.tresys.com
http://oss.tresys.com/mailman/listinfo/refpolicy
Quoted 5 lines
Quoted 4 lines
_______________________________________________
refpolicy mailing list
refpolicy at oss.tresys.com
http://oss.tresys.com/mailman/listinfo/refpolicy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20100921/e6e993c9/attachment.bin
PATCH 1/1 hadoop 1/10 -- unconfined
Quoted 20 lines · Dominick Grift
Quoted 19 lines · Paul Nuzzi
Quoted 17 lines · Dominick Grift
Quoted 6 lines · Paul Nuzzi
Quoted 2 lines · Dominick Grift
Well ive rewritten the policy as much as i ca with the information that i currently have.
Because of the use of the hadoop domain attributes i cannot determine whether it is the initrc script doing something or the application, and so i cannot currently finish thehadoop_domain_templatepolicy.The
hadoop_domainpolicy is basic stuff that most programs share, plus a few hadoop specific things. I initially had separate functions for initrc and hadoop type policy. Since we are not exporting hadoop specific functionality to other modules I removed them from the .if file.With that in mind, it looks like the policy has some duplicate rules.
Quoted 5 lines
Quoted 3 lines
Also i have no clue what transitions to the
hadoop_tdomain. It does not own an initrc script so i gather it is no init daemon domain. Must be an application domain then? A lot of other things that arent, clear and/ or make no sense.
I have also left out things that i think, should be handled differently.
hadoop_tis for the hadoop executable which is/usr/bin/hadoop. It does basic file system stuff, submits jobs and administers the cluster.And who what runs it? who or/and what transitions to the
hadoop_tdomain?
Quoted 8 lines
Quoted 1 line
All of the users run it. Users and the sysadm need to transition to the
hadoop_tdomain.ok so you can transition to it by creating a custom module with the following:
hadoop_run(sysadm_t, sysadm_r)Can you confirm that this works?
They are transitioning correctly for sysadm_u.
Quoted 20 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
It would be cool if someone could test this policy and provide feedback in the shape of avc denials.
I was able to get zookeeper server and client to run. Here is the audit2allow in permissive mode. Ignore the networking avcs. I didn't port the networking functions since it was built as a module. Zookeeper client doesn't domtrans into a domain. There is an semodule insert error.
hadoop_tasktracker_data_tneeds to be modified.Quoted 7 lines
Quoted 5 lines
Thanks i fixed that file context specification now.
Were you able to run the init script domains in permissive mode? Does it work when you use
run_init? Do the initrc domains properly transition to the main domains in permissive mode?None of the pseudo initrc domains transitioned to the target domain using
run_init.Any avc denials related to this? Because the domain transitions are specified in policy (example:
hadoop_datanode_initrc_t->hadoop_exec_t->hadoop_datanode_t)Quoted 2 lines
Quoted 2 lines
Could you provides some avc denials of that?
Quoted 8 lines
Quoted 1 line
There doesn't seem to be any denials for the domtrans.
So the domain transition does not occur but no avc denials are showed? that is strange.
maybe semodule -DB will expose some related information. Also check forSELINUX_ERR(grep -iSELINUX_ERR/var/log/audit/audit.log)Are the executables properly labelled?
I don't know if you changed anything with the new patch but they seem to be transitioning correctly. I added a separate module with hadoop_run(sysadm_t, sysadm_r) and hadoop_run(unconfined_t, unconfined_r). To get it to compile you need to add a gen_require hadoop_exec_t to hadoop_domtrans.
Quoted 40 lines
Quoted 20 lines
Quoted 2 lines
You should also specify file contexts for the pid files and lock files.
system_u:system_r:hadoop_datanode_initrc_t:s0 0 S 489 3125 1 1 80 0 - 579640 futex_ ? 00:00:02 java system_u:system_r:hadoop_namenode_initrc_t:s0 0 S 489 3376 1 2 80 0 - 581189 futex_ ? 00:00:02 java system_u:system_r:zookeeper_server_t:s0 0 S 488 3598 1 0 80 0 - 496167 futex_ ? 00:00:00 java(quoted diff) +0
-4-rw-r--r--. hadoop hadoop system_u:object_r:hadoop_datanode_var_run_t:s0 hadoop-hadoop-datanode.pid -rw-r--r--. hadoop hadoop system_u:object_r:hadoop_namenode_var_run_t:s0 hadoop-hadoop-namenode.pid -rw-r--r--. root root system_u:object_r:hadoop_datanode_initrc_lock_t:s0 /var/lock/subsys/hadoop-datanode -rw-r--r--. root root system_u:object_r:hadoop_namenode_initrc_lock_t:s0 /var/lock/subsys/hadoop-namenodeQuoted 7 lines
Quoted 6 lines
#=============
zookeeper_server_t==============
allowzookeeper_server_tjava_exec_t:file { read getattr open executeexecute_no_trans}; allowzookeeper_server_tnet_conf_t:file { read getattr open };
allowzookeeper_server_tport_t:tcp_socket {name_bindname_connect};Quoted 4 lines
Quoted 2 lines
What port is it connecting and binding sockets to? Why are they not labelled?
I left out the networking since I built it as a module. I haven't had luck running refpolicy on Fedora. The corenet_* functions might need to be written if refpolicy doesn't want all the ports permanently defined.
You could patch fedoras selinux-policy rpm that is what i usually do. Anyways i will just assume its the ports we declared.
Quoted 13 lines
Quoted 7 lines
Quoted 4 lines
allow
zookeeper_server_tself:process execmem;
allowzookeeper_server_tself:tcp_socket { setopt read bind create accept write getattr connect shutdown listen };I will add the above rules to the policy that i have, except for the bind/connect to generic port types as this seems like a bad idea to me.
I think I left out binding to generic ports in my policy.
Quoted 2 lines
Were there no denials left for the zookeeper client? Did you use
zookeeper_run_client()to transition to thezookeeper_tdomain?
Quoted 6 lines
Quoted 2 lines
zookeeper_clienttransitioned to theunconfined_java_tdomain so there were no denials. I ran your patched policy without any modifications.Because you probably ran is in the unconfined domain. You should use the
zookeeper_run_client()that my patch provides, so that you can transition to the confined domain.
Looks like that transitions correctly when I add zookeeper_run_client(unconfined_t, unconfined_r). Thanks for taking an interest in the patch. How do we want to merge your changes with mine?
Quoted 26 lines
I will add file context specifications for the locks and pids you have reported.
Quoted 21 lines
Quoted 20 lines
Quoted 7 lines
Quoted 7 lines
Some properties of this policy:
The hadoop init script domains must be started by the system, or by unconfined or
sysadm_tby usingrun_initserver <hadoop service>
To use the zookeeper client domain, thezookeeper_run_clientdomain must be called for a domain. (for example if you wish to run it asunconfined_t, you would callzookeeper_run_client(unconfined_t, unconfined_r)The zookeeper server seems to be an ordinary init daemon domain.
Since i do not know what kind of dommainhadoop_tis, it is currently pretty much unreachable. I have created anhadoop_domtransinterface that can be called but currently no role is allowed thehadoop_tdomain.Quoted 5 lines
Quoted 5 lines
Signed-off-by Dominick Grift <[email protected]>_______________________________________________
refpolicy mailing list
refpolicy at oss.tresys.com
http://oss.tresys.com/mailman/listinfo/refpolicy_______________________________________________
refpolicy mailing list
refpolicy at oss.tresys.com
http://oss.tresys.com/mailman/listinfo/refpolicy
PATCH 1/1 hadoop 1/10 -- unconfined
Quoted 23 lines · Paul Nuzzi
Quoted 22 lines · Dominick Grift
Quoted 20 lines · Paul Nuzzi
Quoted 10 lines · Dominick Grift
Quoted 6 lines · Paul Nuzzi
Quoted 2 lines · Dominick Grift
Well ive rewritten the policy as much as i ca with the information that i currently have.
Because of the use of the hadoop domain attributes i cannot determine whether it is the initrc script doing something or the application, and so i cannot currently finish thehadoop_domain_templatepolicy.The
hadoop_domainpolicy is basic stuff that most programs share, plus a few hadoop specific things. I initially had separate functions for initrc and hadoop type policy. Since we are not exporting hadoop specific functionality to other modules I removed them from the .if file.With that in mind, it looks like the policy has some duplicate rules.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Also i have no clue what transitions to the
hadoop_tdomain. It does not own an initrc script so i gather it is no init daemon domain. Must be an application domain then? A lot of other things that arent, clear and/ or make no sense.
I have also left out things that i think, should be handled differently.
hadoop_tis for the hadoop executable which is/usr/bin/hadoop. It does basic file system stuff, submits jobs and administers the cluster.And who what runs it? who or/and what transitions to the
hadoop_tdomain?All of the users run it. Users and the sysadm need to transition to the
hadoop_tdomain.
Quoted 8 lines
Quoted 6 lines
ok so you can transition to it by creating a custom module with the following:
hadoop_run(sysadm_t, sysadm_r)Can you confirm that this works?
They are transitioning correctly for
sysadm_u.
Thanks
Quoted 28 lines
Quoted 28 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
It would be cool if someone could test this policy and provide feedback in the shape of avc denials.
I was able to get zookeeper server and client to run. Here is the audit2allow in permissive mode. Ignore the networking avcs. I didn't port the networking functions since it was built as a module. Zookeeper client doesn't domtrans into a domain. There is an semodule insert error.
hadoop_tasktracker_data_tneeds to be modified.Quoted 7 lines
Quoted 5 lines
Thanks i fixed that file context specification now.
Were you able to run the init script domains in permissive mode? Does it work when you use
run_init? Do the initrc domains properly transition to the main domains in permissive mode?None of the pseudo initrc domains transitioned to the target domain using
run_init.Any avc denials related to this? Because the domain transitions are specified in policy (example:
hadoop_datanode_initrc_t->hadoop_exec_t->hadoop_datanode_t)Quoted 4 lines
Quoted 2 lines
Could you provides some avc denials of that?
There doesn't seem to be any denials for the domtrans.
So the domain transition does not occur but no avc denials are showed? that is strange.
maybe semodule -DB will expose some related information. Also check forSELINUX_ERR(grep -iSELINUX_ERR/var/log/audit/audit.log)
Quoted 5 lines
Quoted 1 line
Are the executables properly labelled?
I don't know if you changed anything with the new patch but they seem to be transitioning correctly. I added a separate module with
hadoop_run(sysadm_t, sysadm_r)andhadoop_run(unconfined_t, unconfined_r). To get it to compile you need to add agen_requirehadoop_exec_ttohadoop_domtrans.
Thanks fixed the hadoop_exec_t requirement. I did change some trivial things, not sure if they are related to it though.
Quoted 44 lines
Quoted 44 lines
Quoted 21 lines
Quoted 3 lines
You should also specify file contexts for the pid files and lock files.
system_u:system_r:hadoop_datanode_initrc_t:s0 0 S 489 3125 1 1 80 0 - 579640 futex_ ? 00:00:02 java system_u:system_r:hadoop_namenode_initrc_t:s0 0 S 489 3376 1 2 80 0 - 581189 futex_ ? 00:00:02 java system_u:system_r:zookeeper_server_t:s0 0 S 488 3598 1 0 80 0 - 496167 futex_ ? 00:00:00 java(quoted diff) +0
-4-rw-r--r--. hadoop hadoop system_u:object_r:hadoop_datanode_var_run_t:s0 hadoop-hadoop-datanode.pid -rw-r--r--. hadoop hadoop system_u:object_r:hadoop_namenode_var_run_t:s0 hadoop-hadoop-namenode.pid -rw-r--r--. root root system_u:object_r:hadoop_datanode_initrc_lock_t:s0 /var/lock/subsys/hadoop-datanode -rw-r--r--. root root system_u:object_r:hadoop_namenode_initrc_lock_t:s0 /var/lock/subsys/hadoop-namenodeQuoted 7 lines
Quoted 6 lines
#=============
zookeeper_server_t==============
allowzookeeper_server_tjava_exec_t:file { read getattr open executeexecute_no_trans}; allowzookeeper_server_tnet_conf_t:file { read getattr open };
allowzookeeper_server_tport_t:tcp_socket {name_bindname_connect};Quoted 4 lines
Quoted 2 lines
What port is it connecting and binding sockets to? Why are they not labelled?
I left out the networking since I built it as a module. I haven't had luck running refpolicy on Fedora. The corenet_* functions might need to be written if refpolicy doesn't want all the ports permanently defined.
You could patch fedoras selinux-policy rpm that is what i usually do. Anyways i will just assume its the ports we declared.
Quoted 15 lines
Quoted 7 lines
Quoted 4 lines
allow
zookeeper_server_tself:process execmem;
allowzookeeper_server_tself:tcp_socket { setopt read bind create accept write getattr connect shutdown listen };I will add the above rules to the policy that i have, except for the bind/connect to generic port types as this seems like a bad idea to me.
I think I left out binding to generic ports in my policy.
Quoted 2 lines
Were there no denials left for the zookeeper client? Did you use
zookeeper_run_client()to transition to thezookeeper_tdomain?
zookeeper_clienttransitioned to theunconfined_java_tdomain so there were no denials. I ran your patched policy without any modifications.
Quoted 6 lines
Quoted 3 lines
Because you probably ran is in the unconfined domain. You should use the
zookeeper_run_client()that my patch provides, so that you can transition to the confined domain.Looks like that transitions correctly when I add
zookeeper_run_client(unconfined_t, unconfined_r). Thanks for taking an interest in the patch. How do we want to merge your changes with mine?
Honestly i think there are some mistakes in your version, and i suspect that i adopted some of those mistakes into my patch.
For example. in my patch i allow the hadoop rc scripts to create pid files. but from your feedback i strongly suspect that the rc scripts do not create the pid files:
Quoted 1 line
Quoted 1 line
Quoted 1 line
-rw-r--r--. hadoop hadoop
system_u:object_r:hadoop_datanode_var_run_t:s0 hadoop-hadoop-datanode.pid
This shows that a process running as the hadoop user created the hadoop datanode pid file. If the rc script would have created it , it wouldnt be hadoop but root i suspect.
My opinion is that it is best to start over and use my patch as a clean base.
Then we can extend my patch with any raw AVC denials.
I will post a new patch soon with the hadoop_domtrans fix and with the pid filetrans removed for rc script domains (and maybe remove some other things that i dont fully trust.)
Just so you know, we also hang out on IRC. That medium is a bit better for collaboration/ interactivity than maillists, especially with the larger projects.
Quoted 20 lines
Quoted 20 lines
I will add file context specifications for the locks and pids you have reported.
Quoted 16 lines
Quoted 16 lines
Quoted 12 lines
Quoted 12 lines
Some properties of this policy:
The hadoop init script domains must be started by the system, or by unconfined or
sysadm_tby usingrun_initserver <hadoop service>
To use the zookeeper client domain, thezookeeper_run_clientdomain must be called for a domain. (for example if you wish to run it asunconfined_t, you would callzookeeper_run_client(unconfined_t, unconfined_r)The zookeeper server seems to be an ordinary init daemon domain.
Since i do not know what kind of dommainhadoop_tis, it is currently pretty much unreachable. I have created anhadoop_domtransinterface that can be called but currently no role is allowed thehadoop_tdomain.Signed-off-by Dominick Grift <[email protected]>_______________________________________________
refpolicy mailing list
refpolicy at oss.tresys.com
http://oss.tresys.com/mailman/listinfo/refpolicy
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
_______________________________________________
refpolicy mailing list
refpolicy at oss.tresys.com
http://oss.tresys.com/mailman/listinfo/refpolicy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20100923/287ad29b/attachment.bin
PATCH 1/1 hadoop 1/10 -- unconfined
In reply to Paul NuzziQuoted 4 lines
Quoted 4 lines
Quoted 3 lines
The
hadoop_domainpolicy is basic stuff that most programs share, plus a few hadoop specific things. I initially had separate functions for initrc and hadoop type policy. Since we are not exporting hadoop specific functionality to other modules I removed them from the .if file.
Could you send an updated patch so I can see these changes?
Signature · 3 lines
Jeremy J. Solt Tresys Technology, LLC 410-290-1411 x122