Skip to content

Commit 12c8373

Browse files
committed
NEW Add script to have all custom cert beeing a link to speific cert
1 parent 5ce8c86 commit 12c8373

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

scripts/make_instances_offlineonline.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export YELLOW='\033[0;33m'
1616
echo "***** $0 *****"
1717

1818
if [ "x$2" == "x" ]; then
19+
echo "Script to make all instances offline or back online."
1920
echo "Usage: $0 urlwhenoffline test|offline|online"
2021
echo
2122
echo "Example: $0 offline.php test"
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/bin/bash
2+
#---------------------------------------------------------
3+
# Relink local certificates found to link to specific files
4+
#---------------------------------------------------------
5+
6+
source /etc/lsb-release
7+
8+
export RED='\033[0;31m'
9+
export GREEN='\033[0;32m'
10+
export BLUE='\033[0;34m'
11+
export YELLOW='\033[0;33m'
12+
13+
14+
echo "***** $0 *****"
15+
16+
if [ "x$2" == "x" ]; then
17+
echo "Relink local certificates found into /home/admin/wwwroot/dolibarr_documents/sellyoursaas_local/crt to link to specific cert files"
18+
echo
19+
echo "Usage: $0 root_of_cert_to_link_to regex_of_files_to_replace test|confirm"
20+
echo "Example: $0 /etc/apache2/all.with.dolicloud.com xxx.dolicloud.com test|confirm"
21+
echo
22+
exit 1
23+
fi
24+
25+
if [ "x$3" != "xtest" -a "x$3" != "xconfirm" ]; then
26+
echo "Parameter 3 must be test|confirm"
27+
exit 2
28+
fi
29+
30+
# possibility to change the ssl certificates name
31+
export webSSLCertificateCRT=`grep '^websslcertificatecrt=' /etc/sellyoursaas.conf | cut -d '=' -f 2`
32+
if [[ "x$webSSLCertificateCRT" == "x" ]]; then
33+
export webSSLCertificateCRT=with.sellyoursaas.com.crt
34+
fi
35+
export webSSLCertificateKEY=`grep '^websslcertificatekey=' /etc/sellyoursaas.conf | cut -d '=' -f 2`
36+
if [[ "x$webSSLCertificateKEY" == "x" ]]; then
37+
export webSSLCertificateKEY=with.sellyoursaas.com.key
38+
fi
39+
export webSSLCertificateIntermediate=`grep '^websslcertificateintermediate=' /etc/sellyoursaas.conf | cut -d '=' -f 2`
40+
if [[ "x$webSSLCertificateIntermediate" == "x" ]]; then
41+
export webSSLCertificateIntermediate=with.sellyoursaas.com-intermediate.crt
42+
fi
43+
export domainmyaccount=`grep '^domain=' /etc/sellyoursaas.conf | cut -d '=' -f 2`
44+
45+
export urlwhenoffline=$1
46+
if [[ $urlwhenoffline != http* ]]; then
47+
export urlwhenoffline="https://myaccount.$domainmyaccount/$1"
48+
fi
49+
50+
51+
export scriptdir=$(dirname $(realpath ${0}))
52+
53+
echo "Search local cert files to relink with: ls /home/admin/wwwroot/dolibarr_documents/sellyoursaas_local/crt/*.key | grep $2"
54+
for fic in `ls /home/admin/wwwroot/dolibarr_documents/sellyoursaas_local/crt/*.key | grep $2`
55+
do
56+
newfic="${fic%.key}"
57+
echo "* Process file $newfic..."
58+
echo "ln -fs $1.key $newfic.key"
59+
echo "ln -fs $1.crt $newfic.crt"
60+
echo "ln -fs $1-intermediate.crt $newfic-intermediate.crt"
61+
if [ "x$3" == "xconfirm" ]; then
62+
ln -fs $1.key $newfic.key
63+
ln -fs $1.crt $newfic.crt
64+
ln -fs $1-intermediate.crt $newfic-intermediate.crt
65+
else
66+
echo "Test mode: nothing done"
67+
fi
68+
done
69+
70+
echo "Finished."

0 commit comments

Comments
 (0)