the-bastion/bin/plugin/restricted/accountMFAResetPassword
Stéphane Lesimple fde20136ef
Initial commit
2020-10-20 14:30:27 +00:00

44 lines
1.2 KiB
Perl
Executable file

#! /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 => "remove the UNIX password of an account (MFA)",
options => {
"account=s" => \my $account,
},
helptext => <<'EOF'
Remove the UNIX password of an account
Usage: --osh SCRIPT_NAME --account ACCOUNT
--account ACCOUNT Specify which account you want to remove the UNIX password of
Note that if doesn't remove the account UNIX password requirement, if set (see ``accountModify`` for this)
EOF
);
my $fnret;
if (not $account) {
help();
osh_exit 'ERR_MISSING_PARAMETER', "Expected an --account argument";
}
$fnret = OVH::Bastion::is_bastion_account_valid_and_existing(account => $account);
$fnret or osh_exit $fnret;
$account = $fnret->value->{'account'};
my @command = qw{ sudo -n -u root -- /usr/bin/env perl -T };
push @command, $OVH::Bastion::BASEPATH . '/bin/helper/osh-accountMFAResetPassword';
push @command, "--account", $account;
osh_exit(OVH::Bastion::helper(cmd => \@command));