Настройка DKIM на Postfix

Настройка DKIM на Postfix 01Настройка DKIM на Postfix упирается в установку дополнительного компонента — OpenDKIM, а со стороны Postfix необходимо добавить лишь несколько строчек. Помимо этого, вам надо будет также добавить DNS-запись у вашего регистратора (ну или на вашем DNS-сервере, если зона делегирована вам).

Теперь обо всем подробнее.


Если вам интересна тематика почтовых серверов, рекомендую обратиться к соответствующей рубрике на моем блоге — Mail Servers.


Настройка DKIM на Postfix

Если пока вы чувствуете себя неуверенно с DKIM, рекомендую прочитать статью Технология DKIM для почтового сервера.

В качестве тестового домена будет использоваться bq-srv.ru.

Установка

С установкой на Debian все просто:

Переходим к настройке.

Ключи

Начинать настройку OpenDKIM будет логичнее всего с генерации пары ключей — закрытого и открытого. Сделать это можно локально на сервере с помощью утилиты opendkim-genkey, но для начала создадим отдельный каталог с необходимыми правами и выставим нужного владельца:

А теперь создаем ключи:

Примечание: уже на этом этапе вам надо определиться с именем селектора, в моем случае это mail. Если не знаете что это такое, почитайте статью про DKIM — см. выше. Также, если вы настраивали Postfix по моей статье — Простейший relay на Postfix для Exchange Server, то команда postconf -h mydomain вернет имя вашего домена. В противном случае вам нужно прописать домен в поле —domain=your_domain самостоятельно.

После выполнения команды будут созданы два файла — mail.private и mail.txt. Вы можете посмотреть их содержимое, если интересно. Один из этих файлов нам понадобится уже в следующей главе.

Выставим нужные права на файл закрытого ключа:

Можно создавать записи.

Записи DNS

Чтобы не тратить время впустую, ожидая распространения DNS-записей, разумно добавить DKIM-запись уже сейчас, а потом спокойно заниматься настройкой. Напомню, что потребуется создать запись TXT. Её вы можете найти в файле /etc/opendkim/mail.txt и она уже имеет нужный вид:

Примечание: напомню, что если вы упираетесь в максимальную длину записи в 255  символов и регистратор не дает создать запись длиннее, есть обходное решение 1. В противном случае обратитесь в поддержку регистратора.

Переходим к настройке.

Настройка OpenDKIM

Основные настройки OpenDKIM находятся в файле /etc/opendkim.conf. Оставим его оригинал в качестве бэкапа, а на его месте создадим новый пустой файл:

Открываем его для редактирования и вставляем содержимое:

Традиционно небольшое описание 2 каждого параметра ниже.

Каждая строка файла /etc/opendkim/KeyTable задает соответствие селектор — домен — закрытый ключ. Разумеется вы можете иметь сколько угодно доменов и селекторов:

Соответствия отправителей и селектора определяет файл /etc/opendkim/SigningTable. По сути, второе значение каждой строки SigningTable соответствует первому значению файла KeyTable:

Файл /etc/opendkim/TrustedHosts используется для двух целей одновременно. Он определяет список внутренних (InternalHosts) и внешних (ExternalIgnoreList) хостов, с которых всю почту надо подписывать, а не проверять.

На стороне OpenDKIM настройка завершена, теперь необходимо научить Postfix отдавать письма на подпись.

Настройка Postfix

Чтобы Postfix после всех манипуляций подписывал сообщение, необходимо добавить всего три строки в конфиг /etc/postfix/main.cf:

Напомню, что сам Postfix ничего не знает о DKIM и в процессе обработки сообщения лишь на время отправляет его OpenDKIM и, как только тот его подпишет, принимает его обратно и отсылает конечным получателям. В терминологии Postfix эта технология называется Milter (mail filter 3).

Добавьте проверку DKIM самой последней, но перед DMARC (если она имеется).

Проверка работы

А теперь отправим тестовое письмо и после этого проверим содержимое лог-файлов (по умолчанию /var/log/mail.log). Хочу напомнить, что моя лаба представляет из себя связку Exchange Server 2016 + релэй на Postfix, который я начал настраивать в статье Простейший relay на Postfix для Exchange Server. Итак, логи:

