I know that by adding/modifying the SubjectAltName entry in openssl.cnf this can be achieved, but is there a way to do so without having to modify that file every time?
How to add multiple email adresses to an SSL certificate via the command line?
openssl;ssl;certificates
You can achieve this with a single command and without editing the openssl.cnf file:openssl req -x509 \    -newkey rsa:4096 \    -sha256 \    -nodes \    -days 3650 \    -keyout smime.key \    -out smime.crt \    -subj /CN=Nobody \    -extensions SAN \    -config <(cat /etc/ssl/openssl.cnf; echo '[SAN]'; echo 'subjectAltName=email:nobody@example.com')For more information, see: Provide subjectAltName to openssl directly on command line