All of lore.kernel.org
 help / color / mirror / Atom feed
* uml policy
@ 2002-09-12 18:12 Tom
  2002-09-12 18:46 ` Russell Coker
  2002-09-12 18:49 ` Russell Coker
  0 siblings, 2 replies; 9+ messages in thread
From: Tom @ 2002-09-12 18:12 UTC (permalink / raw)
  To: selinux

During Linux Kongress, I had a little chat with Russell about uml
(user-mode-linux) on top of SELinux (for now, I'll leave the
mindboggling involved with SE-UML-Linux to someone else :) ).

I've found out that uml runs fine as a standard userspace process (i.e.
as it was intendend) with the default policy. So getting it simply to
run is already done.

I plan to spend some time on running uml in it's own domain, with
minimal rights and auto-trans into it when you fire it up. I'm
announcing this so anyone else working on something similiar can yell
and we don't need to do redundant work.


-- 
http://web.lemuria.org/pubkey.html
pub  1024D/2D7A04F5 2002-05-16 Tom Vogt <tom@lemuria.org>
     Key fingerprint = C731 64D1 4BCF 4C20 48A4  29B2 BF01 9FA1 2D7A 04F5

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 9+ messages in thread
* UML policy
@ 2003-01-12 12:06 Russell Coker
  0 siblings, 0 replies; 9+ messages in thread
From: Russell Coker @ 2003-01-12 12:06 UTC (permalink / raw)
  To: selinux

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

I've attached a first draft of a policy for user-mode-linux.  Also 
macros/user_macros.te needs the following line:
ifdef(`uml.te', `uml_domain($1)')

This creates a user_uml_t domain that has read access to user_uml_ro_t and 
read/write access to user_uml_rw_t.  It has basic access to /proc, access to 
ptrace it's child processes, and can create it's own files in /tmp which it 
can execute.

For executable types, there is uml_exec_t for the system and user_uml_exec_t 
for the user.  So the user can run a UML kernel supplied by the administrator 
or one that they compile themself.

I probably need to do more to allow xterms and the UML networking daemon to 
work.  But the attached policy is enough to get all the basic functions 
going, and sets a good foundation for building further UML policy.

The aim of the UML policy is that each user domain can run it's own UMLs that 
are totally separate from each other and are prevented from accessing files 
on the user's home directory, seeing their processes in /proc, etc.  So if 
someone breaks out of a UML all they get is the ability to run another UML.


Also I've just spent an entertaining day trying to port UML to 2.5.56 and 
porting it to 2.4.20 (although there's still a minor bug to fix).  If 
anyone's interested in sharing UML patches then contact me off-list.


I'm working on SE Linux inside a UML again...

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

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


# Author: Russell Coker <russell@coker.com.au>
#
type uml_exec_t, file_type, sysadmfile, exec_type;

# the main code is in macros/program/uml_macros.te

[-- Attachment #3: uml_macros.te --]
[-- Type: text/plain, Size: 2844 bytes --]

#
# Macros for uml domains.
#

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

#
# uml_domain(domain_prefix)
#
# Define a derived domain for the uml program when executed
# by a user domain.
#
# The type declaration for the executable type for this program is
# provided separately in domains/program/uml.te. 
#
undefine(`uml_domain')
ifdef(`uml.te', `
define(`uml_domain',`
# Derived domain based on the calling user domain and the program.
type $1_uml_t, domain;
type $1_uml_exec_t, file_type, sysadmfile;
type $1_uml_ro_t, file_type, sysadmfile;
type $1_uml_rw_t, file_type, sysadmfile;

allow $1_t { $1_uml_ro_t $1_uml_rw_t $1_uml_exec_t }:file { relabelfrom relabelto create_file_perms };
allow $1_t { $1_uml_ro_t $1_uml_rw_t $1_uml_exec_t }:dir { relabelfrom relabelto create_dir_perms };

# Transition from the user domain to this domain.
domain_auto_trans($1_t, { uml_exec_t $1_uml_exec_t }, $1_uml_t)
can_exec($1_uml_t, { uml_exec_t $1_uml_exec_t })

# The user role is authorized for this domain.
role $1_r types $1_uml_t;

# Inherit and use descriptors from gnome-pty-helper.
ifdef(`gnome-pty-helper.te',
`allow $1_uml_t $1_gph_t:fd use;
allow $1_t $1_gph_t:fd use;')

# Inherit and use descriptors from newrole.
ifdef(`newrole.te', `allow $1_uml_t newrole_t:fd use;')

# allow ps to show uml
allow $1_t $1_uml_t:dir { search getattr read };
allow $1_t $1_uml_t:{ file lnk_file } { read getattr };
allow $1_t $1_uml_t:process signal;

# allow the UML thing to happen
allow $1_uml_t self:process { fork signal_perms ptrace };
can_create_pty($1_uml)
allow $1_uml_t root_t:dir search;
tmp_domain($1_uml)
can_exec($1_uml_t, $1_uml_tmp_t)
create_dir_file($1_t, $1_uml_tmp_t)

# Use the network.
can_network($1_uml_t)

#allow $1_uml_t { etc_t resolv_conf_t }:file { read getattr };
#allow $1_uml_t etc_t:lnk_file read;
#allow $1_uml_t fs_t:filesystem getattr;
#allow $1_uml_t var_t:dir search;
allow $1_uml_t devpts_t:dir { getattr read search };
allow $1_uml_t device_t:dir search;
allow $1_uml_t devtty_t:chr_file rw_file_perms;
allow $1_uml_t self:unix_stream_socket create_stream_socket_perms;
allow $1_uml_t self:unix_dgram_socket create_socket_perms;
allow $1_uml_t privfd:fd use;
allow $1_uml_t proc_t:dir search;
allow $1_uml_t proc_t:file { getattr read };
#allow $1_uml_t { self proc_t }:lnk_file read;
#allow $1_uml_t self:dir search;
#dontaudit $1_uml_t var_run_t:dir search;

# Write to the user domain tty.
allow $1_uml_t $1_tty_device_t:chr_file rw_file_perms;
allow $1_uml_t $1_devpts_t:chr_file rw_file_perms;

# allow utmp access
#allow $1_uml_t initrc_var_run_t:file read;
#dontaudit $1_uml_t initrc_var_run_t:file lock;

# access config files
allow $1_uml_t home_root_t:dir search;
file_type_auto_trans($1_uml_t, $1_home_dir_t, $1_uml_rw_t)
r_dir_file($1_uml_t, $1_uml_ro_t)

')

', `

define(`uml_domain',`')

')

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

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

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-12 18:12 uml policy Tom
2002-09-12 18:46 ` Russell Coker
2002-09-12 21:18   ` Tom
2002-09-12 22:53     ` Russell Coker
2002-09-13  5:35       ` Tom
2002-09-13  9:01         ` Russell Coker
2002-09-13 15:56           ` Tom
2002-09-12 18:49 ` Russell Coker
  -- strict thread matches above, loose matches on Subject: below --
2003-01-12 12:06 UML policy Russell Coker

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.