source: bin/generate_certificate.sh

Last change on this file was 115, checked in by george, 15 years ago
  • Upraveno: Různé systémové shellové skripty.
  • Property svn:executable set to *
File size: 989 bytes
Line 
1#!/bin/sh
2
3cd /etc/pki/tls/certs
4
5SERVER=centrala.zdechov.net
6PRIVATE_KEY=$SERVER.key
7CERTIFICATE_FILE=$SERVER.crt
8VALID_DAYS=365
9
10cd /etc/pki/tls/certs
11echo Delete old private key
12rm $PRIVATE_KEY
13echo Create new private/public-keys without passphrase for server
14openssl genrsa -out $PRIVATE_KEY 1024
15cp /etc/pki/tls/certs/$PRIVATE_KEY /etc/pki/tls/private/$PRIVATE_KEY
16
17echo Create selfsigned certificate
18rm $CERTIFICATE_FILE
19# From man req:
20# -x509
21# this option outputs a self signed certificate instead
22# of a certificate request. This is typically used to
23# generate a test certificate or a self signed root CA.
24# The extensions added to the certificate (if any) are
25# specified in the configuration file.
26
27cd /etc/pki/tls/certs
28openssl req -new -days $VALID_DAYS -key $PRIVATE_KEY -x509 -out $CERTIFICATE_FILE
29
30echo private-keyfile is $PRIVATE_KEY
31echo server-certificate-file is $CERTIFICATE_FILE
32
33ls -l $PRIVATE_KEY $CERTIFICATE_FILE
Note: See TracBrowser for help on using the repository browser.