jailmaker/templates/incus/config

72 lines
2.4 KiB
Plaintext
Raw Normal View History

2024-02-25 15:19:48 +00:00
# WARNING: EXPERIMENTAL CONFIG TEMPLATE!
2024-02-13 20:01:28 +00:00
startup=0
gpu_passthrough_intel=0
2024-02-25 15:19:48 +00:00
gpu_passthrough_nvidia=0
# Turning off seccomp filtering improves performance at the expense of security
# TODO: don't disable seccomp but specify which syscalls should be allowed
seccomp=0
2024-02-13 20:01:28 +00:00
2024-06-23 16:33:20 +00:00
# Use bridge networking to provide an isolated network namespace,
2024-02-13 20:01:28 +00:00
# so incus can manage firewall rules
# Alternatively use --network-macvlan=eno1 instead of --network-bridge
2024-02-13 20:01:28 +00:00
# Ensure to change eno1/br1 to the interface name you want to use
# You may want to add additional options here, e.g. bind mounts
# TODO: don't use --capability=all but specify only the required capabilities
systemd_nspawn_user_args=--network-bridge=br1
2024-02-13 20:01:28 +00:00
--resolv-conf=bind-host
--capability=all
--bind=/dev/fuse
--bind=/dev/kvm
--bind=/dev/vsock
--bind=/dev/vhost-vsock
# Script to run on the HOST before starting the jail
# Load kernel module and config kernel settings required for incus
pre_start_hook=#!/usr/bin/bash
2024-02-25 15:19:48 +00:00
set -euo pipefail
2024-02-13 20:01:28 +00:00
echo 'PRE_START_HOOK'
echo 1 > /proc/sys/net/ipv4/ip_forward
modprobe br_netfilter
echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables
echo 1 > /proc/sys/net/bridge/bridge-nf-call-ip6tables
modprobe vhost_vsock
2024-02-25 15:19:48 +00:00
# Only used while creating the jail
distro=debian
release=bookworm
2024-02-13 20:01:28 +00:00
# Install incus according to:
# https://github.com/zabbly/incus#installation
initial_setup=#!/usr/bin/bash
2024-02-15 16:23:57 +00:00
set -euo pipefail
apt-get update && apt-get -y install curl
2024-02-13 20:01:28 +00:00
mkdir -p /etc/apt/keyrings/
curl -fsSL https://pkgs.zabbly.com/key.asc -o /etc/apt/keyrings/zabbly.asc
sh -c 'cat <<EOF > /etc/apt/sources.list.d/zabbly-incus-stable.sources
Enabled: yes
Types: deb
URIs: https://pkgs.zabbly.com/incus/stable
Suites: $(. /etc/os-release && echo ${VERSION_CODENAME})
Components: main
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/zabbly.asc
EOF'
apt-get update
apt-get -y install incus incus-ui-canonical
2024-02-13 20:01:28 +00:00
# You generally will not need to change the options below
systemd_run_default_args=--property=KillMode=mixed
2024-02-25 15:19:48 +00:00
--property=Type=notify
--property=RestartForceExitStatus=133
--property=SuccessExitStatus=133
--property=Delegate=yes
--property=TasksMax=infinity
--collect
--setenv=SYSTEMD_NSPAWN_LOCK=0
2024-02-13 20:01:28 +00:00
systemd_nspawn_default_args=--keep-unit
2024-02-25 15:19:48 +00:00
--quiet
--boot
--bind-ro=/sys/module
--inaccessible=/sys/module/apparmor