public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: Stoiko Ivanov <s.ivanov@proxmox.com>, pmg-devel@lists.proxmox.com
Subject: Re: [pmg-devel] [PATCH pmg-api 2/2] pmg7to8: add check for deprecated default entries in ruledb
Date: Mon, 17 Feb 2025 14:26:42 +0100	[thread overview]
Message-ID: <8c507270-8e86-4a71-bff3-5989b94997fe@proxmox.com> (raw)
In-Reply-To: <20250130123350.50043-3-s.ivanov@proxmox.com>

On 1/30/25 13:33, Stoiko Ivanov wrote:
> with a new section for future checks of the rule database.
> 
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
>   src/PMG/CLI/pmg7to8.pm | 19 +++++++++++++++++++
>   1 file changed, 19 insertions(+)
> 
> diff --git a/src/PMG/CLI/pmg7to8.pm b/src/PMG/CLI/pmg7to8.pm
> index d0a6cbe..4e11b6b 100644
> --- a/src/PMG/CLI/pmg7to8.pm
> +++ b/src/PMG/CLI/pmg7to8.pm
> @@ -13,6 +13,7 @@ use PMG::API2::APT;
>   use PMG::API2::Certificates;
>   use PMG::API2::Cluster;
>   use PMG::RESTEnvironment;
> +use PMG::RuleDB;
>   use PMG::Utils;
>   
>   use Term::ANSIColor;
> @@ -526,6 +527,23 @@ sub check_dkms_modules {
>       }
>   }
>   
> +sub check_ruledb {
> +    log_info("Check the rulesystem...");
> +
> +    my $rdb = PMG::RuleDB->new();
> +    my $ogroups = $rdb->load_objectgroups("who");
> +    for my $who ($ogroups->@*) {
> +	my $group_name = $who->{name};
> +	next if ($group_name ne 'Blacklist' && $group_name ne 'Whitelist');
> +	my $objects = $rdb->load_group_objects($who->{id});
> +	for my $obj ($objects->@*) {
> +	    log_warn("deprecated default entry in '$group_name' present: $obj->{address}")
> +		if ($obj->{address} =~ m/(?:no)?mail\@fromthisdomain.com/);

I'd like here an additional sentence to the user what can be done, e.g. 'consider removing the rule'
or something like that. When having such a migration/upgrade tool, we should always
provide instructions on what to do when something is off.

> +	}
> +    }
> +    return;
> +}
> +
>   sub check_misc {
>       print_header("MISCELLANEOUS CHECKS");
>       my $ssh_config = eval { PVE::Tools::file_get_contents('/root/.ssh/config') };
> @@ -637,6 +655,7 @@ __PACKAGE__->register_method ({
>       code => sub {
>   	my ($param) = @_;
>   
> +	check_ruledb();
>   	check_pmg_packages();
>   	check_cluster_status();
>   	my $upgraded_db = check_running_postgres();



_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel


      reply	other threads:[~2025-02-17 13:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-30 12:33 [pmg-devel] [PATCH pmg-api 0/2] change sample-entries in default Who-Objects and check in pmg7to8 Stoiko Ivanov
2025-01-30 12:33 ` [pmg-devel] [PATCH pmg-api 1/2] fix #5972: ruledb: default ruleset: use .example as TLD Stoiko Ivanov
2025-01-30 12:33 ` [pmg-devel] [PATCH pmg-api 2/2] pmg7to8: add check for deprecated default entries in ruledb Stoiko Ivanov
2025-02-17 13:26   ` Dominik Csapak [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8c507270-8e86-4a71-bff3-5989b94997fe@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pmg-devel@lists.proxmox.com \
    --cc=s.ivanov@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal