New upstream version 0.2
MartÃn Ferrari
7 years ago
|
0 |
setup.py
|
|
1 |
unshare.c
|
|
2 |
COPYING
|
0 | |
Metadata-Version: 1.0
|
1 | |
Name: python-unshare
|
2 | |
Version: 0.1
|
3 | |
Summary: Python bindings for the Linux unshare() syscall
|
4 | |
Home-page: http://code.google.com/p/python-unshare/
|
5 | |
Author: Martin Ferrari
|
6 | |
Author-email: martin.ferrari@gmail.com
|
7 | |
License: GPLv2
|
8 | |
Description: This simple extension provides bindings to the Linux unshare() syscall, added in kernel version 2.6.16
|
9 | |
|
10 | |
By using unshare(), new and interesting features of the Linux kernel can be exploited, such as:
|
11 | |
|
12 | |
* Creating a new network name space (CLONE_NEWNET)
|
13 | |
* Creating a new file system mount name space (CLONE_NEWNS)
|
14 | |
* Reverting other features shared from clone()
|
15 | |
Platform: Linux
|
|
0 |
This simple extension provides bindings to the Linux `unshare()` syscall, added in kernel version 2.6.16
|
|
1 |
|
|
2 |
By using `unshare()`, new and interesting features of the Linux kernel can be exploited, such as:
|
|
3 |
|
|
4 |
* Creating a new network name space (`CLONE_NEWNET`)
|
|
5 |
* Creating a new file system mount name space (`CLONE_NEWNS`)
|
|
6 |
* Reverting other features shared from `clone()`
|
|
7 |
|
|
8 |
This library provides an equivalent of the (recently added) util-linux command-line program `unshare`.
|
13 | 13 |
|
14 | 14 |
setup(
|
15 | 15 |
name = 'python-unshare',
|
16 | |
version = '0.1',
|
|
16 |
version = '0.2',
|
17 | 17 |
description = 'Python bindings for the Linux unshare() syscall',
|
18 | 18 |
long_description = longdesc,
|
19 | 19 |
author = 'Martin Ferrari',
|
32 | 32 |
return PyErr_SetFromErrno(PyExc_OSError);
|
33 | 33 |
Py_RETURN_NONE;
|
34 | 34 |
}
|
|
35 |
|
|
36 |
static PyObject * _setns(PyObject *self, PyObject *args) {
|
|
37 |
int fd, nstype, ret;
|
|
38 |
if (!PyArg_ParseTuple(args, "ii", &fd, &nstype))
|
|
39 |
return NULL;
|
|
40 |
ret = setns(fd, nstype);
|
|
41 |
if(ret == -1)
|
|
42 |
return PyErr_SetFromErrno(PyExc_OSError);
|
|
43 |
Py_RETURN_NONE;
|
|
44 |
}
|
|
45 |
|
35 | 46 |
static PyMethodDef methods[] = {
|
36 | 47 |
{"unshare", _unshare, METH_VARARGS,
|
37 | 48 |
"unshare(flags)\n\n"
|
|
43 | 54 |
" CLONE_SYSVSEM CLONE_NEWUTS CLONE_NEWIPC CLONE_NEWUSER "
|
44 | 55 |
"CLONE_NEWPID\n"
|
45 | 56 |
" CLONE_NEWNET\n"
|
|
57 |
},
|
|
58 |
{"setns", _setns, METH_VARARGS,
|
|
59 |
"setns(fd, nstype)\n\n"
|
|
60 |
"Reassociate the calling thread with a new namespace.\n"
|
|
61 |
"fd is a filedescriptor referring to a namespace.\n"
|
|
62 |
"nstype specifies which type of namespace the calling thread\n"
|
|
63 |
"may be reassociated with.\n\n"
|
|
64 |
"Possible values for nstype:\n"
|
|
65 |
" 0 Allow any type of namespace to be joined.\n"
|
|
66 |
" CLONE_NEWIPC fd must refer to an IPC namespace.\n"
|
|
67 |
" CLONE_NEWNET fd must refer to a network namespace.\n"
|
|
68 |
" CLONE_NEWNS fd must refer to a mount namespace.\n"
|
|
69 |
" CLONE_NEWPID fd must refer to a descendant PID namespace.\n"
|
|
70 |
" CLONE_NEWUSER fd must refer to a user namespace.\n"
|
|
71 |
" CLONE_NEWUTS fd must refer to a UTS namespace.\n"
|
46 | 72 |
},
|
47 | 73 |
{NULL, NULL, 0, NULL}
|
48 | 74 |
};
|