mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-08 19:26:48 +00:00
fix(gstfsd): only the panel, with the host's key, can change a VM's disk
gstfsd, the root service on each compute that rewrites a shut-off VM's /etc/shadow and authorized_keys, did what any client on its port asked. Now it needs GSTFSD_KEY (64 hexadecimal characters, in the unit's /etc/default/webvirt-gstfsd) and does not start without it. Each connection gets a new challenge; the panel signs its request for it with HMAC-SHA256 and gstfsd checks the signature before any change, so a request recorded on one connection is refused on another. gstfsd signs its reply for the same challenge and the panel's nonce, and the panel accepts only that reply. Each compute has a gstfsd key, the host's GSTFSD_KEY: the compute forms and the API take it and never show it, and an empty value on an edit keeps it. The bootstrap script makes the key file once, readable by root only; the README shows how to make it and where the panel takes it. The traffic is still not encrypted: a remote panel's port stays open to the panel's address only.
This commit is contained in:
parent
a408cfdb2b
commit
2dab23cd9e
13 changed files with 388 additions and 108 deletions
|
|
@ -386,8 +386,15 @@ __check_end_of_life_versions
|
|||
# CentOS Install Functions
|
||||
#
|
||||
# gstfsd and its systemd unit, enabled and (re)started: from the clone this
|
||||
# script runs in, else from GitHub
|
||||
# script runs in, else from GitHub. Its key is made once and kept: the
|
||||
# panel's copy of it (the host's gstfsd key) stays valid.
|
||||
install_gstfsd() {
|
||||
if [ ! -s /etc/default/webvirt-gstfsd ]; then
|
||||
key="$(python3 -c 'import secrets; print(secrets.token_hex(32))')" || return 1
|
||||
(umask 077 && printf 'GSTFSD_KEY=%s\n' "$key" > /etc/default/webvirt-gstfsd) || return 1
|
||||
fi
|
||||
# only root reads it, also when it was there already
|
||||
chown root:root /etc/default/webvirt-gstfsd && chmod 600 /etc/default/webvirt-gstfsd || return 1
|
||||
src="$(dirname "$0")/.."
|
||||
if [ -f "$src/conf/daemon/gstfsd" ]; then
|
||||
install -m 755 "$src/conf/daemon/gstfsd" /usr/local/bin/gstfsd &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue