mirror of
https://github.com/ovh/the-bastion.git
synced 2025-01-10 01:15:15 +08:00
42 lines
1.1 KiB
Text
42 lines
1.1 KiB
Text
|
#! /usr/bin/env perl
|
||
|
# vim: set filetype=perl ts=4 sw=4 sts=4 et:
|
||
|
use common::sense;
|
||
|
|
||
|
use File::Basename;
|
||
|
use lib dirname(__FILE__) . '/../../../lib/perl';
|
||
|
use OVH::Result;
|
||
|
use OVH::Bastion;
|
||
|
use OVH::Bastion::Plugin qw( :DEFAULT help );
|
||
|
|
||
|
my $remainingOptions = OVH::Bastion::Plugin::begin(
|
||
|
argv => \@ARGV,
|
||
|
header => "list your egress passwords",
|
||
|
options => {},
|
||
|
helptext => <<'EOF'
|
||
|
List the hashes and metadata of the egress passwords associated to your account
|
||
|
|
||
|
Usage: --osh SCRIPT_NAME
|
||
|
|
||
|
The passwords corresponding to these hashes are only needed for devices that don't support key-based SSH
|
||
|
EOF
|
||
|
);
|
||
|
|
||
|
# code
|
||
|
my $fnret;
|
||
|
|
||
|
$fnret = OVH::Bastion::get_hashes_list(context => 'account', account => $self);
|
||
|
$fnret or osh_exit $fnret;
|
||
|
|
||
|
foreach my $item (@{$fnret->value}) {
|
||
|
osh_info $item->{'description'};
|
||
|
foreach my $hash (sort keys %{$item->{'hashes'}}) {
|
||
|
osh_info "... $hash: " . $item->{'hashes'}{$hash};
|
||
|
}
|
||
|
osh_info "\n";
|
||
|
}
|
||
|
if (not @{$fnret->value}) {
|
||
|
osh_info "You don't have any egress password configured";
|
||
|
}
|
||
|
|
||
|
osh_ok($fnret);
|