Kerberos Сравнение версий

Различия

Здесь показаны различия между двумя версиями данной страницы.

Ссылка на это сравнение

Предыдущая версия справа и слева Предыдущая версия
Следующая версия
Предыдущая версия
wiki:руководство_по_ubuntu_server:авторизация_по_сети:kerberos [2012/06/13 16:17]
[Сервер Kerberos]
wiki:руководство_по_ubuntu_server:авторизация_по_сети:kerberos [2019/04/10 11:52] (текущий)
[Линукс клиент Kerberos]
Строка 93: Строка 93:
     Jul 13 17:​53:​34 ​ Jul 14 03:​53:​34 ​ krbtgt/​EXAMPLE.COM@EXAMPLE.COM     Jul 13 17:​53:​34 ​ Jul 14 03:​53:​34 ​ krbtgt/​EXAMPLE.COM@EXAMPLE.COM
 </​code>​ </​code>​
-где имя файла кэша krb5cc_1000 составлено из префикса krb5cc_ и id пользователя (uid), который в нашем случае 1000.  +где имя файла кэша krb5cc_1000 составлено из префикса krb5cc_ и id пользователя (uid), который в нашем случае 1000. У вас может возникнуть необходимость добавить запись в /​etc/​hosts ​для ​KDC чтобы клиент мог его найтиНапример
- +<​code>​192.168.0.1 ​  ​kdc01.example.com ​      kdc01</​code>​ 
-    Where the cache filename krb5cc_1000 is composed of the prefix krb5cc_ and the user id (uid), which in this case is 1000. You may need to add an entry into the /​etc/​hosts ​for the KDC so the client can find the KDC. For example+Замените **192.168.0.1** на IP адрес вашего ​KDC. Обычно такое требуется,​ когда ваша ​Kerberos ​область охватывает различные сети, разделенные роутерами
- +  ** Лучший способ позволить клиентам автоматически определить ​KDC для области это использование SRV записей ​DNS. Добавьте следующие записи в /​etc/​named/​db.example.com:​ 
-    ​192.168.0.1 ​  ​kdc01.example.com ​      ​kdc01 +<​code>​
- +
-    Replacing ​192.168.0.1 ​with the IP address of your KDC. This usually happens when you have a Kerberos ​realm encompassing different networks separated by routers+
- +
-    The best way to allow clients to automatically determine the KDC for the Realm is using DNS SRV recordsAdd the following to /​etc/​named/​db.example.com:​ +
     _kerberos._udp.EXAMPLE.COM. ​    IN SRV 1  0 88  kdc01.example.com.     _kerberos._udp.EXAMPLE.COM. ​    IN SRV 1  0 88  kdc01.example.com.
     _kerberos._tcp.EXAMPLE.COM. ​    IN SRV 1  0 88  kdc01.example.com.     _kerberos._tcp.EXAMPLE.COM. ​    IN SRV 1  0 88  kdc01.example.com.
Строка 109: Строка 104:
     _kerberos-adm._tcp.EXAMPLE.COM. IN SRV 1  0 749 kdc01.example.com.     _kerberos-adm._tcp.EXAMPLE.COM. IN SRV 1  0 749 kdc01.example.com.
     _kpasswd._udp.EXAMPLE.COM. ​     IN SRV 1  0 464 kdc01.example.com.     _kpasswd._udp.EXAMPLE.COM. ​     IN SRV 1  0 464 kdc01.example.com.
 +</​code>​
 +<​note>​Замените **EXAMPLE.COM**,​ **kdc01** и **kdc02** на ваши имя домена,​ первичный и вторичный KDC</​note>​
  
-    Replace EXAMPLE.COM,​ kdc01, and kdc02 with your domain name, primary KDC, and secondary KDC.+Смотрите [[wiki:​руководство_по_ubuntu_server:​служба_доменных_имен|Служба доменных имен (DNS)]] для детальных инструкций по настройке DNS.
  
-    See Domain Name Service (DNS) for detailed instructions on setting up DNS. +Ваша новая область ​Kerberos ​теперь готова аутентифицировать клиентов.
- +
-Your new Kerberos ​Realm is now ready to authenticate clients.+
  
 ====Вторичный KDC==== ====Вторичный KDC====
  
