libreoffice-online/loolwsd-generate-proof-key
Andras Timar 25bc0a1088 Proof: add loolwsd-generate-proof-key helper script
Change-Id: Ibbd99b6431b1a2992c520d3fad5f52d0770905f6
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92788
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
2020-04-23 19:36:06 +02:00

32 lines
781 B
Bash
Executable file

#!/bin/bash
SUDO=''
if (( $EUID != 0 )); then
if hash sudo 2>/dev/null; then
SUDO='sudo'
else
"Run the script as root."
exit 1
fi
fi
if [ -f /etc/loolwsd/proof_key ]; then
echo "/etc/loolwsd/proof_key exists already."
exit 0
fi
if hash ssh-keygen 2>/dev/null; then
$SUDO ssh-keygen -t rsa -N "" -m PEM -f /etc/loolwsd/proof_key
if [ $? -ne 0 ] ; then
exit $?
fi
if id -u lool >/dev/null 2>&1; then
$SUDO chown lool: /etc/loolwsd/proof_key
else
echo "User lool does not exist. Please reinstall loolwsd package, or in case of manual installation from source, create the lool user manually."
fi
else
echo "ssh-keygen command not found. Please install openssh client tools."
exit 127
fi