📄 kerberosiv.html
字号:
Opening database...<samp class="PROMPT">Enter Kerberos master key:</samp>Current Kerberos master key version is 1.Master key entered. BEWARE!Previous or default values are in [brackets] ,enter return to leave the same, or new value.<samp class="PROMPT">Principal name:</samp> <kbd class="USERINPUT">jane</kbd><samp class="PROMPT">Instance:</samp><Not found>, <samp class="PROMPT">Create [y] ?</samp> <kbdclass="USERINPUT">y</kbd>Principal: jane, Instance: , kdc_key_ver: 1<sampclass="PROMPT">New Password:</samp> <---- enter a secure password hereVerifying password<sampclass="PROMPT">New Password:</samp> <---- re-enter the password herePrincipal's new key version = 1<samp class="PROMPT">Expiration date (enter yyyy-mm-dd) [ 2000-01-01 ] ?</samp><samp class="PROMPT">Max ticket lifetime (*5 minutes) [ 255 ] ?</samp><samp class="PROMPT">Attributes [ 0 ] ?</samp>Edit O.K.<sampclass="PROMPT">Principal name:</samp> <---- null entry here will cause an exit</pre></div><div class="SECT2"><h2 class="SECT2"><a id="AEN19676" name="AEN19676">14.7.6 Testing It All Out</a></h2><p>First we have to start the Kerberos daemons. Note that if you have correctly editedyour <tt class="FILENAME">/etc/rc.conf</tt> then this will happen automatically when youreboot. This is only necessary on the Kerberos server. Kerberos clients willautomatically get what they need from the <tt class="FILENAME">/etc/kerberosIV</tt>directory.</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">kerberos &</kbd>Kerberos server startingSleep forever on errorLog file is /var/log/kerberos.logCurrent Kerberos master key version is 1.Master key entered. BEWARE!Current Kerberos master key version is 1Local realm: EXAMPLE.COM<samp class="PROMPT">#</samp> <kbd class="USERINPUT">kadmind -n &</kbd>KADM Server KADM0.0A initializingPlease do not use 'kill -9' to kill this job, use aregular kill insteadCurrent Kerberos master key version is 1.Master key entered. BEWARE!</pre><p>Now we can try using the <tt class="COMMAND">kinit</tt> command to get a ticket forthe ID <tt class="USERNAME">jane</tt> that we created above:</p><pre class="SCREEN"><samp class="PROMPT">%</samp> <kbd class="USERINPUT">kinit jane</kbd>MIT Project Athena (grunt.example.com)Kerberos Initialization for "jane"<samp class="PROMPT">Password:</samp></pre><p>Try listing the tokens using <tt class="COMMAND">klist</tt> to see if we really havethem:</p><pre class="SCREEN"><samp class="PROMPT">%</samp> <kbd class="USERINPUT">klist</kbd>Ticket file: /tmp/tkt245Principal: jane@EXAMPLE.COM Issued Expires PrincipalApr 30 11:23:22 Apr 30 19:23:22 krbtgt.EXAMPLE.COM@EXAMPLE.COM</pre><p>Now try changing the password using <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=passwd&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">passwd</span>(1)</span></a> to check ifthe <b class="APPLICATION">kpasswd</b> daemon can get authorization to the Kerberosdatabase:</p><pre class="SCREEN"><samp class="PROMPT">%</samp> <kbd class="USERINPUT">passwd</kbd>realm EXAMPLE.COM<samp class="PROMPT">Old password for jane:</samp><samp class="PROMPT">New Password for jane:</samp>Verifying password<samp class="PROMPT">New Password for jane:</samp>Password changed.</pre></div><div class="SECT2"><h2 class="SECT2"><a id="AEN19709" name="AEN19709">14.7.7 Adding <ttclass="COMMAND">su</tt> Privileges</a></h2><p>Kerberos allows us to give <span class="emphasis"><i class="EMPHASIS">each</i></span>user who needs <tt class="USERNAME">root</tt> privileges their own <spanclass="emphasis"><i class="EMPHASIS">separate</i></span> <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=su&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">su</span>(1)</span></a> password. Wecould now add an ID which is authorized to <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=su&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">su</span>(1)</span></a> to <ttclass="USERNAME">root</tt>. This is controlled by having an instance of <ttclass="USERNAME">root</tt> associated with a principal. Using <ttclass="COMMAND">kdb_edit</tt> we can create the entry <varclass="LITERAL">jane.root</var> in the Kerberos database:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">kdb_edit</kbd>Opening database...<samp class="PROMPT">Enter Kerberos master key:</samp>Current Kerberos master key version is 1.Master key entered. BEWARE!Previous or default values are in [brackets] ,enter return to leave the same, or new value.<samp class="PROMPT">Principal name:</samp> <kbd class="USERINPUT">jane</kbd><samp class="PROMPT">Instance:</samp> <kbd class="USERINPUT">root</kbd><Not found>, Create [y] ? yPrincipal: jane, Instance: root, kdc_key_ver: 1<sampclass="PROMPT">New Password:</samp> <---- enter a SECURE password hereVerifying password<samp class="PROMPT">New Password:</samp> <---- re-enter the password herePrincipal's new key version = 1<samp class="PROMPT">Expiration date (enter yyyy-mm-dd) [ 2000-01-01 ] ?</samp><samp class="PROMPT">Max ticket lifetime (*5 minutes) [ 255 ] ?</samp> <kbdclass="USERINPUT">12</kbd> <--- Keep this short!<samp class="PROMPT">Attributes [ 0 ] ?</samp>Edit O.K.<sampclass="PROMPT">Principal name:</samp> <---- null entry here will cause an exit</pre><p>Now try getting tokens for it to make sure it works:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">kinit jane.root</kbd>MIT Project Athena (grunt.example.com)Kerberos Initialization for "jane.root"<samp class="PROMPT">Password:</samp></pre><p>Now we need to add the user to <tt class="USERNAME">root</tt>'s <ttclass="FILENAME">.klogin</tt> file:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">cat /root/.klogin</kbd>jane.root@EXAMPLE.COM</pre><p>Now try doing the <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=su&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">su</span>(1)</span></a>:</p><pre class="SCREEN"><samp class="PROMPT">%</samp> <kbd class="USERINPUT">su</kbd><samp class="PROMPT">Password:</samp></pre><p>and take a look at what tokens we have:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">klist</kbd>Ticket file: /tmp/tkt_root_245Principal: jane.root@EXAMPLE.COM Issued Expires PrincipalMay 2 20:43:12 May 3 04:43:12 krbtgt.EXAMPLE.COM@EXAMPLE.COM</pre></div><div class="SECT2"><h2 class="SECT2"><a id="AEN19764" name="AEN19764">14.7.8 Using Other Commands</a></h2><p>In an earlier example, we created a principal called <var class="LITERAL">jane</var>with an instance <var class="LITERAL">root</var>. This was based on a user with the samename as the principal, and this is a Kerberos default; that a <varclass="LITERAL"><principal>.<instance></var> of the form <varclass="LITERAL"><username>.</var><tt class="USERNAME">root</tt> will allow that<var class="LITERAL"><username></var> to <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=su&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">su</span>(1)</span></a> to <ttclass="USERNAME">root</tt> if the necessary entries are in the <ttclass="FILENAME">.klogin</tt> file in <tt class="USERNAME">root</tt>'s homedirectory:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">cat /root/.klogin</kbd>jane.root@EXAMPLE.COM</pre><p>Likewise, if a user has in their own home directory lines of the form:</p><pre class="SCREEN"><samp class="PROMPT">%</samp> <kbd class="USERINPUT">cat ~/.klogin</kbd>jane@EXAMPLE.COMjack@EXAMPLE.COM</pre><p>This allows anyone in the <var class="LITERAL">EXAMPLE.COM</var> realm who hasauthenticated themselves as <tt class="USERNAME">jane</tt> or <ttclass="USERNAME">jack</tt> (via <tt class="COMMAND">kinit</tt>, see above) to access to<tt class="USERNAME">jane</tt>'s account or files on this system (<ttclass="HOSTID">grunt</tt>) via <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=rlogin&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">rlogin</span>(1)</span></a>, <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=rsh&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">rsh</span>(1)</span></a> or <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=rcp&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">rcp</span>(1)</span></a>.</p><p>For example, <tt class="USERNAME">jane</tt> now logs into another system usingKerberos:</p><pre class="SCREEN"><samp class="PROMPT">%</samp> <kbd class="USERINPUT">kinit</kbd>MIT Project Athena (grunt.example.com)<samp class="PROMPT">Password:</samp><samp class="PROMPT">%</samp> <kbd class="USERINPUT">rlogin grunt</kbd>Last login: Mon May 1 21:14:47 from grumbleCopyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994 The Regents of the University of California. All rights reserved.FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995</pre><p>Or <tt class="USERNAME">jack</tt> logs into <tt class="USERNAME">jane</tt>'s accounton the same machine (<tt class="USERNAME">jane</tt> having set up the <ttclass="FILENAME">.klogin</tt> file as above, and the person in charge of Kerberos havingset up principal <span class="emphasis"><i class="EMPHASIS">jack</i></span> with a nullinstance):</p><pre class="SCREEN"><samp class="PROMPT">%</samp> <kbd class="USERINPUT">kinit</kbd><samp class="PROMPT">%</samp> <kbd class="USERINPUT">rlogin grunt -l jane</kbd>MIT Project Athena (grunt.example.com)<samp class="PROMPT">Password:</samp>Last login: Mon May 1 21:16:55 from grumbleCopyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994 The Regents of the University of California. All rights reserved.FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995</pre></div></div><div class="NAVFOOTER"><hr align="LEFT" width="100%" /><table summary="Footer navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><td width="33%" align="left" valign="top"><a href="tcpwrappers.html"accesskey="P">Prev</a></td><td width="34%" align="center" valign="top"><a href="index.html"accesskey="H">Home</a></td><td width="33%" align="right" valign="top"><a href="kerberos5.html"accesskey="N">Next</a></td></tr><tr><td width="33%" align="left" valign="top">TCP Wrappers</td><td width="34%" align="center" valign="top"><a href="security.html"accesskey="U">Up</a></td><td width="33%" align="right" valign="top"><b class="APPLICATION">Kerberos5</b></td></tr></table></div><p align="center"><small>This, and other documents, can be downloaded from <ahref="ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/">ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/</a>.</small></p><p align="center"><small>For questions about FreeBSD, read the <ahref="http://www.FreeBSD.org/docs.html">documentation</a> before contacting <<ahref="mailto:questions@FreeBSD.org">questions@FreeBSD.org</a>>.<br />For questions about this documentation, e-mail <<ahref="mailto:doc@FreeBSD.org">doc@FreeBSD.org</a>>.</small></p></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -