aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--NEWS4
-rwxr-xr-xcreate-ssl-certificate22
-rw-r--r--rpm-helper.macros.in2
4 files changed, 23 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 7402a6b..c635a51 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
PACKAGE = rpm-helper
-VERSION = 0.19
+VERSION = 0.19.1
SVNPATH = svn+ssh://svn.mandriva.com/svn/soft/rpm/$(PACKAGE)
SCRIPT_FILES = add-user del-user add-service del-service create-file \
diff --git a/NEWS b/NEWS
index 00a28fc..635f58f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+2007-08-17 Guillaume Rousse <guillomovitch@mandriva.org> 0.19.1
+ * fix usage of ssl certificate creation helper without 3rd argument
+ * allow local certificate configuration
+
2007-06-29 Guillaume Rousse <guillomovitch@mandriva.org> 0.19.0
* new ssl certificate creation helper
* renamed ChangeLog to NEWS
diff --git a/create-ssl-certificate b/create-ssl-certificate
index 595a439..784d0e4 100755
--- a/create-ssl-certificate
+++ b/create-ssl-certificate
@@ -14,7 +14,19 @@ bundle=$4 # bundle mode
group=$5 # group with read access on key
if [ $num = 1 ]; then
+ # default values
host=$(hostname)
+ KEY_LENGTH=1024
+ CERT_DAYS=365
+ EMAIL_ADDRESS=root@$host
+ COMMON_NAME=$host
+ ORGANISATIONAL_UNIT_NAME="default $srv cert for $host"
+
+ # source configuration
+ if [ -f /etc/sysconfig/ssl ]; then
+ . /etc/sysconfig/ssl
+ fi
+
conffile=/tmp/$$
keyfile=/etc/pki/tls/private/$pkg.pem
if [ "$bundle" == true ]; then
@@ -25,23 +37,23 @@ if [ $num = 1 ]; then
# create a temporary configuration file
cat > $conffile <<EOF
-default_bits = 1024
+default_bits = $KEY_LENGTH
encrypt_key = no
prompt = no
distinguished_name = req_dn
req_extensions = req_ext
[ req_dn ]
-commonName = $host
-organizationalUnitName = default $srv cert for $host
-emailAddress = root@$host
+commonName = $COMMON_NAME
+organizationalUnitName = $ORGANISATIONAL_UNIT_NAME
+emailAddress = $EMAIL_ADDRESS
[ req_ext ]
basicConstraints = CA:FALSE
EOF
# generate certificates
- openssl req -new -x509 -days 365 \
+ openssl req -new -x509 -days $CERT_DAYS \
-config $conffile \
-keyout $keyfile \
-out $certfile >/dev/null 2>&1
diff --git a/rpm-helper.macros.in b/rpm-helper.macros.in
index fe53b1a..0204544 100644
--- a/rpm-helper.macros.in
+++ b/rpm-helper.macros.in
@@ -13,7 +13,7 @@
%{nil}
%_create_ssl_certificate_helper %_rpm_helper_dir/create-ssl-certificate
-%create_ssl_certificate() %_create_ssl_certificate_helper %{name} $1 %{1} %{2} %{3} \
+%create_ssl_certificate() %_create_ssl_certificate_helper %{name} $1 %{1} %{2} %{?3} \
%{nil}
# initscripts macros