Примечание: если вдруг возникают сложности с поиском логов, то помните, что ваша главная задача — найти идентификатор сообщения и уже по нему фильтровать. Сразу после отправки сообщения на сервере-релэе вы можете просмотреть последние записи в логах командой:
# tail -n 40 /var/log/mail.log
Идентификатор сообщения представляет из себя десятисимвольную запись (пример — 016117F3F7). Скопируйте его и выполните уже другую команду:
# grep -e ‘016117F3F7’ /var/log/mail.log
После этого вы получите все записи, связанные с обработкой сообщение, которому присвоен идентификатор 016117F3F7.

Видно, что письмо приходит с эксча, подписывается (DKIM-Signature field added), ставится в очередь на отправку и отправляется со статусом ОК. На принимающей стороне просматриваем заголовки сообщения и видим:

А также саму подпись:

Релэй правильно подписывает отсылаемые сообщения, но надо удостовериться, что он не забывает проверять подписи у сообщений, которые приходят снаружи на внутренний сервер. Пробуем отправить сообщение с любого внешнего сервера и смотрим логи:

Из логов видно, что сообщение получено, DKIM подпись проверена и является валидной, а далее сообщение направлено на конечный сервер EXCH01.

Настройка на этом завершена.

comments powered by HyperComments
2resting-place
2022-07-04 22:50:59
<strong>1believes</strong>
dissertation writing memes
2022-07-05 16:18:49
<strong>tips on writing a dissertation https://professionaldissertationwriting.org/</strong>
dissertation
2022-07-05 17:09:39
<strong>masters dissertation help https://professionaldissertationwriting.com/</strong>
doctoral dissertation help
2022-07-06 00:08:42
<strong>dissertation writing service https://dissertationwritingcenter.com/</strong>
dissertation express
2022-07-06 00:44:22
<strong>writing your dissertation in https://dissertationhelpexpert.com/</strong>
dissertation defense presentation
2022-07-06 03:18:48
<strong>buy the help https://accountingdissertationhelp.com/</strong>
phd dissertation help download
2022-07-06 07:06:05
<strong>uk dissertation writing https://examplesofdissertation.com/</strong>
writing a dissertation
2022-07-06 10:14:56
<strong>phd dissertation peer reviewing help https://writing-a-dissertation.net/</strong>
writing service
2022-07-06 13:03:28
<strong>define dissertation https://bestdissertationwritingservice.net/</strong>
dissertation writing service
2022-07-06 14:25:01
<strong>rfp writing services https://businessdissertationhelp.com/</strong>
help with dissertation
2022-07-06 17:04:13
<strong>custom dissertation writing services https://customdissertationwritinghelp.com/</strong>
free dissertation help
2022-07-06 22:14:31
<strong>need help https://writingadissertationproposal.com/</strong>
dissertation paper writing service
2022-07-07 05:50:14
<strong>dissertation help service binding https://customthesiswritingservices.com/</strong>
best online casino us
2022-07-25 18:47:54
<strong>raging bull casino online https://download-casino-slots.com/</strong>
secure online casino
2022-07-25 22:20:48
<strong>harrington online casino https://firstonlinecasino.org/</strong>
free casino slots online
2022-07-26 02:46:08
<strong>monarch online casino https://newlasvegascasinos.com/</strong>
harrington online casino
2022-07-26 06:03:16
<strong>fastest withdrawal online casino https://trust-online-casino.com/</strong>
online free casino games
2022-07-26 06:54:46
<strong>gta online casino car https://onlinecasinosdirectory.org/</strong>
nj casino online sites
2022-07-26 10:28:32
<strong>online casino hosting sanjeev beemidi https://9lineslotscasino.com/</strong>
online casino games real money
2022-07-26 16:16:11
<strong>tropica casino online https://internet-casinos-online.net/</strong>
online casino arizona
2022-07-26 17:09:12
<strong>vegas casino online no deposit bonus codes https://cybertimeonlinecasino.com/</strong>
sugarhouse casino online sportsbook
2022-07-26 20:04:08
<strong>wild vegas online casino https://1freeslotscasino.com/</strong>
golden casino online
2022-07-26 23:56:58
<strong>online casino real money free play https://vrgamescasino.com/</strong>
online casino no deposits
2022-07-27 02:43:14
<strong>miami online casino https://casino-online-roulette.com/</strong>
stardust online casino
2022-07-27 04:38:10
<strong>chumba casino online https://casino-online-jackpot.com/</strong>
online casino index
2022-07-27 07:41:39
<strong>online casino bonuses no deposit https://onlineplayerscasino.com/</strong>
online casino usa legal
2022-07-27 13:26:36
<strong>borgata online casino atlantic city https://all-online-casino-games.com/</strong>
free online casino no deposit
2022-07-27 15:51:42
<strong>online casino malaysia https://casino8online.com/</strong>
free vpn for chrome
2022-08-07 14:18:09
<strong>vpn free ip address https://freevpnconnection.com/</strong>
best free vpn for mac
2022-08-07 16:33:54
<strong>free lifetime vpn https://shiva-vpn.com/</strong>
vpn download free
2022-08-07 20:35:23
<strong>best vpn protocols https://freehostingvpn.com/</strong>
best free phone vpn
2022-08-07 21:52:03
<strong>best free vpn for ipad https://ippowervpn.net/</strong>
free phone vpn
2022-08-08 00:39:38
<strong>free vpn connection https://imfreevpn.net/</strong>
cyber ghost vpn
2022-08-08 02:57:21
<strong>free internet vpn https://superfreevpn.net/</strong>
best vpn for fire tv
2022-08-08 04:37:55
<strong>zenmate vpn free https://free-vpn-proxy.com/</strong>
hotspot vpn
2022-08-08 07:17:24
<strong>what is vpn on windows https://rsvpnorthvalley.com/</strong>
dating gay bbc meet twinks
2022-08-23 14:16:59
<strong>gay sex dating https://gay-singles-dating.com/</strong>
gay dating charlotte nc
2022-08-23 17:21:49
<strong>gay/bi dating apps https://gayedating.com/</strong>
older gay men dating sites
2022-08-23 20:07:33
<strong>gay dating site younger men for older men https://datinggayservices.com/</strong>
dating site asian
2022-08-24 13:21:49
<strong>dating near me free https://freephotodating.com/</strong>
japan bbw
2022-08-24 15:00:23
<strong>international singles https://onlinedatingbabes.com/</strong>
tinder dating
2022-08-24 16:46:45
<strong>asian dating chat https://adult-singles-online-dating.com/</strong>
dating free chating
2022-08-24 19:21:53
<strong>100% inspektion https://adult-classifieds-online-dating.com/</strong>
date sex
2022-08-25 02:45:24
<strong>american dating https://datingpersonalsonline.com/</strong>
free sex dating
2022-08-25 04:35:09
<strong>single women darling side https://wowdatingsites.com/</strong>
online dating sites
2022-08-25 07:16:07
<strong>date me site https://lavaonlinedating.com/</strong>
online dating game
2022-08-25 08:48:40
<strong>free dating sites totally free https://freeadultdatingpasses.com/</strong>
singles websites
2022-08-25 12:49:11
<strong>single personal ads https://virtual-online-dating-service.com/</strong>
free online dating sites with no fees
2022-08-25 13:22:50
<strong>best free online dating sites https://zonlinedating.com/</strong>
plenty of fish
2022-08-25 16:28:36
<strong>free date sites https://onlinedatingservicesecrets.com/</strong>
las atlantis casino online
2022-08-30 09:47:42
<strong>casino online no deposit https://onlinecasinos4me.com/</strong>
parx casino online
2022-08-30 14:53:24
<strong>online casino guide https://online2casino.com/</strong>
my choice casino online slots
2022-08-30 19:59:22
<strong>online casino freispiele https://casinosonlinex.com/</strong>
gay phone chat line numbers
2022-09-03 00:50:17
<strong>gay kink chat https://newgaychat.com/</strong>
boomerang gay chat
2022-09-03 05:36:28
<strong>gay chat toms river nj https://gaychatcams.net/</strong>
chat with gay thai boys
2022-09-03 09:27:44
<strong>gay chat app https://gaychatspots.com/</strong>
free rulette gay chat
2022-09-03 17:16:22
<strong>bbc gay chat room free https://gay-live-chat.net/</strong>
gay chat rouetee
2022-09-03 23:08:23
<strong>profile tube boys user gay chat boi https://chatcongays.com/</strong>
zoom chat gay
2022-09-04 00:11:29
<strong>random gay video chat https://gayphillychat.com/</strong>
gay chat room atlanta
2022-09-04 06:57:41
<strong>reddit gay chat room https://gaychatnorules.com/</strong>
gay chat webcam room facebook free
2022-09-04 10:07:04
<strong>gay video cam chat https://gaymusclechatrooms.com/</strong>
vietnam gay chat
2022-09-04 17:28:33
<strong>gay chat by zip code https://free-gay-sex-chat.com/</strong>
gay men snap chat
2022-09-04 20:38:31
<strong>gay phone chat lines with free trials https://gayinteracialchat.com/</strong>
gay chat webcams
2022-10-20 17:15:19
<strong>gay chat phone line locker https://gaymanchatrooms.com/</strong>
pay to do my paper
2022-10-21 00:06:01
<strong>buy school papers https://writepapersformoney.com/</strong>
custom paper services
2022-10-21 01:14:41
<strong>buying paper https://write-my-paper-for-me.org/</strong>
custom papers
2022-10-21 03:50:16
<strong>papers help https://top100custompapernapkins.com/</strong>
help me write my paper
2022-10-21 04:46:07
<strong>pay someone to do my paper https://researchpaperswriting.org/</strong>
help writing college papers
2022-10-21 06:50:22
<strong>cheap paper writing services https://cheapcustompaper.org/</strong>
order a paper
2022-10-21 08:01:13
<strong>paper writing services reviews https://writingpaperservice.net/</strong>
write my economics paper
2022-10-21 09:27:56
<strong>some to write my paper https://buyessaypaperz.com/</strong>
white paper writing services
2022-10-21 14:34:49
<strong>buy cheap papers online https://papercranewritingservices.com/</strong>
order a paper
2022-10-21 16:14:12
<strong>someone to write my paper https://premiumpapershelp.com/</strong>
write my paper in apa format
2022-10-21 17:12:15
<strong>write my english paper https://ypaywallpapers.com/</strong>
help me write my paper
2022-10-21 18:25:15
<strong>paper writing services online https://studentpaperhelp.com/</strong>
1approximately
2023-01-27 09:46:50
<strong>1changelog</strong>
coursework help university
2023-02-05 14:45:03
<strong>creative writing coursework ideas https://brainycoursework.com/</strong>
coursework service
2023-02-05 17:17:32
<strong>coursework science https://writingacoursework.com/</strong>
design and technology gcse coursework
2023-02-05 19:05:22
<strong>https://mycourseworkhelp.net/</strong>
coursework
2023-02-05 20:27:52
<strong>coursework project https://courseworkdownloads.com/</strong>
coursework help
2023-02-05 21:42:52
<strong>design technology coursework https://courseworkinfotest.com/</strong>
coursework website
2023-02-05 22:51:13
<strong>coursework psychology https://coursework-expert.com/</strong>
coursework help uk
2023-02-06 01:04:27
<strong>coursework history https://buycoursework.org/</strong>
coursework help university
2023-02-06 02:18:03
<strong>coursework science https://courseworkdomau.com/</strong>
dating agency login
2023-02-08 13:11:53
<strong>dating sims https://freewebdating.net/</strong>
sating websites
2023-02-08 14:41:48
<strong>best dating apps https://jewish-dating-online.net/</strong>
free single site
2023-02-08 16:24:20
<strong>single chat sites https://free-dating-sites-free-personals.com/</strong>
singles and personals
2023-02-08 17:21:40
<strong>absolutely free dating site https://sexanddatingonline.com/</strong>
single seniors dating sites
2023-02-08 20:22:00
<strong>dating single online https://onlinedatingsuccessguide.com/</strong>
japan bbw
2023-02-08 23:08:26
<strong>game online woman https://datingwebsiteshopper.com/</strong>
best online meeting websites
2023-02-09 00:15:05
<strong>free adult chat rooms https://allaboutdatingsites.com/</strong>
fdating site
2023-02-09 01:04:44
<strong>dating sifes https://freedatinglive.com/</strong>
meet singles for free
2023-02-09 02:09:05
<strong>matchmaking dating https://freewebdating.net/</strong>
Яндекс.Метрика