IMPORTANT: the Common Name (CN) of the servers should be different from that of the CA. Otherwise, things won't work on servers that use OpenSSL.
openssl genpkey -algorithm ed25519 > ca-key.pem
openssl req -x509 -new -sha512 -days 365250 -subj '/CN=ca' -key ca-key.pem -out ca-cert.pem
openssl genpkey -algorithm ed25519 > server-key.pem
openssl req -new -sha512 -subj '/CN=server' -key server-key.pem -out server-csr.pem
openssl x509 -days 365250 -req -in server-csr.pem -CA ca-cert.pem -CAkey ca-key.pem -CAcreateserial -out server-cert.pem
For setting the SAN of the server,
add this option to the last command (openssl x509 ...
):
-extfile <(printf "subjectAltName=my.san.com")
For adding an IP SAN:
-extfile <(printf "subjectAltName=IP:1.2.3.4")
openssl verify -verbose -CAfile ca-cert.pem server-cert.pem