🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #89380

Re: INN 2.7.0 rc1 - pgpverify issue - CentOS 7

#89380
From: Julien ÉLIE
Date: Thu, 26 May 2022 19:47
138 lines
7287 bytes
Hi Russ,

>> gpg seems to check its arguments in order, and it exits with status 2 if
>> an argument is not supported.  Why not just run:
> 
>>      gpg --allow-weak-digest-algos --version
> 
>> If the option is supported, gpg displays several lines and exits
>> gracefully.  Otherwise, it raises an error:
> 
>> gpg: Invalid option "--allow-weak-digest-algos"
>> zsh: exit 2     gpg --allow-weak-digest-algos --version
> 
> Thanks, yes, that was exactly the kind of thing I was hoping for but was
> too groggy from travel to think through.
> 
> I wonder if we could do something like that in configure and pass down
> something to pgpverify via INN::Config to tell it whether or not to add
> that flag.  This will probably only be needed temporarily, but it looks
> like we have at least one user who is going to run into that version
> bound, so there will probably be more.

Would the following changes correspond to what you had in mind?
(the patch is not complete, but has the main logic)

I'll bump the version number of pgpverify to 1.31 if that's OK for you.



--- a/configure.ac
+++ b/configure.ac
@@ -441,7 +441,9 @@
  
  dnl Look for PGP 5.0's pgpv, then pgp, then pgpgpg (not sure why anyone would
  dnl have pgpgpg and not gpgv, but it doesn't hurt).  Separately look for
-dnl GnuPG (which we prefer).
+dnl GnuPG (which we prefer) and whether it supports a flag introduced in
+dnl GnuPG 2.0.23 to allow weak hash algorithms like MD5 in old PGP keys still
+dnl used to sign control articles.
  DO_PGPVERIFY=true
  AC_ARG_VAR([GPGV], [Location of GnuPG gpgv program])
  AC_ARG_VAR([GPG], [Location of GnuPG gpg program])
@@ -454,6 +456,16 @@
  AC_SUBST([DO_PGPVERIFY])
  
+GPG_HAS_ALLOW_WEAK_DIGEST_ALGOS_FLAG=0
+AS_IF([test x"$GPG" != x],
+    [AC_MSG_CHECKING([if GnuPG recognizes the --allow-weak-digest-algos flag])
+     AS_IF(["$GPG" --allow-weak-digest-algos --version >/dev/null 2>&1],
+         [GPG_HAS_ALLOW_WEAK_DIGEST_ALGOS_FLAG=1
+          AC_MSG_RESULT([yes])],
+         [AC_MSG_RESULT([no])])])
+AC_SUBST([GPG_HAS_ALLOW_WEAK_DIGEST_ALGOS_FLAG])
+
+
  dnl Look for a program that takes an ftp URL as a command line argument and
  dnl retrieves the file to the current directory.  Shame we can't also use
  dnl lynx -source; it only writes to stdout.  ncftp as of version 3 doesn't


--- a/control/pgpverify.in
+++ b/control/pgpverify.in
@@ -143,8 +143,15 @@
  # and the script is able to successfully include your INN::Config module,
  # the value of $INN::Config::gpg will override this.  On a recent Debian
  # variant, use /usr/bin/gpg1 (from the gnupg1 package) if you want to
-# support old signatures with MD5 digest algorithms.
+# support old signatures with MD5 digest algorithms.  Or you may want to use
+# a more recent version of GnuPG (2.0.23+), in which case a special flag must
+# be added when running gpg; you then have to set the value of
+# $gpg_has_allow_weak_digest_algos_flag to 1 if --allow-weak-digest-algos is
+# supported, and 0 otherwise.  If your INN::Config module has been included,
+# the value of $INN::Config::gpg_has_allow_weak_digest_algos_flag will override
+# this.
  # $gpg = '/usr/local/bin/gpg';
+# $gpg_has_allow_weak_digest_algos_flag = 0;
  
  # Path to the GnuPG gpgv binary, if you have GnuPG.  If you do, this will
  # be used in preference to PGP.  For most current control messages, you
@@ -220,7 +227,7 @@ $log_date = -t STDOUT; # Do it if STDOUT is to a terminal.
  require 5;
  
  use strict;
-use vars qw($gpg $gpgv $pgp $keyring $tmp $tmpdir $lockdir $syslog_method
-            $syslog_facility $syslog_level $log_date $findid $test $messageid);
+use vars qw($gpg $gpg_has_allow_weak_digest_algos_flag $gpgv $pgp $keyring
+            $tmp $tmpdir $lockdir $syslog_method $syslog_facility $syslog_level
+            $log_date $findid $test $messageid);
  
  use Fcntl qw(O_WRONLY O_CREAT O_EXCL);
