summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2003-07-09 14:53:59 +0000
committerMike Frysinger <vapier@gentoo.org>2003-07-09 14:53:59 +0000
commit6bf099784a040e2dabde487a04b39f961b7e7214 (patch)
tree6644a1bbb398d66bf8036525bc5d1b8e40cd649b /app-shells/sandboxshell/files
parentsome new official patches, apply without modification (diff)
downloadgentoo-2-6bf099784a040e2dabde487a04b39f961b7e7214.tar.gz
gentoo-2-6bf099784a040e2dabde487a04b39f961b7e7214.tar.bz2
gentoo-2-6bf099784a040e2dabde487a04b39f961b7e7214.zip
initial ebuild
Diffstat (limited to 'app-shells/sandboxshell/files')
-rw-r--r--app-shells/sandboxshell/files/digest-sandboxshell-0.10
-rw-r--r--app-shells/sandboxshell/files/sandboxshell37
-rw-r--r--app-shells/sandboxshell/files/sandboxshell.conf61
3 files changed, 98 insertions, 0 deletions
diff --git a/app-shells/sandboxshell/files/digest-sandboxshell-0.1 b/app-shells/sandboxshell/files/digest-sandboxshell-0.1
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/app-shells/sandboxshell/files/digest-sandboxshell-0.1
diff --git a/app-shells/sandboxshell/files/sandboxshell b/app-shells/sandboxshell/files/sandboxshell
new file mode 100644
index 000000000000..68bd3fb22cee
--- /dev/null
+++ b/app-shells/sandboxshell/files/sandboxshell
@@ -0,0 +1,37 @@
+#!/bin/bash
+# Written by vapier@gentoo.org
+# public-domain code ... z0r ...
+# $Header: /var/cvsroot/gentoo-x86/app-shells/sandboxshell/files/sandboxshell,v 1.1 2003/07/09 14:53:39 vapier Exp $
+
+. /sbin/functions.sh
+. /etc/profile
+
+# sanity checks ...
+cd ${PWD} || {
+ eerror "Could not access ${PWD}"
+ exit 1
+}
+
+export LD_PRELOAD=/lib/libsandbox.so
+export SANDBOX_LIB=/lib/libsandbox.so
+export SANDBOX_LOG="/tmp/sandboxme-$(date '+%d.%m.%Y-%H.%M.%S').log"
+export SANDBOX_DEBUG_LOG="${SANDBOX_LOG}.debug"
+export SANDBOX_DENY=""
+export SANDBOX_READ="/"
+export SANDBOX_WRITE="/dev/tty:/dev/pts:/dev/null:/tmp"
+export SANDBOX_PREDICT="${HOME}/.bash_history"
+export SANDBOX_ON="1"
+
+einfo "Loading sandboxed shell"
+einfo " Log File: ${SANDBOX_LOG}"
+einfo " Debug Log File: ${SANDBOX_DEBUG_LOG}"
+einfo " sandboxon: turn sandbox on"
+einfo " sandboxoff: turn sandbox off"
+einfo " addread <path>: allow <path> to be read"
+einfo " addwrite <path>: allow <path> to be written"
+einfo " adddeny <path>: deny access to <path>"
+einfo " addpredict <path>: allow fake access to <path>"
+
+export SANDBOX_ACTIVE="armedandready"
+export SANDBOX_WRITE="${SANDBOX_WRITE}:`pwd`:/etc/mtab:/dev/ram5:/root/.ccache"
+exec /bin/bash --init-file /etc/sandboxshell.conf
diff --git a/app-shells/sandboxshell/files/sandboxshell.conf b/app-shells/sandboxshell/files/sandboxshell.conf
new file mode 100644
index 000000000000..276fd8f89797
--- /dev/null
+++ b/app-shells/sandboxshell/files/sandboxshell.conf
@@ -0,0 +1,61 @@
+#!/bin/bash
+# Written by vapier@gentoo.org
+# public-domain code ... z0r ...
+# $Header: /var/cvsroot/gentoo-x86/app-shells/sandboxshell/files/sandboxshell.conf,v 1.1 2003/07/09 14:53:39 vapier Exp $
+
+source /etc/profile
+
+# do ebuild environment loading ... detect if we're in portage
+# build area or not ... uNF uNF uNF
+#sbs_pdir=`portageq envvar PORTAGE_TMPDIR`/portage/ #portageq takes too long imo
+if [ -z "${PORTAGE_TMPDIR}" ] ; then
+ sbs_gpdir=`( source /etc/make.globals && echo $PORTAGE_TMPDIR ) 2> /dev/null`
+ sbs_cpdir=`( source /etc/make.conf && echo $PORTAGE_TMPDIR ) 2> /dev/null`
+ [ -z "${sbs_cpdir}" ] \
+ && sbs_pdir=${sbs_gpdir} \
+ || sbs_pdir=${sbs_cpdir}
+else
+ sbs_pdir=${PORTAGE_TMPDIR}
+fi
+[ -z "${sbs_pdir}" ] && sbs_pdir=/var/tmp
+sbs_pdir=${sbs_pdir}/portage/
+
+if [ "${PWD:0:${#sbs_pdir}}" == "${sbs_pdir}" ] ; then
+ sbs_bdir=`echo ${PWD:${#sbs_pdir}} | cut -d/ -f1`
+ sbs_tmpenvfile=${sbs_pdir}${sbs_bdir}/temp/environment
+ if [ -e "${sbs_tmpenvfile}" ] ; then
+ echo "Found environment at ${sbs_tmpenvfile}"
+ printf " * Would you like to load the environment? "
+ read env
+ sbs_PREPWD=${PWD}
+ [ "${env}" == "y" ] && source ${PWD}/temp/environment 2> /dev/null
+ PWD=${sbs_PREPWD}
+ fi
+fi
+
+cd ${PWD}
+export PS1="[s]${PS1}"
+
+adddeny() {
+ export SANDBOX_DENY="$SANDBOX_DENY:$1"
+}
+
+addpredict() {
+ export SANDBOX_PREDICT="$SANDBOX_PREDICT:$1"
+}
+
+addread() {
+ export SANDBOX_READ="$SANDBOX_READ:$1"
+}
+
+addwrite() {
+ export SANDBOX_WRITE="$SANDBOX_WRITE:$1"
+}
+
+sandboxon() {
+ export SANDBOX_ON="1"
+}
+
+sandboxoff() {
+ export SANDBOX_OFF="0"
+}