How to edit DKIM selector?

SYSTEM INFORMATION
OS type and version EL 10.1
Webmin version 2.621
Virtualmin version 8
Webserver version apache

How to edit/change the DKIM selector to reflect the server rather than some random number. Various articles also suggest using a name that means something.
Was the change to numbers for a good reason?

Can anybody tell me how/where I can edit it please.

NO idea why the number. (EDIT: could be year month?) The only place I find mine is:

root@main:/etc/postfix# grep -r xxxxxx /etc/*
/etc/opendkim.conf:Selector xxxxxx

I’ll assume these are articles by those you trust. But, having NO idea where there may be other hooks, I won’t touch mine. I don’t care if it is called dkim1, as if that makes a difference to the machines using it. :wink:

Thanks for the tip.
I checked a fresh install of the OS with opendkim and the selector is set to “default” out of the box, so Virtualmin install is what changed it most likely.

Question still is: Why a number, and how to change it?

Looks like nobody knows.

I asked the same question September 2025.

Someone else asked in September 2023, no answer then either.

Well, I too do not know of a way to change the selector. I do know that if you delete the key, Virtualmin lets you create a new / fresh DKIM during which you can specify a selector of your choice - or at least it did, a few versions ago.

There is in Virtualmin → Manage Virtual Server → DNS Settings → DNS DKIM Record an option button captioned Generate new key but I do not know if it lets one specify a different selector than the one being used.

And yes, I am among those who say that the selector should match the hostname in some way. This comes in handy when one manages multiple servers.

1 Like

I’d set up a test server and install OpenDKIM and change the selector in the file mentioned above, or, wherever your install puts it. Then install Virtualmin and see if the change sticks. If not, change it again, and regenerate the keys. I doubt it will ever change again, but of course, I don’t know that.

A date is used I think as it is a semi random number. A server can potentially have more than one key and using this number might prevent collisions when importing from other systems?

Not date, I installed a couple of days apart and still got the same number 202600.

Fresh install on AlmaLinux 10.1 each time.

Another catch, fresh install of OS and opendkim has owner:group as root:root for
/etc/opendkim/ keys/ folder. Needs to be: root:opendkim 750