Commit 3bbd6d59 authored by Marco Marinello's avatar Marco Marinello

Limit key check string

Signed-off-by: Marco Marinello's avatarMarco Marinello <mmarinello@sezf.it>
parent 63d48e7f
......@@ -31,7 +31,7 @@ fi
# Check if the SSH key already exists, if so check if is in authorized-keys
if [ -e $clonezillaFolder/.ssh/id_rsa.pub ] ; then
if ! grep $(cat $clonezillaFolder/.ssh/id_rsa.pub) /root/.ssh/authorized_keys 2>&1 > /dev/null ; then
if ! grep $(cat $clonezillaFolder/.ssh/id_rsa.pub|cut -d ' ' -f 2) /root/.ssh/authorized_keys 2>&1 > /dev/null ; then
echo 'command="if [[ \"$SSH_ORIGINAL_COMMAND\" =~ ^scp[[:space:]]-f ]] || [[ \"$SSH_ORIGINAL_COMMAND\" =~ ^add_client_principal ]] || [[ \"$SSH_ORIGINAL_COMMAND\" =~ rm[[:space:]]/root/ ]]; then $SSH_ORIGINAL_COMMAND; else echo \"Access Denied $SSH_ORIGINAL_COMMAND\"; fi"' $(cat $clonezillaFolder/.ssh/id_rsa.pub) >> /root/.ssh/authorized_keys
fi
else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment