commit
df5d8597bd
@ -0,0 +1,2 @@
|
||||
SOURCES/guestfs-tools-1.48.2.tar.gz
|
||||
SOURCES/libguestfs.keyring
|
@ -0,0 +1,2 @@
|
||||
a4082a350bc8d303ebe31780964e2d72a81378c3 SOURCES/guestfs-tools-1.48.2.tar.gz
|
||||
1bbc40f501a7fef9eef2a39b701a71aee2fea7c4 SOURCES/libguestfs.keyring
|
@ -0,0 +1,100 @@
|
||||
From 37c002682a9e5b87d5793f1567c4ddfb8ca72d11 Mon Sep 17 00:00:00 2001
|
||||
From: Laszlo Ersek <lersek@redhat.com>
|
||||
Date: Sun, 10 Apr 2022 13:38:34 +0200
|
||||
Subject: [PATCH] sysprep: remove lvm2's default "system.devices" file
|
||||
|
||||
(Background: lvm2 commit 83fe6e720f42, "device usage based on devices
|
||||
file", 2021-02-23; first released in v2_03_12.)
|
||||
|
||||
"lvm pvscan" may be -- and in RHEL9, will soon be -- restricted to those
|
||||
block devices whose WWIDs are listed in "/etc/lvm/devices/system.devices".
|
||||
This is a problem when cloning a VM, as cloning may change the WWIDs of
|
||||
the domain's disk devices, and then physical volumes underlying the guest
|
||||
filesystems may not be found. Example:
|
||||
<https://bugzilla.redhat.com/show_bug.cgi?id=2059545#c12>.
|
||||
|
||||
Add the "lvm-system-devices" operation for removing this file, so that
|
||||
"lvm pvscan" investigate all block devices for PVs.
|
||||
|
||||
(Note that this operation is independent from "lvm-uuids". The libguestfs
|
||||
appliance creates a pristine LVM_SYSTEM_DIR in "appliance/init" (see
|
||||
libguestfs commit dd162d2cd56a), thus, when "lvm-uuids" calls "g#pvs" and
|
||||
"g#vgs", those APIs can never be affected by an
|
||||
"$LVM_SYSTEM_DIR/devices/system.devices" file.)
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2072493
|
||||
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
||||
Message-Id: <20220410113834.6258-1-lersek@redhat.com>
|
||||
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
|
||||
(cherry picked from commit 4fe8a03cd2d3e4570f4298245bb184ccdc4da0cd)
|
||||
---
|
||||
sysprep/Makefile.am | 1 +
|
||||
.../sysprep_operation_lvm_system_devices.ml | 44 +++++++++++++++++++
|
||||
2 files changed, 45 insertions(+)
|
||||
create mode 100644 sysprep/sysprep_operation_lvm_system_devices.ml
|
||||
|
||||
diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am
|
||||
index 0e3afc8a0..7d5e8aadf 100644
|
||||
--- a/sysprep/Makefile.am
|
||||
+++ b/sysprep/Makefile.am
|
||||
@@ -46,6 +46,7 @@ operations = \
|
||||
ipa_client \
|
||||
kerberos_data \
|
||||
kerberos_hostkeytab \
|
||||
+ lvm_system_devices \
|
||||
lvm_uuids \
|
||||
logfiles \
|
||||
machine_id \
|
||||
diff --git a/sysprep/sysprep_operation_lvm_system_devices.ml b/sysprep/sysprep_operation_lvm_system_devices.ml
|
||||
new file mode 100644
|
||||
index 000000000..b41fa5dbc
|
||||
--- /dev/null
|
||||
+++ b/sysprep/sysprep_operation_lvm_system_devices.ml
|
||||
@@ -0,0 +1,44 @@
|
||||
+(* virt-sysprep
|
||||
+ * Copyright (C) 2012-2022 Red Hat Inc.
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation; either version 2 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License along
|
||||
+ * with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+ *)
|
||||
+
|
||||
+open Sysprep_operation
|
||||
+open Common_gettext.Gettext
|
||||
+
|
||||
+module G = Guestfs
|
||||
+
|
||||
+let system_devices_file = "/etc/lvm/devices/system.devices"
|
||||
+
|
||||
+let rec lvm_system_devices_perform g root side_effects =
|
||||
+ let typ = g#inspect_get_type root in
|
||||
+ if typ = "linux" then g#rm_f system_devices_file
|
||||
+
|
||||
+let op = {
|
||||
+ defaults with
|
||||
+ name = "lvm-system-devices";
|
||||
+ enabled_by_default = true;
|
||||
+ heading = s_"Remove LVM2 system.devices file";
|
||||
+ pod_description =
|
||||
+ Some (s_"On Linux guests, LVM2's scanning for physical volumes (PVs) may \
|
||||
+ be restricted to those block devices whose WWIDs are listed in \
|
||||
+ C<" ^ system_devices_file ^ ">. When cloning VMs, WWIDs may \
|
||||
+ change, breaking C<lvm pvscan>. Remove \
|
||||
+ C<" ^ system_devices_file ^ ">.");
|
||||
+ perform_on_filesystems = Some lvm_system_devices_perform;
|
||||
+}
|
||||
+
|
||||
+let () = register_operation op
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,347 @@
|
||||
From 5792f2e95bcddf476f2fe37e0bc4d97bd881d8fa Mon Sep 17 00:00:00 2001
|
||||
From: Laszlo Ersek <lersek@redhat.com>
|
||||
Date: Tue, 10 May 2022 12:50:46 +0200
|
||||
Subject: [PATCH] adopt inversion of SELinux relabeling in virt-customize
|
||||
|
||||
Remove "--selinux-relabel" options.
|
||||
|
||||
Do not add any "--no-selinux-relabel" options; rely on the internal check
|
||||
for SELinux support instead ("is_selinux_guest" in
|
||||
"common/mlcustomize/SELinux_relabel.ml").
|
||||
|
||||
"--no-selinux-relabel" becomes a real option for virt-sysprep now.
|
||||
(Again?)
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1554735
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2075718
|
||||
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
||||
Message-Id: <20220510105046.15167-1-lersek@redhat.com>
|
||||
Acked-by: Richard W.M. Jones <rjones@redhat.com>
|
||||
[lersek@redhat.com: incorporate common submodule update]
|
||||
(cherry picked from commit 19de3d1c8d4efb53565dbffe532d41ee9d25a832)
|
||||
---
|
||||
builder/templates/make-template.ml | 8 +-------
|
||||
builder/virt-builder.pod | 20 ++++----------------
|
||||
common | 2 +-
|
||||
customize/customize_run.ml | 2 +-
|
||||
customize/test-settings.sh | 3 ---
|
||||
sysprep/main.ml | 2 --
|
||||
sysprep/test-virt-sysprep-docs.sh | 2 +-
|
||||
7 files changed, 8 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/builder/templates/make-template.ml b/builder/templates/make-template.ml
|
||||
index 6786fec19..b40789284 100755
|
||||
--- a/builder/templates/make-template.ml
|
||||
+++ b/builder/templates/make-template.ml
|
||||
@@ -256,8 +256,7 @@ let rec main () =
|
||||
printf "Sysprepping ...\n%!";
|
||||
let cmd =
|
||||
sprintf "virt-sysprep --quiet -a %s%s"
|
||||
- (quote tmpout)
|
||||
- (if is_selinux_os os then " --selinux-relabel" else "") in
|
||||
+ (quote tmpout) in
|
||||
if Sys.command cmd <> 0 then exit 1
|
||||
);
|
||||
|
||||
@@ -480,11 +479,6 @@ and can_sysprep_os = function
|
||||
| Debian _ | Ubuntu _ -> true
|
||||
| FreeBSD _ | Windows _ -> false
|
||||
|
||||
-and is_selinux_os = function
|
||||
- | RHEL _ | Alma _ | CentOS _ | CentOSStream _ | Fedora _ -> true
|
||||
- | Debian _ | Ubuntu _
|
||||
- | FreeBSD _ | Windows _ -> false
|
||||
-
|
||||
and needs_uefi os arch =
|
||||
match os, arch with
|
||||
| Fedora _, Armv7
|
||||
diff --git a/builder/virt-builder.pod b/builder/virt-builder.pod
|
||||
index f7dd6cdad..aeb505296 100644
|
||||
--- a/builder/virt-builder.pod
|
||||
+++ b/builder/virt-builder.pod
|
||||
@@ -131,12 +131,6 @@ To update the installed packages to the latest version:
|
||||
|
||||
virt-builder debian-7 --update
|
||||
|
||||
-For guests which use SELinux, like Fedora and Red Hat Enterprise
|
||||
-Linux, you may need to do SELinux relabelling after installing or
|
||||
-updating packages (see L</SELINUX> below):
|
||||
-
|
||||
- virt-builder fedora-27 --update --selinux-relabel
|
||||
-
|
||||
=head2 Customizing the installation
|
||||
|
||||
There are many options that let you customize the installation. These
|
||||
@@ -972,7 +966,7 @@ command line.
|
||||
|
||||
=item *
|
||||
|
||||
-SELinux relabelling is done (I<--selinux-relabel>).
|
||||
+SELinux relabelling is done unless disabled with I<--no-selinux-relabel>.
|
||||
|
||||
=back
|
||||
|
||||
@@ -1072,8 +1066,7 @@ A typical virt-builder command would be:
|
||||
--install puppet \
|
||||
--append-line '/etc/puppet/puppet.conf:[agent]' \
|
||||
--append-line '/etc/puppet/puppet.conf:server = puppetmaster.example.com/' \
|
||||
- --run-command 'systemctl enable puppet' \
|
||||
- --selinux-relabel
|
||||
+ --run-command 'systemctl enable puppet'
|
||||
|
||||
The precise instructions vary according to the Linux distro. For
|
||||
further information see:
|
||||
@@ -1753,14 +1746,14 @@ two possible strategies it can use to ensure correct labelling:
|
||||
|
||||
=over 4
|
||||
|
||||
-=item Using I<--selinux-relabel>
|
||||
+=item Automatic relabeling
|
||||
|
||||
This runs L<setfiles(8)> just before finalizing the guest, which sets
|
||||
SELinux labels correctly in the disk image.
|
||||
|
||||
This is the recommended method.
|
||||
|
||||
-=item I<--touch> F</.autorelabel>
|
||||
+=item Using I<--no-selinux-relabel> I<--touch> F</.autorelabel>
|
||||
|
||||
Guest templates may already contain a file called F</.autorelabel> or
|
||||
you may touch it.
|
||||
@@ -1771,11 +1764,6 @@ them, which is normal and harmless.
|
||||
|
||||
=back
|
||||
|
||||
-Please note that if your guest uses SELinux, and you are doing operations
|
||||
-on it which might create new files or change existing ones, you are
|
||||
-recommended to use I<--selinux-relabel>. This will help in making sure
|
||||
-that files have the right SELinux labels.
|
||||
-
|
||||
=head1 MACHINE READABLE OUTPUT
|
||||
|
||||
The I<--machine-readable> option can be used to make the output more
|
||||
Submodule common 0a231b3e6..48527b876:
|
||||
diff --git a/common/mlcustomize/customize-options.pod b/common/mlcustomize/customize-options.pod
|
||||
index 71b545d..a83c80a 100644
|
||||
--- a/common/mlcustomize/customize-options.pod
|
||||
+++ b/common/mlcustomize/customize-options.pod
|
||||
@@ -206,6 +206,19 @@ the image was built, use this option.
|
||||
|
||||
See also: L</LOG FILE>.
|
||||
|
||||
+=item B<--no-selinux-relabel>
|
||||
+
|
||||
+Do not attempt to correct the SELinux labels of files in the guest.
|
||||
+
|
||||
+In such guests that support SELinux, customization automatically
|
||||
+relabels files so that they have the correct SELinux label. (The
|
||||
+relabeling is performed immediately, but if the operation fails,
|
||||
+customization will instead touch F</.autorelabel> on the image to
|
||||
+schedule a relabel operation for the next time the image boots.) This
|
||||
+option disables the automatic relabeling.
|
||||
+
|
||||
+The option is a no-op for guests that do not support SELinux.
|
||||
+
|
||||
=item B<--password> USER:SELECTOR
|
||||
|
||||
Set the password for C<USER>. (Note this option does I<not>
|
||||
@@ -297,16 +310,6 @@ It cannot delete directories, only regular files.
|
||||
|
||||
=back
|
||||
|
||||
-=item B<--selinux-relabel>
|
||||
-
|
||||
-Relabel files in the guest so that they have the correct SELinux label.
|
||||
-
|
||||
-This will attempt to relabel files immediately, but if the operation fails
|
||||
-this will instead touch F</.autorelabel> on the image to schedule a
|
||||
-relabel operation for the next time the image boots.
|
||||
-
|
||||
-You should only use this option for guests which support SELinux.
|
||||
-
|
||||
=item B<--sm-attach> SELECTOR
|
||||
|
||||
Attach to a pool using C<subscription-manager>.
|
||||
diff --git a/common/mlcustomize/customize-synopsis.pod b/common/mlcustomize/customize-synopsis.pod
|
||||
index 5f18540..2520853 100644
|
||||
--- a/common/mlcustomize/customize-synopsis.pod
|
||||
+++ b/common/mlcustomize/customize-synopsis.pod
|
||||
@@ -12,5 +12,5 @@
|
||||
[--truncate-recursive PATH] [--timezone TIMEZONE] [--touch FILE]
|
||||
[--uninstall PKG,PKG..] [--update] [--upload FILE:DEST]
|
||||
[--write FILE:CONTENT] [--no-logfile]
|
||||
- [--password-crypto md5|sha256|sha512] [--selinux-relabel]
|
||||
+ [--password-crypto md5|sha256|sha512] [--no-selinux-relabel]
|
||||
[--sm-credentials SELECTOR]
|
||||
diff --git a/common/mlcustomize/customize_cmdline.ml b/common/mlcustomize/customize_cmdline.ml
|
||||
index 9326baa..5d404e8 100644
|
||||
--- a/common/mlcustomize/customize_cmdline.ml
|
||||
+++ b/common/mlcustomize/customize_cmdline.ml
|
||||
@@ -109,8 +109,8 @@ and flags = {
|
||||
(* --no-logfile *)
|
||||
password_crypto : Password.password_crypto option;
|
||||
(* --password-crypto md5|sha256|sha512 *)
|
||||
- selinux_relabel : bool;
|
||||
- (* --selinux-relabel *)
|
||||
+ no_selinux_relabel : bool;
|
||||
+ (* --no-selinux-relabel *)
|
||||
sm_credentials : Subscription_manager.sm_credentials option;
|
||||
(* --sm-credentials SELECTOR *)
|
||||
}
|
||||
@@ -121,7 +121,7 @@ let rec argspec () =
|
||||
let ops = ref [] in
|
||||
let scrub_logfile = ref false in
|
||||
let password_crypto = ref None in
|
||||
- let selinux_relabel = ref false in
|
||||
+ let no_selinux_relabel = ref false in
|
||||
let sm_credentials = ref None in
|
||||
|
||||
let rec get_ops () = {
|
||||
@@ -131,7 +131,7 @@ let rec argspec () =
|
||||
and get_flags () = {
|
||||
scrub_logfile = !scrub_logfile;
|
||||
password_crypto = !password_crypto;
|
||||
- selinux_relabel = !selinux_relabel;
|
||||
+ no_selinux_relabel = !no_selinux_relabel;
|
||||
sm_credentials = !sm_credentials;
|
||||
}
|
||||
in
|
||||
@@ -459,11 +459,11 @@ let rec argspec () =
|
||||
),
|
||||
Some "md5|sha256|sha512", "When the virt tools change or set a password in the guest, this\noption sets the password encryption of that password to\nC<md5>, C<sha256> or C<sha512>.\n\nC<sha256> and C<sha512> require glibc E<ge> 2.7 (check crypt(3) inside\nthe guest).\n\nC<md5> will work with relatively old Linux guests (eg. RHEL 3), but\nis not secure against modern attacks.\n\nThe default is C<sha512> unless libguestfs detects an old guest that\ndidn't have support for SHA-512, in which case it will use C<md5>.\nYou can override libguestfs by specifying this option.\n\nNote this does not change the default password encryption used\nby the guest when you create new user accounts inside the guest.\nIf you want to do that, then you should use the I<--edit> option\nto modify C</etc/sysconfig/authconfig> (Fedora, RHEL) or\nC</etc/pam.d/common-password> (Debian, Ubuntu).";
|
||||
(
|
||||
- [ L"selinux-relabel" ],
|
||||
- Getopt.Set selinux_relabel,
|
||||
- s_"Relabel files with correct SELinux labels"
|
||||
+ [ L"no-selinux-relabel" ],
|
||||
+ Getopt.Set no_selinux_relabel,
|
||||
+ s_"Do not relabel files with correct SELinux labels"
|
||||
),
|
||||
- None, "Relabel files in the guest so that they have the correct SELinux label.\n\nThis will attempt to relabel files immediately, but if the operation fails\nthis will instead touch F</.autorelabel> on the image to schedule a\nrelabel operation for the next time the image boots.\n\nYou should only use this option for guests which support SELinux.";
|
||||
+ None, "Do not attempt to correct the SELinux labels of files in the guest.\n\nIn such guests that support SELinux, customization automatically\nrelabels files so that they have the correct SELinux label. (The\nrelabeling is performed immediately, but if the operation fails,\ncustomization will instead touch F</.autorelabel> on the image to\nschedule a relabel operation for the next time the image boots.) This\noption disables the automatic relabeling.\n\nThe option is a no-op for guests that do not support SELinux.";
|
||||
(
|
||||
[ L"sm-credentials" ],
|
||||
Getopt.String (
|
||||
diff --git a/common/mlcustomize/customize_cmdline.mli b/common/mlcustomize/customize_cmdline.mli
|
||||
index 14eda49..7ee882a 100644
|
||||
--- a/common/mlcustomize/customize_cmdline.mli
|
||||
+++ b/common/mlcustomize/customize_cmdline.mli
|
||||
@@ -101,8 +101,8 @@ and flags = {
|
||||
(* --no-logfile *)
|
||||
password_crypto : Password.password_crypto option;
|
||||
(* --password-crypto md5|sha256|sha512 *)
|
||||
- selinux_relabel : bool;
|
||||
- (* --selinux-relabel *)
|
||||
+ no_selinux_relabel : bool;
|
||||
+ (* --no-selinux-relabel *)
|
||||
sm_credentials : Subscription_manager.sm_credentials option;
|
||||
(* --sm-credentials SELECTOR *)
|
||||
}
|
||||
diff --git a/common/mlcustomize/test-firstboot.sh b/common/mlcustomize/test-firstboot.sh
|
||||
index b906997..24c67f3 100755
|
||||
--- a/common/mlcustomize/test-firstboot.sh
|
||||
+++ b/common/mlcustomize/test-firstboot.sh
|
||||
@@ -61,9 +61,6 @@ case "$guestname" in
|
||||
extra[${#extra[*]}]='/etc/inittab:
|
||||
s,^#([1-9].*respawn.*/sbin/getty.*),$1,'
|
||||
;;
|
||||
- fedora*|rhel*|centos*)
|
||||
- extra[${#extra[*]}]='--selinux-relabel'
|
||||
- ;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
diff --git a/common/mlcustomize/test-selinuxrelabel.sh b/common/mlcustomize/test-selinuxrelabel.sh
|
||||
index 86278c6..caf7521 100755
|
||||
--- a/common/mlcustomize/test-selinuxrelabel.sh
|
||||
+++ b/common/mlcustomize/test-selinuxrelabel.sh
|
||||
@@ -41,13 +41,12 @@ virt-builder "$guestname" --quiet -o "$disk"
|
||||
# Test #1: relabel with the default configuration works.
|
||||
rm -f "$disk_overlay"
|
||||
guestfish -- disk-create "$disk_overlay" qcow2 -1 backingfile:"$disk"
|
||||
-virt-customize -a "$disk" --selinux-relabel
|
||||
+virt-customize -a "$disk"
|
||||
|
||||
# Test #2: relabel with no SELINUXTYPE in the configuration.
|
||||
rm -f "$disk_overlay"
|
||||
guestfish -- disk-create "$disk_overlay" qcow2 -1 backingfile:"$disk"
|
||||
virt-customize -a "$disk" \
|
||||
- --edit /etc/selinux/config:"s,^SELINUXTYPE=,#&,g" \
|
||||
- --selinux-relabel
|
||||
+ --edit /etc/selinux/config:"s,^SELINUXTYPE=,#&,g"
|
||||
|
||||
rm "$disk" "$disk_overlay"
|
||||
diff --git a/common/options/uri.c b/common/options/uri.c
|
||||
index 6b696fc..84d393c 100644
|
||||
--- a/common/options/uri.c
|
||||
+++ b/common/options/uri.c
|
||||
@@ -135,7 +135,7 @@ parse (const char *arg, char **path_ret, char **protocol_ret,
|
||||
socket = query_get (uri, "socket");
|
||||
|
||||
if (uri->server && STRNEQ (uri->server, "") && socket) {
|
||||
- fprintf (stderr, _("%s: %s: cannot both a server name and a socket query parameter\n"),
|
||||
+ fprintf (stderr, _("%s: %s: cannot have both a server name and a socket query parameter\n"),
|
||||
getprogname (), arg);
|
||||
return -1;
|
||||
}
|
||||
@@ -347,6 +347,7 @@ make_server (xmlURIPtr uri, const char *socket, char ***ret)
|
||||
*ret = malloc (sizeof (char *) * 2);
|
||||
if (*ret == NULL) {
|
||||
perror ("malloc");
|
||||
+ free (server);
|
||||
return -1;
|
||||
}
|
||||
(*ret)[0] = server;
|
||||
diff --git a/customize/customize_run.ml b/customize/customize_run.ml
|
||||
index f2ee20413..99b5fe14d 100644
|
||||
--- a/customize/customize_run.ml
|
||||
+++ b/customize/customize_run.ml
|
||||
@@ -415,7 +415,7 @@ let run (g : G.guestfs) root (ops : ops) =
|
||||
warning (f_"passwords could not be set for this type of guest")
|
||||
);
|
||||
|
||||
- if ops.flags.selinux_relabel then (
|
||||
+ if not ops.flags.no_selinux_relabel then (
|
||||
message (f_"SELinux relabelling");
|
||||
SELinux_relabel.relabel g
|
||||
);
|
||||
diff --git a/customize/test-settings.sh b/customize/test-settings.sh
|
||||
index ed4c90f2e..e8b492dd1 100755
|
||||
--- a/customize/test-settings.sh
|
||||
+++ b/customize/test-settings.sh
|
||||
@@ -61,9 +61,6 @@ case "$guestname" in
|
||||
extra[${#extra[*]}]='/etc/inittab:
|
||||
s,^#([1-9].*respawn.*/sbin/getty.*),$1,'
|
||||
;;
|
||||
- fedora*|rhel*|centos*)
|
||||
- extra[${#extra[*]}]='--selinux-relabel'
|
||||
- ;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
diff --git a/sysprep/main.ml b/sysprep/main.ml
|
||||
index 087d1a17f..b760618ad 100644
|
||||
--- a/sysprep/main.ml
|
||||
+++ b/sysprep/main.ml
|
||||
@@ -132,8 +132,6 @@ let main () =
|
||||
[ L"mount-options" ], Getopt.Set_string (s_"opts", mount_opts), s_"Set mount options (eg /:noatime;/var:rw,noatime)";
|
||||
[ L"network" ], Getopt.Set network, s_"Enable appliance network";
|
||||
[ L"no-network" ], Getopt.Clear network, s_"Disable appliance network (default)";
|
||||
- [ L"no-selinux-relabel" ], Getopt.Unit (fun () -> ()),
|
||||
- s_"Compatibility option, does nothing";
|
||||
[ L"operation"; L"operations" ], Getopt.String (s_"operations", set_operations), s_"Enable/disable specific operations";
|
||||
] in
|
||||
let args = basic_args @ Sysprep_operation.extra_args () in
|
||||
diff --git a/sysprep/test-virt-sysprep-docs.sh b/sysprep/test-virt-sysprep-docs.sh
|
||||
index 51500b5e9..9d0298d68 100755
|
||||
--- a/sysprep/test-virt-sysprep-docs.sh
|
||||
+++ b/sysprep/test-virt-sysprep-docs.sh
|
||||
@@ -25,4 +25,4 @@ $top_srcdir/podcheck.pl "$srcdir/virt-sysprep.pod" virt-sysprep \
|
||||
--path $top_srcdir/common/options \
|
||||
--insert sysprep-extra-options.pod:__EXTRA_OPTIONS__ \
|
||||
--insert sysprep-operations.pod:__OPERATIONS__ \
|
||||
- --ignore=--dryrun,--dump-pod,--dump-pod-options,--no-selinux-relabel
|
||||
+ --ignore=--dryrun,--dump-pod,--dump-pod-options
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,101 @@
|
||||
From 10e2f3fc7eef6da4d741f7617e80d028257d9884 Mon Sep 17 00:00:00 2001
|
||||
From: Laszlo Ersek <lersek@redhat.com>
|
||||
Date: Wed, 25 May 2022 13:06:01 +0200
|
||||
Subject: [PATCH] update common submodule
|
||||
|
||||
Shortlog for 48527b8768d7..f8de5508fe75:
|
||||
|
||||
Laszlo Ersek (1):
|
||||
mlcustomize: refresh generated files
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2089748
|
||||
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
||||
(cherry picked from commit 273de755dfe7eb0f1e81dc62463c125e8bed0cff)
|
||||
---
|
||||
common | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
Submodule common 48527b876..f8de5508f:
|
||||
diff --git a/common/mlcustomize/customize-options.pod b/common/mlcustomize/customize-options.pod
|
||||
index a83c80a..8aafacd 100644
|
||||
--- a/common/mlcustomize/customize-options.pod
|
||||
+++ b/common/mlcustomize/customize-options.pod
|
||||
@@ -310,6 +310,10 @@ It cannot delete directories, only regular files.
|
||||
|
||||
=back
|
||||
|
||||
+=item B<--selinux-relabel>
|
||||
+
|
||||
+This is a compatibility option that does nothing.
|
||||
+
|
||||
=item B<--sm-attach> SELECTOR
|
||||
|
||||
Attach to a pool using C<subscription-manager>.
|
||||
diff --git a/common/mlcustomize/customize-synopsis.pod b/common/mlcustomize/customize-synopsis.pod
|
||||
index 2520853..9e2c4b2 100644
|
||||
--- a/common/mlcustomize/customize-synopsis.pod
|
||||
+++ b/common/mlcustomize/customize-synopsis.pod
|
||||
@@ -13,4 +13,4 @@
|
||||
[--uninstall PKG,PKG..] [--update] [--upload FILE:DEST]
|
||||
[--write FILE:CONTENT] [--no-logfile]
|
||||
[--password-crypto md5|sha256|sha512] [--no-selinux-relabel]
|
||||
- [--sm-credentials SELECTOR]
|
||||
+ [--selinux-relabel] [--sm-credentials SELECTOR]
|
||||
diff --git a/common/mlcustomize/customize_cmdline.ml b/common/mlcustomize/customize_cmdline.ml
|
||||
index 5d404e8..a17bed4 100644
|
||||
--- a/common/mlcustomize/customize_cmdline.ml
|
||||
+++ b/common/mlcustomize/customize_cmdline.ml
|
||||
@@ -111,6 +111,8 @@ and flags = {
|
||||
(* --password-crypto md5|sha256|sha512 *)
|
||||
no_selinux_relabel : bool;
|
||||
(* --no-selinux-relabel *)
|
||||
+ selinux_relabel_ignored : bool;
|
||||
+ (* --selinux-relabel *)
|
||||
sm_credentials : Subscription_manager.sm_credentials option;
|
||||
(* --sm-credentials SELECTOR *)
|
||||
}
|
||||
@@ -122,6 +124,7 @@ let rec argspec () =
|
||||
let scrub_logfile = ref false in
|
||||
let password_crypto = ref None in
|
||||
let no_selinux_relabel = ref false in
|
||||
+ let selinux_relabel_ignored = ref false in
|
||||
let sm_credentials = ref None in
|
||||
|
||||
let rec get_ops () = {
|
||||
@@ -132,6 +135,7 @@ let rec argspec () =
|
||||
scrub_logfile = !scrub_logfile;
|
||||
password_crypto = !password_crypto;
|
||||
no_selinux_relabel = !no_selinux_relabel;
|
||||
+ selinux_relabel_ignored = !selinux_relabel_ignored;
|
||||
sm_credentials = !sm_credentials;
|
||||
}
|
||||
in
|
||||
@@ -464,6 +468,12 @@ let rec argspec () =
|
||||
s_"Do not relabel files with correct SELinux labels"
|
||||
),
|
||||
None, "Do not attempt to correct the SELinux labels of files in the guest.\n\nIn such guests that support SELinux, customization automatically\nrelabels files so that they have the correct SELinux label. (The\nrelabeling is performed immediately, but if the operation fails,\ncustomization will instead touch F</.autorelabel> on the image to\nschedule a relabel operation for the next time the image boots.) This\noption disables the automatic relabeling.\n\nThe option is a no-op for guests that do not support SELinux.";
|
||||
+ (
|
||||
+ [ L"selinux-relabel" ],
|
||||
+ Getopt.Set selinux_relabel_ignored,
|
||||
+ s_"Compatibility option doing nothing"
|
||||
+ ),
|
||||
+ None, "This is a compatibility option that does nothing.";
|
||||
(
|
||||
[ L"sm-credentials" ],
|
||||
Getopt.String (
|
||||
diff --git a/common/mlcustomize/customize_cmdline.mli b/common/mlcustomize/customize_cmdline.mli
|
||||
index 7ee882a..7d14e78 100644
|
||||
--- a/common/mlcustomize/customize_cmdline.mli
|
||||
+++ b/common/mlcustomize/customize_cmdline.mli
|
||||
@@ -103,6 +103,8 @@ and flags = {
|
||||
(* --password-crypto md5|sha256|sha512 *)
|
||||
no_selinux_relabel : bool;
|
||||
(* --no-selinux-relabel *)
|
||||
+ selinux_relabel_ignored : bool;
|
||||
+ (* --selinux-relabel *)
|
||||
sm_credentials : Subscription_manager.sm_credentials option;
|
||||
(* --sm-credentials SELECTOR *)
|
||||
}
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,27 @@
|
||||
From bbdc10642eff480246271f98180733f732c306b3 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 7 Jul 2015 09:28:03 -0400
|
||||
Subject: [PATCH] RHEL: Reject use of libguestfs-winsupport features except for
|
||||
virt-* tools (RHBZ#1240276).
|
||||
|
||||
Fix the tests: it doesn't let us use guestfish for arbitrary Windows
|
||||
edits.
|
||||
---
|
||||
test-data/phony-guests/make-windows-img.sh | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/test-data/phony-guests/make-windows-img.sh b/test-data/phony-guests/make-windows-img.sh
|
||||
index 30908a918..73cf5144e 100755
|
||||
--- a/test-data/phony-guests/make-windows-img.sh
|
||||
+++ b/test-data/phony-guests/make-windows-img.sh
|
||||
@@ -37,6 +37,7 @@ fi
|
||||
|
||||
# Create a disk image.
|
||||
guestfish <<EOF
|
||||
+set-program virt-testing
|
||||
sparse windows.img-t 512M
|
||||
run
|
||||
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,53 @@
|
||||
From 493060f2ee3d5c1c8d6192bbfd307e0b720f6c11 Mon Sep 17 00:00:00 2001
|
||||
From: Laszlo Ersek <lersek@redhat.com>
|
||||
Date: Wed, 29 Jun 2022 15:38:46 +0200
|
||||
Subject: [PATCH] update common submodule for CVE-2022-2211 fix
|
||||
|
||||
$ git shortlog 9e990f3e4530..35467027f657
|
||||
|
||||
Laszlo Ersek (1):
|
||||
options: fix buffer overflow in get_keys() [CVE-2022-2211]
|
||||
|
||||
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
||||
(cherry picked from commit b2e7de29b413d531c9540eb46878170e357f4b62)
|
||||
---
|
||||
common | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
Submodule common 9e990f3e4..35467027f:
|
||||
diff --git a/common/options/keys.c b/common/options/keys.c
|
||||
index 798315c..d27a712 100644
|
||||
--- a/common/options/keys.c
|
||||
+++ b/common/options/keys.c
|
||||
@@ -128,17 +128,23 @@ read_first_line_from_file (const char *filename)
|
||||
char **
|
||||
get_keys (struct key_store *ks, const char *device, const char *uuid)
|
||||
{
|
||||
- size_t i, j, len;
|
||||
+ size_t i, j, nmemb;
|
||||
char **r;
|
||||
char *s;
|
||||
|
||||
/* We know the returned list must have at least one element and not
|
||||
* more than ks->nr_keys.
|
||||
*/
|
||||
- len = 1;
|
||||
- if (ks)
|
||||
- len = MIN (1, ks->nr_keys);
|
||||
- r = calloc (len+1, sizeof (char *));
|
||||
+ nmemb = 1;
|
||||
+ if (ks && ks->nr_keys > nmemb)
|
||||
+ nmemb = ks->nr_keys;
|
||||
+
|
||||
+ /* make room for the terminating NULL */
|
||||
+ if (nmemb == (size_t)-1)
|
||||
+ error (EXIT_FAILURE, 0, _("size_t overflow"));
|
||||
+ nmemb++;
|
||||
+
|
||||
+ r = calloc (nmemb, sizeof (char *));
|
||||
if (r == NULL)
|
||||
error (EXIT_FAILURE, errno, "calloc");
|
||||
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,59 @@
|
||||
From 77a10b30f6f6fdb1648b12f68147e6a894526802 Mon Sep 17 00:00:00 2001
|
||||
From: Laszlo Ersek <lersek@redhat.com>
|
||||
Date: Tue, 28 Jun 2022 13:57:00 +0200
|
||||
Subject: [PATCH] get-kernel, sparsify: set networking for "--key ID:clevis"
|
||||
|
||||
Call the OCaml-language helper "key_store_requires_network" in those OCaml
|
||||
utilities that pass "~key_opts:true" to "create_standard_options", and do
|
||||
not have any code related to networking yet.
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1809453
|
||||
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
||||
Message-Id: <20220628115702.5584-3-lersek@redhat.com>
|
||||
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
|
||||
(cherry picked from commit 4f66f0892e6fd75d10dcfa2f9e94b3e32bdb906e)
|
||||
---
|
||||
get-kernel/get_kernel.ml | 1 +
|
||||
sparsify/copying.ml | 1 +
|
||||
sparsify/in_place.ml | 1 +
|
||||
3 files changed, 3 insertions(+)
|
||||
|
||||
diff --git a/get-kernel/get_kernel.ml b/get-kernel/get_kernel.ml
|
||||
index e485cf495..9c2aa17c2 100644
|
||||
--- a/get-kernel/get_kernel.ml
|
||||
+++ b/get-kernel/get_kernel.ml
|
||||
@@ -176,6 +176,7 @@ let main () =
|
||||
(* Connect to libguestfs. *)
|
||||
let g = open_guestfs () in
|
||||
add g;
|
||||
+ g#set_network (key_store_requires_network ks);
|
||||
g#launch ();
|
||||
|
||||
(* Decrypt the disks. *)
|
||||
diff --git a/sparsify/copying.ml b/sparsify/copying.ml
|
||||
index 39d06c94c..21a603d63 100644
|
||||
--- a/sparsify/copying.ml
|
||||
+++ b/sparsify/copying.ml
|
||||
@@ -187,6 +187,7 @@ You can ignore this warning or change it to a hard failure using the
|
||||
let machine_readable = machine_readable () <> None in
|
||||
Progress.set_up_progress_bar ~machine_readable g
|
||||
);
|
||||
+ g#set_network (key_store_requires_network ks);
|
||||
g#launch ();
|
||||
|
||||
g in
|
||||
diff --git a/sparsify/in_place.ml b/sparsify/in_place.ml
|
||||
index 00f0e0564..0eec63e6f 100644
|
||||
--- a/sparsify/in_place.ml
|
||||
+++ b/sparsify/in_place.ml
|
||||
@@ -58,6 +58,7 @@ let run disk format ignores zeroes ks =
|
||||
let machine_readable = machine_readable () <> None in
|
||||
Progress.set_up_progress_bar ~machine_readable g
|
||||
);
|
||||
+ g#set_network (key_store_requires_network ks);
|
||||
g#launch ();
|
||||
|
||||
(* If discard is not supported in the appliance, we must return exit
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,47 @@
|
||||
From fe59e93b27e3bc17b5cc0874e103330e0000b210 Mon Sep 17 00:00:00 2001
|
||||
From: Laszlo Ersek <lersek@redhat.com>
|
||||
Date: Tue, 28 Jun 2022 13:57:01 +0200
|
||||
Subject: [PATCH] customize: add reminder about "--key ID:clevis"
|
||||
|
||||
virt-customize already enables appliance networking by default;
|
||||
conversely, if the user passes "--no-network", we shouldn't override that
|
||||
for the sake of "--key ID:clevis". Add comments about clevis to the code.
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1809453
|
||||
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
||||
Message-Id: <20220628115702.5584-4-lersek@redhat.com>
|
||||
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
|
||||
(cherry picked from commit e52aea48cbcea3f3b538db0573b58517cbc33da0)
|
||||
---
|
||||
customize/customize_main.ml | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/customize/customize_main.ml b/customize/customize_main.ml
|
||||
index 8a022342f..32b7eebdd 100644
|
||||
--- a/customize/customize_main.ml
|
||||
+++ b/customize/customize_main.ml
|
||||
@@ -52,7 +52,11 @@ let main () =
|
||||
let libvirturi = ref "" in
|
||||
let memsize = ref None in
|
||||
let set_memsize arg = memsize := Some arg in
|
||||
+
|
||||
+ (* Note that [--key ID:clevis] depends on this default. See more below, near
|
||||
+ * [g#set_network network]. *)
|
||||
let network = ref true in
|
||||
+
|
||||
let smp = ref None in
|
||||
let set_smp arg = smp := Some arg in
|
||||
|
||||
@@ -159,6 +163,9 @@ read the man page virt-customize(1).
|
||||
let g = open_guestfs () in
|
||||
Option.may g#set_memsize memsize;
|
||||
Option.may g#set_smp smp;
|
||||
+ (* [--no-network] from the command line takes precedence over the automatic
|
||||
+ * network enablement for [--key ID:clevis], so here we intentionally don't check
|
||||
+ * [key_store_requires_network opthandle.ks]. *)
|
||||
g#set_network network;
|
||||
|
||||
(* Add disks. *)
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,67 @@
|
||||
From c2917c9a7f0c23b94d30af2a5a14e67c46e38242 Mon Sep 17 00:00:00 2001
|
||||
From: Laszlo Ersek <lersek@redhat.com>
|
||||
Date: Tue, 28 Jun 2022 13:57:02 +0200
|
||||
Subject: [PATCH] sysprep: set networking for "--key ID:clevis"
|
||||
|
||||
Similarly to virt-customize, virt-sysprep has prior "--network" and
|
||||
"--no-network" options. Unlike virt-customize though, virt-sysprep
|
||||
defaults to disabling the appliance network. Therefore we can't tell
|
||||
whether the network is disabled "by default" or because the user requested
|
||||
it.
|
||||
|
||||
That's a problem: "--key ID:clevis" is supposed to override the former,
|
||||
but not the latter. Add a separate option for tracking "--no-network", and
|
||||
only if "--no-network" is absent, permit "--network" or "--key ID:clevis"
|
||||
to turn on the network.
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1809453
|
||||
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
||||
Message-Id: <20220628115702.5584-5-lersek@redhat.com>
|
||||
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
|
||||
(cherry picked from commit 1cce13223e9321d1ef333d6ae356c24203990a4a)
|
||||
---
|
||||
sysprep/main.ml | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/sysprep/main.ml b/sysprep/main.ml
|
||||
index b760618ad..1f722dfb0 100644
|
||||
--- a/sysprep/main.ml
|
||||
+++ b/sysprep/main.ml
|
||||
@@ -44,6 +44,7 @@ let main () =
|
||||
let libvirturi = ref "" in
|
||||
let mount_opts = ref "" in
|
||||
let network = ref false in
|
||||
+ let no_network = ref false in
|
||||
let operations = ref None in
|
||||
|
||||
let format = ref "auto" in
|
||||
@@ -131,7 +132,7 @@ let main () =
|
||||
[ L"list-operations" ], Getopt.Unit list_operations, s_"List supported operations";
|
||||
[ L"mount-options" ], Getopt.Set_string (s_"opts", mount_opts), s_"Set mount options (eg /:noatime;/var:rw,noatime)";
|
||||
[ L"network" ], Getopt.Set network, s_"Enable appliance network";
|
||||
- [ L"no-network" ], Getopt.Clear network, s_"Disable appliance network (default)";
|
||||
+ [ L"no-network" ], Getopt.Set no_network, s_"Disable appliance network (default)";
|
||||
[ L"operation"; L"operations" ], Getopt.String (s_"operations", set_operations), s_"Enable/disable specific operations";
|
||||
] in
|
||||
let args = basic_args @ Sysprep_operation.extra_args () in
|
||||
@@ -188,6 +189,7 @@ read the man page virt-sysprep(1).
|
||||
(* Dereference the rest of the args. *)
|
||||
let dryrun = !dryrun in
|
||||
let network = !network in
|
||||
+ let no_network = !no_network in
|
||||
let operations = !operations in
|
||||
|
||||
(* At this point we know which operations are enabled. So call the
|
||||
@@ -208,7 +210,8 @@ read the man page virt-sysprep(1).
|
||||
|
||||
(* Connect to libguestfs. *)
|
||||
let g = open_guestfs () in
|
||||
- g#set_network network;
|
||||
+ g#set_network (not no_network &&
|
||||
+ (network || key_store_requires_network opthandle.ks));
|
||||
add g dryrun;
|
||||
g#launch ();
|
||||
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,87 @@
|
||||
From d15d829d20c1a0d21da584257c4634517d4271d1 Mon Sep 17 00:00:00 2001
|
||||
From: Laszlo Ersek <lersek@redhat.com>
|
||||
Date: Thu, 14 Jul 2022 12:40:04 +0200
|
||||
Subject: [PATCH] sysprep: make an effort to cope with LUKS-on-LVM
|
||||
|
||||
If the guest disk uses the LUKS-on-LVM scheme, then sysprep has a problem:
|
||||
|
||||
- the "fs-uuids" blockdev operation depends on the decrypted LUKS devices
|
||||
being open,
|
||||
|
||||
- the "lvm-uuids" blockdev operation depends on the same devices being
|
||||
closed.
|
||||
|
||||
Attempt to deal with this in "lvm-uuids".
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2106286
|
||||
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
||||
Message-Id: <20220714104005.8334-2-lersek@redhat.com>
|
||||
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
|
||||
(cherry picked from commit 361a447bcb7aef399abad8075ee41197c4071f71)
|
||||
---
|
||||
sysprep/sysprep_operation_lvm_uuids.ml | 42 +++++++++++++++++++++++++-
|
||||
1 file changed, 41 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/sysprep/sysprep_operation_lvm_uuids.ml b/sysprep/sysprep_operation_lvm_uuids.ml
|
||||
index c67b21487..5fc623039 100644
|
||||
--- a/sysprep/sysprep_operation_lvm_uuids.ml
|
||||
+++ b/sysprep/sysprep_operation_lvm_uuids.ml
|
||||
@@ -30,7 +30,46 @@ let rec lvm_uuids_perform g root side_effects =
|
||||
try g#available [|"lvm2"|]; true with G.Error _ -> false in
|
||||
if has_lvm2_feature then (
|
||||
let has_pvs, has_vgs = g#pvs () <> [||], g#vgs () <> [||] in
|
||||
- if has_pvs || has_vgs then g#vg_activate_all false;
|
||||
+ if has_pvs || has_vgs then (
|
||||
+ try g#vg_activate_all false
|
||||
+ with G.Error _ as exn ->
|
||||
+ (* If the "luks" feature is not available, re-raise the exception. *)
|
||||
+ (try g#available [|"luks"|] with G.Error _ -> raise exn);
|
||||
+
|
||||
+ (* Assume VG deactivation failed due to the guest using the
|
||||
+ * FS-on-LUKS-on-LVM scheme.
|
||||
+ *
|
||||
+ * By now, we have unmounted filesystems, but the decrypted LUKS
|
||||
+ * devices still keep the LVs open. Therefore, attempt closing all
|
||||
+ * decrypted LUKS devices that were opened by inspection (i.e., device
|
||||
+ * nodes with pathnames like "/dev/mapper/luks-<uuid>"). Closing the
|
||||
+ * decrypted LUKS devices should remove the references from their
|
||||
+ * underlying LVs, and then VG deactivation should succeed too.
|
||||
+ *
|
||||
+ * Note that closing the decrypted LUKS devices prevents the
|
||||
+ * blockdev-level manipulation of those filesystems that reside on
|
||||
+ * said decrypted LUKS devices, such as the "fs-uuids" operation. But
|
||||
+ * that should be OK, as we order the present operation after all
|
||||
+ * other block device ops.
|
||||
+ *
|
||||
+ * In case the guest uses the FS-on-LVM-on-LUKS scheme, then the
|
||||
+ * original VG deactivation must have failed for a different reason.
|
||||
+ * (As we have unmounted filesystems earlier, and LUKS is below, not
|
||||
+ * on top of, LVM.) The LUKS-closing attempts below will fail then,
|
||||
+ * due to LVM keeping the decrypted LUKS devices open. This failure is
|
||||
+ * harmless and can be considered a no-op. The final, retried VG
|
||||
+ * deactivation should reproduce the original failure.
|
||||
+ *)
|
||||
+ let luks_re = PCRE.compile ("^/dev/mapper/luks" ^
|
||||
+ "-[[:xdigit:]]{8}" ^
|
||||
+ "(?:-[[:xdigit:]]{4}){3}" ^
|
||||
+ "-[[:xdigit:]]{12}$")
|
||||
+ and dmdevs = Array.to_list (g#list_dm_devices ()) in
|
||||
+ let plaintext_devs = List.filter (PCRE.matches luks_re) dmdevs in
|
||||
+ List.iter (fun dev -> try g#cryptsetup_close dev with _ -> ())
|
||||
+ plaintext_devs;
|
||||
+ g#vg_activate_all false
|
||||
+ );
|
||||
if has_pvs then g#pvchange_uuid_all ();
|
||||
if has_vgs then g#vgchange_uuid_all ();
|
||||
if has_pvs || has_vgs then g#vg_activate_all true
|
||||
@@ -39,6 +78,7 @@ let rec lvm_uuids_perform g root side_effects =
|
||||
|
||||
let op = {
|
||||
defaults with
|
||||
+ order = 99; (* Run it after other block device ops. *)
|
||||
name = "lvm-uuids";
|
||||
enabled_by_default = true;
|
||||
heading = s_"Change LVM2 PV and VG UUIDs";
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,39 @@
|
||||
From 0b92347337e9201140ed2daf77a934c731de6630 Mon Sep 17 00:00:00 2001
|
||||
From: Laszlo Ersek <lersek@redhat.com>
|
||||
Date: Thu, 14 Jul 2022 12:40:05 +0200
|
||||
Subject: [PATCH] sysprep: advise against cloning VMs with internal full disk
|
||||
encryption
|
||||
|
||||
This is relevant for sysprep because we recommend sysprep for facilitating
|
||||
cloning.
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2106286
|
||||
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
||||
Message-Id: <20220714104005.8334-3-lersek@redhat.com>
|
||||
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
|
||||
(cherry picked from commit b49ee909f5d1a0d7b5c668335b9098ca8ff85bfd)
|
||||
---
|
||||
sysprep/virt-sysprep.pod | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/sysprep/virt-sysprep.pod b/sysprep/virt-sysprep.pod
|
||||
index deeb5341e..232b9f24b 100644
|
||||
--- a/sysprep/virt-sysprep.pod
|
||||
+++ b/sysprep/virt-sysprep.pod
|
||||
@@ -519,6 +519,13 @@ Either or both options can be used multiple times on the command line.
|
||||
|
||||
=head1 SECURITY
|
||||
|
||||
+Virtual machines that employ full disk encryption I<internally to the
|
||||
+guest> should not be considered for cloning and distribution, as it
|
||||
+provides multiple parties with the same internal volume key, enabling
|
||||
+any one such party to decrypt all the other clones. Refer to the L<LUKS
|
||||
+FAQ|https://gitlab.com/cryptsetup/cryptsetup/-/blob/main/FAQ.md> for
|
||||
+details.
|
||||
+
|
||||
Although virt-sysprep removes some sensitive information from the
|
||||
guest, it does not pretend to remove all of it. You should examine
|
||||
the L</OPERATIONS> above and the guest afterwards.
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,144 @@
|
||||
From 3576da023fb42ceaea80b81aebad345de606a332 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Fri, 15 Jul 2022 08:55:53 +0100
|
||||
Subject: [PATCH] builder, dib: Replace On_exit.rmdir with On_exit.rm_rf
|
||||
|
||||
Update common submodule.
|
||||
|
||||
(cherry picked from commit f5baf83e464c276d3dae6f8e878b8f47fe0d43d9)
|
||||
---
|
||||
builder/builder.ml | 2 +-
|
||||
builder/index_parser_tests.ml | 2 +-
|
||||
builder/repository_main.ml | 2 +-
|
||||
common | 2 +-
|
||||
dib/dib.ml | 2 +-
|
||||
5 files changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/builder/builder.ml b/builder/builder.ml
|
||||
index 2c9c83085..e34aae6c7 100644
|
||||
--- a/builder/builder.ml
|
||||
+++ b/builder/builder.ml
|
||||
@@ -182,7 +182,7 @@ let main () =
|
||||
* create.
|
||||
*)
|
||||
let tmpdir = Mkdtemp.temp_dir "virt-builder." in
|
||||
- On_exit.rmdir tmpdir;
|
||||
+ On_exit.rm_rf tmpdir;
|
||||
|
||||
(* Download the sources. *)
|
||||
let downloader = Downloader.create ~curl:cmdline.curl ~cache ~tmpdir in
|
||||
diff --git a/builder/index_parser_tests.ml b/builder/index_parser_tests.ml
|
||||
index 39983faba..5262a1607 100644
|
||||
--- a/builder/index_parser_tests.ml
|
||||
+++ b/builder/index_parser_tests.ml
|
||||
@@ -28,7 +28,7 @@ open Tools_utils
|
||||
|
||||
let tmpdir =
|
||||
let tmpdir = Mkdtemp.temp_dir "guestfs-tests." in
|
||||
- On_exit.rmdir tmpdir;
|
||||
+ On_exit.rm_rf tmpdir;
|
||||
tmpdir
|
||||
|
||||
let dummy_sigchecker = Sigchecker.create ~gpg:"gpg"
|
||||
diff --git a/builder/repository_main.ml b/builder/repository_main.ml
|
||||
index c5b656310..c24729c4c 100644
|
||||
--- a/builder/repository_main.ml
|
||||
+++ b/builder/repository_main.ml
|
||||
@@ -420,7 +420,7 @@ let main () =
|
||||
(* Create a temporary folder to work in *)
|
||||
let tmpdir = Mkdtemp.temp_dir ~base_dir:cmdline.repo
|
||||
"virt-builder-repository." in
|
||||
- On_exit.rmdir tmpdir;
|
||||
+ On_exit.rm_rf tmpdir;
|
||||
|
||||
let tmprepo = tmpdir // "repo" in
|
||||
mkdir_p tmprepo 0o700;
|
||||
Submodule common af6cb55bc..fd964c1ba:
|
||||
diff --git a/common/mlcustomize/guest_packages.ml b/common/mlcustomize/guest_packages.ml
|
||||
index 4c3c34e..7c29a2a 100644
|
||||
--- a/common/mlcustomize/guest_packages.ml
|
||||
+++ b/common/mlcustomize/guest_packages.ml
|
||||
@@ -73,9 +73,9 @@ let install_command packages package_management =
|
||||
| "zypper" -> sprintf "zypper -n in -l %s" quoted_args
|
||||
|
||||
| "unknown" ->
|
||||
- error_unknown_package_manager (s_"--install")
|
||||
+ error_unknown_package_manager "--install"
|
||||
| pm ->
|
||||
- error_unimplemented_package_manager (s_"--install") pm
|
||||
+ error_unimplemented_package_manager "--install" pm
|
||||
|
||||
let update_command package_management =
|
||||
match package_management with
|
||||
@@ -103,9 +103,9 @@ let update_command package_management =
|
||||
| "zypper" -> "zypper -n update -l"
|
||||
|
||||
| "unknown" ->
|
||||
- error_unknown_package_manager (s_"--update")
|
||||
+ error_unknown_package_manager "--update"
|
||||
| pm ->
|
||||
- error_unimplemented_package_manager (s_"--update") pm
|
||||
+ error_unimplemented_package_manager "--update" pm
|
||||
|
||||
let uninstall_command packages package_management =
|
||||
let quoted_args = String.concat " " (List.map quote packages) in
|
||||
@@ -127,6 +127,6 @@ let uninstall_command packages package_management =
|
||||
| "zypper" -> sprintf "zypper -n rm %s" quoted_args
|
||||
|
||||
| "unknown" ->
|
||||
- error_unknown_package_manager (s_"--uninstall")
|
||||
+ error_unknown_package_manager "--uninstall"
|
||||
| pm ->
|
||||
- error_unimplemented_package_manager (s_"--uninstall") pm
|
||||
+ error_unimplemented_package_manager "--uninstall" pm
|
||||
diff --git a/common/mltools/on_exit.ml b/common/mltools/on_exit.ml
|
||||
index 53ccb68..cae12e7 100644
|
||||
--- a/common/mltools/on_exit.ml
|
||||
+++ b/common/mltools/on_exit.ml
|
||||
@@ -52,7 +52,7 @@ let do_actions () =
|
||||
List.iter (do_action (fun file -> Unix.unlink file)) !files;
|
||||
List.iter (do_action (
|
||||
fun dir ->
|
||||
- let cmd = sprintf "rm -rf %s" (Filename.quote dir) in
|
||||
+ let cmd = sprintf "rm -rf -- %s" (Filename.quote dir) in
|
||||
ignore (Tools_utils.shell_command cmd)
|
||||
)
|
||||
) !rmdirs;
|
||||
@@ -102,7 +102,7 @@ let unlink filename =
|
||||
register ();
|
||||
List.push_front filename files
|
||||
|
||||
-let rmdir dir =
|
||||
+let rm_rf dir =
|
||||
register ();
|
||||
List.push_front dir rmdirs
|
||||
|
||||
diff --git a/common/mltools/on_exit.mli b/common/mltools/on_exit.mli
|
||||
index a02e3db..9bcf104 100644
|
||||
--- a/common/mltools/on_exit.mli
|
||||
+++ b/common/mltools/on_exit.mli
|
||||
@@ -47,7 +47,7 @@ val f : (unit -> unit) -> unit
|
||||
val unlink : string -> unit
|
||||
(** Unlink a single temporary file on exit. *)
|
||||
|
||||
-val rmdir : string -> unit
|
||||
+val rm_rf : string -> unit
|
||||
(** Recursively remove a temporary directory on exit (using [rm -rf]). *)
|
||||
|
||||
val kill : ?signal:int -> int -> unit
|
||||
diff --git a/dib/dib.ml b/dib/dib.ml
|
||||
index f5ce604c8..a4ba36040 100644
|
||||
--- a/dib/dib.ml
|
||||
+++ b/dib/dib.ml
|
||||
@@ -550,7 +550,7 @@ let main () =
|
||||
let image_basename_d = image_basename ^ ".d" in
|
||||
|
||||
let tmpdir = Mkdtemp.temp_dir "dib." in
|
||||
- On_exit.rmdir tmpdir;
|
||||
+ On_exit.rm_rf tmpdir;
|
||||
let auxtmpdir = tmpdir // "in_target.aux" in
|
||||
do_mkdir auxtmpdir;
|
||||
let hookstmpdir = auxtmpdir // "hooks" in
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,60 @@
|
||||
#!/bin/bash -
|
||||
|
||||
set -e
|
||||
|
||||
# Maintainer script to copy patches from the git repo to the current
|
||||
# directory. Use it like this:
|
||||
# ./copy-patches.sh
|
||||
|
||||
project=guestfs-tools
|
||||
rhel_version=9.1
|
||||
|
||||
# Check we're in the right directory.
|
||||
if [ ! -f $project.spec ]; then
|
||||
echo "$0: run this from the directory containing '$project.spec'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case `id -un` in
|
||||
rjones) git_checkout=$HOME/d/$project-rhel-$rhel_version ;;
|
||||
lersek) git_checkout=$HOME/src/guestfs-tools/$project ;;
|
||||
*) git_checkout=$HOME/d/$project-rhel-$rhel_version ;;
|
||||
esac
|
||||
if [ ! -d $git_checkout ]; then
|
||||
echo "$0: $git_checkout does not exist"
|
||||
echo "This script is only for use by the maintainer when preparing a"
|
||||
echo "$project release on RHEL."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get the base version of the project.
|
||||
version=`grep '^Version:' $project.spec | awk '{print $2}'`
|
||||
tag="v$version"
|
||||
|
||||
# Remove any existing patches.
|
||||
git rm -f [0-9]*.patch ||:
|
||||
rm -f [0-9]*.patch
|
||||
|
||||
# Get the patches.
|
||||
(cd $git_checkout; rm -f [0-9]*.patch; git format-patch -N --submodule=diff $tag)
|
||||
mv $git_checkout/[0-9]*.patch .
|
||||
|
||||
# Remove any not to be applied.
|
||||
rm -f *NOT-FOR-RPM*.patch
|
||||
|
||||
# Add the patches.
|
||||
git add [0-9]*.patch
|
||||
|
||||
# Print out the patch lines.
|
||||
echo
|
||||
echo "--- Copy the following text into $project.spec file"
|
||||
echo
|
||||
|
||||
echo "# Patches."
|
||||
for f in [0-9]*.patch; do
|
||||
n=`echo $f | awk -F- '{print $1}'`
|
||||
echo "Patch$n: $f"
|
||||
done
|
||||
|
||||
echo
|
||||
echo "--- End of text"
|
@ -0,0 +1,17 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQJFBAABCAAvFiEE93dPsa0HSn6Mh2fqkXOPc+G3aKAFAmKPVz0RHHJpY2hAYW5u
|
||||
ZXhpYS5vcmcACgkQkXOPc+G3aKBYYxAAm31U2XKvJ164dv92ezjUbQL4D4A+nWh1
|
||||
WGmDmiTFq9IWT8W9U7xw7qT7kzqky+gQBUCGHDQSYiEcdsIlaR7WqdNBfRUHi5lu
|
||||
mrZSMjCfMWaEwTvjtcZrJBmIIP/b/AHfXo/Nxg79MFmSPocfl7RBNpf6HQ7ZnRHW
|
||||
w5P94fJQtOf6Bi9MHc7cwJ/wh7gslOT70puO85igBFbpBUedjINNudl0r7fYUz5I
|
||||
zVxVQuFDYI0+d/UhIBa1ULVTCzlyGn9Rg+9B/B0b2XUZwxXOePusPJ/uK1OUkgue
|
||||
fEtzTzEbl2x90w28+2mbXTyHJWJCKcO36/jII8H8ekF2uREwxgA8qzN6AC4sBwM1
|
||||
o2RiK5LMgqTlPsUP/5lrtAKp9RlXJ76WFnZzt/nSyCTwY+xApbmCQFYWJAaFzAso
|
||||
TAazoyG31AUBhJzBNCoyAsfkb82Lh4++sev8oG8A0qeEvxktFh0tGzfnesFrahfW
|
||||
VwbNbDUFEtTam+8rC667K7/v1FwCfC24BFmq8GZyyE/kmOwRN1jHq9FPYV/0sFLv
|
||||
khkEdR7BWCOGjRS9sP8kN7ApWLHv9gthu9ZtGNA8ms7Gk//WfzMRrhCAWAWyI1kG
|
||||
CG8DuXw63mDpbvY52TBbzD3mKZ30AN8tB4U+j9+PaxwIi0JXqtjJL2ggExCtZMDG
|
||||
W1p4vqAvtB0=
|
||||
=bW2f
|
||||
-----END PGP SIGNATURE-----
|
Loading…
Reference in new issue