mirror of
https://github.com/webmin/webmin.git
synced 2025-07-25 15:09:18 +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'} ] ]);
|
[ 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;
|
1;
|
||||||
|
|
||||||
|
@ -9,15 +9,14 @@ my ($uinfo) = @_;
|
|||||||
if ($config{'sync_create'} && &has_command($config{'keygen_path'}) &&
|
if ($config{'sync_create'} && &has_command($config{'keygen_path'}) &&
|
||||||
-d $uinfo->{'home'} && !-d "$uinfo->{'home'}/.ssh") {
|
-d $uinfo->{'home'} && !-d "$uinfo->{'home'}/.ssh") {
|
||||||
local $cmd;
|
local $cmd;
|
||||||
local $type = $config{'sync_type'} ? "-t $config{'sync_type'}" :
|
local $type = $config{'sync_type'} || &get_preferred_key_type();
|
||||||
$version{'type'} eq 'openssh' &&
|
local $tflag = $type ? "-t $type" : "";
|
||||||
$version{'number'} >= 3.2 ? "-t rsa1" : "";
|
|
||||||
if ($config{'sync_pass'} && $uinfo->{'passmode'} == 3) {
|
if ($config{'sync_pass'} && $uinfo->{'passmode'} == 3) {
|
||||||
$cmd = "$config{'keygen_path'} $type -P ".
|
$cmd = "$config{'keygen_path'} $tflag -P ".
|
||||||
quotemeta($uinfo->{'plainpass'});
|
quotemeta($uinfo->{'plainpass'});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$cmd = "$config{'keygen_path'} $type -P \"\"";
|
$cmd = "$config{'keygen_path'} $tflag -P \"\"";
|
||||||
}
|
}
|
||||||
&system_logged("echo '' | ".&command_as_user($uinfo->{'user'}, 0, $cmd).
|
&system_logged("echo '' | ".&command_as_user($uinfo->{'user'}, 0, $cmd).
|
||||||
" >/dev/null 2>&1");
|
" >/dev/null 2>&1");
|
||||||
|
Reference in New Issue
Block a user