Subversion Repositories ALCASAR

Rev

Rev 2260 | Rev 2295 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2260 Rev 2261
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
#
2
#
3
# $Id: alcasar-importcert.sh 2260 2017-05-29 19:46:00Z tom.houdayer $
3
# $Id: alcasar-importcert.sh 2261 2017-05-29 20:04:37Z tom.houdayer $
4
#
4
#
5
# alcasar-importcert.sh
5
# alcasar-importcert.sh
6
# by Raphaël, Hugo, Clément, Bettyna & rexy
6
# by Raphaël, Hugo, Clément, Bettyna & rexy
7
#
7
#
8
# This script is distributed under the Gnu General Public License (GPL)
8
# This script is distributed under the Gnu General Public License (GPL)
Line 155... Line 155...
155
		then
155
		then
156
			echo "Certificate and/or private key not found"
156
			echo "Certificate and/or private key not found"
157
			exit 1
157
			exit 1
158
		fi
158
		fi
159
 
159
 
160
		if [ ${cert: -4} != ".crt" ]
160
		if [ ${cert: -4} != ".crt" ] && [ ${cert: -4} != ".cer" ]
161
		then
161
		then
162
			echo "Invalid certificate file"
162
			echo "Invalid certificate file"
163
			exit 1
163
			exit 1
164
		fi
164
		fi
165
 
165
 
Line 167... Line 167...
167
		then
167
		then
168
			echo "Invalid private key"
168
			echo "Invalid private key"
169
			exit 1
169
			exit 1
170
		fi
170
		fi
171
 
171
 
172
		if [ "$arg5" != "-c" ] || [ ! -f "$sc" ]
172
		if [ "$arg5" != "-c" ] || [ -z "$sc" ]
173
		then
173
		then
174
			echo "No server-chain given"
174
			echo "No server-chain given"
175
			echo "Importing certificate $cert with private key $key"
175
			echo "Importing certificate $cert with private key $key"
176
			sc=""
176
			sc=""
177
		else
177
		else
-
 
178
			if [ ! -f "$sc" ]
-
 
179
			then
-
 
180
				echo "Server-chain certificate not found"
-
 
181
				exit 1
-
 
182
			fi
-
 
183
			if [ ${sc: -4} != ".crt" ] && [ ${sc: -4} != ".cer" ]
-
 
184
			then
-
 
185
				echo "Invalid server-chain certificate file"
-
 
186
				exit 1
-
 
187
			fi
178
			echo "Importing certificate $cert with private key $key and server-chain $sc"
188
			echo "Importing certificate $cert with private key $key and server-chain $sc"
179
		fi
189
		fi
180
		domainName $cert
190
		domainName $cert
181
		certImport $cert $key $sc
191
		certImport $cert $key $sc
182
		for services in chilli dnsmasq dnsmasq-blackhole dnsmasq-blacklist dnsmasq-whitelist httpd
192
		for services in chilli dnsmasq dnsmasq-blackhole dnsmasq-blacklist dnsmasq-whitelist httpd