public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pmg-devel] [PATCH pmg-api] cluster: fingerprint parsing: adapt to changed openssl output
@ 2023-07-24 11:06 Stoiko Ivanov
  2023-07-24 13:08 ` [pmg-devel] applied: " Fabian Grünbichler
  0 siblings, 1 reply; 2+ messages in thread
From: Stoiko Ivanov @ 2023-07-24 11:06 UTC (permalink / raw)
  To: pmg-devel

currently updating the fingerprints using `pmgcm update-fingerprints`
runs into an error indicating that parsing of the remote node's
fingerprint fails

The error is due to changed output in openssl's x509 command,
introduced in commit:
91034b68b39e3525f09fb263b9272de410a3ba4c
in openssl upstream [0]

Note that in that case it would equally work to change the parameter
from `-sha256` to `-SHA256` in the `openssl x509` command above

The change seems small enough to warrant pulling it into stable-7 as
well (although the issue should not occur in systems upgraded
according to our howtos).

[0] https://github.com/openssl/openssl/commit/91034b68b39e3525f09fb263b9272de410a3ba4c

Reported-by: Martin Maurer <martin@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
quickly tested on a cluster of mine.
 src/PMG/Cluster.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PMG/Cluster.pm b/src/PMG/Cluster.pm
index e9a6054..c431521 100644
--- a/src/PMG/Cluster.pm
+++ b/src/PMG/Cluster.pm
@@ -307,7 +307,7 @@ sub get_remote_cert_fingerprint {
     eval {
 	PVE::Tools::run_command($ssh_cmd, outfunc => sub {
 	    my ($line) = @_;
-	    if ($line =~ m/SHA256 Fingerprint=((?:[A-Fa-f0-9]{2}:){31}[A-Fa-f0-9]{2})/) {
+	    if ($line =~ m/SHA256 Fingerprint=((?:[A-Fa-f0-9]{2}:){31}[A-Fa-f0-9]{2})/i) {
 		$fp = $1;
 	    }
 	});
-- 
2.39.2





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pmg-devel] applied: [PATCH pmg-api] cluster: fingerprint parsing: adapt to changed openssl output
  2023-07-24 11:06 [pmg-devel] [PATCH pmg-api] cluster: fingerprint parsing: adapt to changed openssl output Stoiko Ivanov
@ 2023-07-24 13:08 ` Fabian Grünbichler
  0 siblings, 0 replies; 2+ messages in thread
From: Fabian Grünbichler @ 2023-07-24 13:08 UTC (permalink / raw)
  To: pmg-devel, Stoiko Ivanov

could be made more robust by wrapping "read_local_ssl_cert_fingerprint"
somewhere callable via SSH (so that we have a single way of doing file
path -> cert -> fingerprint) but this serves as a stop-gap measure.

I wonder whether we should lower-case the cache (key) in
PVE::APIClient::LWP, to reduce a potentially confusing source of errors?
some tools use aa:bb:.. , some other use AA:BB:.. for fingerprints, but
they are semantically equivalent..

folded in shortening the RE, now that it's case-insensitive anyway we
don't need to match both A-F and a-f ;)

On July 24, 2023 1:06 pm, Stoiko Ivanov wrote:
> currently updating the fingerprints using `pmgcm update-fingerprints`
> runs into an error indicating that parsing of the remote node's
> fingerprint fails
> 
> The error is due to changed output in openssl's x509 command,
> introduced in commit:
> 91034b68b39e3525f09fb263b9272de410a3ba4c
> in openssl upstream [0]
> 
> Note that in that case it would equally work to change the parameter
> from `-sha256` to `-SHA256` in the `openssl x509` command above
> 
> The change seems small enough to warrant pulling it into stable-7 as
> well (although the issue should not occur in systems upgraded
> according to our howtos).
> 
> [0] https://github.com/openssl/openssl/commit/91034b68b39e3525f09fb263b9272de410a3ba4c
> 
> Reported-by: Martin Maurer <martin@proxmox.com>
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
> quickly tested on a cluster of mine.
>  src/PMG/Cluster.pm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/PMG/Cluster.pm b/src/PMG/Cluster.pm
> index e9a6054..c431521 100644
> --- a/src/PMG/Cluster.pm
> +++ b/src/PMG/Cluster.pm
> @@ -307,7 +307,7 @@ sub get_remote_cert_fingerprint {
>      eval {
>  	PVE::Tools::run_command($ssh_cmd, outfunc => sub {
>  	    my ($line) = @_;
> -	    if ($line =~ m/SHA256 Fingerprint=((?:[A-Fa-f0-9]{2}:){31}[A-Fa-f0-9]{2})/) {
> +	    if ($line =~ m/SHA256 Fingerprint=((?:[A-Fa-f0-9]{2}:){31}[A-Fa-f0-9]{2})/i) {
>  		$fp = $1;
>  	    }
>  	});
> -- 
> 2.39.2
> 
> 
> 
> _______________________________________________
> pmg-devel mailing list
> pmg-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel
> 
> 
> 




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-24 13:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-24 11:06 [pmg-devel] [PATCH pmg-api] cluster: fingerprint parsing: adapt to changed openssl output Stoiko Ivanov
2023-07-24 13:08 ` [pmg-devel] applied: " Fabian Grünbichler

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