ssl-guide.html 9.73 KB
Newer Older
Matt Tucker's avatar
Matt Tucker committed
1 2 3
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
4
  <title>Wildfire SSL Guide</title>
Matt Tucker's avatar
Matt Tucker committed
5 6 7 8
  <link type="text/css" rel="stylesheet" href="style.css">
</head>
<body>
<a name="top"></a>
9
<h1>Wildfire SSL Guide</h1>
Matt Tucker's avatar
Matt Tucker committed
10 11
<h2>Introduction</h2>
<p>
12
This document outlines how to customize the SSL support in Wildfire.
13
<font color="red"><b>Important note:</b></font>
14 15 16
because Wildfire ships with self-signed certificates, it will work out of the box without
installing your own certificate. However, most users will wish to user their own
certificates.</p>
17

18
<p>Wildfire's SSL support is built using the standard Java security
19 20
SSL implementation (javax.net.ssl.SSLServerSocket). In this document, we will
describe how use the standard JDK 1.5 tools to accomplish these tasks.
Matt Tucker's avatar
Matt Tucker committed
21 22 23 24 25 26 27
</p>
<h2>Background</h2>
<p>
A server SSL connection uses two sets of certificates to secure the
connection. The first set is called a "keystore". The keystore contains
the keys and certificates for the server. These security credentials
are used to prove to clients that the server is legitimately operating
28 29
on behalf of a particular domain. If your server will only need to act
as one domain, you only need one key entry and certificate in the keystore.
Matt Tucker's avatar
Matt Tucker committed
30
Keys are stored in the keystore under aliases. Each alias corresponds
Matt Tucker's avatar
Matt Tucker committed
31
to a domain name (e.g. "example.com").
Matt Tucker's avatar
Matt Tucker committed
32 33 34
</p>
<p>
The second set of certificates is called the "truststore" and is used
35 36 37 38
to verify that a client is legitimately operating on behalf of a
particular user. In the vast majority of cases, the truststore is
empty and the server will not attempt to validate client connections
using SSL. Instead, the XMPP authentication process verifies users
Matt Tucker's avatar
Matt Tucker committed
39
in-band. However, you may wish to require SSL authentication for
40 41
certain clients when security is especially important and the number
of clients connection to the server is relatively small.
Matt Tucker's avatar
Matt Tucker committed
42 43 44
</p>
<p>
Certificates attempt to guarantee that a particular party is who they
45 46 47
claim to be. Certificates are trusted based on who signed the certificate.
If you only require light security, are deploying for internal use on
trusted networks, etc. you can use "self-signed" certificates.
Matt Tucker's avatar
Matt Tucker committed
48
Self-signed certificates encrypts the communication channel between
49 50 51
client and server. However the client must verify the legitimacy of the
self-signed certificate through some other channel. The most common client
reaction to a self-signed certificate is to ask the user whether
Matt Tucker's avatar
Matt Tucker committed
52 53 54 55 56 57
to trust the certificate, or to silently trust the certificate is
legitimate. Unfortunately, blindly accepting self-signed certificates
opens up the system to 'man-in-the-middle' attacks.
</p>
<p>
The advantage of a self-signed certificate is you can create them for
58 59 60 61
free which is great when cost is a major concern, or for testing and evaluation.
In addition, you can safely use a self-signed certificate if you can verify
that the certificate you're using is legitimate. So if a system administrator
creates a self-signed certificate, then personally installs it on a client's
Matt Tucker's avatar
Matt Tucker committed
62
truststore (so that the certificate is trusted) you can be assured that
63
the SSL connection will only work between the client and the correct server.
Matt Tucker's avatar
Matt Tucker committed
64 65 66
</p>
<p>
For higher security deployments, you should get your certificate signed
67 68 69 70 71 72
by a certificate authority (CA). Clients truststores will usually contain
the certificates of the major CA's and can verify that a CA has signed a
certificate. This chain of trust allows clients to trust certificate from
servers they've never interacted with before. Certificate signing is similar
to a public notary (with equivalent amounts of verification of identity,
record keeping, and costs).
Matt Tucker's avatar
Matt Tucker committed
73
</p>
Gaston Dombiak's avatar
Gaston Dombiak committed
74
<h2>Sun JDK 1.5 security tools</h2>
Matt Tucker's avatar
Matt Tucker committed
75
<p>
Gaston Dombiak's avatar
Gaston Dombiak committed
76
The Sun JDK (version 1.5.x) ships with all the security tools you need
77
to configure SSL with Wildfire. The most important is the
78 79 80
<tt>keytool</tt> located in the <tt>JAVA_HOME/bin directory</tt> of the
JDK. Sun JVMs persist keystores and truststores on the filesystem as
encrypted files. The <tt>keytool</tt> is used to create, read, update,
81
and delete entries in these files. Wildfire ships with a self-signed
82 83
"dummy" certificate designed for initial evaluation testing. You will need
to adjust the default configuration for most deployments.
Matt Tucker's avatar
Matt Tucker committed
84 85 86 87 88 89
</p>
<p>
In order to configure SSL on your server you need complete the
following tasks:
</p>
<ol>
90
  <li>Decide on your Wildfire server's domain.</li>
