2 if [ ! -e /etc/ssl/certs/imapd.pem ]; then
3 generate_certificate imapd
5 if [ ! -e /etc/ssl/certs/ipop3d.pem ]; then
6 generate_certificate ipop3d
14 generate_certificate() {
16 echo -n "Generating $t certificate..."
20 PEM1="$tmpdir/$t.pem1"
21 PEM2="$tmpdir/$t.pem2"
23 /usr/bin/openssl req -newkey rsa:4096 -keyout "$PEM1" \
24 -nodes -x509 -days 365 -out "$PEM2" >/dev/null 2>&1 << EOF
29 SomeOrganizationalUnit
31 root@localhost.localdomain
36 cat "$PEM2" >> "$cert"
37 install -Dm 600 "$cert" -t /etc/ssl/certs