From Whipped Wigeon, 5 Years ago, written in Bash.
This paste is a reply to Re: Re: Re: Re: Re: Re: Re: Re: Re: save-certifica from Lousy Hamster - go back
Embed
#!/bin/bash
echo "Certificate name (e.g. connexeon.com-2017): "
read CERT_NAME
cd ~/ssl/$CERT_NAME
echo "Certificate (press Ctrl+D when done): " && cat > "$CERT_NAME.cer"
echo "Root Certificate (press Ctrl+D when done): " && cat > "$CERT_NAME-CA.cer"
echo "Intermediate Certificate (press Ctrl+D when done): " && cat >> "$CERT_NAME-CA.cer"
openssl pkcs12 -export -in "$CERT_NAME.cer" -inkey "$CERT_NAME.private.key" -out "$CERT_NAME.pfx" -certfile "$CERT_NAME-CA.cer"
read -p "Nextcloud Username: " USER
read -s -p "Nextcloud Password: " PWD
curl -u $USER:$PWD -X MKCOL "https://c.connexeon.com/remote.php/dav/files/$USER/$CERT_NAME"
for i in $CERT_NAME/* in ./* ; do
  curl -u $USER:$PWD -T "${i##*/}" "https://c.connexeon.com/remote.php/dav/files/$USER/$CERT_NAME/${i##*/}"
done;
echo "Certificate uploaded to: https://c.connexeon.com/remote.php/dav/files/$USER/$CERT_NAME"