#include <libubus.h>
#define STACK_SIZE (1024 * 1024)
-#define OPT_ARGS "S:C:n:h:r:w:d:psulocU:G:NR:fFO:T:"
+#define OPT_ARGS "S:C:n:h:r:w:d:psulocU:G:NR:fFO:T:E"
static struct {
char *name;
int pw_uid;
int pw_gid;
int gr_gid;
+ int require_jail;
} opts;
fprintf(stderr, " -R <dir>\texternal jail rootfs (system container)\n");
fprintf(stderr, " -O <dir>\tdirectory for r/w overlayfs\n");
fprintf(stderr, " -T <size>\tuse tmpfs r/w overlayfs with <size>\n");
+ fprintf(stderr, " -E\t\tfail if jail cannot be setup\n");
fprintf(stderr, "\nWarning: by default root inside the jail is the same\n\
and he has the same powers as root outside the jail,\n\
thus he can escape the jail and/or break stuff.\n\
case 'T':
opts.tmpoverlaysize = optarg;
break;
+ case 'E':
+ opts.require_jail = 1;
+ break;
}
}
if (opts.namespace && opts.seccomp && add_path_and_deps("libpreload-seccomp.so", 1, -1, 1)) {
ERROR("failed to load libpreload-seccomp.so\n");
- return -1;
+ if (opts.require_jail)
+ return -1;
}
if (opts.name)
argv[argc++] = in->tmpoverlaysize;
}
+ if (in->require_jail)
+ argv[argc++] = "-E";
+
blobmsg_list_for_each(&jail->mount, var) {
const char *type = blobmsg_data(var->data);