Migrating DKIM keys

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
Post Reply
julienp
Posts: 19
Joined: Tue Jul 02, 2019 8:48 am

Migrating DKIM keys

Post by julienp »

Hi,

For a migration from one server to another, I am looking for a way to export DKIM keys from the original server to then import them on the new server.

I believe the keys are stored in ldap and see from the wiki https://wiki.zimbra.com/wiki/Configurin ... IM_Signing that we can view the existing keys using the /opt/zimbra/libexec/zmdkimkeyutil -q -d mydomain.com

The above commands provides the selector and both private and public keys.
But I do not see an option to import that data on a new server. the zmdkimkeyutil command only seems to allow generating new selectors and keys. Is there a way to import a selector and keys?

Regards
phoenix
Ambassador
Ambassador
Posts: 27278
Joined: Fri Sep 12, 2014 9:56 pm
Location: Liverpool, England

Re: Migrating DKIM keys

Post by phoenix »

Why not take the easy route and build new DKIM keys, it's not that difficult.
Regards

Bill

Rspamd: A high performance spamassassin replacement

Per ardua ad astra
julienp
Posts: 19
Joined: Tue Jul 02, 2019 8:48 am

Re: Migrating DKIM keys

Post by julienp »

Well building new DKIM keys means then updating all the DNS records, manually and one by one. Not necessarily easy and can be error prone.

Whereas importing the keys would be fast, simpler, and less error prone.
ghen
Outstanding Member
Outstanding Member
Posts: 260
Joined: Thu May 12, 2016 1:56 pm
Location: Belgium
ZCS/ZD Version: 9.0.0

Re: Migrating DKIM keys

Post by ghen »

DKIM keys are meant to be rotated and not kept indefinitely. Migrating to a new server is a good opportunity to generate new keys.
Note that you don't have to replace the current public key in DNS, you just add the new one, and let them co-exist (each one identified by a unique selector).
User avatar
L. Mark Stone
Ambassador
Ambassador
Posts: 2800
Joined: Wed Oct 09, 2013 11:35 am
Location: Portland, Maine, US
ZCS/ZD Version: 10.0.7 Network Edition
Contact:

Re: Migrating DKIM keys

Post by L. Mark Stone »

ghen wrote:DKIM keys are meant to be rotated and not kept indefinitely.

THANK YOU for saying this explicitly!!

Almost all keys should be rotated periodically IMHO.

All the best,
Mark
___________________________________
L. Mark Stone
Mission Critical Email - Zimbra VAR/BSP/Training Partner https://www.missioncriticalemail.com/
AWS Certified Solutions Architect-Associate
julienp
Posts: 19
Joined: Tue Jul 02, 2019 8:48 am

Re: Migrating DKIM keys

Post by julienp »

Rotating keys regularly definitely makes sense.

But rotating keys as part of a migration is not optimal IMHO, it is just another source of potential errors and issues to troubleshoot during a migration process.
During a migration I think the KIS rule should apply: the more you reduce the surface of potential sources of issues, the better a migration procedure will be.

Furthermore DNS can be owned by different actors and teams. It can mean that potentially a migration organisation is more complex because of the people involved.
It can also mean that a migration will fail if poorly planned and not all the correct people are involved. That's not even taking into account situations where DNS records are configured via different Registry services or different DNS services.

The main gap I think currently is that we cannot even import the private keys into a new server. That would enable a migration without any need to make changes on the DNS records.
rainer_d
Advanced member
Advanced member
Posts: 86
Joined: Fri Sep 12, 2014 11:40 pm

Re: Migrating DKIM keys

Post by rainer_d »

The worst is (IMHO) anyway that there is no GUI or API command to manage DKIM-keys.

It has to be done on the shell.
slacker1337
Posts: 36
Joined: Fri Aug 30, 2019 8:54 am

Re: Migrating DKIM keys

Post by slacker1337 »

It's technically possible to migrate/replace existing DKIM keys using zmprov, no need to use LDAP directly. All you need is to replace domain attributes: DKIMKey, DKIMPublicKey, DKIMSelector with correct values from another Zimbra server.
Post Reply