-Once you have one Key Distribution Center ​(KDC) on your networkit is good practice to have a Secondary ​KDC in case the primary becomes unavailableAlsoif you have Kerberos ​clients that are in different networks ​(possibly separated by routers using NAT), it is wise to place a secondary ​KDC in each of those networks. +Когда у вас есть один центр распространения ключей ​(KDC) в сетихорошей практикой является создание вторичного ​KDC на случай,​ если первичный будет недоступенТакжеесли у вас ​Kerberos ​клиенты расположены в различных сетях ​(возможно разделенные роутерами,​ использующими ​NAT), разумно будет поместить вторичные ​KDC в каждую такую сеть.
- +
-    First, install the packages, and when asked for the Kerberos and Admin server names enter the name of the Primary KDC: +
- +
-    sudo apt-get install krb5-kdc krb5-admin-server +
- +
-    Once you have the packages installed, create the Secondary KDC's host principal. From a terminal prompt, enter: +
- +
-    kadmin -q "​addprinc -randkey host/​kdc02.example.com"​ +
- +
-    After, issuing any kadmin commands you will be prompted for your username/​admin@EXAMPLE.COM principal password. +
- +
-    Extract the keytab file: +
- +
-    kadmin -q "ktadd -norandkey -k keytab.kdc02 host/​kdc02.example.com"​ +
- +
-    There should now be a keytab.kdc02 in the current directory, move the file to /​etc/​krb5.keytab:​ +
- +
-    sudo mv keytab.kdc02 /​etc/​krb5.keytab +
- +
-    If the path to the keytab.kdc02 file is different adjust accordingly. +
- +
-    Also, you can list the principals in a Keytab file, which can be useful when troubleshooting,​ using the klist utility: +
- +
-    sudo klist -k /​etc/​krb5.keytab +
- +
-    The -k option indicates the file is a keytab file. +
- +
-    Next, there needs to be a kpropd.acl file on each KDC that lists all KDCs for the Realm. For example, on both primary and secondary KDC, create /​etc/​krb5kdc/​kpropd.acl:+
  
 +  ** Сначала установим пакеты и на вопросы о Kerberos и административном серверах введем имя первичного KDC:
 +<​code>​sudo apt-get install krb5-kdc krb5-admin-server</​code>​
 +  ** Как только пакеты установлены,​ создавайте учетную запись вторичного KDC. Из терминала набираем: ​
 +<​code>​kadmin -q "​addprinc -randkey host/​kdc02.example.com"</​code>​
 +<​note>​После,​ выполняя любые команды kadmin, у вас будет запрашиваться пароль вашей учетной записи username/​admin@EXAMPLE.COM</​note>​
 +  ** Извлекаем файл ключей:​
 +<​code>​kadmin -q "ktadd -norandkey -k keytab.kdc02 host/​kdc02.example.com"</​code>​
 +  ** Теперь в текущем каталоге появился keytab.kdc02,​ переместите его в /​etc/​krb5.keytab:​
 +<​code>​sudo mv keytab.kdc02 /​etc/​krb5.keytab</​code>​
 +<​note>​Если путь до файла keytab.kdc02 иной, замените соответственно.</​note>​
 +Также вы можете вывести список учетных записей в файл keytab, который может быть полезен при решении проблем,​ используя утилиту klist:
 +<​code>​sudo klist -k /​etc/​krb5.keytab</​code>​
 +Опция -k показывает,​ что это keytab файл.
 +  ** Затем на каждом KDC должен быть файл kpropd.acl, который содержит список всех KDC в области. В нашем примере на первичном и вторичном KDC создайте /​etc/​krb5kdc/​kpropd.acl:​
 +<​code>​
     host/​kdc01.example.com@EXAMPLE.COM     host/​kdc01.example.com@EXAMPLE.COM
     host/​kdc02.example.com@EXAMPLE.COM     host/​kdc02.example.com@EXAMPLE.COM
