All of lore.kernel.org
 help / color / mirror / Atom feed
* Squid policy for SE Linux
@ 2002-03-06 16:27 Russell Coker
  2002-03-06 17:24 ` Stephen Smalley
  0 siblings, 1 reply; 4+ messages in thread
From: Russell Coker @ 2002-03-06 16:27 UTC (permalink / raw)
  To: SE Linux; +Cc: miquels

[-- Attachment #1: Type: text/plain, Size: 1241 bytes --]

I have attached my squid.te file.

Here's the relevant parts of my file_contexts file:
/var/cache/squid(|/.*)          system_u:object_r:httpd_cache_t
/usr/lib/squid                  system_u:object_r:squid_t
/usr/sbin/squid                 system_u:object_r:squid_exec_t
/var/log/squid                  system_u:object_r:var_log_squid_t

I also added squid_t to system_r in the rbac file.

I also had to make a couple of minor changes to the squid start script 
(hacked Debian start script attached).

Firstly I made the script change the uid/gid of squid because I didn't want 
to grant setuid capability to the squid binary.

Then I changed the script to do a "cd /" before starting squid instead of
"cd /var/cache/squid" because the /var/cache/squid directory is not readable 
by the initrc_t domain.

Please let me know of any suggestions for improvements.  NSA People, please 
include this in the sample policy if it's good enough.

-- 
If you send email to me or to a mailing list that I use which has >4 lines
of legalistic junk at the end then you are specifically authorizing me to do
whatever I wish with the message and all other messages from your domain, by
posting the message you agree that your long legalistic sig is void.

[-- Attachment #2: squid.te --]
[-- Type: text/plain, Size: 1366 bytes --]

#
# Author:  Russell Coker <russell@coker.com.au>
#

#################################
#
# Rules for the squid_t domain.
#
# squid_t is the domain the squid process runs in, and is also the SID for
# files in /usr/lib/squid
type squid_t, domain, privlog;
# var_log_squid_t is for /var/log/squid
type var_log_squid_t, file_type, sysadmfile;
# main squid binary is of squid_exec_t
type squid_exec_t, file_type, sysadmfile, exec_type;

# Inherit and use descriptors from init.
allow squid_t init_t:fd inherit_fd_perms;

# Create pid file.
type squid_var_run_t, file_type, sysadmfile, pidfile;
file_type_auto_trans(squid_t, var_run_t, squid_var_run_t)

# httpd_cache_t is for /var/cache/squid
allow squid_t httpd_cache_t:dir create_dir_perms;
allow squid_t httpd_cache_t:file rw_file_perms;
file_type_auto_trans(squid_t, httpd_cache_t, httpd_cache_t)

allow squid_t var_log_squid_t:dir rw_dir_perms;
allow squid_t var_log_squid_t:file rw_file_perms;
file_type_auto_trans(squid_t, var_log_squid_t, var_log_squid_t)

# for /usr/lib/squid
allow squid_t squid_t:dir r_dir_perms;
allow squid_t squid_t:file r_file_perms;

can_network(squid_t)
# port 8080 is http_port
allow squid_t http_port_t:tcp_socket name_bind;
allow squid_t squid_t:file { execute_no_trans execute };
allow squid_t squid_exec_t:file execute_no_trans;

domain_auto_trans(initrc_t, squid_exec_t, squid_t)

[-- Attachment #3: squid --]
[-- Type: application/x-shellscript, Size: 2425 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-03-07 12:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-03-06 16:27 Squid policy for SE Linux Russell Coker
2002-03-06 17:24 ` Stephen Smalley
2002-03-06 20:00   ` Russell Coker
2002-03-07 12:14     ` Dale Amon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.