Skip to contentSkip to conversation

Added policy module for the oident daemon.

PATCH In review Dominick Grift 4 participants 14 messages Jul 26, 2008 – Aug 21, 2008 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Added policy module for the oident daemon.

---
 policy/modules/services/oidentd.fc |    9 +++++
 policy/modules/services/oidentd.if |    7 ++++
 policy/modules/services/oidentd.te |   68
++++++++++++++++++++++++++++++++++++
 3 files changed, 84 insertions(+), 0 deletions(-)
 create mode 100644 policy/modules/services/oidentd.fc
 create mode 100644 policy/modules/services/oidentd.if
 create mode 100644 policy/modules/services/oidentd.te
(quoted diff) +0 -0

b/policy/modules/services/oidentd.fc
new file mode 100644
index 0000000..a9209dc

policy/modules/services/oidentd.fc new file +2 -0
@@ -0,0 +1,9 @@
+
+/etc/oidentd.conf		--

gen_context(system_u:object_r:oidentd_config_t,s0)
+/etc/oidentd_masq.conf --
gen_context(system_u:object_r:oidentd_config_t,s0) +
+ifdef(distro_redhat',
+/etc/rc\.d/init\.d/oidentd --
gen_context(system_u:object_r:oidentd_script_exec_t,s0) +')
+
+/usr/sbin/oidentd -- gen_context(system_u:object_r:oidentd_exec_t,s0)

(quoted diff) +0 -0

b/policy/modules/services/oidentd.if
new file mode 100644
index 0000000..a745861

policy/modules/services/oidentd.if new file +7 -0
@@ -0,0 +1,7 @@
+## <summary>SELinux policy for the oident daemon.</summary>
+## <desc>
+##	<p>
+##	Applies SELinux security to the oident daemon.
+##	</p>
+## </desc>
+
(quoted diff) +0 -0

b/policy/modules/services/oidentd.te
new file mode 100644
index 0000000..1b770cf

policy/modules/services/oidentd.te new file +34 -0
@@ -0,0 +1,68 @@
+
+policy_module(oidentd, 0.0.1) 
+
+########################################
+#
+# oidentd private declarations
+#
+
+## <desc>
+## <p>
+## Allow the oident daemon to read
+## unprivileged user home content files.
+## </p>
+## </desc>
+gen_tunable(oidentd_read_unprivileged_user_home_content_files, false)
+
+type oidentd_t;
+type oidentd_exec_t;
+init_daemon_domain(oidentd_t, oidentd_exec_t)
+
+ifdef(`distro_redhat', `
+type oidentd_script_exec_t;
+init_script_type(oidentd_script_exec_t)
+')
+
+type oidentd_config_t;
+files_config_file(oidentd_config_t)
+
+########################################
+#
+# oidentd private policy
+#
+allow oidentd_t self:capability { setuid setgid };
+allow oidentd_t self:netlink_route_socket { write getattr read bind

create nlmsg_read };
+allow oidentd_t self:netlink_tcpdiag_socket { write read create nlmsg_read };
+allow oidentd_t self:tcp_socket { setopt read bind create accept write getattr listen };
+allow oidentd_t self:udp_socket { write read create connect getattr }; +allow oidentd_t self:unix_dgram_socket { create connect }; +
+allow oidentd_t oidentd_config_t:file read_file_perms;
+
+corenet_all_recvfrom_unlabeled(oidentd_t) +corenet_all_recvfrom_netlabel(oidentd_t) +corenet_tcp_sendrecv_all_if(oidentd_t) +corenet_tcp_sendrecv_all_nodes(oidentd_t) +corenet_tcp_bind_all_nodes(oidentd_t) +corenet_tcp_bind_auth_port(oidentd_t);
+
+files_read_etc_files(oidentd_t)
+
+kernel_read_kernel_sysctls(oidentd_t) +kernel_read_network_state(oidentd_t) +kernel_read_network_state_symlinks(oidentd_t) +kernel_read_sysctl(oidentd_t)
+
+libs_use_ld_so(oidentd_t)
+libs_use_shared_libs(oidentd_t)
+
+logging_send_syslog_msg(oidentd_t)
+
+miscfiles_read_localization(oidentd_t)
+
+sysnet_read_config(oidentd_t)
+ +tunable_policy(oidentd_read_unprivileged_user_home_content_files',
+ # ~/.oidentd.conf
+ userdom_read_unpriv_users_home_content_files(oidentd_t)
+')

Signature · 4 lines
1.5.5.2

-- 
Dominick Grift <[email protected]>
#1 lore raw
Quoted 1 line · Dominick Grift

The patch looks line-wrapped. Also a couple comments inline.

Quoted 36 lines
---
 policy/modules/services/oidentd.fc |    9 +++++
 policy/modules/services/oidentd.if |    7 ++++
 policy/modules/services/oidentd.te |   68
++++++++++++++++++++++++++++++++++++
 3 files changed, 84 insertions(+), 0 deletions(-)
 create mode 100644 policy/modules/services/oidentd.fc
 create mode 100644 policy/modules/services/oidentd.if
 create mode 100644 policy/modules/services/oidentd.te
policy/modules/services/oidentd.fc new file +2 -0
new file mode 100644
index 0000000..a9209dc
@@ -0,0 +1,9 @@
+
+/etc/oidentd.conf		--

gen_context(system_u:object_r:oidentd_config_t,s0)
+/etc/oidentd_masq.conf --
gen_context(system_u:object_r:oidentd_config_t,s0)

policy/modules/services/oidentd.fc new file +3 -0
+
+ifdef(`distro_redhat', `
+/etc/rc\.d/init\.d/oidentd		--

gen_context(system_u:object_r:oidentd_script_exec_t,s0) +')

policy/modules/services/oidentd.fc new file +2 -0
+
+/usr/sbin/oidentd		--	gen_context(system_u:object_r:oidentd_exec_t,s0)
policy/modules/services/oidentd.if new file +0 -0
new file mode 100644
index 0000000..a745861

policy/modules/services/oidentd.if line 6

Quoted 6 lines
policy/modules/services/oidentd.if new file +6 -0
@@ -0,0 +1,7 @@
+## <summary>SELinux policy for the oident daemon.</summary>
+## <desc>
+##	<p>
+##	Applies SELinux security to the oident daemon.
+##	</p>
+## </desc>

Better documentation please. Its obvious that this is a policy for oidentd. It would be better to have a one line description of what oidentd is, in the summary. The desc should have that, plus more information about what you can do with the policy.

Quoted 21 lines
policy/modules/services/oidentd.te new file +14 -0
new file mode 100644
index 0000000..1b770cf
@@ -0,0 +1,68 @@
+
+policy_module(oidentd, 0.0.1) 
+
+########################################
+#
+# oidentd private declarations
+#
+
+## <desc>
+## <p>
+## Allow the oident daemon to read
+## unprivileged user home content files.
+## </p>
+## </desc>

policy/modules/services/oidentd.te line 24

Quoted 10 lines
policy/modules/services/oidentd.te new file +10 -0
+gen_tunable(oidentd_read_unprivileged_user_home_content_files, false)
+
+type oidentd_t;
+type oidentd_exec_t;
+init_daemon_domain(oidentd_t, oidentd_exec_t)
+
+ifdef(`distro_redhat', `
+type oidentd_script_exec_t;
+init_script_type(oidentd_script_exec_t)
+')

This doesn't exist upstream yet. Having the build option is insufficient because upstream would fail to build if you set DISTRO=redhat.

Quoted 36 lines
policy/modules/services/oidentd.te new file +9 -0
+type oidentd_config_t;
+files_config_file(oidentd_config_t)
+
+########################################
+#
+# oidentd private policy
+#
+allow oidentd_t self:capability { setuid setgid };
+allow oidentd_t self:netlink_route_socket { write getattr read bind

create nlmsg_read };
+allow oidentd_t self:netlink_tcpdiag_socket { write read create nlmsg_read };
+allow oidentd_t self:tcp_socket { setopt read bind create accept write getattr listen };

policy/modules/services/oidentd.te new file +22 -0
+allow oidentd_t self:udp_socket { write read create connect getattr };
+allow oidentd_t self:unix_dgram_socket { create connect };
+
+allow oidentd_t oidentd_config_t:file read_file_perms;
+
+corenet_all_recvfrom_unlabeled(oidentd_t)
+corenet_all_recvfrom_netlabel(oidentd_t)
+corenet_tcp_sendrecv_all_if(oidentd_t)
+corenet_tcp_sendrecv_all_nodes(oidentd_t)
+corenet_tcp_bind_all_nodes(oidentd_t)
+corenet_tcp_bind_auth_port(oidentd_t);
+
+files_read_etc_files(oidentd_t)
+
+kernel_read_kernel_sysctls(oidentd_t)
+kernel_read_network_state(oidentd_t)
+kernel_read_network_state_symlinks(oidentd_t)
+kernel_read_sysctl(oidentd_t)
+
+libs_use_ld_so(oidentd_t)
+libs_use_shared_libs(oidentd_t)
+

policy/modules/services/oidentd.te

Quoted 10 lines
policy/modules/services/oidentd.te new file +10 -0
+logging_send_syslog_msg(oidentd_t)
+
+miscfiles_read_localization(oidentd_t)
+
+sysnet_read_config(oidentd_t)
+
+tunable_policy(`oidentd_read_unprivileged_user_home_content_files', `
+	# ~/.oidentd.conf
+	userdom_read_unpriv_users_home_content_files(oidentd_t)
+')

Why is this last bit needed? Why would a system service be reading a conf file from a user's home dir?

Signature · 7 lines
Chris PeBenito
<[email protected]>
Developer,
Hardened Gentoo Linux
 
Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE6AF9243
Key fingerprint = B0E6 877A 883F A57A 8E6A  CB00 BC8E E42D E6AF 9243
#2 lore raw
Quoted 4 lines · Chris PeBenito
Quoted 1 line · Dominick Grift

The patch looks line-wrapped. Also a couple comments inline.

...

Quoted 7 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+tunable_policy(`oidentd_read_unprivileged_user_home_content_files', `
+	# ~/.oidentd.conf
+	userdom_read_unpriv_users_home_content_files(oidentd_t)
+')

Why is this last bit needed? Why would a system service be reading a conf file from a user's home dir?

It's reading ~/.oidentd.conf, which allows a user great control over the responses the daemon returns when queried about connections related to that user.

http://linux.die.net/man/5/oidentd.conf

Paul.

--
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.

#3 lore raw
In reply to Chris PeBenito
Quoted 4 lines · Chris PeBenito
Quoted 1 line · Dominick Grift

The patch looks line-wrapped. Also a couple comments inline.

Attached are the modifications.

Signature · 1 line
Dominick Grift <[email protected]>
policy/modules/services/oidentd.fc new file +7 -0
new file mode 100644
index 0000000..327b896
@@ -0,0 +1,7 @@
+
+/etc/oidentd\.conf		--	gen_context(system_u:object_r:oidentd_config_t, s0)
+/etc/oidentd_masq\.conf	--	gen_context(system_u:object_r:oidentd_config_t, s0)
+
+/usr/sbin/oidentd		--	gen_context(system_u:object_r:oidentd_exec_t, s0)
+
+HOME_DIR/\.oidentd.conf		gen_context(system_u:object_r:oidentd_home_t, s0)
policy/modules/services/oidentd.if new file +11 -0
new file mode 100644
index 0000000..e0ad34c
@@ -0,0 +1,11 @@
+## <summary>SELinux policy for Oident daemon.</summary>
+## <desc>
+##	<p>
+##	Oident daemon is a server that implements the TCP/IP
+##	standard IDENT user identification protocol as
+##	specified in the RFC 1413 document.
+##	</p>
+## </desc>
+
+
+
policy/modules/services/oidentd.te new file +71 -0

71 lines not on this page · raw message

#4 lore raw
In reply to Chris PeBenito
Quoted 4 lines · Chris PeBenito
Quoted 1 line · Dominick Grift

The patch looks line-wrapped. Also a couple comments inline.

My last attempt had an error in the file context entry for oidentd_home_t.

Attached is a new attempt.

Signature · 1 line
Dominick Grift <[email protected]>
policy/modules/services/oidentd.fc new file +7 -0
new file mode 100644
index 0000000..ee7fcc4
@@ -0,0 +1,7 @@
+
+/etc/oidentd\.conf		--	gen_context(system_u:object_r:oidentd_config_t, s0)
+/etc/oidentd_masq\.conf	--	gen_context(system_u:object_r:oidentd_config_t, s0)
+
+/usr/sbin/oidentd		--	gen_context(system_u:object_r:oidentd_exec_t, s0)
+
+HOME_DIR/\.oidentd.conf	--	gen_context(system_u:object_r:oidentd_home_t, s0)
policy/modules/services/oidentd.if new file +11 -0
new file mode 100644
index 0000000..e0ad34c
@@ -0,0 +1,11 @@
+## <summary>SELinux policy for Oident daemon.</summary>
+## <desc>
+##	<p>
+##	Oident daemon is a server that implements the TCP/IP
+##	standard IDENT user identification protocol as
+##	specified in the RFC 1413 document.
+##	</p>
+## </desc>
+
+
+
policy/modules/services/oidentd.te new file +71 -0

71 lines not on this page · raw message

#5 lore raw
In reply to Chris PeBenito
Quoted 4 lines · Chris PeBenito
Quoted 1 line · Dominick Grift

The patch looks line-wrapped. Also a couple comments inline.

Previous patch didnt have any policy for user domain interaction with oidentd_home_t.

Attached is my new attempt.

Signature · 1 line
Dominick Grift <[email protected]>
policy/modules/services/oidentd.fc new file +7 -0
new file mode 100644
index 0000000..ee7fcc4
@@ -0,0 +1,7 @@
+
+/etc/oidentd\.conf		--	gen_context(system_u:object_r:oidentd_config_t, s0)
+/etc/oidentd_masq\.conf	--	gen_context(system_u:object_r:oidentd_config_t, s0)
+
+/usr/sbin/oidentd		--	gen_context(system_u:object_r:oidentd_exec_t, s0)
+
+HOME_DIR/\.oidentd.conf	--	gen_context(system_u:object_r:oidentd_home_t, s0)
policy/modules/services/oidentd.if new file +63 -0

63 lines not on this page · raw message

policy/modules/services/oidentd.te new file +68 -0

68 lines not on this page · raw message

#6 lore raw
In reply to Chris PeBenito
Quoted 4 lines · Chris PeBenito
Quoted 1 line · Dominick Grift

The patch looks line-wrapped. Also a couple comments inline.

I guess i should not rush so much because again i made a mistake, and found it too late.

Attached is a new try.

Signature · 1 line
Dominick Grift <[email protected]>
policy/modules/services/oidentd.fc new file +7 -0
new file mode 100644
index 0000000..ee7fcc4
@@ -0,0 +1,7 @@
+
+/etc/oidentd\.conf		--	gen_context(system_u:object_r:oidentd_config_t, s0)
+/etc/oidentd_masq\.conf	--	gen_context(system_u:object_r:oidentd_config_t, s0)
+
+/usr/sbin/oidentd		--	gen_context(system_u:object_r:oidentd_exec_t, s0)
+
+HOME_DIR/\.oidentd.conf	--	gen_context(system_u:object_r:oidentd_home_t, s0)
policy/modules/services/oidentd.if new file +64 -0

64 lines not on this page · raw message

policy/modules/services/oidentd.te new file +69 -0

69 lines not on this page · raw message

#7 lore raw
In reply to Chris PeBenito
Quoted 4 lines · Chris PeBenito
Quoted 1 line · Dominick Grift

The patch looks line-wrapped. Also a couple comments inline.

My previous commit did something not so smart. I had to revert it. Also i replace the manage_file_pattern($2, ...) because it is too coarse.

Signature · 1 line
Dominick Grift <[email protected]>
policy/modules/services/oidentd.fc new file +7 -0
new file mode 100644
index 0000000..ee7fcc4
@@ -0,0 +1,7 @@
+
+/etc/oidentd\.conf		--	gen_context(system_u:object_r:oidentd_config_t, s0)
+/etc/oidentd_masq\.conf	--	gen_context(system_u:object_r:oidentd_config_t, s0)
+
+/usr/sbin/oidentd		--	gen_context(system_u:object_r:oidentd_exec_t, s0)
+
+HOME_DIR/\.oidentd.conf	--	gen_context(system_u:object_r:oidentd_home_t, s0)
policy/modules/services/oidentd.if new file +61 -0

61 lines not on this page · raw message

policy/modules/services/oidentd.te new file +71 -0

71 lines not on this page · raw message

#8 lore raw
In reply to Chris PeBenito
Quoted 4 lines · Chris PeBenito
Quoted 1 line · Dominick Grift

The patch looks line-wrapped. Also a couple comments inline.

Tested and working. My previous attempt called the userdom_search_homedirs template with the wrong parameters.

This cause Oident daemon to not be able to search home_root_t (home).

Attached modification fixes above issue.

Signature · 1 line
Dominick Grift <[email protected]>
policy/modules/services/oidentd.fc new file +7 -0
new file mode 100644
index 0000000..ee7fcc4
@@ -0,0 +1,7 @@
+
+/etc/oidentd\.conf		--	gen_context(system_u:object_r:oidentd_config_t, s0)
+/etc/oidentd_masq\.conf	--	gen_context(system_u:object_r:oidentd_config_t, s0)
+
+/usr/sbin/oidentd		--	gen_context(system_u:object_r:oidentd_exec_t, s0)
+
+HOME_DIR/\.oidentd.conf	--	gen_context(system_u:object_r:oidentd_home_t, s0)
policy/modules/services/oidentd.if new file +61 -0

61 lines not on this page · raw message

policy/modules/services/oidentd.te new file +71 -0

71 lines not on this page · raw message

#9 lore raw
In reply to Chris PeBenito
Quoted 4 lines · Chris PeBenito
Quoted 1 line · Dominick Grift

The patch looks line-wrapped. Also a couple comments inline.

This edition replaces oidentd_read_unprivileged_user_home_content_files by allow_oidentd_read_oidentd_home_content.

This complicates the policy a bit more and so i included a oidentd_selinux manual page for clarity.

Signature · 1 line
Dominick Grift <[email protected]>
man/man8/oidentd_selinux.8 new file +38 -0
new file mode 100644
index 0000000..2c204aa
@@ -0,0 +1,38 @@
+.TH  "oidentd_selinux"  "8"  "14 Aug 2008" "[email protected]" "Oident deamon SELinux policy documentation"
+.de EX
+.nf
+.ft CW
+..
+.de EE
+.ft R
+.fi
+..
+.SH "NAME"
+oidentd_selinux \- Security-Enhanced Linux policy for Oident daemon.
+.SH "DESCRIPTION"
+.PP
+Security-Enhanced Linux provides security for Oidentd daemon via flexible mandatory access control.
+.SH FILE_CONTEXTS
+.PP
+SELinux requires files to have a files type. Users can use the chcon command to change certain files types.  Policy governs the access that daemons have to files.
+.TP
+Allow Oident daemon to read ~/.oidentd.conf by adding the oidentd_home_t files type to the file and by restoring the files type.  This also requires the allow_oidentd_read_oidentd_home_content boolean to be set.
+.PP
+.B
+chcon -t oidentd_home_t ~/.oidentd.conf
+.SH BOOLEANS
+.PP
+SELinux policy is based on least privilege required and may also be customizable by setting a boolean with the setsebool command.
+.TP
+Allow Oident daemon to read Oident daemon home content with the oidentd_home_t files type.
+.PP
+.B
+setsebool -P allow_oidentd_read_oidentd_home_content on
+.TP
+system-config-selinux is a GUI tool available to customize SELinux policy settings.
+.SH AUTHOR
+.PP
+This manual page was written by Dominick Grift <[email protected]>.
+.SH "SEE ALSO"
+.PP
+selinux(8), oidentd(8), oidentd.conf(8), setsebool(8), chcon(8)
policy/modules/services/oidentd.fc new file +7 -0
new file mode 100644
index 0000000..ee7fcc4
@@ -0,0 +1,7 @@
+
+/etc/oidentd\.conf		--	gen_context(system_u:object_r:oidentd_config_t, s0)
+/etc/oidentd_masq\.conf	--	gen_context(system_u:object_r:oidentd_config_t, s0)
+
+/usr/sbin/oidentd		--	gen_context(system_u:object_r:oidentd_exec_t, s0)
+
+HOME_DIR/\.oidentd.conf	--	gen_context(system_u:object_r:oidentd_home_t, s0)
policy/modules/services/oidentd.if new file +61 -0

61 lines not on this page · raw message

policy/modules/services/oidentd.te new file +68 -0

68 lines not on this page · raw message

#10 lore raw
In reply to Chris PeBenito
Quoted 4 lines · Chris PeBenito
Quoted 1 line · Dominick Grift

The patch looks line-wrapped. Also a couple comments inline.

This modification adds CIFS, NIS, NFS support.

Signature · 1 line
Dominick Grift <[email protected]>
man/man8/oidentd_selinux.8 new file +48 -0
new file mode 100644
index 0000000..a880437
@@ -0,0 +1,48 @@
+.TH  "oidentd_selinux"  "8"  "14 Aug 2008" "[email protected]" "Oident deamon SELinux policy documentation"
+.de EX
+.nf
+.ft CW
+..
+.de EE
+.ft R
+.fi
+..
+.SH "NAME"
+oidentd_selinux \- Security-Enhanced Linux policy for Oident daemon.
+.SH "DESCRIPTION"
+.PP
+Security-Enhanced Linux provides security for Oident daemon via flexible mandatory access control.
+.SH FILE_CONTEXTS
+.PP
+SELinux requires files to have a files type. Users can use the chcon command to change certain files types.  Policy governs the access that daemons have to files.
+.TP
+Allow Oident daemon to read ~/.oidentd.conf by adding the oidentd_home_t files type to the file and by restoring the files type.  This also requires the allow_oidentd_read_oidentd_home_content boolean to be set.
+.PP
+.B
+chcon -t oidentd_home_t ~/.oidentd.conf
+.SH BOOLEANS
+.PP
+SELinux policy is based on least privilege required and may also be customizable by setting a boolean with the setsebool command.
+.TP
+Allow Oident daemon to read Oident daemon home content with the oidentd_home_t files type.
+.PP
+.B
+setsebool -P allow_oidentd_read_oidentd_home_content on
+.TP
+Allow Oident daemon to use CIFS for public file transfer services.
+.PP
+.B
+setsebool -P allow_oidentd_use_cifs on
+.TP
+Allow Oident daemon to use NFS for public file transfer services.
+.PP
+.B
+setsebool -P allow_oidentd_use_nfs on
+.TP
+system-config-selinux is a GUI tool available to customize SELinux policy settings.
+.SH AUTHOR
+.PP
+This manual page was written by Dominick Grift <[email protected]>.
+.SH "SEE ALSO"
+.PP
+selinux(8), oidentd(8), oidentd.conf(8), setsebool(8), chcon(8)
policy/modules/services/oidentd.fc new file +7 -0
new file mode 100644
index 0000000..ee7fcc4
@@ -0,0 +1,7 @@
+
+/etc/oidentd\.conf		--	gen_context(system_u:object_r:oidentd_config_t, s0)
+/etc/oidentd_masq\.conf	--	gen_context(system_u:object_r:oidentd_config_t, s0)
+
+/usr/sbin/oidentd		--	gen_context(system_u:object_r:oidentd_exec_t, s0)
+
+HOME_DIR/\.oidentd.conf	--	gen_context(system_u:object_r:oidentd_home_t, s0)
policy/modules/services/oidentd.if new file +61 -0

61 lines not on this page · raw message

policy/modules/services/oidentd.te new file +102 -0

102 lines not on this page · raw message

#11 lore raw

PATCH 1/1 Added policy module for the oident daemon.

Quoted 7 lines · Dominick Grift
Quoted 4 lines · Chris PeBenito
Quoted 1 line · Dominick Grift

The patch looks line-wrapped. Also a couple comments inline.

This modification adds CIFS, NIS, NFS support.

Do you really think that reading the ~/.oidentd.conf needs to be tunable? I was mainly concerned about oidentd reading user_home_t files, for example, since it exposes the whole user's home directory. A config file explictly labeled for reading by oidentd should be ok.

The CIFS and NFS blocks should use the existing use_nfs_home_dirs and use_samba_home_dirs tunables.

The per-role template should create a $1_oidentd_home_t type, so role separation is preserved.

Quoted 242 lines
man/man8/oidentd_selinux.8 new file +48 -0
new file mode 100644
index 0000000..a880437
@@ -0,0 +1,48 @@
+.TH  "oidentd_selinux"  "8"  "14 Aug 2008" "domg472 at gmail.com" "Oident deamon SELinux policy documentation"
+.de EX
+.nf
+.ft CW
+..
+.de EE
+.ft R
+.fi
+..
+.SH "NAME"
+oidentd_selinux \- Security-Enhanced Linux policy for Oident daemon.
+.SH "DESCRIPTION"
+.PP
+Security-Enhanced Linux provides security for Oident daemon via flexible mandatory access control.
+.SH FILE_CONTEXTS
+.PP
+SELinux requires files to have a files type. Users can use the chcon command to change certain files types.  Policy governs the access that daemons have to files.
+.TP
+Allow Oident daemon to read ~/.oidentd.conf by adding the oidentd_home_t files type to the file and by restoring the files type.  This also requires the allow_oidentd_read_oidentd_home_content boolean to be set.
+.PP
+.B
+chcon -t oidentd_home_t ~/.oidentd.conf
+.SH BOOLEANS
+.PP
+SELinux policy is based on least privilege required and may also be customizable by setting a boolean with the setsebool command.
+.TP
+Allow Oident daemon to read Oident daemon home content with the oidentd_home_t files type.
+.PP
+.B
+setsebool -P allow_oidentd_read_oidentd_home_content on
+.TP
+Allow Oident daemon to use CIFS for public file transfer services.
+.PP
+.B
+setsebool -P allow_oidentd_use_cifs on
+.TP
+Allow Oident daemon to use NFS for public file transfer services.
+.PP
+.B
+setsebool -P allow_oidentd_use_nfs on
+.TP
+system-config-selinux is a GUI tool available to customize SELinux policy settings.
+.SH AUTHOR
+.PP
+This manual page was written by Dominick Grift <[email protected]>.
+.SH "SEE ALSO"
+.PP
+selinux(8), oidentd(8), oidentd.conf(8), setsebool(8), chcon(8)
policy/modules/services/oidentd.fc new file +7 -0
new file mode 100644
index 0000000..ee7fcc4
@@ -0,0 +1,7 @@
+
+/etc/oidentd\.conf             --      gen_context(system_u:object_r:oidentd_config_t, s0)
+/etc/oidentd_masq\.conf        --      gen_context(system_u:object_r:oidentd_config_t, s0)
+
+/usr/sbin/oidentd              --      gen_context(system_u:object_r:oidentd_exec_t, s0)
+
+HOME_DIR/\.oidentd.conf        --      gen_context(system_u:object_r:oidentd_home_t, s0)
policy/modules/services/oidentd.if new file +61 -0
new file mode 100644
index 0000000..93f9ad0
@@ -0,0 +1,61 @@
+## <summary>SELinux policy for Oident daemon.</summary>
+## <desc>
+##     <p>
+##     Oident daemon is a server that implements the TCP/IP
+##     standard IDENT user identification protocol as
+##     specified in the RFC 1413 document.
+##     </p>
+## </desc>
+
+#######################################
+## <summary>
+##  The per role template for the Oidentd module.
+## </summary>
+## <desc>
+##     <p>
+##     This template creates derived domains which are used
+##     for Oident daemon.
+##     </p>
+##     <p>
+##     This template is invoked automatically for each user, and
+##     generally does not need to be invoked directly
+##     by policy writers.
+##     </p>
+## </desc>
+## <param name="userdomain_prefix">
+##     <summary>
+##     The prefix of the user domain (e.g., user
+##     is the prefix for user_t).
+##     </summary>
+## </param>
+## <param name="user_domain">
+##     <summary>
+##     The type of the user domain.
+##     </summary>
+##     </param>
+##     <param name="user_role">
+##     <summary>
+##     The role associated with the user domain.
+##     </summary>
+## </param>
+#
+template(`oidentd_per_role_template', `
+       gen_require(`
+               type oidentd_home_t;
+       ')
+
+       ########################################
+       #
+       #  Declarations
+       #
+
+       userdom_user_home_content($1, oidentd_home_t)
+       
+       ########################################
+       #
+       #  Policy
+       #
+
+       allow $2 oidentd_home_t:file manage_file_perms;
+       allow $2 oidentd_home_t:file relabel_file_perms;
+')
policy/modules/services/oidentd.te new file +102 -0
new file mode 100644
index 0000000..c8bcfc3
@@ -0,0 +1,102 @@
+
+policy_module(oidentd, 0.0.1) 
+
+########################################
+#
+# Declarations
+#
+
+## <desc>
+## <p>
+## Allow Oident daemon to read
+## oidentd daemon home files.
+## </p>
+## </desc>
+
+gen_tunable(allow_oidentd_read_oidentd_home_content, false)
+
+## <desc>
+## <p>
+## Allow Oident daemon to use cifs
+## used for public file transfer services.
+## </p>
+## </desc>
+
+gen_tunable(allow_oidentd_use_cifs, false)
+
+## <desc>
+## <p>
+## Allow Oident daemon to use nfs
+## used for public file transfer services.
+## </p>
+## </desc>
+
+gen_tunable(allow_oidentd_use_nfs, false)
+
+type oidentd_t;
+type oidentd_exec_t;
+init_daemon_domain(oidentd_t, oidentd_exec_t)
+
+type oidentd_config_t;
+files_config_file(oidentd_config_t)
+
+type oidentd_home_t;
+files_poly_member(oidentd_home_t)
+
+########################################
+#
+# Policy
+#
+
+allow oidentd_t self:capability { setuid setgid };
+allow oidentd_t self:netlink_route_socket { write getattr read bind create nlmsg_read };
+allow oidentd_t self:netlink_tcpdiag_socket { write read create nlmsg_read };
+allow oidentd_t self:tcp_socket { setopt read bind create accept write getattr listen };
+allow oidentd_t self:udp_socket { write read create connect getattr };
+allow oidentd_t self:unix_dgram_socket { create connect };
+
+allow oidentd_t oidentd_config_t:file read_file_perms;
+
+corenet_all_recvfrom_unlabeled(oidentd_t)
+corenet_all_recvfrom_netlabel(oidentd_t)
+corenet_tcp_sendrecv_all_if(oidentd_t)
+corenet_tcp_sendrecv_all_nodes(oidentd_t)
+corenet_tcp_bind_all_nodes(oidentd_t)
+corenet_tcp_bind_auth_port(oidentd_t)
+
+files_read_etc_files(oidentd_t)
+
+fs_search_auto_mountpoints(oidentd_t)
+
+kernel_read_kernel_sysctls(oidentd_t)
+kernel_read_network_state(oidentd_t)
+kernel_read_network_state_symlinks(oidentd_t)
+kernel_read_sysctl(oidentd_t)
+
+libs_use_ld_so(oidentd_t)
+libs_use_shared_libs(oidentd_t)
+
+logging_send_syslog_msg(oidentd_t)
+
+miscfiles_read_localization(oidentd_t)
+
+sysnet_read_config(oidentd_t)
+
+optional_policy(`
+       nis_use_ypbind(oidentd_t)
+')
+
+tunable_policy(`allow_oidentd_read_oidentd_home_content', `
+       allow oidentd_t oidentd_home_t:file read_file_perms;
+       userdom_search_user_home_dirs(user, oidentd_t)
+')
+
+tunable_policy(`allow_oidentd_use_cifs', `
+       fs_list_cifs(oidentd_t)
+       fs_read_cifs_files(oidentd_t)
+')
+
+tunable_policy(`allow_oidentd_use_nfs', `
+       fs_list_nfs(oidentd_t)
+       fs_read_nfs_files(oidentd_t)
+')
Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
(410) 290-1411 x150
#12 lore raw

PATCH 1/1 Added policy module for the oident daemon.

Quoted 4 lines · Christopher J. PeBenito

Do you really think that reading the ~/.oidentd.conf needs to be tunable? I was mainly concerned about oidentd reading user_home_t files, for example, since it exposes the whole user's home directory. A config file explictly labeled for reading by oidentd should be ok.

I did this in the spirit of least privilege. ~/.oidentd.conf is optional. By implementing this boolean we give operators a choice to fully disallow access to user home dirs.

Attached version has the requested changes applied.

Signature · 15 lines
Dominick Grift <[email protected]>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: oidentd.patch.txt
Type: text/x-patch
Size: 4998 bytes
Desc: not available
Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20080821/668c2d37/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20080821/668c2d37/attachment-0001.bin 
#13 lore raw

PATCH 1/1 Added policy module for the oident daemon.

In reply to Christopher J. PeBenito
Quoted 2 lines · Christopher J. PeBenito

The per-role template should create a $1_oidentd_home_t type, so role separation is preserved.

Attached version attempts to implement oidentdhome and user_oidentd_home_type attributes. It is compiled-tested however i am not sure if i will be able to test this configuration with Fedora policy without some modifications to the policy.

Signature · 15 lines
Dominick Grift <[email protected]>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: oidentd.patch.txt
Type: text/x-patch
Size: 4968 bytes
Desc: not available
Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20080821/0400f4b5/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20080821/0400f4b5/attachment-0001.bin