[ssl_mgmt] Change pattern delimiter: s/#/@/

This commit is contained in:
Thomas Preud'homme 2014-03-09 16:08:41 +08:00
parent 0eeeab14fc
commit e428424cf0
2 changed files with 17 additions and 17 deletions

View File

@ -14,7 +14,7 @@ database = $dir/index.txt
new_certs_dir = $dir/newcerts new_certs_dir = $dir/newcerts
certificate = $dir/certs/ca-cert.pem certificate = $dir/certs/ca-cert.pem
private_key = $dir/private/ca-key.pem private_key = $dir/private/ca-key.pem
default_days = #LENGTH# # Certificates are signed for default_days days default_days = @LENGTH@ # Certificates are signed for default_days days
default_md = md5 default_md = md5
preserve = no preserve = no
email_in_dn = no email_in_dn = no
@ -48,12 +48,12 @@ req_extensions = v3_req
x509_extensions = v3_ca x509_extensions = v3_ca
[ req_distinguished_name ] [ req_distinguished_name ]
organizationName = #ORG# organizationName = @ORG@
organizationalUnitName = #ORGUNIT# organizationalUnitName = @ORGUNIT@
localityName = #LOCALITY# localityName = @LOCALITY@
stateOrProvinceName = #STATE# stateOrProvinceName = @STATE@
countryName = #COUNTRY# countryName = @COUNTRY@
commonName = #COMMONNAME# commonName = @COMMONNAME@
[ v3_ca ] [ v3_ca ]
basicConstraints = CA:TRUE basicConstraints = CA:TRUE
@ -63,4 +63,4 @@ authorityKeyIdentifier = keyid:always,issuer:always
[ v3_req ] [ v3_req ]
basicConstraints = CA:FALSE basicConstraints = CA:FALSE
subjectKeyIdentifier = hash subjectKeyIdentifier = hash
subjectAltName = #ALTNAME# subjectAltName = @ALTNAME@

View File

@ -172,14 +172,14 @@ generate_config ()
{ {
local - replaceCmd cnfTmpFile local - replaceCmd cnfTmpFile
replaceCmd="$(add_to_replace_cmd "${replaceCmd:-}" "#LENGTH#" "${days:-}")" replaceCmd="$(add_to_replace_cmd "${replaceCmd:-}" "@LENGTH@" "${days:-}")"
replaceCmd="$(add_to_replace_cmd "$replaceCmd" "#ORG#" "${organization:-}")" replaceCmd="$(add_to_replace_cmd "$replaceCmd" "@ORG@" "${organization:-}")"
replaceCmd="$(add_to_replace_cmd "$replaceCmd" "#ORGUNIT#" "${unit:-}")" replaceCmd="$(add_to_replace_cmd "$replaceCmd" "@ORGUNIT@" "${unit:-}")"
replaceCmd="$(add_to_replace_cmd "$replaceCmd" "#LOCALITY#" "${city:-}")" replaceCmd="$(add_to_replace_cmd "$replaceCmd" "@LOCALITY@" "${city:-}")"
replaceCmd="$(add_to_replace_cmd "$replaceCmd" "#STATE#" "${state:-}")" replaceCmd="$(add_to_replace_cmd "$replaceCmd" "@STATE@" "${state:-}")"
replaceCmd="$(add_to_replace_cmd "$replaceCmd" "#COUNTRY#" "${country:-}")" replaceCmd="$(add_to_replace_cmd "$replaceCmd" "@COUNTRY@" "${country:-}")"
replaceCmd="$(add_to_replace_cmd "$replaceCmd" "#COMMONNAME#" "${commonName:-}")" replaceCmd="$(add_to_replace_cmd "$replaceCmd" "@COMMONNAME@" "${commonName:-}")"
replaceCmd="$(add_to_replace_cmd "$replaceCmd" "#ALTNAME#" "${altName:-}")" replaceCmd="$(add_to_replace_cmd "$replaceCmd" "@ALTNAME@" "${altName:-}")"
sed "$replaceCmd" $confFile.in > $confFile sed "$replaceCmd" $confFile.in > $confFile
if ask_user_default_no "Do you want to edit the openssl configuration file?" if ask_user_default_no "Do you want to edit the openssl configuration file?"
then then
@ -192,7 +192,7 @@ generate_config ()
fi fi
cnfTmpFile="$(mktemp --tmpdir=. openssl.cnf.XXXXXXXXXX)" cnfTmpFile="$(mktemp --tmpdir=. openssl.cnf.XXXXXXXXXX)"
mv $confFile $cnfTmpFile mv $confFile $cnfTmpFile
grep -v "#[A-Z]\+#" $cnfTmpFile > $confFile grep -v "@[A-Z]\+@" $cnfTmpFile > $confFile
rm $cnfTmpFile rm $cnfTmpFile
} }