ed25519-Support

This commit is contained in:
Bandie 2020-05-24 20:27:22 +02:00
parent 8856ba9cf4
commit 116ff5eba0
Signed by: Bandie
GPG Key ID: 843D7FA93BA46312
2 changed files with 44 additions and 20 deletions

View File

@ -1,2 +0,0 @@
#!/bin/sh
ssh -i /root/.ssh/id_rsa_gitlab_deploy $1 $2

View File

@ -2,7 +2,6 @@
set -e set -e
export PATH="/usr/bin:/bin:/usr/sbin:/sbin" export PATH="/usr/bin:/bin:/usr/sbin:/sbin"
export GIT_SSH="/usr/sbin/foodoor-ssh-wrapper"
dest=/var/run/foodoor-keys dest=/var/run/foodoor-keys
@ -24,16 +23,43 @@ do
do do
ssh-keygen -l -f ${keyfile} &> /dev/null ssh-keygen -l -f ${keyfile} &> /dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
key_length=`ssh-keygen -l -f ${keyfile} | cut -d" " -f1` valid=false
keyinfo=$(ssh-keygen -l -f ${keyfile}) # The whole key information
crypto=$(echo "${keyinfo}" | cut -d" " -f4) # Looks like "(RSA)" or "(ED25519)"
key_length=$(echo "${keyinfo}" | cut -d" " -f1)
if [ "${crypto}" == "(RSA)" ]; then
if [ ${key_length} -lt 4096 ]; then if [ ${key_length} -lt 4096 ]; then
echo "Key size of key ${keyfile} not equal to 4096. Not adding it to key database." >&2 echo "Key size of key ${keyfile} not equal to 4096. Not adding it to key database." >&2
continue continue
else
valid=true
fi fi
elif [ "${crypto}" == "(ED25519)" ]; then
valid=true
fi fi
if [ "$valid" = true ]; then
printf "command=\"/usr/sbin/foodoor ${action}\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding " >> ${outfile} printf "command=\"/usr/sbin/foodoor ${action}\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding " >> ${outfile}
cat "${keyfile}" >> ${outfile} cat "${keyfile}" >> ${outfile}
echo >> ${outfile} echo >> ${outfile}
fi
fi
done done
# Oben
install -d -o ${action} -g nogroup -m 0700 /var/lib/foodoor/${action}/.ssh install -d -o ${action} -g nogroup -m 0700 /var/lib/foodoor/${action}/.ssh
install -b -S .last -o ${action} -g nogroup -m 0600 ${outfile} /var/lib/foodoor/${action}/.ssh/authorized_keys install -b -S .last -o ${action} -g nogroup -m 0600 ${outfile} /var/lib/foodoor/${action}/.ssh/authorized_keys
# Unten
#if [ "${action}" = "open" ]; then
# owner="unlock"
#elif [ "${action}" = "close" ]; then
# owner="lock"
#fi
#install -d -o ${owner} -g nogroup -m 0700 /var/lib/foodoor/${action}/.ssh
#install -b -S .last -o ${owner} -g nogroup -m 0600 ${outfile} /var/lib/foodoor/${action}/.ssh/authorized_keys
done done