Copy Paste DKIM keys

I’m setting up a secondary mail server for my domain, only for sending emails. However, the emails it sends have invalid DKIM signatures (apparently HestiaCP only uses “mail” DNS record for mail). It seems I need to copy the DKIM private and public keys from my primary mail server to the secondary one, but I’m unsure where to find them or if this approach will work. Any advice would be greatly appreciated!

Primary mail server: mail.mydomain.com
Secondary mail server: mail2.mydomain.com

(When I send email from mail2, dkimvalidator.com uses primary mail server’s TXT public key and it fails.)

It worked!

I only copied the private key from mail to mail2.

The file location: /home/admin/conf/mail/mydomain.com/dkim.pem