change default encoding for ssh key generation

master
Kebler Network System Administrator 2023-02-07 12:38:40 -08:00
parent 8e83daa3a5
commit 49e3312319
1 changed files with 5 additions and 5 deletions

View File

@ -29,7 +29,7 @@ ssh_dir_permissions() {
sshkeygen () {
local OPTION; local OPTARG; local OPTIND; local pem
local encode="-t ecdsa"; local pass
local encode; local pass
while getopts 'pr' OPTION; do
# echo $OPTION $OPTARG
case "$OPTION" in
@ -37,8 +37,8 @@ sshkeygen () {
p)
pem="-m PEM"
;;
r)
encode="-t rsa"
e)
encode="-t ecdsa -b 521"
;;
*)
echo unknown sshkeygen option $OPTION
@ -50,8 +50,8 @@ sshkeygen () {
[[ ! $1 ]] && echo must supply a private key name && return 1
[[ $2 ]] && pass="-P $2" || echo warning, you are creating an unencrypted key without a passphrase
ssh-keygen -f $1 $encode -b 521 -C $1 $pass $pem
# defualt is rsa 1024
ssh-keygen -f $1 $encode -C $1 $pass $pem
}