- +</​code>​ 
-    ​Create an empty database on the Secondary ​KDC: +  ** Создаем пустую базу данных на **вторичном ​KDC**
- +<​code>​sudo kdb5_util -s create</​code>​ 
-    ​sudo kdb5_util -s create +  ** Теперь запускаем сервис **kpropd**который слушает соединения от утилиты **kprop****kprop** используется для передачи файлов выгрузки данных
- +<​code>​sudo kpropd -S</​code>​ 
-    Now start the kpropd ​daemonwhich listens for connections from the kprop utility. kprop is used to transfer dump files+  ** Из терминала на **первичном ​KDC** создаем файл выгрузки для базы данных учетных записей
- +<​code>​sudo kdb5_util dump /​var/​lib/​krb5kdc/​dump</​code>​ 
-    ​sudo kpropd -S +  ** Извлекаем **keytab** файл первичного ​KDC и копируем его в /​etc/​krb5.keytab:​ 
- +<​code>​
-    From a terminal on the Primary ​KDC, create a dump file of the principal database+
- +
-    ​sudo kdb5_util dump /​var/​lib/​krb5kdc/​dump +
- +
-    Extract the Primary ​KDC's keytab file and copy it to /​etc/​krb5.keytab:​ +
     kadmin -q "ktadd -k keytab.kdc01 host/​kdc01.example.com"​     kadmin -q "ktadd -k keytab.kdc01 host/​kdc01.example.com"​
     sudo mv keytab.kdc01 /​etc/​krb5.keytab     sudo mv keytab.kdc01 /​etc/​krb5.keytab
- +</​code>​ 
-    Make sure there is a host for kdc01.example.com ​before extracting the Keytab. +<​note>​Убедитесь,​ что это **host** для ​kdc01.example.com, перед извлечением ​Keytab.</​note>​ 
- +  ** Используя утилиту **kprop**, загрузите базу данных на вторичный ​KDC: 
-    Using the kprop utility push the database to the Secondary ​KDC: +<​code>​sudo kprop -r EXAMPLE.COM -f /​var/​lib/​krb5kdc/​dump kdc02.example.com</​code>​ 
- +<​note>​Должно вернуться сообщение ​SUCCEEDED, если распространение сработалоЕсли вернулось сообщение об ошибке,​ проверьте ​/​var/​log/​syslog ​на вторичном ​KDC для дополнительной информации.</​note>​ 
-    ​sudo kprop -r EXAMPLE.COM -f /​var/​lib/​krb5kdc/​dump kdc02.example.com +Вы можете также создать задачу ​cron для периодического обновления базы данных на вторичных ​KDC. Напримерследующий код будет выгружать базу данных каждый час ​(обратите внимание,​ что длинная строка разделена чтобы соответствовать формату документа): 
- +<​code>​
-    There should be a SUCCEEDED ​message if the propagation workedIf there is an error message check /​var/​log/​syslog ​on the secondary ​KDC for more information+
- +
-    You may also want to create a cron job to periodically update the database on the Secondary ​KDC. For examplethe following will push the database every hour (note the long line has been split to fit the format of this document): +
     # m h  dom mon dow   ​command     # m h  dom mon dow   ​command
     0 * * * * /​usr/​sbin/​kdb5_util dump /​var/​lib/​krb5kdc/​dump && ​     0 * * * * /​usr/​sbin/​kdb5_util dump /​var/​lib/​krb5kdc/​dump && ​
     /​usr/​sbin/​kprop -r EXAMPLE.COM -f /​var/​lib/​krb5kdc/​dump kdc02.example.com     /​usr/​sbin/​kprop -r EXAMPLE.COM -f /​var/​lib/​krb5kdc/​dump kdc02.example.com
 +</​code>​
 +  ** Вернемся на **вторичный KDC**, создадим **скрытый** (stash) файл для хранения Kerberos master key (главного ключа Kerberos):
 +<​code>​sudo kdb5_util stash</​code>​
 +  ** Под конец запустим сервис **krb5-kdc** на вторичном KDC:
 +<​code>​sudo /​etc/​init.d/​krb5-kdc start</​code>​
  
