6,10 → 6,10 |
# by Franck BOUIJOUX and REXY |
# This script is distributed under the Gnu General Public License (GPL) |
|
# Script permettant |
# Script permettant |
# - d'exporter les certificats d'un serveur pour les transposer sur un autre. |
|
# This script allows |
# This script allows |
# - export certificates server to move them. |
|
|
30,19 → 30,19 |
fi |
|
|
NOW="$(date +%G%m%d-%Hh%M)" # date et heure du moment |
NOW="$(date +%G%m%d-%Hh%M)" # date et heure du moment |
FILE="certificates-$NOW" |
DIR_SAVE=$DIR_SAVE-$NOW |
|
# Function of export |
# Function of export |
function certs_export() { |
# Export of CA Certificate |
# Export of CA Certificate |
cd /root |
tar cvf $FILE.tar $DIR_PKI/CA/{alcasar-ca.crt,private/alcasar-ca.key} |
tar cvf $FILE.tar $DIR_PKI/CA/{alcasar-ca.crt,private/alcasar-ca.key} |
|
# Export of server Certificate |
tar rvf $FILE.tar $DIR_PKI/tls/{certs/alcasar.crt,private/alcasar.key,certs/server-chain.crt} |
gzip $FILE.tar |
# Export of server Certificate |
tar rvf $FILE.tar $DIR_PKI/tls/{certs/alcasar.crt,private/alcasar.key,certs/server-chain.crt} |
gzip $FILE.tar |
echo "Le ficher des certificats exportés est : $FILE.tar.gz" |
} # end function export |
|
51,16 → 51,16 |
# Sauvegarde de la pki actuelle |
[ -d $DIR_SAVE ] || mkdir $DIR_SAVE |
|
# Save of CA Certificate |
# Save of CA Certificate |
cd $DIR_PKI/CA/ |
cp alcasar-ca.crt $DIR_SAVE/. |
cp private/alcasar-ca.key $DIR_SAVE/. |
cp alcasar-ca.crt $DIR_SAVE/. |
cp private/alcasar-ca.key $DIR_SAVE/. |
|
# Save of server Certificate |
# Save of server Certificate |
cd $DIR_PKI/tls |
cp certs/alcasar.crt $DIR_SAVE/. |
cp private/alcasar.key $DIR_SAVE/. |
cp certs/server-chain.crt $DIR_SAVE/. |
cp certs/alcasar.crt $DIR_SAVE/. |
cp private/alcasar.key $DIR_SAVE/. |
cp certs/server-chain.crt $DIR_SAVE/. |
} # end function archive |
|
function import() { |
71,7 → 71,7 |
[ -d $DIR_IMPORT ] || mkdir $DIR_IMPORT |
rm -rf $DIR_IMPORT/* |
|
# Import of CA Certificate |
# Import of CA Certificate |
tar xzvf $1 --directory=$DIR_IMPORT |
echo "Import new certificates in ALCASAR !!!" |
cp -r $DIR_IMPORT/* /. |
80,9 → 80,9 |
|
# Service apache restart |
service httpd restart |
else |
echo "You are not import new certificates !!!" |
exit 0 |
else |
echo "You are not import new certificates !!!" |
exit 0 |
fi |
} # end import |
|
101,7 → 101,7 |
if [ $nb_args -eq 1 ] |
then |
echo "Il faut passer un fichier de certificat en paramètre !!!" |
exit 0 |
exit 0 |
fi |
import $2 |
;; |