potential rsync patch
Hello,
I was creating a module for a script that uses rsync. I wanted to keep the program in the callers domain throughout, so I developed an interface for "rsync.if" that gives a domain the privileges it needs to execute a rsync without transitioning to the rsync domain. Next, I replaced the appropriate te rules in the "rsync.te" with this interface which I called "can_rsync_notrans".
Finally, the transport mechanism I used for rsync was ssh, so I created a "can_rsync_over_ssh" interface and added that to the "rysnc.if" file.
This is my first attempt at doing something like this, so I am looking for feedback on how to make this more correct and more correctly styled. It is my goal to get these interfaces incorporated into the reference policy.
Any help is greatly appreciated!
Patrick Neely
This adds interfaces to the rsync module.
"can_rsync_notrans" allows other domains to run the rysnc command within the caller domain.
- executing the rsync binary
- sending and receiving packets
- reading network state
"can_rsync_over_ssh" adds the ability to use rsync over ssh within the caller domain.
- executing the ssh binary
- connecting to ssh port
Additional rules are needed to enable public key authentication.
modules/services/rsync.te +1 -36
@@ -52,7 +52,6 @@ # cjp: this should probably only be inetd_child_t rules? # search home and kerberos also. allow rsync_t self:netlink_tcpdiag_socket r_netlink_socket_perms; -allow rsync_t self:capability { setuid setgid }; #end for identd allow rsync_t rsync_data_t:dir list_dir_perms;
@@ -66,44 +65,10 @@ manage_files_pattern(rsync_t,rsync_var_run_t,rsync_var_run_t) files_pid_filetrans(rsync_t,rsync_var_run_t,file) -kernel_read_kernel_sysctls(rsync_t) -kernel_read_system_state(rsync_t) -kernel_read_network_state(rsync_t) - -corenet_all_recvfrom_unlabeled(rsync_t) -corenet_all_recvfrom_netlabel(rsync_t) -corenet_tcp_sendrecv_all_if(rsync_t) -corenet_udp_sendrecv_all_if(rsync_t) -corenet_tcp_sendrecv_all_nodes(rsync_t) -corenet_udp_sendrecv_all_nodes(rsync_t) -corenet_tcp_sendrecv_all_ports(rsync_t) -corenet_udp_sendrecv_all_ports(rsync_t) -corenet_tcp_bind_all_nodes(rsync_t) -corenet_tcp_bind_rsync_port(rsync_t) -corenet_sendrecv_rsync_server_packets(rsync_t) - -dev_read_urand(rsync_t) - -fs_getattr_xattr_fs(rsync_t) - -files_read_etc_files(rsync_t) -files_search_home(rsync_t) - -auth_use_nsswitch(rsync_t) - -libs_use_ld_so(rsync_t) -libs_use_shared_libs(rsync_t) - -logging_send_syslog_msg(rsync_t) logging_dontaudit_search_logs(rsync_t) -miscfiles_read_localization(rsync_t) -miscfiles_read_public_files(rsync_t) +can_rsync_notrans(rsync_t) -tunable_policy(`allow_rsync_anon_write',` - miscfiles_manage_public_files(rsync_t) -') - optional_policy(` daemontools_service_domain(rsync_t, rsync_exec_t) ')
modules/services/rsync.if +84 -0
87 lines not on this page · raw message
Quoted 15 lines · Patrick Neely
I was creating a module for a script that uses rsync. I wanted to keep
the program in the callers domain throughout, so I developed an interface for "rsync.if" that gives a domain the privileges it needs to
execute a rsync without transitioning to the rsync domain. Next, I replaced the appropriate te rules in the "rsync.te" with this interface
which I called "can_rsync_notrans".Finally, the transport mechanism I used for rsync was ssh, so I created
a "can_rsync_over_ssh" interface and added that to the "rysnc.if" file.
Quoted 5 lines
This is my first attempt at doing something like this, so I am looking
for feedback on how to make this more correct and more correctly styled. It is my goal to get these interfaces incorporated into the reference policy.
Not a bad start. There are a few things that I see. The first is the interface naming, and there is a naming convention page [1] that can help you fix that.
The actual implementation is fine for the most part. However, I suggest a few changes. It seems that someone wanting to use an rsync client in their policy is going to have two things that they're going to be concerned about: what files are being rsynced and which network to use. These probably shouldn't be included in the interface. Also, since you base it on the existing policy, which is for rsync daemon mode, some permissions can likely be trimmed too, such as the syslog access and possibly the nsswitch too.
[1] http://oss.tresys.com/projects/refpolicy/wiki/InterfaceNaming
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.