From 7eeccb7c5db7c14cd6e166b5e430be77423e6805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lesimple?= Date: Mon, 15 Feb 2021 11:15:21 +0000 Subject: [PATCH] enh: groupInfo: nicer message when no egress key exists --- bin/helper/osh-groupModify | 4 ++-- bin/plugin/open/groupInfo | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/helper/osh-groupModify b/bin/helper/osh-groupModify index 7667707..fe873d0 100755 --- a/bin/helper/osh-groupModify +++ b/bin/helper/osh-groupModify @@ -59,7 +59,7 @@ if (!$mfaRequired && !defined $ttl) { #
PARAMS:ACCOUNT +#>PARAMS:GROUP $fnret = OVH::Bastion::is_valid_group_and_existing(group => $group, groupType => "key"); $fnret or HEXIT($fnret); @@ -67,7 +67,7 @@ $fnret or HEXIT($fnret); $group = $fnret->value->{'group'}; my $shortGroup = $fnret->value->{'shortGroup'}; -#RIGHTSCHECK if ($self eq 'root') { diff --git a/bin/plugin/open/groupInfo b/bin/plugin/open/groupInfo index 0e2773b..b2bf8f0 100755 --- a/bin/plugin/open/groupInfo +++ b/bin/plugin/open/groupInfo @@ -185,7 +185,10 @@ if ($fnret) { $fnret = OVH::Bastion::get_group_keys(group => $group); if ($fnret and $from) { osh_info ' '; - if (@{$fnret->value->{'sortedKeys'}} == 1) { + if ($fnret->value && !@{$fnret->value->{'sortedKeys'}}) { + osh_info "This group has no SSH egress key, the owner may use groupGenerateEgressKey to generate one."; + } + elsif (@{$fnret->value->{'sortedKeys'}} == 1) { osh_info "The public key of this group is:"; } else {