Most CA's will issue either a MultiDomain SSL or a single Wildcard cert.
So you would need (2) Certs to cover those 3 domains.
1) example.com, www.example.com
2) app.example.com, *.app.example.com
staging.app.example.com is covered by *.app.example.com but user.staging.app.example.com is not.
I've suggested using - hyphens instead in some cases, such as user-staging.app.example.com
I say most, as you can request these from Digicert and some others.
Cert 1 Generation with OpenSSL)
openssl req -new -newkey rsa:2048 -nodes -sha256 -keyout example.com.key -subj "/C=US/ST=Virginia/O=Company Name/OU=Web Security/CN=example.com" -config <(
cat <<-EOF
[req]
default_bits = 2048
default_md = sha256
req_extensions = req_ext
distinguished_name = dn
[ dn ]
[ req_ext ]
subjectAltName = @alt_names
[alt_names]
DNS.1 = example.com
DNS.2 = www.example.com
EOF
)
Cert 2 Generation with OpenSSL)
openssl req -new -newkey rsa:2048 -nodes -sha256 -keyout example.com.key -subj "/C=US/ST=Virginia/O=Company Name/OU=Web Security/CN=example.com" -config <(
cat <<-EOF
[req]
default_bits = 2048
default_md = sha256
req_extensions = req_ext
distinguished_name = dn
[ dn ]
[ req_ext ]
subjectAltName = @alt_names
[alt_names]
DNS.1 = app.example.com
DNS.2 = *.app.example.com
EOF
)
*.app.example.comto be dynamic such as username. And with this scenario, I won't be able to register a cert for each one of them. What do you think I should do? – senty Dec 06 '17 at 23:57*.app.example.comin the certificate, instead I registered as*.example.com, so it only worked onapp.example.combut not staging. Is that right? But if so, how aboutexample.com? – senty Dec 07 '17 at 00:01example.comis not covered by*.example.comhowever MANY CAs will add that SAN – Jacob Evans Dec 07 '17 at 00:04*.app.example.com,example.com, and*.staging.app.example.com. Is that right? – senty Dec 07 '17 at 00:05