]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/core/namespace.h
Merge pull request #4536 from poettering/seccomp-namespaces
[thirdparty/systemd.git] / src / core / namespace.h
CommitLineData
c2f1db8f 1#pragma once
15ae422b
LP
2
3/***
4 This file is part of systemd.
5
6 Copyright 2010 Lennart Poettering
c575770b 7 Copyright 2016 Djalal Harouni
15ae422b
LP
8
9 systemd is free software; you can redistribute it and/or modify it
5430f7f2
LP
10 under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation; either version 2.1 of the License, or
15ae422b
LP
12 (at your option) any later version.
13
14 systemd is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5430f7f2 17 Lesser General Public License for more details.
15ae422b 18
5430f7f2 19 You should have received a copy of the GNU Lesser General Public License
15ae422b
LP
20 along with systemd; If not, see <http://www.gnu.org/licenses/>.
21***/
22
c575770b
DH
23typedef struct NameSpaceInfo NameSpaceInfo;
24
15ae422b
LP
25#include <stdbool.h>
26
417116f2
LP
27#include "macro.h"
28
1b8689f9
LP
29typedef enum ProtectHome {
30 PROTECT_HOME_NO,
31 PROTECT_HOME_YES,
32 PROTECT_HOME_READ_ONLY,
33 _PROTECT_HOME_MAX,
34 _PROTECT_HOME_INVALID = -1
35} ProtectHome;
36
37typedef enum ProtectSystem {
38 PROTECT_SYSTEM_NO,
39 PROTECT_SYSTEM_YES,
40 PROTECT_SYSTEM_FULL,
3f815163 41 PROTECT_SYSTEM_STRICT,
1b8689f9
LP
42 _PROTECT_SYSTEM_MAX,
43 _PROTECT_SYSTEM_INVALID = -1
44} ProtectSystem;
417116f2 45
c575770b
DH
46struct NameSpaceInfo {
47 bool private_dev:1;
48 bool protect_control_groups:1;
49 bool protect_kernel_tunables:1;
50 bool protect_kernel_modules:1;
51};
52
ee818b89 53int setup_namespace(const char *chroot,
c575770b 54 const NameSpaceInfo *ns_info,
2a624c36
AP
55 char **read_write_paths,
56 char **read_only_paths,
57 char **inaccessible_paths,
a004cb4c
LP
58 const char *tmp_dir,
59 const char *var_tmp_dir,
1b8689f9
LP
60 ProtectHome protect_home,
61 ProtectSystem protect_system,
e6547662 62 unsigned long mount_flags);
613b411c
LP
63
64int setup_tmp_dirs(const char *id,
65 char **tmp_dir,
66 char **var_tmp_dir);
67
68int setup_netns(int netns_storage_socket[2]);
417116f2 69
1b8689f9
LP
70const char* protect_home_to_string(ProtectHome p) _const_;
71ProtectHome protect_home_from_string(const char *s) _pure_;
72
73const char* protect_system_to_string(ProtectSystem p) _const_;
74ProtectSystem protect_system_from_string(const char *s) _pure_;