You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+28-7Lines changed: 28 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -147,18 +147,39 @@ podman run -d --name code-server \
147
147
!!! warning "Work in Progress"
148
148
This image is functional but may change significantly in a future release.
149
149
150
-
Common dev tools (gcc, clang, llvm, python, gmake) are baked into the image for now.
150
+
Common dev tools (gcc, clang, llvm, python, gmake, git, ssh) are baked into the image for now.
151
151
152
-
!!! warning "No sudo / su / doas in Terminal"
153
-
Podman strips the setuid bit from binaries at runtime, so `sudo`, `su`, and `doas` will not work inside the code-server terminal. To run commands as root, use `podman exec` from the host.
152
+
## Running commands as `root` in Terminal
153
+
Podman strips the setuid bit from binaries at runtime, so `sudo`, `su`, and `doas` will not work inside the code-server terminal.
154
154
155
-
## Installing Packages
155
+
To allow running commands as the `root` user, we can use FreeBSD's MAC framework and the `mdo` command which does not depend on the setuid bit being set.
156
+
The `mac_do` kernel module has to be loaded on the host which runs Podman before the container is started.
157
+
You can load the module at runtime by running
158
+
```sh
159
+
kldload mac_do
160
+
```
161
+
To load the module automatically during boot you can add it to `rc.conf` with
162
+
```sh
163
+
sysrc kld_list+=mac_do
164
+
```
156
165
157
-
This is a known limitation of this WIP image and will likely improve in a future release.
166
+
If the `mac_do` module is loaded when the container starts, it will automatically install a rule that allows the `bsd` user to execute commands as root by running `mdo <command>`.
158
167
159
-
Due to FreeBSD jail restrictions, `pkg install` cannot be run from the code-server terminal directly.
160
-
Install additional packages from the host using `podman exec`:
168
+
To disable the installation of the `mac_do` rule that allows the privilege elevation, you can set the `DISABLE_MDO` environment variable to `true` or `yes`:
169
+
```yaml
170
+
services:
171
+
code-server:
172
+
environment:
173
+
- DISABLE_MDO=true
174
+
```
175
+
176
+
## Installing Packages
177
+
If the `mac_do` module is loaded on the host you can install packages in the terminal by running
178
+
```sh
179
+
mdo pkg install...
180
+
```
161
181
182
+
If the module is not loaded or if `DISABLE_MDO` is set to `true` you have to install additional packages from the host using `podman exec`:
Copy file name to clipboardExpand all lines: compose.yaml
+29-7Lines changed: 29 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -9,18 +9,39 @@ x-daemonless:
9
9
!!! warning "Work in Progress"
10
10
This image is functional but may change significantly in a future release.
11
11
12
-
Common dev tools (gcc, clang, llvm, python, gmake) are baked into the image for now.
12
+
Common dev tools (gcc, clang, llvm, python, gmake, git, ssh) are baked into the image for now.
13
13
14
-
!!! warning "No sudo / su / doas in Terminal"
15
-
Podman strips the setuid bit from binaries at runtime, so `sudo`, `su`, and `doas` will not work inside the code-server terminal. To run commands as root, use `podman exec` from the host.
14
+
## Running commands as `root` in Terminal
15
+
Podman strips the setuid bit from binaries at runtime, so `sudo`, `su`, and `doas` will not work inside the code-server terminal.
16
16
17
-
## Installing Packages
17
+
To allow running commands as the `root` user, we can use FreeBSD's MAC framework and the `mdo` command which does not depend on the setuid bit being set.
18
+
The `mac_do` kernel module has to be loaded on the host which runs Podman before the container is started.
19
+
You can load the module at runtime by running
20
+
```sh
21
+
kldload mac_do
22
+
```
23
+
To load the module automatically during boot you can add it to `rc.conf` with
24
+
```sh
25
+
sysrc kld_list+=mac_do
26
+
```
18
27
19
-
This is a known limitation of this WIP image and will likely improve in a future release.
28
+
If the `mac_do` module is loaded when the container starts, it will automatically install a rule that allows the `bsd` user to execute commands as root by running `mdo <command>`.
20
29
21
-
Due to FreeBSD jail restrictions, `pkg install` cannot be run from the code-server terminal directly.
22
-
Install additional packages from the host using `podman exec`:
30
+
To disable the installation of the `mac_do` rule that allows the privilege elevation, you can set the `DISABLE_MDO` environment variable to `true` or `yes`:
31
+
```yaml
32
+
services:
33
+
code-server:
34
+
environment:
35
+
- DISABLE_MDO=true
36
+
```
37
+
38
+
## Installing Packages
39
+
If the `mac_do` module is loaded on the host you can install packages in the terminal by running
40
+
```sh
41
+
mdo pkg install...
42
+
```
23
43
44
+
If the module is not loaded or if `DISABLE_MDO` is set to `true` you have to install additional packages from the host using `podman exec`:
0 commit comments