summarylogtreecommitdiffstats
path: root/omikeygen
blob: 2535ee7662f34d5e1a88a555bcb297cd24953dff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

set -e

certsdir=/etc/opt/omi/ssl
keyfile=$certsdir/omikey.pem
certfile=$certsdir/omi.pem

echo "Generating OMI certificates"

openssl req -x509 -sha256 -newkey rsa:2048 -days 3650 -nodes -config - -keyout "$keyfile" -out "$certfile" <<EOF
[ req ]
distinguished_name     = req_distinguished_name
prompt                 = no
[ req_distinguished_name ]
CN                     = hostname
CN                     = longhostname
EOF

chmod 600 "$keyfile"
chmod 644 "$certfile"

chown omi:omi "$keyfile" "$certfile"