mirror of
https://github.com/ovh/the-bastion.git
synced 2025-09-29 08:14:56 +08:00
enh: print_public_key: better formatter
This commit is contained in:
parent
6ccb43e938
commit
c89dd82d26
1 changed files with 27 additions and 4 deletions
|
@ -760,24 +760,47 @@ sub print_public_key {
|
|||
}
|
||||
|
||||
if ($key->{'info'}) {
|
||||
osh_info(Term::ANSIColor::colored("info: " . $key->{'info'}, 'cyan'));
|
||||
my $info = $key->{'info'};
|
||||
|
||||
# parse data from 'info' and print it nicely
|
||||
my ($name) = $info =~ m{NAME="([^"]+)};
|
||||
osh_info(Term::ANSIColor::colored("name: " . $name, 'cyan'));
|
||||
|
||||
my ($by) = $info =~ m{ADDED_BY=(\S+)};
|
||||
my ($when) = $info =~ m{DATETIME=(\S+)};
|
||||
my ($version) = $info =~ m{VERSION=(\S+)};
|
||||
my ($session) = $info =~ m{UNIQID=(\S+)};
|
||||
osh_info(
|
||||
Term::ANSIColor::colored(
|
||||
sprintf(
|
||||
"info: added by %s at %s in session %s running v%s",
|
||||
$by || '(?)',
|
||||
$when || '(?)',
|
||||
$session || '(?)',
|
||||
$version || '(?)'
|
||||
),
|
||||
'cyan'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ($key->{'isPiv'}) {
|
||||
osh_info(
|
||||
Term::ANSIColor::colored(
|
||||
"PIV: "
|
||||
. "TouchPolicy="
|
||||
. $key->{'pivInfo'}{'Yubikey'}{'TouchPolicy'}
|
||||
. ", PinPolicy="
|
||||
. " PinPolicy="
|
||||
. $key->{'pivInfo'}{'Yubikey'}{'PinPolicy'}
|
||||
. ", SerialNo="
|
||||
. " SerialNo="
|
||||
. $key->{'pivInfo'}{'Yubikey'}{'SerialNumber'}
|
||||
. ", Firmware="
|
||||
. " Firmware="
|
||||
. $key->{'pivInfo'}{'Yubikey'}{'FirmwareVersion'},
|
||||
'magenta'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
osh_info(
|
||||
sprintf(
|
||||
"%s%s (%s-%d) [%s]%s",
|
||||
|
|
Loading…
Add table
Reference in a new issue