mirror of
https://github.com/webmin/webmin.git
synced 2025-07-20 16:48:46 +00:00
Use ed25519 key if supported https://github.com/webmin/webmin/issues/1739
This commit is contained in:
@ -377,5 +377,16 @@ return &ui_radio($name, lc($value) eq 'yes' ? 1 :
|
||||
[ 2, $text{'default'} ] ]);
|
||||
}
|
||||
|
||||
sub get_preferred_key_type
|
||||
{
|
||||
if ($version{'type'} eq 'openssh' && $version{'number'} >= 6.5) {
|
||||
return "ed25519";
|
||||
}
|
||||
if ($version{'type'} eq 'openssh' && $version{'number'} >= 3.2) {
|
||||
return "rsa1";
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
@ -9,15 +9,14 @@ my ($uinfo) = @_;
|
||||
if ($config{'sync_create'} && &has_command($config{'keygen_path'}) &&
|
||||
-d $uinfo->{'home'} && !-d "$uinfo->{'home'}/.ssh") {
|
||||
local $cmd;
|
||||
local $type = $config{'sync_type'} ? "-t $config{'sync_type'}" :
|
||||
$version{'type'} eq 'openssh' &&
|
||||
$version{'number'} >= 3.2 ? "-t rsa1" : "";
|
||||
local $type = $config{'sync_type'} || &get_preferred_key_type();
|
||||
local $tflag = $type ? "-t $type" : "";
|
||||
if ($config{'sync_pass'} && $uinfo->{'passmode'} == 3) {
|
||||
$cmd = "$config{'keygen_path'} $type -P ".
|
||||
$cmd = "$config{'keygen_path'} $tflag -P ".
|
||||
quotemeta($uinfo->{'plainpass'});
|
||||
}
|
||||
else {
|
||||
$cmd = "$config{'keygen_path'} $type -P \"\"";
|
||||
$cmd = "$config{'keygen_path'} $tflag -P \"\"";
|
||||
}
|
||||
&system_logged("echo '' | ".&command_as_user($uinfo->{'user'}, 0, $cmd).
|
||||
" >/dev/null 2>&1");
|
||||
|
Reference in New Issue
Block a user