-    Back on the Secondary ​KDC, create a stash file to hold the Kerberos master key: +**Вторичный ​KDC** теперь должен иметь возможность выдавать билеты для своей области. Вы можете это проверитьостановив сервис **krb5-kdc** на первичном ​KDC и затем запросив билет с помощью **kinit**Если все пойдет хорошовы получите билет со вторичного ​KDC. В противном случае проверяйте ​/​var/​log/​syslog ​и /​var/​log/​auth.log ​на вторичном ​KDC.
- +
-    sudo kdb5_util stash +
- +
-    Finally, start the krb5-kdc ​daemon on the Secondary ​KDC+
- +
-    sudo /etc/init.d/krb5-kdc start +
- +
-The Secondary KDC should now be able to issue tickets for the Realm. You can test this by stopping the krb5-kdc daemon on the Primary KDCthen by using kinit to request a ticket. If all goes well you should receive a ticket from the Secondary ​KDC. Otherwise, check /​var/​log/​syslog ​and /​var/​log/​auth.log ​in the Secondary ​KDC.+
  
 ====Линукс клиент Kerberos==== ====Линукс клиент Kerberos====
  
-This section covers configuring a Linux system as a Kerberos ​clientThis will allow access to any kerberized services once a user has successfully logged into the system.+Эта часть освещает настройку клиента **Kerberos** на системе ЛинуксЭто позволит получить доступ к любому керберезированному сервису как только пользователь удачно авторизуется в системе.
  
 ===Установка=== ===Установка===
  
-In order to authenticate to a Kerberos ​Realmthe krb5-user ​and libpam-krb5 ​packages are neededalong with a few others that are not strictly necessary but make life easierTo install the packages enter the following in a terminal prompt:+Чтобы аутентифицироваться в области ​Kerberos, ​требуются пакеты **krb5-user** и **libpam-krb5**а также некоторые другие,​ которые не являются необходимыми,​ но делают жизнь прощеДля установки пакетов наберите следующую команду в терминале: 
 +<​code>​sudo apt-get install krb5-user libpam-krb5 libpam-ccreds auth-client-config</​code>​
  
-sudo apt-get install krb5-user libpam-krb5 libpam-ccreds ​auth-client-config +Пакет **auth-client-config** позволяет просто настроить ​PAM для аутентификации множества сервисова **libpam-ccreds** будет кэшировать параметры аутентификации,​ позволяя вам подключаться когда центр распространения ключей ​(KDC) недоступенЭтот пакет также полезен для переносных компьютеров,​ которые могут авторизовываться с использованием ​Kerberos ​в корпоративной сетино также должны быть доступны и вне сети.
- +
-The auth-client-config package allows simple configuration of PAM for authentication from multiple sourcesand the libpam-ccreds ​will cache authentication credentials allowing you to login in case the Key Distribution Center ​(KDC) is unavailableThis package is also useful for laptops that may authenticate using Kerberos ​while on the corporate networkbut will need to be accessed off the network as well.+
  
 ===Настройка=== ===Настройка===
  
-To configure the client in a terminal enter+Для настройки клиента наберите в терминале
- +<​code>​sudo dpkg-reconfigure krb5-config</​code>​
-sudo dpkg-reconfigure krb5-config +
- +
-You will then be prompted to enter the name of the Kerberos Realm. Also, if you don't have DNS configured with Kerberos SRV records, the menu will prompt you for the hostname of the Key Distribution Center (KDC) and Realm Administration server.+
  
-The dpkg-reconfigure adds entries to the /etc/krb5.conf file for your RealmYou should have entries similar to the following:+Вас попросят ввести имя области KerberosТакже, если у вас нет DNS сервера с настроенными записями Kerberos **SRV**, меню запросит у вас сетевое имя центра распространения ключей (KDC) и административного сервера области.
  
 +**dpkg-reconfigure** добавит записи в файл /​etc/​krb5.conf для вашей области. У вас будут записи,​ похожие на следующие:​
 +<​code>​
 [libdefaults] [libdefaults]
         default_realm = EXAMPLE.COM         default_realm = EXAMPLE.COM
 ... ...
 [realms] [realms]
