sendmail with DKIM on ubuntu 22 LTS

sudo apt-get install opendkim opendkim-tools
sudo mkdir -p /etc/opendkim/keys/ENTER-YOUR-DOMAIN.COM
sudo opendkim-genkey -b 2048 -d ENTER-YOUR-DOMAIN.COM -D /etc/opendkim/keys/ENTER-YOUR-DOMAIN.COM -s mail -v
# import DNS record from mail.txt in /etc/opendkim/keys/ENTER-YOUR-DOMAIN.COM
sudo chown -R opendkim:opendkim /etc/opendkim
sudo chmod -R go-rw /etc/opendkim/keys

# edit /etc/mail/sendmail.mc , add: INPUT_MAIL_FILTER(`opendkim', `S=local:/run/opendkim/opendkim.sock')
# edit /etc/opendkim.conf , 
#Domain                  yourdomain.com
#KeyFile                 /etc/opendkim/keys/yourdomain.com/mail.private
#Selector                mail

sudo m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

sudo systemctl restart opendkim
sudo systemctl restart sendmail