blob: 5b907e67d5d7e071585bc7d553316f563f395cba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
% ----------------------------
\subsubsection{How to isolate Applications}
\begin{frame}[fragile]
\frametitle{How to isolate Applications}
\begin{itemize}
\item System Information via Kernel API
\begin{itemize}
\item Syscalls
\item PseudoFS (e.g. /proc and /sys)
\item Filesystem tree
\item Network Infrastructure (interfaces, components)
\end{itemize}
\item Namespaces
\begin{itemize}
\item Reduction of System Scope
\item System View Virtualization
\end{itemize}
\item Controlgroup
\begin{itemize}
\item Partitioning of System Resources (CPU time, Memory, etc.)
\end{itemize}
\item Container
\begin{itemize}
\item Configuration Tools
\item Use Namespaces and Controlgroups
\item Application in a Box
\end{itemize}
\end{itemize}
\end{frame}
% ----------------------------
\subsubsection{Namespaces}
\begin{frame}[fragile]
\frametitle{Namespaces}
\begin{itemize}
\item Mount: \\
Provide different filesystem
\item PID: \\
Provide new Process-ID scope
\item IPC: \\
Provide isolated inter process communication entities
\item Network: \\
Provide isolated networking environment
\item User: \\
Provide different User/UID mapping
\item UTS: \\
Provide different hostname
\end{itemize}
\end{frame}
% ----------------------------
\subsubsection{Container}
% ----------------------------
\begin{frame}[fragile]
\frametitle{Containers}
\begin{itemize}
\item Application Isolation
\item Lightweight Virtualisation
\item Based on cgroups and namespaces
\item Easy namespace configuration and management
\item Projects:
\begin{itemize}
\item Docker
\item Linux-VServer
\item OpenVZ
\item Linux Container (LXC)
\item \dots
\end{itemize}
\end{itemize}
\end{frame}
% ----------------------------
\subsubsection{LXC Handling}
% ----------------------------
\begin{frame}[fragile]
\frametitle{Linux Containers (LXC)}
\begin{beamerboxesrounded}[shadow=true]{Start/Stop container:}
\begin{scriptsize}
\begin{verbatim}
# Start: Better for single commands
lxc-execute -n cont_name [-f config] /bin/bash
# Start: Better for container systems
lxc-start -n cont_name [-f config]
# Stop container
lxc-stop -n foo
\end{verbatim}
\end{scriptsize}
\end{beamerboxesrounded}
\begin{beamerboxesrounded}[shadow=true]{Control container:}
\begin{scriptsize}
\begin{verbatim}
# Pause/resume container (controlling group of processes)
lxc-freeze -n cont_name
lxc-unfreeze -n cont_name
# Monitor container states
lxc-monitor -n cont_name
# Attach to container console
lxc-console -n cont_name
\end{verbatim}
\end{scriptsize}
\end{beamerboxesrounded}
\end{frame}
% ----------------------------
\begin{frame}[fragile]
\frametitle{Linux Container (LXC): Configuration I}
\begin{beamerboxesrounded}[shadow=true]{Networking example:}
\begin{scriptsize}
\begin{verbatim}
#
# new hostname for container
#
lxc.utsname = myhostname
#
# Network vistualization
# - private segment in container
# - connected via br0 to device network
#
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.name = eth0
lxc.network.hwaddr = 4a:49:43:49:79:bf
lxc.network.ipv4 = 10.2.3.5/24 10.2.3.255
\end{verbatim}
\end{scriptsize}
\end{beamerboxesrounded}
\end{frame}
% ----------------------------
\begin{frame}[fragile]
\frametitle{Linux Container (LXC): Configuration II}
\begin{beamerboxesrounded}[shadow=true]{Controlgroup example:}
\begin{scriptsize}
\begin{verbatim}
#
# new hostname for container
#
lxc.utsname = myhostname
#
# schedule container processes only on CPU 3 and 4
#
lxc.cgroup.cpuset.cpus = 3,4
#
# Deny access to device nodes other than
# - /dev/null (c, 1, 3)
# - /dev/urandom (c, 1, 3)
# - /dev/sda5 (b, 8, 5)
#
lxc.cgroup.devices.deny = a
lxc.cgroup.devices.allow = c 1:3 rw
lxc.cgroup.devices.allow = c 1:9 ro
lxc.cgroup.devices.allow = b 8:5 rw
\end{verbatim}
\end{scriptsize}
\end{beamerboxesrounded}
\end{frame}
% ----------------------------
\subsubsection{Summary}
% ----------------------------
\begin{frame}[fragile]
\frametitle{Container: Summary}
\begin{itemize}
\item Lightweight Virtualization
\item Isolation of Applications
\item Hide System Resources/Configuration
\item Common:
\begin{itemize}
\item Shared Kernel
\end{itemize}
\item Solution:
\begin{itemize}
\item Viewability between Applications
\item Sandbox (in combination with MAC)
\end{itemize}
\end{itemize}
\end{frame}
|