PennMUSH Community

root/1.8.3/tags/p6/README.SSL

Revision 919, 13.7 kB (checked in by shawnw, 1 year ago)

1.8.3p3

Line 
1                             Use SSL with PennMUSH
2                            Revised: 11 August 2003
3
4
5 As of version 1.7.7p17, PennMUSH supports SSL connections when linked
6 with the OpenSSL library (http://www.openssl.org). The following
7 features are supported:
8
9   * Encrypted sessions using SSLv2, SSLv3, and TLSv1 protocols
10     with ephemeral Diffie-Hellman keying.
11   * Authentication of the server via certificates
12   * Authentication of the clients via certificates
13
14 This document explains how to use SSL with PennMUSH, and covers
15 the following issues:
16
17    I. An SSL overview
18    II. Compiling with OpenSSL
19    III. Mush configuration overview
20    IV. Installing a server certificate (required)
21    V. Using client certificates for authentication (optional)
22    VI. Legal issues
23
24
25 I. An SSL overview
26
27   When an SSL client connects to an SSL server, it performs a
28   "handshake" that looks something like this:
29
30   Client says hello, offers a menu of cipher options
31   Server says hello, selects a cipher.
32   Server presents its certificate, requests a client certificate
33   Client presents a certificate (or not)
34   Client and server exchange cryptographic session keys
35
36   The server is identified to the client by a certificate, an encoded
37   text that gives the server's name and other attributes and is
38   signed by a certifying authority (CA), like Verisign. The client
39   checks that the signature is by a CA that it trusts, and may perform
40   other validation on the certificate (e.g., checking that the hostname
41   in the certificate matches the hostname it's trying to connect to).
42
43   If the client chooses to present a certificate (or is required to
44   by the server), the server will likewise attempt to validate it
45   against its list of trusted CAs, and may perform other verification.
46
47   Once session keys have been exchanged, the client and server can
48   communicate secure from eavesdropping.
49
50 II. Compiling with OpenSSL
51
52   The Configure script distributed with PennMUSH automatically detects
53   the OpenSSL libraries (libssl and libcrypto) and attempts to link
54   them into the executable, defining HAVE_SSL and HAS_OPENSSL in
55   config.h. If you have SSL libraries but wish to avoid linking with them,
56   give the --without-ssl argument to Configure when you run it.
57
58   You can compile the OpenSSL libraries yourself from source code
59   at http://www.openssl.org. If you install it through your OS'es
60   package management system, you need shared libraries and development
61   headers. (Packages with names like openssl, libssl, and -dev or -shlibs
62   prefixes are common. Exact names vary from OS to OS. You want at least
63   verison 0.9.7.) If OpenSSL gets installed in a place that isn't checked
64   by default, you can invoke configure with ./configure --with-ssl=/path/to
65   (The path must be the root directory of where OpenSSL's include/ and lib/
66   directories are.)
67
68   OpenSSL can also be compiled on Windows, and you could add its
69   libraries to the PennMUSH project file and link it in that way.
70   Noltar has done this succesfully; it requires compiling both
71   OpenSSL and PennMUSH in /MD (multithread dll) mode.
72
73 III. Mush configuration overview
74
75   mush.cnf includes three directives that configure the SSL support:
76
77   ssl_port selects the port number for the MUSH to listen for SSL
78   connections. Any port number other than the MUSH's ordinary listening
79   port can be chosen (subject, of course, to other system restrictions
80   on choosing port numbers).
81
82   ssl_private_key_file specifies the name of the file (relative to the
83   game/ directory if it's not an absolute path) that contains the
84   MUSH server's certificate and private key. See section IV below.
85
86   ssl_ca_file specifies the name of the file that contains certificates
87   of trusted certificate authorities. OpenSSL distributes a file containing
88   the best known CAs that is suitable for use here.  If you comment this
89   out, client certificate checking will not be performed.
90
91   ssl_require_client_cert is a boolean option that controls whether the
92   MUSH server will require clients to present valid (that is, signed by
93   a CA for which ssl_ca_file holds a certificate) certificates in order
94   to connect. As no mud clients currently do this, you probably want it
95   off. See section V below.
96
97 IV. Installing a server certificate
98
99   SSL support requires that the MUSH present a server certificate (except
100   as discussed below).  You must create a file containing the certificate
101   and the associated private key (stripped of any passphrase protection)
102   and point the ssl_private_key_file directive at this file. This file
103   should only be readable by the MUSH account!
104
105   How do you get such a certificate and private key? Here are the
106   steps you can use with openssl's command-line tool:
107
108   1. Generate a certificate signing request (mymush.csr) and a private key
109      (temp.key). You will be asked to answer several questions.
110      Be sure the Common Name you request is your MUSH's hostname:
111
112      $ openssl req -new -out mymush.csr -keyout temp.key -passin pass:foobar
113
114   2. Strip the passphrase off of your private key, leaving you
115      with an unpassworded mymush.key file:
116  
117      $ openssl rsa -in temp.key -out mymush.key -passin pass:foobar
118      $ rm temp.key
119
120   3. Send the certificate signing request to a certifying authority
121      to have it signed. If the CA needs the private key, send the
122      passphrased one. The CA will send you back a certificate
123      which you save to a file (mymush.crt)
124
125   4. Concatenate the certificate with the unpassworded private key and
126      use this as the ssl_private_key_file:
127
128      $ cat mymush.key >> mymush.crt
129
130   Commercial CAs like Verisign sign certificates for a yearly or two-yearly
131   fee that is probably too steep for most MUSH Gods. Instead of using
132   a commercial CA, you can generate a self-signed certificate by
133   changing step 1 above to:
134
135   $ openssl req -new -x509 -days 3650 -out mymush.crt -keyout temp.key -passin pass:foobar
136
137   A self-signed certificate is free, but clients that attempt to validate
138   certificates will fail to validate a self-signed certificate unless
139   the user manually installs the certificate in their client and configures
140   it to be trusted. How to do that is beyond the scope of this document,
141   and highly client-dependent.
142
143   Another option is to skip the use of a certificate altogether.
144   If you don't provide an ssl_private_key_file, the server will only
145   accept connections from clients that are willing to use the
146   anonymous Diffie-Hellman cipher; it is unknown which clients
147   are configured to offer this. This provides clients with no
148   security that they are actually connecting to your server, and
149   exposes them to a man-in-the-middle attack, but requires no
150   work on your part at all.
151
152   Hosting providers or other parties may one day provide CA service
153   to PennMUSHes for free. When they do, you'll have to install those
154   CAs' certificates in your client as trusted in order to have the
155   server's certificate validate, but if a few CAs certify many MUSHes,
156   this is efficient.
157
158
159 V. Using client certificates for authentication
160
161   If you provide PennMUSH with a file containing the certificates of
162   trusted CAs (using the ssl_ca_file directive in mush.cnf), it will,
163   by default, request that clients present certificates when they connect.
164   Clients that do not present certificates will still be allowed to
165   connect (unless ssl_require_client_cert is enabled).
166  
167   Clients that do present certificates must present certificates signed
168   by a trusted CA, or they will be disconnected. Both valid and invalid
169   certificates are logged (to connect.log and netmush.log, respectively).
170
171   If you were really serious about this, you probably would issue your
172   own certs and not allow Verisign, etc. certs. You'd probably want to
173   have the server validate extra attributes on each client cert, which
174   should probably include the player's dbref and creation time. This is
175   left as an exercise for the reader for now.
176
177
178 VI. Legal issues
179
180   OpenSSL is used in PennMUSH and may be redistributed with PennMUSH
181   under the following license(s):
182
183   OpenSSL License
184   ---------------
185
186 /* ====================================================================
187  * Copyright (c) 1998-2001 The OpenSSL Project.  All rights reserved.
188  *
189  * Redistribution and use in source and binary forms, with or without
190  * modification, are permitted provided that the following conditions
191  * are met:
192  *
193  * 1. Redistributions of source code must retain the above copyright
194  *    notice, this list of conditions and the following disclaimer.
195  *
196  * 2. Redistributions in binary form must reproduce the above copyright
197  *    notice, this list of conditions and the following disclaimer in
198  *    the documentation and/or other materials provided with the
199  *    distribution.
200  *
201  * 3. All advertising materials mentioning features or use of this
202  *    software must display the following acknowledgment:
203  *    "This product includes software developed by the OpenSSL Project
204  *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
205  *
206  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
207  *    endorse or promote products derived from this software without
208  *    prior written permission. For written permission, please contact
209  *    openssl-core@openssl.org.
210  *
211  * 5. Products derived from this software may not be called "OpenSSL"
212  *    nor may "OpenSSL" appear in their names without prior written
213  *    permission of the OpenSSL Project.
214  *
215  * 6. Redistributions of any form whatsoever must retain the following
216  *    acknowledgment:
217  *    "This product includes software developed by the OpenSSL Project
218  *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
219  *
220  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
221  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
222  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
223  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
224  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
225  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
226  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
227  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
228  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
229  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
230  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
231  * OF THE POSSIBILITY OF SUCH DAMAGE.
232  * ====================================================================
233  *
234  * This product includes cryptographic software written by Eric Young
235  * (eay@cryptsoft.com).  This product includes software written by Tim
236  * Hudson (tjh@cryptsoft.com).
237  *
238  */
239
240  Original SSLeay License
241  -----------------------
242
243 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
244  * All rights reserved.
245  *
246  * This package is an SSL implementation written
247  * by Eric Young (eay@cryptsoft.com).
248  * The implementation was written so as to conform with Netscapes SSL.
249  *
250  * This library is free for commercial and non-commercial use as long as
251  * the following conditions are aheared to.  The following conditions
252  * apply to all code found in this distribution, be it the RC4, RSA,
253  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
254  * included with this distribution is covered by the same copyright terms
255  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
256  *
257  * Copyright remains Eric Young's, and as such any Copyright notices in
258  * the code are not to be removed.
259  * If this package is used in a product, Eric Young should be given attribution
260  * as the author of the parts of the library used.
261  * This can be in the form of a textual message at program startup or
262  * in documentation (online or textual) provided with the package.
263  *
264  * Redistribution and use in source and binary forms, with or without
265  * modification, are permitted provided that the following conditions
266  * are met:
267  * 1. Redistributions of source code must retain the copyright
268  *    notice, this list of conditions and the following disclaimer.
269  * 2. Redistributions in binary form must reproduce the above copyright
270  *    notice, this list of conditions and the following disclaimer in the
271  *    documentation and/or other materials provided with the distribution.
272  * 3. All advertising materials mentioning features or use of this software
273  *    must display the following acknowledgement:
274  *    "This product includes cryptographic software written by
275  *     Eric Young (eay@cryptsoft.com)"
276  *    The word 'cryptographic' can be left out if the rouines from the library
277  *    being used are not cryptographic related :-).
278  * 4. If you include any Windows specific code (or a derivative thereof) from
279  *    the apps directory (application code) you must include an acknowledgement:
280  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
281  *
282  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
283  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
284  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
285  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
286  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
287  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
288  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
289  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
290  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
291  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
292  * SUCH DAMAGE.
293  *
294  * The licence and distribution terms for any publically available version or
295  * derivative of this code cannot be changed.  i.e. this code cannot simply be
296  * copied and put under another distribution licence
297  * [including the GNU Public Licence.]
298  */
299
300
301
Note: See TracBrowser for help on using the browser.