Matt Tucker's avatar
Matt Tucker committed
91
  <li>Create a self-signed SSL server certificate for your server
92
domain. Note: you may already have one if your Wildfire server
Matt Tucker's avatar
Matt Tucker committed
93 94 95 96 97 98 99 100 101 102 103 104 105
domain matches an existing web domain with SSL.
If so, you can skip to step 4.</li>
  <li>[Optional] Have a certificate authority (CA) certify the SSL
server certificate.
    <ol style="list-style-type: lower-alpha;">
      <li>Generate a certificate signing request (CSR).</li>
      <li>Submit your CSR to a CA for signing.</li>
    </ol>
  </li>
  <li>Import the server certificate into the keystore. Note: if you are
going to use a self-signed certificate
generated in step 2, the certificate is already imported and you can
skip this step.</li>
106
  <li>Remove default certificates from the keystore.</li>
Matt Tucker's avatar
Matt Tucker committed
107
  <li>Import client certificates into the truststore.</li>
108
  <li>Adjust the Wildfire configuration with proper keystore and
Matt Tucker's avatar
Matt Tucker committed
109 110
truststore settings.</li>
</ol>
Matt Tucker's avatar
Matt Tucker committed
111
<h3>1. Decide on a Server Domain</h3>
Matt Tucker's avatar
Matt Tucker committed
112
<p>
113
The Wildfire server domain should match the host name of the server;
Matt Tucker's avatar
Matt Tucker committed
114 115 116
for example, "example.com". Your user accounts will have addresses with
the format "user@example.com" like email addresses. We'll assume
the domain is "example.com" for the rest of the examples.
Matt Tucker's avatar
Matt Tucker committed
117
</p>
Matt Tucker's avatar
Matt Tucker committed
118
<h3>2. Create a self-signed server certificate</h3>
Matt Tucker's avatar
Matt Tucker committed
119 120
<p>
In order to create a self-signed server certificate go to the command
Matt Tucker's avatar
Matt Tucker committed
121
line and change directories to the <tt>resources/security</tt>
122
directory of your Wildfire installation. You should see the default
Matt Tucker's avatar
Matt Tucker committed
123 124 125 126 127 128 129 130 131 132
<tt>keystore</tt> and <tt>truststore</tt> files. First, you should
change the default keystore
password:
</p>
<p><tt>keytool -storepasswd -keystore keystore</tt></p>
<p>
keytool will ask for the old password (by default it is <tt>changeit</tt>)
then the new password.
Now we'll create a certificate using the keytool:
</p>
Matt Tucker's avatar
Matt Tucker committed
133
<p><tt>keytool -genkey -keystore keystore -alias example.com</tt></p>
Matt Tucker's avatar
Matt Tucker committed
134
<p>
Matt Tucker's avatar
Matt Tucker committed
135
where you should substitute your server's name for <tt>example.com</tt>.
136
The keytool will ask for the store password, then several pieces of
137 138 139 140
information required for the certificate. Enter all the information but remember 
to <b>complete with your server's name when asked for your first and last name</b>. 
After you have entered all the required information, keytool will ask you to 
verify the information and set a key password.
141 142 143 144 145
<b>You must use the same key password as the store password.</b> By default
you get this by simply hitting 'enter' when prompted for a key password.</p>
<p>If you later change the keystore password remember to change the entries'
password as well using the keytool:</p>

