Browse code

tls: name the certificates based on $MAIN_NAME (cherry picked from commit 6ecc6c13f63dab04083f61aa1b7ee767f9441ee0)

Daniel-Constantin Mierla authored on 11/12/2009 22:07:27 • Juha Heinanen committed on 13/12/2009 07:09:54
Showing 2 changed files
... ...
@@ -23,6 +23,6 @@ include ../../Makefile.modules
23 23
 
24 24
 
25 25
 install-tls-cert: $(cfg_prefix)/$(cfg_dir)
26
-	./$(SCR_NAME)_cert.sh -d $(cfg_prefix)/$(cfg_dir)
26
+	MAIN_NAME=$(MAIN_NAME) ./$(SCR_NAME)_cert.sh -d $(cfg_prefix)/$(cfg_dir)
27 27
 
28 28
 install-cfg:  install-tls-cert
... ...
@@ -3,18 +3,20 @@
3 3
 # $Id$
4 4
 #
5 5
 # This script generates a self-signed TLS/SSL certificate that can be
6
-# immediately used with the TLS module of SER. The file was inspired
6
+# immediately used with the TLS module of SIP Router. The file was inspired
7 7
 # by a script from Debian's uw-imapd package.
8 8
 #
9 9
 
10 10
 #############################################################################
11 11
 # Configuration variables
12 12
 #############################################################################
13
-DEFAULT_DIR="/usr/local/etc/ser"
13
+NAME=$MAIN_NAME
14
+if [ -z "$NAME" ] ; then NAME="sip-router"; fi;
15
+DEFAULT_DIR="/usr/local/etc/$NAME"
14 16
 DEFAULT_DAYS=365
15
-DEFAULT_INFO="Self-signed certificate for SER"
16
-DEFAULT_CERT_FILENAME="ser-selfsigned.pem"
17
-DEFAULT_KEY_FILENAME="ser-selfsigned.key"
17
+DEFAULT_INFO="Self-signed certificate for $NAME"
18
+DEFAULT_CERT_FILENAME="$NAME-selfsigned.pem"
19
+DEFAULT_KEY_FILENAME="$NAME-selfsigned.key"
18 20
 
19 21
 DEFAULT_OPENSSL='openssl'
20 22
 
... ...
@@ -50,19 +52,19 @@ longopts() {
50 52
 usage() {
51 53
 cat <<EOF
52 54
 NAME
53
-  $COMMAND - Generate a self-signed TLS/SSL certificate for use with SER.
55
+  $COMMAND - Generate a self-signed TLS/SSL certificate for use with $NAME.
54 56
 
55 57
 SYNOPSIS
56 58
   $COMMAND [options]
57 59
 
58 60
 DESCRIPTION
59 61
   This is a simple shell script that generates a self signed TLS/SSL
60
-  certificate (and private key) for use with the tls module of SER. The
62
+  certificate (and private key) for use with the tls module of $NAME. The
61 63
   self-signed certificate is suitable for testing and/or private setups.
62 64
   You are encouraged to create a proper authorized one if needed.
63 65
 
64 66
   Both certificate and key files are by default stored in the directory
65
-  containing the configuration file of SER (unless you change it using
67
+  containing the configuration file of $NAME (unless you change it using
66 68
   the options below).
67 69
 
68 70
 OPTIONS
... ...
@@ -100,7 +102,7 @@ AUTHOR
100 102
   Written by Jan Janak <jan@iptel.org>
101 103
 
102 104
 REPORTING BUGS
103
-  Report bugs to <ser-bugs@iptel.org>
105
+  Report bugs to <sr-dev@sip-router.org>
104 106
 EOF
105 107
 } #usage
106 108
 
... ...
@@ -175,7 +177,7 @@ if [ $? != 0 ] ; then
175 177
 	exit 1
176 178
 fi
177 179
 
178
-echo "Creating a new SER self-signed certificate for '$FQDN'" \
180
+echo "Creating a new $NAME self-signed certificate for '$FQDN'" \
179 181
      "valid for $DAYS days."
180 182
 openssl req -new -x509 -days "$DAYS" -nodes -out "$DIR/$CERT_FILENAME" \
181 183
         -keyout "$DIR/$KEY_FILENAME" > /dev/null 2>&1 <<+