Commit 0e9f28e7 authored by Eric's avatar Eric

script de double cryptage des logs

parent dacd5a2d
#!/bin/bash
#double chiffrement du fichier log passé en paramètre ...
#root a certifie les cles de destination
LOG=${1}
TEMPNAME=`tempfile`
rm -f ${TEMPNAME}
if [ -f "${LOG}" -a ! -z "${LOG}" ]; then
echo "on essaye de chiffrer ${LOG} ..." >/dev/stderr
gpg --sign --encrypt --batch -a -r admin-crypto-01@sud-ouest2.org -o ${TEMPNAME} ${LOG}
if [ $? == 0 ]; then
gpg --sign --encrypt --batch -r admin-crypto-02@sud-ouest2.org ${TEMPNAME}
if [ $? == 0 ]; then
mv "${TEMPNAME}" "${LOG}.gpg"
echo "Le fichier est pret : ${LOG}.gpg" >/dev/stderr
else
echo "Erreur lors de la 2° passe" >/dev/stderr
fi
else
echo "Erreur lors de la 1ere passe" >/dev/stderr
fi
else
#echo "No file passed ad first arg, trying stdin" >/dev/stderr
gpg --sign --encrypt --batch -a -r admin-crypto-01@sud-ouest2.org -o ${TEMPNAME} -
if [ $? == 0 ]; then
gpg --sign --encrypt --batch -r admin-crypto-02@sud-ouest2.org -o - ${TEMPNAME}
if [ $? == 0 ]; then
#echo "Le fichier est pret : stdout" >/dev/stderr
true
else
echo "Erreur lors de la 2° passe" >/dev/stderr
exit -1
fi
else
echo "Erreur lors de la 1ere passe" >/dev/stderr
exit -1
fi
fi
rm -f ${TEMPNAME}
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