How to import ssl wildcard all domain & subdomain

vpscanban

Verified User
Joined
Feb 9, 2022
Messages
40
Hello.

I already have a wildcard ssl certificate for the domain. However in DirectAdmin I am creating subdomain as addon and there are more than 300 subs adding as addon. I cannot import SSL for each domain because it will take a lot of time. How can I import wildcard ssl certificate for all sub. Please support me.

Thank all.

iScreen Shoter - Microsoft Edge - 230808185300.png
 
However in DirectAdmin I am creating subdomain as addon
What do you mean "as addon". You mean you create subdomains als seperate domains?

If yes, enable auto-ssl then they will automatically get new certificates.

Check if it's enabled (on new installes it is enabled if I'm not mistaken).
 
Can you share which workaround you found? Might be interestingn to others wanting the same thing, maybe now or in the future.
 
DirectAdmin I have 300+ subdomains added as addon.

I bought wildcard ssl so I need a way to import SSL for those 300 subs.

If you add it manually, you need to import each subdomain.

I wrote a script to change all files *.domain.key, *.domain.cacert, *.domain.cert, *.domain.cert.combined in
/usr/local/directadmin/data/users/web/domains/

Below is my script, if you take a look, you will surely understand my request
Can you share which workaround you found? Might be interestingn to others wanting the same thing, maybe now or in the future.

#!/bin/bash

# Location File *.domain.com.key, *.domain.com.cacert, *.domain.com.cert, *.domain.com.cert.combined
source_dir="/usr/local/directadmin/data/users/web/domains/"

# Folder file SSL ssl.key, ssl.cacert, ssl.cert và ssl.cert.combined
ssl_dir="/root/"

# file SSL
ssl_key="ssl.key"
ssl_cacert="ssl.cacert"
ssl_cert="ssl.cert"
ssl_cert_combined="ssl.cert.combined"

# Browse through each file type in the folder and perform the task
for file_type in "key" "cacert" "cert" "cert.combined"; do
for webx_file in "$source_dir"*."$file_type"; do
if [ -e "$webx_file" ]; then
# Empty content of file *.domain.com.file_type
> "$webx_file"

# Copy the contents of ssl.file_type into the file *.domain.com.file_type
cat "$ssl_dir$ssl_$file_type" > "$webx_file"

echo "import content ssl.$file_type vào $webx_file"
fi
done
done

echo "Complete the SSL certificate import process file *.domain.com.key, *.domain.com.cacert, *.domain.com.cert, *.domain.com.cert.combined"
 
Back
Top