diff options
author | Guillaume Rousse <guillomovitch@mandriva.org> | 2007-08-16 22:52:24 +0000 |
---|---|---|
committer | Guillaume Rousse <guillomovitch@mandriva.org> | 2007-08-16 22:52:24 +0000 |
commit | c8be34886c11347fa4482a14687a4d7f89cc5ef4 (patch) | |
tree | 8b26f416cf4cad02673eace449a276b5b531cf80 /create-ssl-certificate | |
parent | ec52d4271b05a4251758e642f73f42c9960cecf1 (diff) | |
download | rpm-helper-c8be34886c11347fa4482a14687a4d7f89cc5ef4.tar rpm-helper-c8be34886c11347fa4482a14687a4d7f89cc5ef4.tar.gz rpm-helper-c8be34886c11347fa4482a14687a4d7f89cc5ef4.tar.bz2 rpm-helper-c8be34886c11347fa4482a14687a4d7f89cc5ef4.tar.xz rpm-helper-c8be34886c11347fa4482a14687a4d7f89cc5ef4.zip |
allow local configuration
Diffstat (limited to 'create-ssl-certificate')
-rwxr-xr-x | create-ssl-certificate | 22 |
1 files changed, 17 insertions, 5 deletions
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 |