First you have to generate a Certificate Signing request (CSR) for *.domain.com from WHM >> SSL/TLS >> Generate a SSL Certificate and Signing Request. Make sure to enter ‘Host to make cert for:’ as *.domain.com.
Then contact your SSL provider with that CSR to purchase SSL for *.domain.com.
Once you get the certificate, login to WHM and click Install a SSL Certificate and Setup the Domain. Enter Domain as *.domain.com and user as nobody (if you get an error when you use cpanel username of your account as user).
After installing wildcard SSL successfully, you have to add the following htaccess rule in /home/user/public_html of your account domain.com, to setup SSL for sub1.domain.com & sub2.domain.com.
—
RewriteEngine On
RewriteCond %{SERVER_PORT} ^443$
RewriteCond %{HTTP_HOST} ^sub1\.domain\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/sub1/
RewriteRule ^(.*) /sub1/$1
RewriteCond %{SERVER_PORT} ^443$
RewriteCond %{HTTP_HOST} ^sub2\.domain\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/sub2/
RewriteRule ^(.*) /sub2/$1
—
Please note that document root for sub1.domain.com & sub2.domain.com are as follows respectively.
/home/user/public_html/sub1
/home/user/public_html/sub2
Hope this helps