-        EXAMPLE.COM =                +        EXAMPLE.COM =                
                 kdc = 192.168.0.1 ​                               kdc = 192.168.0.1 ​              
                 admin_server = 192.168.0.1                 admin_server = 192.168.0.1
         }         }
 +</​code>​
  
-If you set the uid of each of your network-authenticated users to start at 5000, as suggested in Installationyou can then tell pam to only try to authenticate using Kerberos ​users with uid > 5000: +<​note>​Если вы установите ​uid каждого вашего авторизованного в сети пользователя начиная с 5000, как предложено в [[#​сервер_kerberos|Установке]]вы затем сможете указать ​pam аутентифицировать с помощью ​Kerberos ​только пользователей с uid > 5000: 
 +<​code>​
 # Kerberos should only be applied to ldap/​kerberos users, not local ones. # Kerberos should only be applied to ldap/​kerberos users, not local ones.
 for i in common-auth common-session common-account common-password;​ do for i in common-auth common-session common-account common-password;​ do
Строка 231: Строка 199:
  /​etc/​pam.d/​$i ​  /​etc/​pam.d/​$i ​
 done  done 
 +</​code>​
 +Это поможет избежать запросов (несуществующих) паролей Kerberos для локально аутентифицированных пользователей при смене у них пароля с помощью passwd.</​note>​
  
-This will avoid being asked for the (non-existent) Kerberos password of a locally authenticated user when changing its password using passwd. +Вы можете проверить настройки запросив билет с помощью утилиты **kinit**Например
- +<​code>​
-You can test the configuration by requesting a ticket using the kinit utilityFor example+
 kinit steve@EXAMPLE.COM kinit steve@EXAMPLE.COM
 Password for steve@EXAMPLE.COM:​ Password for steve@EXAMPLE.COM:​
 +</​code>​
  
-When a ticket has been grantedthe details can be viewed using klist: +Когда билет будет предоставлендетали можно увидеть с помощью **klist**
 +<​code>​
 klist klist
 Ticket cache: FILE:/​tmp/​krb5cc_1000 Ticket cache: FILE:/​tmp/​krb5cc_1000
Строка 252: Строка 221:
 Kerberos 4 ticket cache: /​tmp/​tkt1000 Kerberos 4 ticket cache: /​tmp/​tkt1000
 klist: You have no tickets cached klist: You have no tickets cached
 +</​code>​
  
-Next, use the auth-client-config ​to configure the libpam-krb5 ​module to request a ticket during login:+Затем используйте **auth-client-config** для настройки модуля ​libpam-krb5 ​для запроса билета в процессе входа: 
 +<​code>​sudo auth-client-config -a -p kerberos_example</​code>​
  
-sudo auth-client-config -a -p kerberos_example +Теперь вы будете получать билет в случае удачной авторизации на входе.
- +
-You will should now receive a ticket upon successful login authentication.+
  
 ====Ссылки==== ====Ссылки====
  
-    For more information on MIT's version of Kerberos, ​see the MIT Kerberos ​site+  -- Для дополнительной информации по версии ​MIT Kerberos, ​смотрите сайт [[http://​web.mit.edu/​Kerberos/​|MIT Kerberos]]
- +  -- [[https://​help.ubuntu.com/​community/​Kerberos|Ubuntu Wiki Kerberos]] для деталей
-    The Ubuntu Wiki Kerberos ​page has more details+  -- [[http://​oreilly.com/​catalog/​9780596004033/​|Kerberos: The Definitive Guide]] от O'​Reilly - великолепное руководство по установке ​Kerberos. 
- +  -- Также почувствуйте свободу без остановки на IRC каналах **//#​ubuntu-server//** и **//#kerberos//** на [[http://​freenode.net/​|Freenode]], если у вас остались вопросы по Kerberos.
-    O'​Reilly'​s ​Kerberos: The Definitive Guide is a great reference when setting up Kerberos. +
- +
-    Also, feel free to stop by the #​ubuntu-server ​and #​kerberos ​IRC channels on Freenode ​if you have Kerberos ​questions. +
  
 ---- ----