1 package PVE
::CLI
::pve6to7
;
10 use PVE
::API2
::Certificates
;
12 use PVE
::AccessControl
;
18 use PVE
::RPCEnvironment
;
20 use PVE
::Tools
qw(run_command split_list);
22 use PVE
::VZDump
::Common
;
29 use base
qw(PVE::CLIHandler);
31 my $nodename = PVE
::INotify
::nodename
();
33 sub setup_environment
{
34 PVE
::RPCEnvironment-
>setup_default_cli_env();
37 my $min_pve_major = 6;
38 my $min_pve_minor = 4;
39 my $min_pve_pkgrel = 1;
49 my ($level, $line) = @_;
51 $counters->{$level}++ if defined($level) && defined($counters->{$level});
53 print uc($level), ': ' if defined($level);
59 $log_line->('pass', @_);
64 $log_line->('info', @_);
67 $log_line->('skip', @_);
70 print color
('yellow');
71 $log_line->('warn', @_);
76 $log_line->('fail', @_);
80 my $print_header_first = 1;
83 print "\n" if !$print_header_first;
85 $print_header_first = 0;
88 my $get_systemd_unit_state = sub {
92 my $filter_output = sub {
97 run_command
(['systemctl', 'is-enabled', "$unit"], outfunc
=> $filter_output, noerr
=> 1);
98 return if !defined($state);
99 run_command
(['systemctl', 'is-active', "$unit"], outfunc
=> $filter_output, noerr
=> 1);
102 return $state // 'unknown';
104 my $log_systemd_unit_state = sub {
105 my ($unit, $no_fail_on_inactive) = @_;
107 my $log_method = \
&log_warn
;
109 my $state = $get_systemd_unit_state->($unit);
110 if ($state eq 'active') {
111 $log_method = \
&log_pass
;
112 } elsif ($state eq 'inactive') {
113 $log_method = $no_fail_on_inactive ? \
&log_warn
: \
&log_fail
;
114 } elsif ($state eq 'failed') {
115 $log_method = \
&log_fail
;
118 $log_method->("systemd unit '$unit' is in state '$state'");
125 $versions = eval { PVE
::API2
::APT-
>versions({ node
=> $nodename }) } if !defined($versions);
127 if (!defined($versions)) {
128 my $msg = "unable to retrieve package version information";
129 $msg .= "- $@" if $@;
134 my $pkgs = [ grep { $_->{Package
} eq $pkg } @$versions ];
135 if (!defined $pkgs || $pkgs == 0) {
136 log_fail
("unable to determine installed $pkg version.");
143 sub check_pve_packages
{
144 print_header
("CHECKING VERSION INFORMATION FOR PVE PACKAGES");
146 print "Checking for package updates..\n";
147 my $updates = eval { PVE
::API2
::APT-
>list_updates({ node
=> $nodename }); };
148 if (!defined($updates)) {
149 log_warn
("$@") if $@;
150 log_fail
("unable to retrieve list of package updates!");
151 } elsif (@$updates > 0) {
152 my $pkgs = join(', ', map { $_->{Package
} } @$updates);
153 log_warn
("updates for the following packages are available:\n $pkgs");
155 log_pass
("all packages uptodate");
158 print "\nChecking proxmox-ve package version..\n";
159 if (defined(my $proxmox_ve = $get_pkg->('proxmox-ve'))) {
160 my $min_pve_ver = "$min_pve_major.$min_pve_minor-$min_pve_pkgrel";
162 my ($maj, $min, $pkgrel) = $proxmox_ve->{OldVersion
} =~ m/^(\d+)\.(\d+)-(\d+)/;
166 if ($maj > $min_pve_major) {
167 log_pass
("already upgraded to Proxmox VE " . ($min_pve_major + 1));
169 } elsif ($maj >= $min_pve_major && $min >= $min_pve_minor && $pkgrel >= $min_pve_pkgrel) {
170 log_pass
("proxmox-ve package has version >= $min_pve_ver");
172 log_fail
("proxmox-ve package is too old, please upgrade to >= $min_pve_ver!");
175 my ($krunning, $kinstalled) = (qr/5\.11/, 'pve-kernel-5.11');
177 ($krunning, $kinstalled) = (qr/5\.(?:4|11)/, 'pve-kernel-4.15');
180 print "\nChecking running kernel version..\n";
181 my $kernel_ver = $proxmox_ve->{RunningKernel
};
182 if (!defined($kernel_ver)) {
183 log_fail
("unable to determine running kernel version.");
184 } elsif ($kernel_ver =~ /^$krunning/) {
185 log_pass
("expected running kernel '$kernel_ver'.");
186 } elsif ($get_pkg->($kinstalled)) {
187 log_warn
("expected kernel '$kinstalled' intalled but not yet rebooted!");
189 log_warn
("unexpected running and installed kernel '$kernel_ver'.");
192 log_fail
("proxmox-ve package not found!");
197 sub check_storage_health
{
198 print_header
("CHECKING CONFIGURED STORAGES");
199 my $cfg = PVE
::Storage
::config
();
203 my $info = PVE
::Storage
::storage_info
($cfg);
205 foreach my $storeid (keys %$info) {
206 my $d = $info->{$storeid};
208 if ($d->{type
} eq 'sheepdog') {
209 log_fail
("storage '$storeid' of type 'sheepdog' is enabled - experimental sheepdog support dropped in PVE 6")
210 } elsif ($d->{active
}) {
211 log_pass
("storage '$storeid' enabled and active.");
213 log_warn
("storage '$storeid' enabled but not active!");
216 log_skip
("storage '$storeid' disabled.");
221 sub check_cluster_corosync
{
222 print_header
("CHECKING CLUSTER HEALTH/SETTINGS");
224 if (!PVE
::Corosync
::check_conf_exists
(1)) {
225 log_skip
("standalone node.");
229 $log_systemd_unit_state->('pve-cluster.service');
230 $log_systemd_unit_state->('corosync.service');
232 if (PVE
::Cluster
::check_cfs_quorum
(1)) {
233 log_pass
("Cluster Filesystem is quorate.");
235 log_fail
("Cluster Filesystem readonly, lost quorum?!");
238 my $conf = PVE
::Cluster
::cfs_read_file
('corosync.conf');
239 my $conf_nodelist = PVE
::Corosync
::nodelist
($conf);
242 print "\nAnalzying quorum settings and state..\n";
243 if (!defined($conf_nodelist)) {
244 log_fail
("unable to retrieve nodelist from corosync.conf");
246 if (grep { $conf_nodelist->{$_}->{quorum_votes
} != 1 } keys %$conf_nodelist) {
247 log_warn
("non-default quorum_votes distribution detected!");
249 map { $node_votes += $conf_nodelist->{$_}->{quorum_votes
} // 0 } keys %$conf_nodelist;
252 my ($expected_votes, $total_votes);
253 my $filter_output = sub {
255 ($expected_votes) = $line =~ /^Expected votes:\s*(\d+)\s*$/
256 if !defined($expected_votes);
257 ($total_votes) = $line =~ /^Total votes:\s*(\d+)\s*$/
258 if !defined($total_votes);
261 run_command
(['corosync-quorumtool', '-s'], outfunc
=> $filter_output, noerr
=> 1);
264 if (!defined($expected_votes)) {
265 log_fail
("unable to get expected number of votes, setting to 0.");
268 if (!defined($total_votes)) {
269 log_fail
("unable to get expected number of votes, setting to 0.");
273 my $cfs_nodelist = PVE
::Cluster
::get_clinfo
()->{nodelist
};
274 my $offline_nodes = grep { $cfs_nodelist->{$_}->{online
} != 1 } keys %$cfs_nodelist;
275 if ($offline_nodes > 0) {
276 log_fail
("$offline_nodes nodes are offline!");
279 my $qdevice_votes = 0;
280 if (my $qdevice_setup = $conf->{main
}->{quorum
}->{device
}) {
281 $qdevice_votes = $qdevice_setup->{votes
} // 1;
284 log_info
("configured votes - nodes: $node_votes");
285 log_info
("configured votes - qdevice: $qdevice_votes");
286 log_info
("current expected votes: $expected_votes");
287 log_info
("current total votes: $total_votes");
289 log_warn
("expected votes set to non-standard value '$expected_votes'.")
290 if $expected_votes != $node_votes + $qdevice_votes;
291 log_warn
("total votes < expected votes: $total_votes/$expected_votes!")
292 if $total_votes < $expected_votes;
294 my $conf_nodelist_count = scalar(keys %$conf_nodelist);
295 my $cfs_nodelist_count = scalar(keys %$cfs_nodelist);
296 log_warn
("cluster consists of less than three quorum-providing nodes!")
297 if $conf_nodelist_count < 3 && $conf_nodelist_count + $qdevice_votes < 3;
299 log_fail
("corosync.conf ($conf_nodelist_count) and pmxcfs ($cfs_nodelist_count) don't agree about size of nodelist.")
300 if $conf_nodelist_count != $cfs_nodelist_count;
302 print "\nChecking nodelist entries..\n";
303 for my $cs_node (sort keys %$conf_nodelist) {
304 my $entry = $conf_nodelist->{$cs_node};
305 log_fail
("$cs_node: no name entry in corosync.conf.")
306 if !defined($entry->{name
});
307 log_fail
("$cs_node: no nodeid configured in corosync.conf.")
308 if !defined($entry->{nodeid
});
310 for my $link (0..7) {
311 $gotLinks++ if defined($entry->{"ring${link}_addr"});
313 log_fail
("$cs_node: no ringX_addr (0 <= X <= 7) link defined in corosync.conf.") if $gotLinks <= 0;
315 my $verify_ring_ip = sub {
317 if (defined(my $ring = $entry->{$key})) {
318 my ($resolved_ip, undef) = PVE
::Corosync
::resolve_hostname_like_corosync
($ring, $conf);
319 if (defined($resolved_ip)) {
320 if ($resolved_ip ne $ring) {
321 log_warn
("$cs_node: $key '$ring' resolves to '$resolved_ip'.\n Consider replacing it with the currently resolved IP address.");
323 log_pass
("$cs_node: $key is configured to use IP address '$ring'");
326 log_fail
("$cs_node: unable to resolve $key '$ring' to an IP address according to Corosync's resolve strategy - cluster will potentially fail with Corosync 3.x/kronosnet!");
330 for my $link (0..7) {
331 $verify_ring_ip->("ring${link}_addr");
335 print "\nChecking totem settings..\n";
336 my $totem = $conf->{main
}->{totem
};
337 my $transport = $totem->{transport
};
338 if (defined($transport)) {
339 if ($transport ne 'knet') {
340 log_fail
("Corosync transport explicitly set to '$transport' instead of implicit default!");
342 log_pass
("Corosync transport set to '$transport'.");
345 log_pass
("Corosync transport set to implicit default.");
348 # TODO: are those values still up-to-date?
349 if ((!defined($totem->{secauth
}) || $totem->{secauth
} ne 'on') && (!defined($totem->{crypto_cipher
}) || $totem->{crypto_cipher
} eq 'none')) {
350 log_fail
("Corosync authentication/encryption is not explicitly enabled (secauth / crypto_cipher / crypto_hash)!");
352 if (defined($totem->{crypto_cipher
}) && $totem->{crypto_cipher
} eq '3des') {
353 log_fail
("Corosync encryption cipher set to '3des', no longer supported in Corosync 3.x!"); # FIXME: can be removed?
355 log_pass
("Corosync encryption and authentication enabled.");
360 log_info
("run 'pvecm status' to get detailed cluster status..");
362 print_header
("CHECKING INSTALLED COROSYNC VERSION");
363 if (defined(my $corosync = $get_pkg->('corosync'))) {
364 if ($corosync->{OldVersion
} =~ m/^2\./) {
365 log_fail
("corosync 2.x installed, cluster-wide upgrade to 3.x needed!");
366 } elsif ($corosync->{OldVersion
} =~ m/^3\./) {
367 log_pass
("corosync 3.x installed.");
369 log_fail
("unexpected corosync version installed: $corosync->{OldVersion}!");
375 print_header
("CHECKING HYPER-CONVERGED CEPH STATUS");
377 if (PVE
::Ceph
::Tools
::check_ceph_inited
(1)) {
378 log_info
("hyper-converged ceph setup detected!");
380 log_skip
("no hyper-converged ceph setup detected!");
384 log_info
("getting Ceph status/health information..");
385 my $ceph_status = eval { PVE
::API2
::Ceph-
>status({ node
=> $nodename }); };
386 my $osd_flags = eval { PVE
::API2
::Ceph-
>get_flags({ node
=> $nodename }); };
387 my $noout_wanted = 1;
388 my $noout = $osd_flags && $osd_flags =~ m/noout/;
390 if (!$ceph_status || !$ceph_status->{health
}) {
391 log_fail
("unable to determine Ceph status!");
393 my $ceph_health = $ceph_status->{health
}->{status
};
395 log_fail
("unable to determine Ceph health!");
396 } elsif ($ceph_health eq 'HEALTH_OK') {
397 log_pass
("Ceph health reported as 'HEALTH_OK'.");
398 } elsif ($ceph_health eq 'HEALTH_WARN' && $noout && (keys %{$ceph_status->{health
}->{checks
}} == 1)) {
399 log_pass
("Ceph health reported as 'HEALTH_WARN' with a single failing check and 'noout' flag set.");
401 log_warn
("Ceph health reported as '$ceph_health'.\n Use the PVE ".
402 "dashboard or 'ceph -s' to determine the specific issues and try to resolve them.");
406 log_info
("getting Ceph OSD flags..");
409 log_fail
("unable to get Ceph OSD flags!");
411 if ($osd_flags =~ m/recovery_deletes/ && $osd_flags =~ m/purged_snapdirs/) {
412 log_pass
("all PGs have been scrubbed at least once while running Ceph Luminous."); # FIXME: remove?
414 log_fail
("missing 'recovery_deletes' and/or 'purged_snapdirs' flag, scrub of all PGs required before upgrading to Nautilus!");
419 # TODO: check OSD min-required version, if to low it breaks stuff!
421 log_info
("getting Ceph daemon versions..");
422 my $ceph_versions = eval { PVE
::Ceph
::Tools
::get_cluster_versions
(undef, 1); };
423 if (!$ceph_versions) {
424 log_fail
("unable to determine Ceph daemon versions!");
427 { 'key' => 'mon', 'name' => 'monitor' },
428 { 'key' => 'mgr', 'name' => 'manager' },
429 { 'key' => 'mds', 'name' => 'MDS' },
430 { 'key' => 'osd', 'name' => 'OSD' },
433 foreach my $service (@$services) {
434 my $name = $service->{name
};
435 if (my $service_versions = $ceph_versions->{$service->{key
}}) {
436 if (keys %$service_versions == 0) {
437 log_skip
("no running instances detected for daemon type $name.");
438 } elsif (keys %$service_versions == 1) {
439 log_pass
("single running version detected for daemon type $name.");
441 log_warn
("multiple running versions detected for daemon type $name!");
444 log_skip
("unable to determine versions of running Ceph $name instances.");
448 my $overall_versions = $ceph_versions->{overall
};
449 if (!$overall_versions) {
450 log_warn
("unable to determine overall Ceph daemon versions!");
451 } elsif (keys %$overall_versions == 1) {
452 log_pass
("single running overall version detected for all Ceph daemon types.");
453 if ((keys %$overall_versions)[0] =~ /^ceph version 15\./) {
457 log_warn
("overall version mismatch detected, check 'ceph versions' output for details!");
463 log_pass
("'noout' flag set to prevent rebalancing during cluster-wide upgrades.");
465 log_warn
("'noout' flag set, Ceph cluster upgrade seems finished.");
467 } elsif ($noout_wanted) {
468 log_warn
("'noout' flag not set - recommended to prevent rebalancing during upgrades.");
471 log_info
("checking Ceph config..");
472 my $conf = PVE
::Cluster
::cfs_read_file
('ceph.conf');
474 my $global = $conf->{global
};
476 my $global_monhost = $global->{mon_host
} // $global->{"mon host"} // $global->{"mon-host"};
477 if (!defined($global_monhost)) {
478 log_warn
("No 'mon_host' entry found in ceph config.\n It's recommended to add mon_host with all monitor addresses (without ports) to the global section.");
480 log_pass
("Found 'mon_host' entry.");
483 my $ipv6 = $global->{ms_bind_ipv6
} // $global->{"ms bind ipv6"} // $global->{"ms-bind-ipv6"};
485 my $ipv4 = $global->{ms_bind_ipv4
} // $global->{"ms bind ipv4"} // $global->{"ms-bind-ipv4"};
486 if ($ipv6 eq 'true' && (!defined($ipv4) || $ipv4 ne 'false')) {
487 log_warn
("'ms_bind_ipv6' is enabled but 'ms_bind_ipv4' is not disabled.\n Make sure to disable 'ms_bind_ipv4' for ipv6 only clusters, or add an ipv4 network to public/cluster network.");
489 log_pass
("'ms_bind_ipv6' is enabled and 'ms_bind_ipv4' disabled");
492 log_pass
("'ms_bind_ipv6' not enabled");
495 if (defined($global->{keyring
})) {
496 log_warn
("[global] config section contains 'keyring' option, which will prevent services from starting with Nautilus.\n Move 'keyring' option to [client] section instead.");
498 log_pass
("no 'keyring' option in [global] section found.");
502 log_warn
("Empty ceph config found");
505 my $local_ceph_ver = PVE
::Ceph
::Tools
::get_local_version
(1);
506 if (defined($local_ceph_ver)) {
507 if ($local_ceph_ver == 14) {
508 my $ceph_volume_osds = PVE
::Ceph
::Tools
::ceph_volume_list
();
509 my $scanned_osds = PVE
::Tools
::dir_glob_regex
('/etc/ceph/osd', '^.*\.json$');
510 if (-e
'/var/lib/ceph/osd/' && !defined($scanned_osds) && !(keys %$ceph_volume_osds)) {
511 log_warn
("local Ceph version is Nautilus, local OSDs detected, but no conversion from ceph-disk to ceph-volume done (yet).");
515 log_fail
("unable to determine local Ceph version.");
519 sub check_backup_retention_settings
{
520 log_info
("Checking backup retention settings..");
524 my $node_has_retention;
526 my $maxfiles_msg = "parameter 'maxfiles' is deprecated with PVE 7.x and will be removed in a " .
527 "future version, use 'prune-backups' instead.";
530 my $confdesc = PVE
::VZDump
::Common
::get_confdesc
();
532 my $fn = "/etc/vzdump.conf";
533 my $raw = PVE
::Tools
::file_get_contents
($fn);
535 my $conf_schema = { type
=> 'object', properties
=> $confdesc, };
536 my $param = PVE
::JSONSchema
::parse_config
($conf_schema, $fn, $raw);
538 if (defined($param->{maxfiles
})) {
540 log_warn
("$fn - $maxfiles_msg");
543 $node_has_retention = defined($param->{maxfiles
}) || defined($param->{'prune-backups'});
547 log_warn
("unable to parse node's VZDump configuration - $err");
550 my $storage_cfg = PVE
::Storage
::config
();
552 for my $storeid (keys $storage_cfg->{ids
}->%*) {
553 my $scfg = $storage_cfg->{ids
}->{$storeid};
555 if (defined($scfg->{maxfiles
})) {
557 log_warn
("storage '$storeid' - $maxfiles_msg");
560 next if !$scfg->{content
}->{backup
};
561 next if defined($scfg->{maxfiles
}) || defined($scfg->{'prune-backups'});
562 next if $node_has_retention;
564 log_info
("storage '$storeid' - no backup retention settings defined - by default, PVE " .
565 "7.x will no longer keep only the last backup, but all backups");
569 my $vzdump_cron = PVE
::Cluster
::cfs_read_file
('vzdump.cron');
571 # only warn once, there might be many jobs...
572 if (scalar(grep { defined($_->{maxfiles
}) } $vzdump_cron->{jobs
}->@*)) {
574 log_warn
("/etc/pve/vzdump.cron - $maxfiles_msg");
579 log_warn
("unable to parse node's VZDump configuration - $err");
582 log_pass
("no problems found.") if $pass;
585 sub check_cifs_credential_location
{
586 log_info
("checking CIFS credential location..");
588 my $regex = qr/^(.*)\.cred$/;
592 PVE
::Tools
::dir_glob_foreach
('/etc/pve/priv/', $regex, sub {
595 my ($basename) = $filename =~ $regex;
597 log_warn
("CIFS credentials '/etc/pve/priv/$filename' will be moved to " .
598 "'/etc/pve/priv/storage/$basename.pw' during the update");
603 log_pass
("no CIFS credentials at outdated location found.") if !$found;
606 sub check_custom_pool_roles
{
607 log_info
("Checking custom roles for pool permissions..");
609 my $raw = read_file
('/etc/pve/user.cfg');
612 while ($raw =~ /^\s*(.+?)\s*$/gm) {
616 foreach my $d (split (/:/, $line)) {
622 my $et = shift @data;
623 next if $et ne 'role';
625 my ($role, $privlist) = @data;
626 if (!PVE
::AccessControl
::verify_rolename
($role, 1)) {
627 warn "user config - ignore role '$role' - invalid characters in role name\n";
631 $roles->{$role} = {} if !$roles->{$role};
632 foreach my $priv (split_list
($privlist)) {
633 $roles->{$role}->{$priv} = 1;
637 foreach my $role (sort keys %{$roles}) {
638 if (PVE
::AccessControl
::role_is_special
($role)) {
642 if ($role eq "PVEPoolUser") {
643 # the user created a custom role named PVEPoolUser
644 log_fail
("Custom role '$role' has a restricted name - a built-in role 'PVEPoolUser' will be available with the upgrade");
646 log_pass
("Custom role '$role' has no restricted name");
649 my $perms = $roles->{$role};
650 if ($perms->{'Pool.Allocate'} && $perms->{'Pool.Audit'}) {
651 log_pass
("Custom role '$role' contains updated pool permissions");
652 } elsif ($perms->{'Pool.Allocate'}) {
653 log_warn
("Custom role '$role' contains permission 'Pool.Allocate' - to ensure same behavior add 'Pool.Audit' to this role");
655 log_pass
("Custom role '$role' contains no permissions that need to be updated");
661 print_header
("MISCELLANEOUS CHECKS");
662 my $ssh_config = eval { PVE
::Tools
::file_get_contents
('/root/.ssh/config') };
663 if (defined($ssh_config)) {
664 log_fail
("Unsupported SSH Cipher configured for root in /root/.ssh/config: $1")
665 if $ssh_config =~ /^Ciphers .*(blowfish|arcfour|3des).*$/m;
667 log_skip
("No SSH config file found.");
670 log_info
("Checking common daemon services..");
671 $log_systemd_unit_state->('pveproxy.service');
672 $log_systemd_unit_state->('pvedaemon.service');
673 $log_systemd_unit_state->('pvestatd.service');
675 my $root_free = PVE
::Tools
::df
('/', 10);
676 log_warn
("Less than 2G free space on root file system.")
677 if defined($root_free) && $root_free->{avail
} < 2*1024*1024*1024;
679 log_info
("Checking for running guests..");
680 my $running_guests = 0;
682 my $vms = eval { PVE
::API2
::Qemu-
>vmlist({ node
=> $nodename }) };
683 log_warn
("Failed to retrieve information about this node's VMs - $@") if $@;
684 $running_guests += grep { $_->{status
} eq 'running' } @$vms if defined($vms);
686 my $cts = eval { PVE
::API2
::LXC-
>vmlist({ node
=> $nodename }) };
687 log_warn
("Failed to retrieve information about this node's CTs - $@") if $@;
688 $running_guests += grep { $_->{status
} eq 'running' } @$cts if defined($cts);
690 if ($running_guests > 0) {
691 log_warn
("$running_guests running guest(s) detected - consider migrating or stopping them.")
693 log_pass
("no running guest detected.")
696 log_info
("Checking if the local node's hostname '$nodename' is resolvable..");
697 my $local_ip = eval { PVE
::Network
::get_ip_from_hostname
($nodename) };
699 log_warn
("Failed to resolve hostname '$nodename' to IP - $@");
701 log_info
("Checking if resolved IP is configured on local node..");
702 my $cidr = Net
::IP
::ip_is_ipv6
($local_ip) ?
"$local_ip/128" : "$local_ip/32";
703 my $configured_ips = PVE
::Network
::get_local_ip_from_cidr
($cidr);
704 my $ip_count = scalar(@$configured_ips);
706 if ($ip_count <= 0) {
707 log_fail
("Resolved node IP '$local_ip' not configured or active for '$nodename'");
708 } elsif ($ip_count > 1) {
709 log_warn
("Resolved node IP '$local_ip' active on multiple ($ip_count) interfaces!");
711 log_pass
("Resolved node IP '$local_ip' configured and active on single interface.");
715 log_info
("Check node certificate's RSA key size");
716 my $certs = PVE
::API2
::Certificates-
>info({ node
=> $nodename });
722 'id-ecPublicKey' => {
728 my $certs_check_failed = 0;
729 foreach my $cert (@$certs) {
730 my ($type, $size, $fn) = $cert->@{qw(public-key-type public-key-bits filename)};
732 if (!defined($type) || !defined($size)) {
733 log_warn
("'$fn': cannot check certificate, failed to get it's type or size!");
736 my $check = $certs_check->{$type};
737 if (!defined($check)) {
738 log_warn
("'$fn': certificate's public key type '$type' unknown, check Debian Busters release notes");
742 if ($size < $check->{minsize
}) {
743 log_fail
("'$fn', certificate's $check->{name} public key size is less than 2048 bit");
744 $certs_check_failed = 1;
746 log_pass
("Certificate '$fn' passed Debian Busters security level for TLS connections ($size >= 2048)");
750 check_backup_retention_settings
();
751 check_cifs_credential_location
();
752 check_custom_pool_roles
();
755 __PACKAGE__-
>register_method ({
759 description
=> 'Check (pre-/post-)upgrade conditions.',
761 additionalProperties
=> 0,
765 returns
=> { type
=> 'null' },
769 check_pve_packages
();
770 check_cluster_corosync
();
772 check_storage_health
();
775 print_header
("SUMMARY");
778 $total += $_ for values %$counters;
780 print "TOTAL: $total\n";
781 print colored
("PASSED: $counters->{pass}\n", 'green');
782 print "SKIPPED: $counters->{skip}\n";
783 print colored
("WARNINGS: $counters->{warn}\n", 'yellow');
784 print colored
("FAILURES: $counters->{fail}\n", 'red');
786 if ($counters->{warn} > 0 || $counters->{fail
} > 0) {
787 my $color = $counters->{fail
} > 0 ?
'red' : 'yellow';
788 print colored
("\nATTENTION: Please check the output for detailed information!\n", $color);
789 print colored
("Try to solve the problems one at a time and then run this checklist tool again.\n", $color) if $counters->{fail
} > 0;
795 our $cmddef = [ __PACKAGE__
, 'checklist', [], {}];
797 # for now drop all unknown params and just check