Now it is time to add users to the machine. First, start off with the administrator account.
# kadmin.local kadmin.local: addprinc admin/admin@ Enter password for principal "admin/admin@ your_password Re-enter password for principal "admin/admin@ your_password Principal "admin/admin@YOUR_REALM" created.
Then create a keytab on the server. This will authenticate who can modify things on the server and who cannot. Make sure you place everything on one line (including kadmin/changepw):
kadmin.local: ktadd -k /etc/kadm5.keytab kadmin/admin kadmin/changepw Entry for principal kadmin/admin with kvno 3, encryption type DES-CBC-CRC added to keytab WRFILE:/etc/kadm5.keytab. Entry for principal kadmin/changepw with kvno 3, encryption type DES-CBC-CRC added to keytab WRFILE:/etc/kadm5.keytab.You should see something similar, but probably not identical. Then you have to add the necessary information to the server. Edit your /etc/inetd.conf and insert the following:
krb5_prop 754/tcp # Kerberos v5 slave propagation kerberos-adm 749/tcp # Kerberos v5 admin/chpwd kerberos-adm 749/udp # Kerberos v5 admin/chpwd kpasswd 761/tcp kpwd # Kerberos "passwd" -kfallNow, as root, restart inetd and run krb5kdc and kadmind. Congratulations, most of the pain is over. It took me eight hours to get here my first time trying this—hope you did better.
Now test it. A few commands to know about are kinit, klist and kdestory. These initialize your tickets which authorize you, list them and destroy them. (Yes, from the user's point of view, everything is fairly simple.) So try it out by doing a kinit admin/admin@YOUR_REALM
underground:~> kinit admin/admin Password for admin/admin@UNDER: underground:~> klist Ticket cache: /tmp/krb5cc_1000 Default principal: admin/admin@UNDER Valid starting Expires Service principal 08 May 98 15:04:45 09 May 98 01:04:43 krbtgt/UNDER@UNDER
If you got it to work this far, you are virtually done. Add yourself as a user. Run kadmin—it should ask you for a password, same as the one you typed in way back when you created kadmin/admin. The procedure for adding another user is just as simple. Each user is a “principal” (don't ask me where the name came from).
kadmin: addprinc Enter password for principal "user@ Re-enter password for principal "user@ Principal "user@YOUR_REALM" created.Should you make a mistake, just delete the principal like so:
kadmin: delprinc user@ Are you sure you want to delete the principal "user@ Principal "user@YOUR_REALM" deleted.Now test this out the same way you did the administrator. You should get a new ticket.
I still haven't explained how to use it, so here we go. In order for you to be able to use Kerberos encrypted services on a machine, it must satisfy the following:
It has a principal host/hostname@REALM on the server
It has the correct services set up.
It has a keytab file and has /etc/inetd.conf set up right.
The easiest way to try this out is to set up the server so that it will let you make encrypted connections, before you attempt to add other machines. The problem is that it is a bit different from setting up another machine. So we are going to say we want to have kerberized TELNET and FTP on the machine pepsi.kellogg.nwu.edu for this example. To do this, you need to satisfy the three requirements above.
Let's go over the first. You are going to need to install Kerberos on the machine you want to offer kerberized services on first. All this means is putting the binaries on the machine (in our example pepsi.kellogg.nwu.edu). So just go install the binaries. You can, if you want, just copy them over. Then copy your /etc/krb5.conf file from the KDC (server) and place it on the machine you are giving kerberized services (pepsi.kellogg.nwu.edu). From that machine, you must run kinit admin/admin. Then run kadmind from your machine (or in my case pepsi.kellogg.nwu.edu) and run the following commands:
kadmin: addprinc host/pepsi.kellogg.nwu.edu kadmin: addprinc telnet/pepsi.kellogg.nwu.edu kadmin: addprinc ftp/pepsi.kellogg.nwu.edu kadmin: ktadd host/pepsi.kellogg.nwu.edu telnet/pepsi.kellogg.nwu.edu ftp/pepsi.kellogg.nwu.edu
A quick explanation is in order. For each service you plan to offer that is kerberized, you must have a principal. Hence, the use of telnet and ftp with the addprinc command. Then you must make the keytab. That is done by issuing the ktadd command. All of this must be done on the machine, you are setting up to offer services (in this case pepsi.kellogg.nwu.edu).
Finally, edit your /etc/inetd.conf and add the following lines. You will want to comment out any previous definitions of telnet and ftp.
klogin stream tcp nowait root /krb5/sbin/klogind klogind -ki eklogin stream tcp nowait root /krb5/sbin/klogind klogind -eki kshell stream tcp nowait root /krb5/sbin/kshd kshd -ki telnet stream tcp nowait root /krb5/sbin/telnetd telnetd -a valid ftp stream tcp nowait root /krb5/sbin/ftpd -a
Go back to the main server and create yourself a ticket (kinit user@YOUR_REALM). Now make a user (see above addprinc command) for yourself and try to login using telnet like this:
underground:~> telnet -l cosimo pepsi Trying 220.127.116.11... Connected to pepsi.kellogg.nwu.edu (18.104.22.168). Escape character is '^]'. [ Kerberos V5 accepts you as "cosimo@UNDER" ] Last login: Fri May 8 13:44:44 on tty2 Linux 2.0.30. pepsi:~>Note how you didn't have to enter a password. That's okay, because the ticket gave you the access to the machine. The ticket does eventually expire, but it can be renewed by issuing a new kinit command. (Do a klist to see when it does expire. If you copied my /etc/krb5.conf, it will be 600 minutes.)
- Let's Go to Mars with Martian Lander
- Applied Expert Systems, Inc.'s CleverView for TCP/IP on Linux
- Papa's Got a Brand New NAS
- My Childhood in a Cigar Box
- VMware's Clarity Design System
- Jetico's BestCrypt Container Encryption for Linux
- Smith Charts for All
- iguazio's Enterprise Data Cloud
- Linux Journal January 2017
- Panther MPC, Inc.'s Panther Alpha