SL (RedHat / CentOS) 6.x Sandbox

Végre volt időm átnézni RedHat 6-os Sandbox feature-jét, amely a release notes-ukban is olvasható (8.2.2. bekezdés):
http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/6.0_R…

Magyarázat a Sandbox-hoz:
http://www.misdivision.com/blog/rhel-6-sandbox

Ez egy olyan SELinux policy, amellyel könnyedén bezárhatunk alkalmazásokat egy csökkentett jogosultsággal rendelkező környezetbe, ahol alapesetben nincs joguk más folyamatokhoz és fájlokhoz hozzáférni. Ez a -X kapcsolóval grafikus alkalmazásokhoz is egyszerű lehetőség. A -t kapcsolóval megadható más policy, pl. hogy hozzáférhessen net-hez is.

Szerk.: a grafikus sessionnél új X server-t indít az alkalmazásnak, és fix méretű (800x600 alapért.) mérettel nyitja meg az ablakot - viszont paraméterként ez felülbírálható a -w kapcsolóval.

Szerk2.: a bezárt HOME directory-t az alkalmazásnak egyébként /tmp/.sandbox-home-XXXXXX mappa alatt hozza létre, a tmp-jét pedig a /tmp/.sandbox-user-XXXXXX alatt, úgyhogy egyszerű a fájl csere vagy mappájának olvasása is - illetve a -I (nagy í) kapcsolóval felsorolhatók fájl nevek, amelyeket automatikusan bemásol a környezetbe a sandbox lérehozásakor.


yum info policycoreutils-sandbox

	Name        : policycoreutils-sandbox
	Arch        : x86_64
	Version     : 2.0.83
	Release     : 19.18.el6
	Size        : 109 k
	Repo        : sl
	Summary     : SELinux sandbox utilities
	URL         : http://www.selinuxproject.org
	License     : GPLv2+
	Description : The policycoreutils-sandbox package contains the
                      scripts to create graphical sandboxes

su -c "yum install policycoreutils-sandbox"

man sandbox

sandbox echo hello

	hello

sandbox pwd

	/home/andras

sandbox -X gedit
sandbox -X inkscape
sandbox -X xterm

	pstree
	
		/proc/5079: Permission denied
	
	ping 127.0.0.1
	
		ping: icmp open socket: Permission denied

sandbox -X firefox

	Unable to connect

sandbox -t

	Usage:
	sandbox [-h] [-c] [-l level ] [-[X|M] [-H homedir] [-T tempdir]] [-I
        includefile ] [-W windowmanager ] [ -w windowsize ] [[-i file ] ...]
        [ -t type ] command

	sandbox [-h] [-c] [-l level ] [-[X|M] [-H homedir] [-T tempdir]] [-I
        includefile ] [-W windowmanager ] [ -w windowsize ] [[-i file ] ...]
        [ -t type ] -S

	Policy defines the following types for use with the -t:
		    sandbox_x_t
		    sandbox_min_t
		    sandbox_net_t
		    sandbox_web_t
		    sandbox_t

	sandbox: error: -t option requires an argument

sandbox -t sandbox_net_t -X firefox

	Page loads ;)

Hozzászólások