mirror of
https://github.com/ovh/the-bastion.git
synced 2025-10-08 20:36:23 +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'}) {
|
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'}) {
|
if ($key->{'isPiv'}) {
|
||||||
osh_info(
|
osh_info(
|
||||||
Term::ANSIColor::colored(
|
Term::ANSIColor::colored(
|
||||||
"PIV: "
|
"PIV: "
|
||||||
. "TouchPolicy="
|
. "TouchPolicy="
|
||||||
. $key->{'pivInfo'}{'Yubikey'}{'TouchPolicy'}
|
. $key->{'pivInfo'}{'Yubikey'}{'TouchPolicy'}
|
||||||
. ", PinPolicy="
|
. " PinPolicy="
|
||||||
. $key->{'pivInfo'}{'Yubikey'}{'PinPolicy'}
|
. $key->{'pivInfo'}{'Yubikey'}{'PinPolicy'}
|
||||||
. ", SerialNo="
|
. " SerialNo="
|
||||||
. $key->{'pivInfo'}{'Yubikey'}{'SerialNumber'}
|
. $key->{'pivInfo'}{'Yubikey'}{'SerialNumber'}
|
||||||
. ", Firmware="
|
. " Firmware="
|
||||||
. $key->{'pivInfo'}{'Yubikey'}{'FirmwareVersion'},
|
. $key->{'pivInfo'}{'Yubikey'}{'FirmwareVersion'},
|
||||||
'magenta'
|
'magenta'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
osh_info(
|
osh_info(
|
||||||
sprintf(
|
sprintf(
|
||||||
"%s%s (%s-%d) [%s]%s",
|
"%s%s (%s-%d) [%s]%s",
|
||||||
|
|
Loading…
Add table
Reference in a new issue