Skip to content

Commit fd31d84

Browse files
committed
README: add a "Security model" section
Add a "Security model" section explaining the current security model of libkrun and clarifying some local assumptions. Signed-off-by: Sergio Lopez <[email protected]>
1 parent f602343 commit fd31d84

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,24 @@ A conventional virtual interface that allows the guest to communicate with the o
8383

8484
Use `krun_add_net_unixstream` and/or `krun_add_net_unixdgram` to add a virtio-net interface connected to the userspace network proxy.
8585

86+
## Security model
87+
88+
The libkrun security model is primarily defined by the consideration that both the guest and the VMM pertain to the same security context. For many operations, the VMM acts as a proxy for the guest within the host. Host resources that are accessible to the VMM can potentially be accessed by the guest through it.
89+
90+
While defining the security implementation of your environment, you should think about the guest and the VMM as a single entity. To prevent the guest from accessing host's resources, you need to use the host's OS security features to run the VMM inside an isolated context. On Linux, the primary mechanism to be used for this purpose is namespaces. Single-user systems may have a more relaxed security policy and just ensure the VMM runs with a particular UID/GID.
91+
92+
While most virtio devices allow the guest to access resources from the host, two of them require special consideration when used: virtio-fs and virtio-vsock+TSI.
93+
94+
### virtio-fs
95+
96+
When exposing a directory in a filesystem from the host to the guest through virtio-fs devices configured with `krun_set_root` and/or `krun_add_virtiofs`, libkrun **does not** provide any protection against the guest attempting to access other directories in the same filesystem, or even other filesystems in the host.
97+
98+
A mount point isolation mechanism from the host should be used in combination with virtio-fs.
99+
100+
### virtio-vsock + TSI
101+
102+
When TSI is enabled, the VMM acts as a proxy for AF_INET, AF_INET6 and AF_UNIX sockets, for both incoming and outgoing connections. For all that matters, the VMM and the guest should be considered to be running in the network context. As such, you should apply on the VMM whatever restrictions you want to apply on the guest.
103+
86104
## Building and installing
87105

88106
### Linux (generic variant)

0 commit comments

Comments
 (0)