Typo
[linux_from_scratch_hints.git] / OLD / kerberos.txt
bloba36e4d4b0164fd1ef26eab14edb8bf7383706588
1 TITLE:          Kerberos V
2 LFS VERSION:    any
3 AUTHOR:         Succendo Fornacalis <succendo@atlaswebmail.com>
5 SYNOPSIS:
6         Installing Kerberos V on clients and the KDC
8 HINT:
9 So, you want to run Kerberos eh? Or just curious what Kerberos is? Well in such
10 a case I will give you my explanation of Kerberos. Kerberos is an authentication
11 method developed by MIT that is based on tickets. Tickets, as you may know, are
12 used in place of the users password, as well as very strong encryption to
13 services like telnet. The Tickets are given out by a Key Distribution Center
14 (KDC) and then used for authenticating to any other server within it's realm.
15 So, in short, users send their password to the KDC, The KDC then gives them a
16 Ticket granting Ticket or TGT encrypted using their password as the key. If
17 their password is bad, then the TGT will be bogus.  The TGT which expires at a
18 given time, permits the client to obtain additional tickets. This gives
19 permission to a specific service.  If this hint is acward or just plain bad, let
20 me know, or if I just suck at explaining something let me know that too, and
21 I’ll make revision. I am, by no means, a writer so I’m sure this could be
22 better. And with that, good luck.
25 CONTENTS
26 ========
28   1. Introduction
29   2. Installing Kerberos
30   3. Creating Configs
31   4. Adding Support
32   5. Creating Bootscripts
35 Software used/mentioned/etc in this hint
36 ========================================
37 Kerberos V: http://web.MIT.edu/network/Kerberos-form.html
38 Samba 2.2.2: ftp://ftp.samba.org/pub/samba/samba-2.2.2.tar.gz
39 OpenSSL: http://www.openssl.org/source/openssl-0.9.6b.tar.gz
40 SSH: ftp://ftp.ssh.com/pub/ssh/ssh-3.0.1.tar.gz 
42 Installing Kerberos V
43 =====================
44 cd src &&
45 /configure --prefix=/usr &&
46 make distclean &&
47 make &&
48 make check &&
49 make install
51 If you want to keep everything after the LFS install seperatate, you can give it
52 the prefix /usr/local. Just make sure you change the ./configure lines to
53 /usr/local.
55 This will compile the Kerberos tools, and a telnetd with kerberos support.
57 Setting up KDC
58 ==============
59 see man krb5.conf and man kdc.conf
60 the config files are built much like a windows .ini file.  The realm is usually
61 the domain in caps.  Below are commands that I used for my configs, only a few
62 changes are needed.
64 KDC Configuration:
66 cat > /etc/krb5.conf << "EOF"
67 [libdefaults]
68     ticket_lifetime = 600
69     default_realm = NOVASTAR.WOX.ORG
70     default_tkt_enctypes = des3-hmac-sha1 des-cbc-crc
71     default_tgs_enctypes = des3-hmac-sha1 des-cbc-crc
73 [realms]
74     NOVASTAR.WOX.ORG = {
75         kdc = SockPuppet.novastar.wox.org:88
76         admin_server = SockPuppet.novastar.wox.org:749
77         default_domain = novastar.wox.org
78     }
80 [domain_realm]
81     .novastar.wox.org = NOVASTAR.WOX.ORG
82     novastar.wox.org = NOVASTAR.WOX.ORG
84 [logging]
85     kdc = FILE:/var/log/krb5kdc.log
86     admin_server = FILE:/var/log/kadmin.log
87     default = FILE:/var/log/krb5lib.log
88 EOF
90 cat > /etc/kdc.conf << "EOF"
91 [kdcdefaults]
92     kdc_ports = 88,750
94 [realms]
95     NOVASTAR.WOX.ORG = {
96         database_name = /usr/var/krb5kdc/principal
97         admin_keytab = /usr/var/krb5kdc/kadm5.keytab
98         acl_file = /usr/var/krb5kdc/kadm5.acl
99         dict_file = /usr/var/krb5kdc/kadm5.dict
100         key_stash_file = /usr/var/krb5kdc/.k5.NOVASTAR.WOX.ORG
101         kadmind_port = 749
102         max_life = 10h 0m 0s
103         max_renewable_life = 7d 0h 0m 0s
104         master_key_type = des3-hmac-sha1
105         supported_enctypes = des3-hmac-sha1:normal des-cbc-crc:normal
106     }
109 To add Kerberos V4 support, add des-cbc-crc:v4 to the supported_enctypes line.
111 add Kerberos to /etc/services with these commandi (note that there daemons can
112 be run an any server within the relm):
114 echo "kerberos      88/udp    kdc    # Kerberos V5 KDC" >>/etc/services
115 echo "kerberos      88/tcp    kdc    # Kerberos V5 KDC" >>/etc/services
116 echo "klogin        543/tcp          # Kerberos authenticated rlogin"
117 >>/etc/services
118 echo "kshell        544/tcp   cmd    # and remote shell" >>/etc/services
119 echo "kerberos-adm  749/tcp          # Kerberos 5 admin/changepw"
120 >>/etc/services
121 echo "kerberos-adm  749/udp          # Kerberos 5 admin/changepw"
122 >>/etc/services
123 echo "krb5_prop     754/tcp          # Kerberos slave propagation"
124 >>/etc/services
125 echo "eklogin       2105/tcp         # Kerberos auth. & encrypted rlogin"
126 >>/etc/services
127 echo "krb524        4444/tcp         # Kerberos 5 to 4 ticket translator"
128 >>/etc/services
130 add Kerberos servers to inetd.conf with these commands. This only allows
131 authentification through kerberos if you want to allow nono kerberos access to
132 telnet (why?) ftp sh etc. have a look at the man pages (make sure you find and
133 remove ftp, telnet, shell, login, and exec from you're config)
135 echo "klogin  stream  tcp  nowait  root  /usr/sbin/klogind klogind -k -c" >>
136 /etc/inetd.conf
137 echo "eklogin stream  tcp  nowait  root  /usr/sbin/klogind klogind -k -c -e" >>
138 /etc/inetd.conf
139 echo "kshell  stream  tcp  nowait  root  /usr/sbin/kshd kshd -k -c -A" >>
140 /etc/inetd.conf
141 echo "ftp     stream  tcp  nowait  root  /usr/sbin/ftpd ftpd -a" >>
142 /etc/inetd.conf
143 echo "telnet  stream  tcp  nowait  root  /usr/sbin/telnetd telnetd -a valid" >>
144 /etc/inetd.conf
147 Creating the database:
148 the creation of the password database is more complex than I would like to cover
149 in this hint, MIT has a great howto on the entire prosses at
150 http://web.mit.edu/kerberos/www/krb5-1.2/krb5-1.2.2/doc/install.html#SEC42 
153 Setting Up Clients
154 ==================
155 cat > /etc/krb5.conf << "EOF"
156 [libdefaults]
157     ticket_lifetime = 600
158     default_realm = NOVASTAR.WOX.ORG
159     default_tkt_enctypes = des3-hmac-sha1 des-cbc-crc
160     default_tgs_enctypes = des3-hmac-sha1 des-cbc-crc
162 [realms]
163     NOVASTAR.WOX.ORG = {
164         kdc = SockPuppet.novastar.wox.org:88
165         admin_server = SockPuppet.novastar.wox.org:749
166         default_domain = novastar.wox.org
167     }
169 [domain_realm]
170     .novastar.wox.org = NOVASTAR.WOX.ORG
171     novastar.wox.org = NOVASTAR.WOX.ORG
174 add Kerberos to /etc/services with these command:
176 echo "kerberos      88/udp    kdc    # Kerberos V5 KDC" >>/etc/services
177 echo "kerberos      88/tcp    kdc    # Kerberos V5 KDC" >>/etc/services
178 echo "klogin        543/tcp          # Kerberos authenticated rlogin"
179 >>/etc/services
180 echo "kshell        544/tcp   cmd    # and remote shell" >>/etc/services
181 echo "kerberos-adm  749/tcp          # Kerberos 5 admin/changepw"
182 >>/etc/services
183 echo "kerberos-adm  749/udp          # Kerberos 5 admin/changepw"
184 >>/etc/services
185 echo "krb5_prop     754/tcp          # Kerberos slave propagation"
186 >>/etc/services
187 echo "eklogin       2105/tcp         # Kerberos auth. & encrypted rlogin"
188 >>/etc/services
189 echo "krb524        4444/tcp         # Kerberos 5 to 4 ticket translator"
190 >>/etc/services
192 Adding Support
193 ==============
194 in this section I assume you have openssl installed, if not, go for it. Samba is
195 the only daemon that I have come accross in my search that has kerberos V
196 suport, if you know of any others, let me know.
198 Samba: 
199 /configure --with-krb5=/usr --with-ssl &&
200 make &&
201 make install
203 SSH: Unfortanatly OpenSSH (as of now) does not support Kerberos V. NOTE: SSH's
204 support of Kerberos V is EXPERIMENTAL. I take no responsibility if it goes ape
205 and eats you're dog. you have been warned.
206 /configure --with-kerberos5=/usr --prefix=/usr &&
207 make &&
208 make install
211 Creating Bootscripts
212 ====================
213 this is the final step in our great adventure together. Creating the boot
214 scripts for all of the daemons.
216 cat > /etc/init.d/kdc << "EOF"
217 #!/bin/sh
218 # Begin /etc/init.d/kdc
221 # Include the functions declared in the /etc/init.d/functions file
224 source /etc/init.d/functions
226 case "$1" in
227         start)
228                 echo -n "Starting Kerberos KDC ..."
229                 loadproc krb5kdc
230                 ;;
232         stop)
233                 echo -n "Stopping Kerberos KDC ..."
234                 killproc krb5kdc
235                 ;;
237         restart)
238                 $0 stop
239                 /usr/bin/sleep 1
240                 $0 start
241                 ;;
243         status)
244                 statusproc krb5kdc
245                 ;;
247         *)
248                 echo "Usage: $0 {start|stop|restart|status}"
249                 exit 1
250                 ;;
252 esac
254 # End /etc/init.d/kdc
257 cat > /etc/init.d/samba << "EOF"
258 #!/bin/sh
259 # Begin /etc/init.d/samba
262 # Include the functions declared in the /etc/init.d/functions file
265 source /etc/init.d/functions
267 case "$1" in
268         start)
269                 echo -n "Starting Samba ..."
270                 loadproc /usr/local/samba/bin/smbd
271                 ;;
273         stop)
274                 echo -n "Stopping Samba ..."
275                 killproc smbd
276                 ;;
278         restart)
279                 $0 stop
280                 /usr/bin/sleep 1
281                 $0 start
282                 ;;
284         status)
285                 statusproc smbd
286                 ;;
288         *)
289                 echo "Usage: $0 {start|stop|restart|status}"
290                 exit 1
291                 ;;
293 esac
295 # End /etc/init.d/samba
298 cat > /etc/init.d/sshd << "EOF"
299 #!/bin/sh
300 # Begin /etc/init.d/ssh
303 # Include the functions declared in the /etc/init.d/functions file
306 source /etc/init.d/functions
308 case "$1" in
309         start)
310                 echo -n "Starting SSH ..."
311                 loadproc sshd
312                 ;;
314         stop)
315                 echo -n "Stopping SSH ..."
316                 killproc sshd
317                 ;;
319         restart)
320                 $0 stop
321                 /usr/bin/sleep 1
322                 $0 start
323                 ;;
325         status)
326                 statusproc sshd 
327                 ;;
329         *)
330                 echo "Usage: $0 {start|stop|restart|status}"
331                 exit 1
332                 ;;
334 esac
336 # End /etc/init.d/ssh
339 chmod 754 /etc/init.d/kdc &&
340 chmod 754 /etc/init.d/samba &&
341 chmod 754 /etc/init.d/ssh &&
342 ln -sf ../init.d/kdc /etc/rc0.d/K400kdc &&
343 ln -sf ../init.d/kdc /etc/rc1.d/K400kdc &&
344 ln -sf ../init.d/kdc /etc/rc2.d/K400kdc &&
345 ln -sf ../init.d/kdc /etc/rc3.d/S600kdc &&
346 ln -sf ../init.d/kdc /etc/rc4.d/S600kdc &&
347 ln -sf ../init.d/kdc /etc/rc5.d/S600kdc &&
348 ln -sf ../init.d/kdc /etc/rc6.d/K400kdc &&
349 ln -sf ../init.d/samba /etc/rc0.d/K401samba &&
350 ln -sf ../init.d/samba /etc/rc1.d/K401samba &&
351 ln -sf ../init.d/samba /etc/rc2.d/K401samba &&
352 ln -sf ../init.d/samba /etc/rc3.d/S601samba &&
353 ln -sf ../init.d/samba /etc/rc4.d/S601samba &&
354 ln -sf ../init.d/samba /etc/rc5.d/S601samba &&
355 ln -sf ../init.d/samba /etc/rc6.d/K400samba &&
356 ln -sf ../init.d/ssh /etc/rc0.d/K402ssh &&
357 ln -sf ../init.d/ssh /etc/rc1.d/K402ssh &&
358 ln -sf ../init.d/ssh /etc/rc2.d/K402ssh &&
359 ln -sf ../init.d/ssh /etc/rc3.d/S602ssh &&
360 ln -sf ../init.d/ssh /etc/rc4.d/S602ssh &&
361 ln -sf ../init.d/ssh /etc/rc5.d/S602ssh &&
362 ln -sf ../init.d/ssh /etc/rc6.d/K402ssh 
365 Further Reading
366 ===========
368 Apache hint: http://hints.linuxfromscratch.org/hints/apache+php4+sql.hint.txt
369 Samba hint: http://hints.linuxfromscratch.org/hints/samba.txt
370 MIT's Docs on Kerberos:
371 http://web.mit.edu/kerberos/www/krb5-1.2/index.html#documentation