diff options
author | davidovski <david@davidovski.xyz> | 2023-02-02 14:10:02 +0000 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2023-02-02 14:10:02 +0000 |
commit | f29d569cd33a73da5ad675f43a34ad53c5cc9bc6 (patch) | |
tree | 76fe6267f8307e7630fc6f53ff99a9767ad40de0 /skip/apache2/apache2-ssl.post-install | |
parent | 05d004dfe0c9a9d898fac8a4a0292ca2a74ca391 (diff) |
Work
Diffstat (limited to 'skip/apache2/apache2-ssl.post-install')
-rw-r--r-- | skip/apache2/apache2-ssl.post-install | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/skip/apache2/apache2-ssl.post-install b/skip/apache2/apache2-ssl.post-install new file mode 100644 index 0000000..1e8478a --- /dev/null +++ b/skip/apache2/apache2-ssl.post-install @@ -0,0 +1,30 @@ +#!/bin/sh + +ssldir=/etc/ssl/apache2 +sslkey=$ssldir/server.key +sslcert=$ssldir/server.pem + +umask 077 + +[ -f $sslkey ] || openssl genrsa 2048 > $sslkey 2>/dev/null + +FQDN=`hostname -f` +if [ "x${FQDN}" = "x" ]; then + FQDN=localhost.localdomain +fi + +if [ ! -f ${sslcert} ] ; then +cat << EOF | openssl req -new -key ${sslkey} \ + -x509 -days 365 -set_serial $RANDOM \ + -out ${sslcert} 2>/dev/null +-- +SomeState +SomeCity +SomeOrganization +SomeOrganizationalUnit +${FQDN} +root@${FQDN} +EOF +fi + + |