Matt Tucker's avatar
Matt Tucker committed
146
<p><tt>keytool -keypasswd -alias example.com -keystore keystore</tt>
Matt Tucker's avatar
Matt Tucker committed
147
</p>
Matt Tucker's avatar
Matt Tucker committed
148
<h3>3. Obtain a CA signed certificate</h3>
Matt Tucker's avatar
Matt Tucker committed
149 150 151 152 153
<p>
If you decide to get a CA signed certificate, you must first export the
certificate in the
standard CSR format. You can do this with the keytool:
</p>
Matt Tucker's avatar
Matt Tucker committed
154
<p><tt>keytool -certreq -keystore keystore -alias example.com -file
Matt Tucker's avatar
Matt Tucker committed
155 156
certificate_file</tt></p>
<p>
Matt Tucker's avatar
Matt Tucker committed
157
Where you should substitute your server's name for <tt>example.com</tt>
Matt Tucker's avatar
Matt Tucker committed
158 159 160 161 162
and the name of the
certificate file you wish to produce for <tt>certificate_file</tt>.
Submit the generated CSR to the CA and follow their instructions to get
it signed.
</p>
Matt Tucker's avatar
Matt Tucker committed
163
<h3>4. Import server certificates</h3>
Matt Tucker's avatar
Matt Tucker committed
164 165 166 167 168
<p>
If you had a CA sign your server certificate, or if you have an
existing SSL certificate,
you must import it using the keytool.
</p>
Matt Tucker's avatar
Matt Tucker committed
169
<p><tt>keytool -import -keystore keystore -alias example.com -file
Matt Tucker's avatar
Matt Tucker committed
170 171 172 173 174
signed_certificate_file</tt></p>
<p>
It is important that the alias not already have an associated key or
you'll receive an error.
</p>
175 176 177 178 179 180 181 182
<h3>5. Remove default certificates</h3>
<p>
After importing your certificate you must remove the default certificates
using the keytool.
</p>
<p><tt>keytool -delete -keystore keystore -alias rsa</tt></p>
<p><tt>keytool -delete -keystore keystore -alias dsa</tt></p>
<h3>6. Import client certificates</h3>
Matt Tucker's avatar
Matt Tucker committed
183 184 185 186 187 188 189 190 191 192 193 194 195 196
<p>
If you require clients to verify themselves using certificates, obtain
their certificates and import them into the truststore file rather than
the keystore. First, you should change the default truststore
password:
</p>
<p><tt>keytool -storepasswd -keystore truststore</tt></p>
<p>
keytool will ask for the old password (by default it is <tt>changeit</tt>)
then the new password.
Now import each certificate using the keytool:
</p>
<p><tt>keytool -import -keystore truststore -alias user_name -file
certificate_file</tt></p>
197
<h3>7. Configure Wildfire</h3>
Matt Tucker's avatar
Matt Tucker committed
198
<p>
199
Open the Wildfire Admin Console in your favorite
Gaston Dombiak's avatar
Gaston Dombiak committed
200
browser and add or change the following system properties:
Matt Tucker's avatar
Matt Tucker committed
201 202
</p>
<ul>
203 204
  <li>xmpp.socket.ssl.active -- set to 'true' to active SSL</li>
  <li>xmpp.socket.ssl.port -- the port to use for SSL (default is
Matt Tucker's avatar
Matt Tucker committed
205
5223 for XMPP)</li>
206
  <li>xmpp.socket.ssl.storeType -- the store type used ("JKS" is
207
the Sun Java Keystore format used by the JDK keytool). If this property is 
208
not defined, Wildfire will assume a value of "jks".</li>
209
  <li>xmpp.socket.ssl.keystore -- the location of the keystore file
210
relative to your Wildfire installation root directory. You can leave this property
Matt Tucker's avatar
Matt Tucker committed
211
blank to use the default keystore.</li>
212
  <li>xmpp.socket.ssl.keypass -- the keystore/key password you
Matt Tucker's avatar
Matt Tucker committed
213
changed in step 2.</li>
214
  <li>xmpp.socket.ssl.truststore -- leave blank to not use a
Matt Tucker's avatar
Matt Tucker committed
215
truststore, otherwise the location of the truststore file relative to
216
your Wildfire installation root directory.</li>
217
  <li>xmpp.socket.ssl.trustpass -- the truststore/key password you
218
changed in step 6.</li>
Matt Tucker's avatar
Matt Tucker committed
219
</ul>
220
You will need to restart the server after you have modified any of the above system properties.
Gaston Dombiak's avatar
Gaston Dombiak committed
221
</body>
Matt Tucker's avatar
Matt Tucker committed
222
</html>