# we need to untaint it, as it's going to be passed as an arg to the array version of system(),
# it can contain anything, really, there is no shell escape possible (see generate_ssh_key in ssh.inc)
($passphrase) = $passphrase =~ /^(.+)$/;
}
my $keykeeper_uid = (getpwnam('keykeeper'))[2];
my $group_gid = (getgrnam($group))[2];
if (!$keykeeper_uid || !$group_gid) {
warn_syslog("Couldn't get the uid of keykeeper ($keykeeper_uid) or gid of $group ($group_gid) while $self is attempting to generate a new key with algo $algo and size $size");
HEXIT('ERR_INTERNAL', msg => "Couldn't fetch the required account or group IDs");
}
osh_info "Generating a new key pair, this might take a while...";
$fnret = OVH::Bastion::generate_ssh_key(
folder => $keyhome,
prefix => $shortGroup,
algo => $algo,
size => $size,
passphrase => $passphrase,
uid => $keykeeper_uid,
gid => $group_gid,
group_readable => 1,
);
$fnret or HEXIT($fnret);
my $filepath = $fnret->value->{'file'};
my $mtime = (stat($filepath))[9];
osh_info "The new key pair has been generated:\n";
$fnret = OVH::Bastion::get_ssh_pub_key_info(file => $filepath . ".pub", way => "egress");