DKIM for all domains except which have one

Richard G

Verified User
Joined
Jul 6, 2008
Messages
14,311
Location
Maastricht
Hello.
I want to create DKIM records for all domains which do not have one yet.
And in this help section, I found this line:
Code:
echo "action=rewrite&value=dkim" >> /usr/local/directadmin/data/task.queue

So this looks fine, I just want to be sure it will only generate records on domains which do not have a dkim record yet, to prevent double DKIM TXT records in DNS.

Does it work this way? Or will this command create a DKIM record even if one is already present?
 
I just remembered I had a cancelled VPS (but not yet removed) from a friend of mine where I had access to and which already had a DKIM record.
Tested there, nothing wrong happened, so probably the dkim is either left alone or is overwritten.
No double entry's.

So I tested on our live VPS, no problem either. Doing the servers now. Also no double entry's.

So I've answered my own question, there will be no double entry's. :)

You can use that command too.
 
I just tested, too and it appears that existing DKIM records are not overwritten, either. :) This is good to know for those that use a remote DNS server and would have had to update the DKIM there if the records had been overwritten.
 
Hi, does this work in 2025? I have to enable DKIM in all the accounts from one server and it´s very slow to do it manually account per account.
It would be a great feature an option to "enable dkim in all domains"
 
It worked!! :)

I recommend to execute this in the terminal

Bash:
sudo ls /etc/virtual/
sudo bash -c 'for domain in $(ls /etc/virtual/); do
    if [ ! -f "/etc/virtual/$domain/dkim.public.key" ]; then
        echo "$domain NO tiene DKIM"
    else
        echo "$domain YA tiene DKIM"
    fi
done'



and then


Bash:
#!/bin/bash
for domain in $(ls /etc/virtual/); do
    if [ ! -f "/etc/virtual/$domain/dkim.public.key" ]; then
        echo "Habilitando DKIM para $domain"
        echo "action=rewrite&value=dkim&domain=$domain" >> /usr/local/directadmin/data/task.queue
    else
        echo "Saltando $domain (ya tiene DKIM)"
    fi
done

# Procesar la cola
/usr/local/directadmin/dataskq d
 
Back
Top