@@ -243,6 +250,7 @@ $pgp = $INN::Config::pgp
      if $INN::Config::pgp && $INN::Config::pgp ne "no-pgp-found-during-configure";
  $gpgv = $INN::Config::gpgv if $INN::Config::gpgv;
  $gpg = $INN::Config::gpg if $INN::Config::gpg;
+$gpg_has_allow_weak_digest_algos_flag
+  = $INN::Config::gpg_has_allow_weak_digest_algos_flag
+    if $INN::Config::gpg_has_allow_weak_digest_algos_flag;
  $tmp = ($INN::Config::pathtmp ? $INN::Config::pathtmp : $tmpdir) . "/pgp$$";
  $lockdir = $INN::Config::locks if $INN::Config::locks;
  $syslog_facility = $INN::Config::syslog_facility if $INN::Config::syslog_facility;
@@ -462,7 +470,10 @@ sub pgp_verify {
    my @command;
    if ($pgpstyle eq 'GPG') {
      if ($gpg) {
-      @command = ($gpg, qw/--verify --allow-weak-digest-algos/);
+      @command = ($gpg, qw/--verify/);
+      if ($gpg_has_allow_weak_digest_algos_flag) {
+        push (@command, qw/--allow-weak-digest-algos/);
+      }
        push (@command, qw/--quiet --status-fd=1 --logger-fd=1/);
      } else {
        @command = ($gpgv, qw/--quiet --status-fd=1 --logger-fd=1/);





--- a/perl/INN/Config.pm.in
+++ b/perl/INN/Config.pm.in
@@ -146,8 +146,9 @@ our $syslog_facility = lc('@SYSLOG_FACILITY@');
  $syslog_facility =~ s/log_//;
  
  ##  Set up some useful parameters.
-my @PARAMVAR = qw($do_dbz_tagged_hash);
+my @PARAMVAR = qw($do_dbz_tagged_hash $gpg_has_allow_weak_digest_algos_flag);
  our $do_dbz_tagged_hash = '@DO_DBZ_TAGGED_HASH@';
+our $gpg_has_allow_weak_digest_algos_flag
+  = @GPG_HAS_ALLOW_WEAK_DIGEST_ALGOS_FLAG@;
  
  ##  Set up some environment values.
  if ($ovmethod && $ovmethod eq "ovdb") {



-- 
Julien ÉLIE

« Il n'y a que le premier pas qui coûte. » (Mme du Deffand)
Technical Details
Message-ID: <t6olgq$1gv2v$1@news.trigofacile.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
References: <t6jf6o$1i26$1@bwh01.blueworldhosting.com> <87zgj5xukm.fsf@hope.eyrie.org> <t6mj2a$coi$1@bwh01.blueworldhosting.com> <87ee0hxg87.fsf@hope.eyrie.org> <87a6b5xfv7.fsf@hope.eyrie.org> <t6mkfu$fsu$1@bwh01.blueworldhosting.com> <875yltxexv.fsf@hope.eyrie.org> <t6nhlc$1fm8c$1@news.trigofacile.com> <87v8tsgwzd.fsf@hope.eyrie.org>

Show Full Headers
Complete Article Headers
Message-ID: <t6olgq$1gv2v$1@news.trigofacile.com>
Subject: Re: INN 2.7.0 rc1 - pgpverify issue - CentOS 7
Date: Thu, 26 May 2022 21:47:38 +0200
From: Julien ÉLIE <iulius@nom-de-mon-site.com.invalid>
References: <t6jf6o$1i26$1@bwh01.blueworldhosting.com> <87zgj5xukm.fsf@hope.eyrie.org> <t6mj2a$coi$1@bwh01.blueworldhosting.com> <87ee0hxg87.fsf@hope.eyrie.org> <87a6b5xfv7.fsf@hope.eyrie.org> <t6mkfu$fsu$1@bwh01.blueworldhosting.com> <875yltxexv.fsf@hope.eyrie.org> <t6nhlc$1fm8c$1@news.trigofacile.com> <87v8tsgwzd.fsf@hope.eyrie.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
Newsgroups: news.software.nntp
Organization: Groupes francophones par TrigoFACILE
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 26 May 2022 19:47:38 -0000 (UTC)
Injection-Info: news.trigofacile.com; posting-account="julien"; posting-host="san13-h02-176-143-2-105.dsl.sta.abo.bbox.fr:176.143.2.105"; logging-data="1604703"; mail-complaints-to="abuse@trigofacile.com"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.9.1
Cancel-Lock: sha1:oF32VOxb5yTcO0aLzZ3s63H/gfI= sha256:QIDuSZMJ7IJuZLai+lesQ+psJ0Uns/kblEdNQC+YscM= sha1:C5UiguiYHkRhEUXP+W4xODRrn08= sha256:y3AtAsYepaSqG2OqK2/6b+xpBMDGDvpN8FDAP/J7McY=
In-Reply-To: <87v8tsgwzd.fsf@hope.eyrie.org>