mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-10 20:26:48 +00:00
fix(backup): TLS client certificates persist in Docker and are backed up
libvirt reads a TLS compute's client certificate from the panel user's ~/.pki/libvirt. In Docker that was /var/www/.pki inside the container, so `docker compose up -d --build` dropped it and every TLS compute stopped connecting; no backup held it on either install type, although "Moving to a new machine" says the backup carries what the computes accept, and the README never said where the certificates go. Docker keeps /var/www/.pki in a webvirtcloud-pki volume, owned by www-data and private like ~/.ssh; the backup copies ~/.pki into pki/; the moving steps put it back; and "Adding a Compute Node" says where the files go.
This commit is contained in:
parent
77f85832c9
commit
482f5bc16d
6 changed files with 33 additions and 10 deletions
|
|
@ -15,8 +15,8 @@ PREFIX = "webvirtcloud-backup-"
|
|||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = ("Copy the database, secret key, worker id, settings and the SSH keys of the panel's user into a new "
|
||||
"directory in backups/, then delete all but the newest --keep backups.")
|
||||
help = ("Copy the database, secret key, worker id, settings and the SSH keys and TLS certificates of the "
|
||||
"panel's user into a new directory in backups/, then delete all but the newest --keep backups.")
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument("--keep", type=int, default=7, help="how many backups to keep (default 7)")
|
||||
|
|
@ -73,6 +73,10 @@ class Command(BaseCommand):
|
|||
for source in ssh.iterdir():
|
||||
if source.is_file() and not source.is_symlink():
|
||||
shutil.copyfile(source, to / "ssh" / source.name)
|
||||
# the TLS client certificates libvirt reads (~/.pki/libvirt); a link stays a link
|
||||
pki = Path.home() / ".pki"
|
||||
if pki.is_dir():
|
||||
shutil.copytree(pki, to / "pki", symlinks=True)
|
||||
if (settings.BASE_DIR / ".git").exists():
|
||||
commit = subprocess.run(["git", "rev-parse", "HEAD"], cwd=settings.BASE_DIR, capture_output=True, text=True)
|
||||
if commit.returncode == 0:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue