#!/usr/bin/perl print "Creating 2048 Bit Key for the CA: \n"; $cmd = `openssl genrsa -des3 -out ca.key 2048`; print "\n"; print "\n"; print "Creating self signed Certificate of your CA: \n"; $cmd = `openssl req -new -x509 -days 3652 -key ca.key -out ca.crt`; print "\n"; print "\n"; print "Create a 2048 Bit Key for your domain: \n"; $cmd = `openssl genrsa -out pop3d.key 2048`; print "\n"; print "\n"; print "Create a Certificate for your domain: \n"; $cmd = `openssl req -new -key pop3d.key -out pop3d.csr`; print "\n"; print "\n"; print "Sign the domain Certificate by your CA: \n"; $cmd = `./sign.sh pop3d.csr`; print "\n"; print "\n"; print "Modifying pop3d.crt and creating pop3d.pem: \n"; open CRT, "pop3d.crt" or die "Unable to open pop3d.crt! $!\n"; @crt = ; close CRT; open KEY, "pop3d.key" or die "Unable to open pop3d.key: $!\n"; @key = ; close KEY; open PEM, ">pop3d.pem" or die "Can't open pop3d.pem: $!\n"; foreach (@key) { print PEM $_; } $notcert = 1; foreach (@crt) { if (/BEGIN CERTIFICATE/) { $notcert = 0; } next if ($notcert); print PEM $_; } close PEM; print "Add Diffie-Helmann Code Block:"; $cmd = `openssl gendh >> pop3d.pem`; $cmd = `cp pop3d.pem /usr/lib/courier-imap/share/`; $cmd = `chmod 0600 /usr/lib/courier-imap/share/pop3d.pem`;