Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clowdflows
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Alain Shakour
clowdflows
Commits
8c0f69b0
Commit
8c0f69b0
authored
Mar 01, 2013
by
Anze Vavpetic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed file
parent
8b64c610
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
34 deletions
+0
-34
workflows/ilp/rsd/jail_test.py
workflows/ilp/rsd/jail_test.py
+0
-34
No files found.
workflows/ilp/rsd/jail_test.py
deleted
100644 → 0
View file @
8b64c610
import
pwd
import
os
import
shutil
import
tempfile
import
stat
import
subprocess
jail_dir
=
tempfile
.
mkdtemp
()
os
.
chmod
(
jail_dir
,
stat
.
S_IRUSR
|
stat
.
S_IWUSR
)
#etc
#we use several other permission bits here.
#c.f. best practices article
jail_etc
=
os
.
path
.
abspath
(
os
.
path
.
join
(
jail_dir
,
"etc"
))
os
.
mkdir
(
jail_etc
)
shutil
.
copy
(
'/etc/resolv.conf'
,
jail_etc
)
for
required_dir
in
[
'/usr/bin/'
]:
#use mount -r --bind as a convenient way of giving read-only access
#to other folders (libraries, etc) required by the jailed process
mount_point
=
"%s%s"
%
(
jail_dir
,
required_dir
)
os
.
makedirs
(
mount_point
)
subprocess
.
call
([
"sudo"
,
"mount"
,
"-r"
,
"--bind"
,
required_dir
,
mount_point
])
nobody_user
=
pwd
.
getpwnam
(
"nobody"
).
pw_uid
os
.
chroot
(
jail_dir
)
os
.
chdir
(
'/'
)
os
.
seteuid
(
nobody_user
)
p
=
subprocess
.
Popen
([
'python'
,
'rsd.py'
])
stdout_str
,
stderr_str
=
p
.
communicate
()
print
stdout_str
print
stderr_str
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment