{"id":36,"date":"2008-05-03T02:25:39","date_gmt":"2008-05-03T00:25:39","guid":{"rendered":"http:\/\/blog.sqawasmi.com\/?p=36"},"modified":"2008-10-04T10:17:13","modified_gmt":"2008-10-04T08:17:13","slug":"kerberos-5-a-quick-start","status":"publish","type":"post","link":"https:\/\/blog.sqawasmi.com\/index.php\/2008\/05\/03\/kerberos-5-a-quick-start\/","title":{"rendered":"Kerberos 5, a quick start"},"content":{"rendered":"<p><span style=\"color: #ff0000;\">i still maintain this, it&#8217;s not complete<\/span><\/p>\n<p>Kerberos is a network authentication protocol created by MIT, it&#8217;s uses symmetric-key cryptography to authenticate users to network services.<br \/>\nfrom wikipedia: &#8220;Kerberos uses as its basis the Needham-Schroeder protocol. It makes use of a trusted third party, termed a key distribution center (KDC), which consists of two logically separate parts: an Authentication Server (AS) and a Ticket Granting Server (TGS). Kerberos works on the basis of &#8220;tickets&#8221; which serve to prove the identity of users.<\/p>\n<p>The KDC maintains a database of secret keys; each entity on the network \u2014 whether a client or a server \u2014 shares a secret key known only to itself and to the KDC. Knowledge of this key serves to prove an entity&#8217;s identity. For communication between two entities, the KDC generates a session key which they can use to secure their interactions.&#8221;<\/p>\n<p>This quick howto explain how to run Kerberos server\/client using two machines, i use Centos 5 for this..<\/p>\n<p>* Some Kerberos Terminology:<br \/>\ni will not explain all Kerberos Terminology, you can refer to another guides for this.<br \/>\n&#8211; Principal: a unique name of a user or service allowed to authenticate using kerberos, it&#8217;s follows the form user[\/instance]@REALM, instance is optional. all principals in realm have their own key.<br \/>\n&#8211; realm: a network that uses kerberos, usually is the same as the DNS domain name with uppercase letters.<br \/>\n&#8211; ticket: a temporary credentials that verify the identity of a client for a particular service.<br \/>\n&#8211; kinit: a command allows a principal who has already logged in to obtain and cache the initial ticket-granting ticket (TGT).<br \/>\n&#8211; keytab: a file includes an unencrypted list of principals and their keys, it&#8217;s used by the servers to retrieve the keys they needs from keytab instead of using kinit.<br \/>\n&#8211; Key Distribution Center (KDC): a service that issues Kerberos tickets.<br \/>\n&#8211; ticket-granting server (TGS): a server that issues tickets for a desired service.<br \/>\n&#8211; ticket-granting ticket: a special ticket that allows the client to obtain additional tickets without applying for them from the KDC.<\/p>\n<p>&#8212;&#8212;&#8212;-<\/p>\n<p>Configuring a Kerberos 5 Server:<br \/>\n* ensure that time synchronization and DNS (you can use hosts file) are functioning correctly on the server and client machines before configuring Kerberos, in this way Kerberos prevent an attacker from using an old ticket to masquerade as a valid user. maybe you can use ntp to do synchronization.<\/p>\n<p>* yum install krb5-libs krb5-server krb5-workstation<br \/>\n* edit \/etc\/krb5.conf and \/var\/kerberos\/krb5kdc.conf files to reflect the realm and domain-to-realm mappings, for example this is my krb5.conf file:<\/p>\n<p>[logging]<br \/>\ndefault = FILE:\/var\/log\/krb5libs.log<br \/>\nkdc = FILE:\/var\/log\/krb5kdc.log<br \/>\nadmin_server = FILE:\/var\/log\/kadmind.log<\/p>\n<p>[libdefaults]<br \/>\ndefault_realm = TEST.LAB<br \/>\ndns_lookup_realm = false<br \/>\ndns_lookup_kdc = false<br \/>\nticket_lifetime = 24h<br \/>\nforwardable = yes<\/p>\n<p>[realms]<br \/>\nEXAMPLE.COM = {<br \/>\nkdc = m1.test.lab:88<br \/>\nadmin_server = m1.test.lab:749<br \/>\ndefault_domain = test.lab<br \/>\n}<\/p>\n<p>[domain_realm]<br \/>\n.test.lab = TEST.LAB<br \/>\ntest.lab = TEST.LAB<\/p>\n<p>[kdc]<br \/>\nprofile = \/var\/kerberos\/krb5kdc\/kdc.conf<\/p>\n<p>[appdefaults]<br \/>\npam = {<br \/>\ndebug = false<br \/>\nticket_lifetime = 36000<br \/>\nrenew_lifetime = 36000<br \/>\nforwardable = true<br \/>\nkrb4_convert = false<br \/>\n}<\/p>\n<p>i used TEST.LAB as realm, kdc is my kerberos server, and i maped my domain to it&#8217;s realm in [domain_realm] section.<br \/>\nfor kdc.conf file, this is my configuration:<\/p>\n<p>[kdcdefaults]<br \/>\nacl_file = \/var\/kerberos\/krb5kdc\/kadm5.acl<br \/>\ndict_file = \/usr\/share\/dict\/words<br \/>\nadmin_keytab = \/var\/kerberos\/krb5kdc\/kadm5.keytab<br \/>\nv4_mode = nopreauth<\/p>\n<p>[realms]<br \/>\nTEST.LAB = {<br \/>\nsupported_enctypes = des3-hmac-sha1:normal arcfour-hmac:normal des-hmac-sha1:normal des-cbc-md5:normal des-cbc-crc:normal des-cbc-crc:v4 des-cbc-crc:afs3<br \/>\n}<\/p>\n<p>* create te database:<br \/>\n[root@m1 ~]# \/usr\/kerberos\/sbin\/kdb5_util create -s<br \/>\nLoading random data<br \/>\nInitializing database &#8216;\/var\/kerberos\/krb5kdc\/principal&#8217; for realm &#8216;TEST.LAB&#8217;,<br \/>\nmaster key name &#8216;K\/M@TEST.LAB&#8217;<br \/>\nYou will be prompted for the database Master Password.<br \/>\nIt is important that you NOT FORGET this password.<br \/>\nEnter KDC database master key:<br \/>\nRe-enter KDC database master key to verify:<br \/>\n[root@m1 ~]#<\/p>\n<p>-s option forces creation of a stashe file in wic hthe master server key is stored, with stash file kerberos server will not prompts the user for the master server password every time it starts.<\/p>\n<p>* edit \/var\/kerberos\/krb5kdc\/kadm5.acl file and change realm to yours. my file:<\/p>\n<p>*\/admin@TEST.LAB        *<\/p>\n<p>this file used by kadmin to determine which principals have administrative access to the Kerberos database and their level of access.<\/p>\n<p>* now the first step is to add our System Administrator, so we can use Kerberos remotely from any client.<br \/>\nwe will use kadmin.local command for this.<br \/>\n[root@m1 ~]# kadmin.local<br \/>\nAuthenticating as principal root\/admin@TEST.LAB with password.<br \/>\nkadmin.local:  ?<br \/>\nAvailable kadmin.local requests:<\/p>\n<p>add_principal, addprinc, ank<br \/>\nAdd principal<br \/>\ndelete_principal, delprinc<br \/>\nDelete principal<br \/>\nmodify_principal, modprinc<br \/>\nModify principal<br \/>\nchange_password, cpw     Change password<br \/>\nget_principal, getprinc  Get principal<br \/>\nlist_principals, listprincs, get_principals, getprincs<br \/>\nList principals<br \/>\nadd_policy, addpol       Add policy<br \/>\nmodify_policy, modpol    Modify policy<br \/>\ndelete_policy, delpol    Delete policy<br \/>\nget_policy, getpol       Get policy<br \/>\nlist_policies, listpols, get_policies, getpols<br \/>\nList policies<br \/>\nget_privs, getprivs      Get privileges<br \/>\nktadd, xst               Add entry(s) to a keytab<br \/>\nktremove, ktrem          Remove entry(s) from a keytab<br \/>\nlock                     Lock database exclusively (use with extreme caution!)<br \/>\nunlock                   Release exclusive database lock<br \/>\nlist_requests, lr, ?     List available requests.<br \/>\nquit, exit, q            Exit program.<\/p>\n<p>kadmin.local:  addprinc sysadmin<br \/>\nWARNING: no policy specified for sysadmin@TEST.LAB; defaulting to no policy<br \/>\nEnter password for principal &#8220;sysadmin@TEST.LAB&#8221;:<br \/>\nRe-enter password for principal &#8220;sysadmin@TEST.LAB&#8221;:<br \/>\nPrincipal &#8220;sysadmin@TEST.LAB&#8221; created.<\/p>\n<h3>Related Images:<\/h3>","protected":false},"excerpt":{"rendered":"<p>i still maintain this, it&#8217;s not complete<\/p>\n<p>Kerberos is a network authentication protocol created by MIT, it&#8217;s uses symmetric-key cryptography to authenticate users to network services.<br \/>\nfrom wikipedia: &#8220;Kerberos uses as its basis the Needham-Schroeder protocol. It makes use of a trusted third party, termed a key distribution center (KDC), which consists of two logically separate parts: an Authentication Server (AS) and a Ticket Granting Server (TGS). Kerberos works on the basis of &#8220;tickets&#8221; which serve to prove the identity of users.<\/p>\n<p>The KDC maintains a database of <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"ngg_post_thumbnail":0,"footnotes":""},"categories":[12],"tags":[],"class_list":["post-36","post","type-post","status-publish","format-standard","hentry","category-about-my-life"],"_links":{"self":[{"href":"https:\/\/blog.sqawasmi.com\/index.php\/wp-json\/wp\/v2\/posts\/36","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.sqawasmi.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.sqawasmi.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.sqawasmi.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.sqawasmi.com\/index.php\/wp-json\/wp\/v2\/comments?post=36"}],"version-history":[{"count":2,"href":"https:\/\/blog.sqawasmi.com\/index.php\/wp-json\/wp\/v2\/posts\/36\/revisions"}],"predecessor-version":[{"id":326,"href":"https:\/\/blog.sqawasmi.com\/index.php\/wp-json\/wp\/v2\/posts\/36\/revisions\/326"}],"wp:attachment":[{"href":"https:\/\/blog.sqawasmi.com\/index.php\/wp-json\/wp\/v2\/media?parent=36"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.sqawasmi.com\/index.php\/wp-json\/wp\/v2\/categories?post=36"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.sqawasmi.com\/index.php\/wp-json\/wp\/v2\/tags?post=36"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}