Debian Codegraph @

share/man/container-shell.1.rst

raw
1 .. Open Infrastructure: compute-tools
2
3 .. Copyright (C) 2014-2026 Daniel Baumann <[email protected]>
4 ..
5 .. SPDX-License-Identifier: GPL-3.0+
6 ..
7 .. This program is free software: you can redistribute it and/or modify
8 .. it under the terms of the GNU General Public License as published by
9 .. the Free Software Foundation, either version 3 of the License, or
10 .. (at your option) any later version.
11 ..
12 .. This program is distributed in the hope that it will be useful,
13 .. but WITHOUT ANY WARRANTY; without even the implied warranty of
14 .. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 .. GNU General Public License for more details.
16 ..
17 .. You should have received a copy of the GNU General Public License
18 .. along with this program. If not, see <https://www.gnu.org/licenses/>.
19
20 ===============
21 container-shell
22 ===============
23
24 ----------------------------------------
25 Manage systemd-nspawn containers (shell)
26 ----------------------------------------
27
28 :manual section: 1
29 :manual group: Open Infrastructure
30
31 Synopsis
32 ========
33
34 | **container-shell** ['OPTIONS']
35 | **cntsh** ['OPTIONS']
36
37 Description
38 ===========
39
40 compute-tools provides the system integration for managing containers using
41 systemd-nspawn.
42
43 Usage
44 -----
45
46 Although the **container-shell** can be started from a running system like any
47 other program, the main intend is to use the **container-shell** via SSH. That
48 way otherwise unprivileged users have possibility to manage containers without
49 needing a regular shell login on the container server.
50
51 For usage over SSH a unprivileged user should be created:
52
53 |
54 | sudo adduser --gecos "compute-tools,,," \\
55 | --home /var/lib/open-infrastructure/container-shell \\
56 | --shell /usr/bin/container-shell
57
58 The container-shell can then be allowed for specific SSH keys via
59 /var/lib/compute-tools/container-shell/.ssh/authorized_keys like so:
60
61 |
62 | command="/usr/bin/container-shell",no-port-forwarding,no-X11-forwarding,\\
63 | no-agent-forwarding,no-pty ssh-ed25519 [...]
64
65 Restricted shell
66 ----------------
67
68 The container-shell by default grants any user that has access to it to use all available container commands.
69
70 Through two corresponding environment variables users can be allowed or disallowed to use specific container commands.
71 In connection with SSH this makes it possible to grant certain SSH keys (and by that, users) privileges to operate container
72 servers without having to give them root access, a login shell at all and prevents them from doing things they are not trusted to do.
73
74 Example (blacklisting)
75 ^^^^^^^^^^^^^^^^^^^^^^
76
77 In order to allow all commands except for removing and stopping containers, the
78 following variable can be used:
79
80 |
81 | command="CONTAINER_COMMANDS_DISABLE='remove stop' \\
82 | /usr/bin/container-shell",no-port-forwarding,no-X11-forwarding,\\
83 | no-agent-forwarding,no-pty ssh-ed25519 [...]
84
85 Example (whitelisting)
86 ^^^^^^^^^^^^^^^^^^^^^^
87
88 The other way around works too. To disallow all commands except for listing
89 containers and showing the compute-tools version, the following variable can be
90 used:
91
92 |
93 | command="CONTAINER_COMMANDS_ENABLE='list version' \\
94 | /usr/bin/container-shell",no-port-forwarding,no-X11-forwarding,\\
95 | no-agent-forwarding,no-pty ssh-ed25519 [...]
96
97 Commands
98 ========
99
100 All container commands are available, see container(1). Additionally, the
101 following commands are specific to container-shell:
102
103 about:
104 Shows introduction (manpage).
105
106 help:
107 Shows available commands within the container-shell.
108
109 help COMMAND:
110 Shows help (manpage) for a specific container command.
111
112 logout, exit:
113 Exits container-shell.
114
115 See also
116 ========
117
118 | compute-tools(7),
119 | container(1).
120
121 Homepage
122 ========
123
124 More information about compute-tools and the Open Infrastructure project can be
125 found on the homepage (https://open-infrastructure.net).
126
127 Contact
128 =======
129
130 Bug reports, feature requests, help, patches, support and everything else are
131 welcome on the Open Infrastructure Software Mailing List
132 <[email protected]>.
133
134 Debian specific bugs can also be reported in the Debian Bug Tracking System
135 (https://bugs.debian.org).
136
137 Authors
138 =======
139
140 compute-tools were written by Daniel Baumann
141 <[email protected]> and others.