Skip to content

Commit

Permalink
Merge pull request #4 from grazzolini/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
grazzolini authored Aug 15, 2016
2 parents b5f4109 + 4a9adad commit d6b584c
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion tinyssh_install
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,37 @@ display_fingerprints() {
generate_keys() {
if [ ! -d /etc/tinyssh/sshkeydir ]; then
tinysshd-makekey /etc/tinyssh/sshkeydir
if [ $? -eq 0 ]; then
echo "Generated tinyssh keys..."
return 0
fi
fi
return 1
}

copy_openssh_keys() {
local osshed25519="/etc/ssh/ssh_host_ed25519_key"

local destdir="/etc/tinyssh/sshkeydir"

local return_code=1

if [ ! -d $destdir -a -x /usr/bin/tinyssh-convert ]; then
mkdir $destdir
fi

if [ -s "$osshed25519" -a ! -s $destdir/.ed25519.sk -a ! -s $destdir/ed25519.pk -a -x /usr/bin/tinyssh-convert ]; then
tinyssh-convert -f $osshed25519 -d $destdir
if [ $? -eq 0 ]; then
return_code=0
fi
fi

if [ $return_code -eq 0 ]; then
echo "Converted keys from OpenSSH..."
fi

return $return_code
}

create_systemd_customdep () {
Expand Down Expand Up @@ -41,7 +71,7 @@ build ()

umask 0022

generate_keys
copy_openssh_keys || generate_keys
display_fingerprints

#systemd enabled
Expand Down

0 comments on commit d6b584c

Please sign in to comment.