summaryrefslogtreecommitdiff
path: root/setup-webconf
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2008-03-05 10:23:58 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2008-03-05 10:23:58 +0000
commit38d09cee90e522744c7f1e792d3d6ce0e01d5756 (patch)
treee262cbc4c0e3780a5f280f9828984ba92b8126eb /setup-webconf
parent83faad7a14e0f5ef33248d0fd667a7fc1d4448a7 (diff)
downloadalpine-conf-38d09cee90e522744c7f1e792d3d6ce0e01d5756.zip
do not ask for user info when setting up self signed cert
Diffstat (limited to 'setup-webconf')
-rw-r--r--setup-webconf21
1 files changed, 20 insertions, 1 deletions
diff --git a/setup-webconf b/setup-webconf
index e4f13f7..20aa5d0 100644
--- a/setup-webconf
+++ b/setup-webconf
@@ -56,6 +56,7 @@ ln -s /usr/share/acf/www/ /var/www/localhost/htdocs
SSLDIR=/etc/ssl/mini_httpd
+SSLCNF=$SSLDIR/mini_httpd.cnf
KEYFILE=$SSLDIR/server.key
CRTFILE=$SSLDIR/server.crt
PEMFILE=$SSLDIR/server.pem
@@ -63,9 +64,27 @@ PEMFILE=$SSLDIR/server.pem
if [ -f $PEMFILE ]; then
echo "$PEMFILE already exist."
else
+ mkdir -p $SSLDIR
+cat <<EOF >$SSLCNF
+[ req ]
+default_bits = 1024
+encrypt_key = yes
+distinguished_name = req_dn
+x509_extensions = cert_type
+prompt = no
+
+[ req_dn ]
+OU=HTTPS server
+CN=$(hostname -f)
+emailAddress=postmaster@example.com
+
+[ cert_type ]
+nsCertType = server
+EOF
echo "Generating certificates for HTTPS..."
openssl genrsa 2048 > $KEYFILE
- openssl req -new -x509 -nodes -sha1 -days 3650 -key $KEYFILE > $CRTFILE
+ openssl req -new -x509 -nodes -sha1 -days 3650 -key $KEYFILE \
+ -config $SSLCNF > $CRTFILE
cat $KEYFILE >> $CRTFILE
rm $KEYFILE
mv $CRTFILE $PEMFILE