mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-11-21 19:02:53 +00:00
added --namespace-keep-mount
This commit is contained in:
@@ -130,6 +130,17 @@ void linux_namespace_jail() {
|
||||
uwsgi_error("mount()");
|
||||
}
|
||||
|
||||
struct uwsgi_string_list *usl = uwsgi.ns_keep_mount;
|
||||
while(usl) {
|
||||
// bind mounting keep-mount items
|
||||
char *ks = uwsgi_concat2("/.uwsgi_ns_tmp_mountpoint", usl->value);
|
||||
if (mount(ks, usl->value, "none", MS_BIND, NULL)) {
|
||||
uwsgi_error("mount()");
|
||||
}
|
||||
free(ks);
|
||||
usl = usl->next;
|
||||
}
|
||||
|
||||
while (unmounted) {
|
||||
|
||||
unmounted = 0;
|
||||
@@ -139,6 +150,7 @@ void linux_namespace_jail() {
|
||||
delim0++;
|
||||
delim1 = strchr(delim0, ' ');
|
||||
*delim1 = 0;
|
||||
if (uwsgi_string_list_has_item(uwsgi.ns_keep_mount, delim0, strlen(delim0))) continue;
|
||||
if (!strcmp(delim0, "/") || !strcmp(delim0, "/proc"))
|
||||
continue;
|
||||
if (!umount(delim0)) {
|
||||
|
||||
@@ -385,6 +385,19 @@ void internal_server_error(struct wsgi_request *wsgi_req, char *message) {
|
||||
uwsgi.wsgi_req->response_size += wsgi_req->socket->proto_write(wsgi_req, message, strlen(message));
|
||||
}
|
||||
|
||||
struct uwsgi_string_list *uwsgi_string_list_has_item(struct uwsgi_string_list *list, char *key, size_t keylen) {
|
||||
struct uwsgi_string_list *usl = list;
|
||||
while(usl) {
|
||||
if (keylen == usl->len) {
|
||||
if (!memcmp(key, usl->value, keylen)) {
|
||||
return usl;
|
||||
}
|
||||
}
|
||||
usl = usl->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
void uwsgi_set_cgroup() {
|
||||
|
||||
|
||||
@@ -410,6 +410,7 @@ static struct uwsgi_option uwsgi_base_options[] = {
|
||||
{"cgroup", required_argument, 0, "put the processes in the specified cgroup", uwsgi_opt_add_string_list, &uwsgi.cgroup, 0},
|
||||
{"cgroup-opt", required_argument, 0, "set value in specified cgroup option", uwsgi_opt_add_string_list, &uwsgi.cgroup_opt, 0},
|
||||
{"namespace", required_argument, 0, "run in a new namespace under the specified rootfs", uwsgi_opt_set_str, &uwsgi.ns, 0},
|
||||
{"namespace-keep-mount", required_argument, 0, "keep the specified mountpoint in your namespace", uwsgi_opt_add_string_list, &uwsgi.ns_keep_mount, 0},
|
||||
{"ns", required_argument, 0, "run in a new namespace under the specified rootfs", uwsgi_opt_set_str, &uwsgi.ns, 0},
|
||||
{"namespace-net", required_argument, 0, "add network namespace", uwsgi_opt_set_str, &uwsgi.ns_net, 0},
|
||||
{"ns-net", required_argument, 0, "add network namespace", uwsgi_opt_set_str, &uwsgi.ns_net, 0},
|
||||
|
||||
@@ -1533,6 +1533,7 @@ struct uwsgi_server {
|
||||
struct uwsgi_string_list *cgroup_opt;
|
||||
char *ns;
|
||||
char *ns_net;
|
||||
struct uwsgi_string_list *ns_keep_mount;
|
||||
#endif
|
||||
|
||||
char *protocol;
|
||||
@@ -2891,6 +2892,8 @@ char *uwsgi_substitute(char *, char *, char *);
|
||||
void manage_cluster_message(char *, int);
|
||||
void uwsgi_opt_add_custom_option(char *, char *, void *);
|
||||
|
||||
struct uwsgi_string_list *uwsgi_string_list_has_item(struct uwsgi_string_list *, char *, size_t);
|
||||
|
||||
#ifdef UWSGI_SSL
|
||||
void uwsgi_ssl_init(void);
|
||||
SSL_CTX *uwsgi_ssl_new_server_context(char *, char *, char *, char *, char *);
|
||||
|
||||
Reference in New Issue
Block a user