Skip to main content
summaryrefslogtreecommitdiffstats
blob: 6dd8cbea4e7de3ab187ecc3ab0782c4dafd1f3a9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
   <title>Chapter&nbsp;7.&nbsp;Configuring Security</title><link rel="stylesheet" type="text/css" href="css/docbook.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><meta name="keywords" content="jetty, servlet, servlet-api, cometd, http, websocket, eclipse, maven, java, server, software"><link rel="home" href="index.html" title="Jetty"><link rel="up" href="jetty-config-guide.html" title="Part&nbsp;II.&nbsp;Jetty Configuration Guide"><link rel="prev" href="setting-port80-access.html" title="Setting Port 80 Access for a Non-Root User"><link rel="next" href="configuring-security-authentication.html" title="Authentication"><link xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" rel="shortcut icon" href="images/favicon.ico"><link rel="stylesheet" href="css/highlighter/foundation.css"><script src="js/highlight.pack.js"></script><script>
      hljs.initHighlightingOnLoad();
    </script><link type="text/css" rel="stylesheet" href="css/font-awesome/font-awesome.min.css"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><tr><td style="width: 25%"><a href="http://www.eclipse.org/jetty"><img src="images/jetty-header-logo.png" alt="Jetty Logo"></a><br><span style="font-size: small">
            Version: 9.3.15-SNAPSHOT</span></td><td style="width: 50%"><script type="text/javascript">  (function() {
            var cx = '016459005284625897022:obd4lsai2ds';
            var gcse = document.createElement('script');
            gcse.type = 'text/javascript';
            gcse.async = true;
            gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
            '//www.google.com/cse/cse.js?cx=' + cx;
            var s = document.getElementsByTagName('script')[0];
            s.parentNode.insertBefore(gcse, s);
            })();
          </script><gcse:search></gcse:search></td></tr></table><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&nbsp;7.&nbsp;Configuring Security</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="setting-port80-access.html"><i class="fa fa-chevron-left" aria-hidden="true"></i> Previous</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;II.&nbsp;Jetty Configuration Guide<br><a accesskey="p" href="index.html"><i class="fa fa-home" aria-hidden="true"></i> Home</a></th><td width="20%" align="right">&nbsp;<a accesskey="n" href="configuring-security-authentication.html">Next <i class="fa fa-chevron-right" aria-hidden="true"></i></a></td></tr></table><hr></div><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="jetty-callout"><h5 class="callout"><a href="http://www.webtide.com/">Contact the core Jetty developers at
          <span class="website">www.webtide.com</span></a></h5><p>
 private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ...
 scalability guidance for your apps and Ajax/Comet projects ... development services for sponsored feature development
      </p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="configuring-security"></a>Chapter&nbsp;7.&nbsp;Configuring Security</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="configuring-security.html#jetty-home-and-jetty-base">Using the $\{jetty.home} and $\{jetty.base} Concepts to Configure</a></span></dt><dt><span class="section"><a href="configuring-security-authentication.html">Authentication</a></span></dt><dt><span class="section"><a href="configuring-form-size.html">Limiting Form Content</a></span></dt><dt><span class="section"><a href="serving-aliased-files.html">Aliased Files and Symbolic links</a></span></dt><dt><span class="section"><a href="configuring-security-secure-passwords.html">Secure Password Obfuscation</a></span></dt><dt><span class="section"><a href="jaas-support.html">JAAS Support</a></span></dt><dt><span class="section"><a href="spnego-support.html">Spnego Support</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="jetty-home-and-jetty-base"></a>Using the $\{jetty.home} and $\{jetty.base} Concepts to Configure</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="configuring-security.html#configuring-security-jetty91">Configuring SSL in with modules</a></span></dt><dt><span class="section"><a href="configuring-security.html#reviewing-ssl-config">Reviewing the Configuration</a></span></dt><dt><span class="section"><a href="configuring-security.html#summary-configuring-SSL-Jetty">Summary of Configuring SSL</a></span></dt></dl></div><p>Security</p><p>Jetty 9.1 introduced <code class="literal">${jetty.base}</code> and <code class="literal">${jetty.home}</code>.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="literal">${jetty.home}</code> is the directory location for the jetty distribution (the binaries).</li><li class="listitem"><code class="literal">${jetty.base}</code> is the directory location for your customizations to the distribution.</li></ul></div><p>This separation:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Allows you to manage multiple Jetty installations.</li><li class="listitem">Makes it simple to retain your current configuration when you upgrade your Jetty distribution.</li></ul></div><p>For more information, see <a class="xref" href="startup-base-and-home.html" title="Managing Jetty Base and Jetty Home">Managing Jetty Base and Jetty Home</a>.</p><p>Further, Jetty 9.1 parameterized all of the standard configuration XMLs.
For SSL, parameters are now properties in the <code class="literal">start.ini</code> or <code class="literal">start.d\ssl.ini</code>, reducing to eliminating the need to edit XML files.</p><p>Instead of explicitly listing all the libraries, properties, and XML files for a feature, Jetty 9.1 introduced a new module system.
A module is defined in a <code class="literal">modules/*.mod</code> file, including the libraries, dependencies, XML, and template INI files for a Jetty feature.
Thus you can use a single <code class="literal">--module=name</code> command line option as the equivalent of specifying many <code class="literal">--lib=location, feature.xml, name=value</code> arguments for a feature and all its dependencies.
Modules use their dependencies to control the ordering of libraries and XML files.
For more information, see <a class="xref" href="startup-modules.html" title="Managing Startup Modules">Managing Startup Modules</a>.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="configuring-security-jetty91"></a>Configuring SSL in with modules</h3></div></div></div><p>This page describes how to configure SSL in Jetty with modules.
It provides an example of using the <code class="literal">${jetty.home}</code> and <code class="literal">${jetty.base}</code> to maximum effect.
It also includes a detailed explanation of how modules work.</p><p>This example assumes you have the jetty-distribution unpacked in <code class="literal">/home/user/jetty-distribution-{VERSION}</code>.
It also assumes you are using <code class="literal">start.ini</code> to configure your server features.</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p class="simpara">Create a base directory anywhere.</p><div class="screenexample"><pre class="screen">[/home/user]$ mkdir my-base
[/home/user]$ cd my-base</pre></div></li><li class="listitem"><p class="simpara">Add the modules for SSL, HTTP, and webapp deployment.
Adding modules in this way will append the associated module properties to the <code class="literal">${jetty.base}/start.ini</code> file.</p><div class="screenexample"><pre class="screen">[my-base]$ java -jar /home/user/jetty-distribution-9.3.15-SNAPSHOT/start.jar --add-to-start=http,https,deploy

ssl             initialised in ${jetty.base}/start.ini (appended)
ssl             enabled in     ${jetty.base}/start.ini
DOWNLOAD: https://github.com/eclipse/jetty.project/raw/master/jetty-server/src/main/config/etc/keystore to etc/keystore
server          initialised in ${jetty.base}/start.ini (appended)
server          enabled in     ${jetty.base}/start.ini
http            initialised in ${jetty.base}/start.ini (appended)
http            enabled in     ${jetty.base}/start.ini
server          enabled in     ${jetty.base}/start.ini
deploy          initialised in ${jetty.base}/start.ini (appended)
deploy          enabled in     ${jetty.base}/start.ini
MKDIR: ${jetty.base}/webapps
server          enabled in     ${jetty.base}/start.ini</pre></div></li><li class="listitem"><p class="simpara">Look at your directory.</p><div class="screenexample"><pre class="screen">[my-base]$ ls -la
total 20
drwxrwxr-x   4 user group 4096 Oct  8 06:55 ./
drwxr-xr-x 103 user group 4096 Oct  8 06:53 ../
drwxrwxr-x   2 user group 4096 Oct  8 06:55 etc/
-rw-rw-r--   1 user group  815 Oct  8 06:55 start.ini
drwxrwxr-x   2 user group 4096 Oct  8 06:55 webapps/</pre></div></li><li class="listitem"><p class="simpara">Copy your WAR files into webapps.</p><div class="screenexample"><pre class="screen">[my-base]$ ls -la
[my-base]$ cp ~/code/project/target/gadget.war webapps/</pre></div></li><li class="listitem"><p class="simpara">Copy your keystore into place.</p><div class="screenexample"><pre class="screen">[my-base]$ cp ~/code/project/keystore etc/keystore</pre></div></li><li class="listitem"><p class="simpara">Edit the <code class="literal">start.ini</code> to configure your SSL settings.</p><div class="screenexample"><pre class="screen">[my-base]$ cat start.ini</pre></div></li><li class="listitem"><p class="simpara">Initialize module ssl.</p><pre class="literallayout">--module=ssl</pre></li><li class="listitem"><p class="simpara">Define the port to use for secure redirection.</p><pre class="literallayout">jetty.secure.port=8443</pre></li><li class="listitem"><p class="simpara">Set up a demonstration keystore and truststore.</p><pre class="literallayout">jetty.keystore=etc/keystore
jetty.truststore=etc/keystore</pre></li><li class="listitem"><p class="simpara">Set the demonstration passwords.</p><pre class="literallayout">jetty.keystore.password=OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4
jetty.keymanager.password=OBF:1u2u1wml1z7s1z7a1wnl1u2g
jetty.truststore.password=OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</pre></li><li class="listitem"><p class="simpara">Initialize the module server.</p><pre class="literallayout">--module=server
threads.min=10
threads.max=200
threads.timeout=60000
#jetty.host=myhost.com
jetty.dump.start=false
jetty.dump.stop=false</pre></li><li class="listitem"><p class="simpara">Initialize module http.</p><pre class="literallayout">--module=http
jetty.http.port=8080
http.timeout=30000</pre></li><li class="listitem"><p class="simpara">Initialize module deploy.</p><pre class="literallayout">--module=deploy</pre></li></ol></div><p>Look at the configuration you have at this point.</p><div class="screenexample"><pre class="screen">[my-base]$ java -jar /home/user/jetty-distribution-9.3.15-SNAPSHOT/start.jar --list-config

Java Environment:
-----------------
 java.home=/usr/lib/jvm/jdk-7u21-x64/jre
 java.vm.vendor=Oracle Corporation
 java.vm.version=23.21-b01
 java.vm.name=Java HotSpot(TM) 64-Bit Server VM
 java.vm.info=mixed mode
 java.runtime.name=Java(TM) SE Runtime Environment
 java.runtime.version=1.7.0_21-b11
 java.io.tmpdir=/tmp

Jetty Environment:
-----------------
 jetty.home=/home/user/jetty-distribution-9.3.15-SNAPSHOT
 jetty.base=/home/user/my-base
 jetty.version=9.3.15-SNAPSHOT

JVM Arguments:
--------------
 (no jvm args specified)

System Properties:
------------------
 jetty.base = /home/user/my-base
 jetty.home = /home/user/jetty-distribution-9.3.15-SNAPSHOT

Properties:
-----------
 http.timeout = 30000
 jetty.dump.start = false
 jetty.dump.stop = false
 jetty.keymanager.password = OBF:1u2u1wml1z7s1z7a1wnl1u2g
 jetty.keystore = etc/keystore
 jetty.keystore.password = OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4
 jetty.http.port = 8080
 jetty.secure.port = 8443
 jetty.truststore = etc/keystore
 jetty.truststore.password = OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4
 threads.max = 200
 threads.min = 10
 threads.timeout = 60000

Jetty Server Classpath:
-----------------------
Version Information on 11 entries in the classpath.
: order presented here is how they would appear on the classpath.
      changes to the --module=name command line options will be reflected here.
 0:                    3.1.0 | ${jetty.home}/lib/servlet-api-3.1.jar
 1:                  3.1.RC0 | ${jetty.home}/lib/jetty-schemas-3.1.jar
 2:                9.3.15-SNAPSHOT | ${jetty.home}/lib/jetty-http-9.3.15-SNAPSHOT.jar
 3:                9.3.15-SNAPSHOT | ${jetty.home}/lib/jetty-continuation-9.3.15-SNAPSHOT.jar
 4:                9.3.15-SNAPSHOT | ${jetty.home}/lib/jetty-server-9.3.15-SNAPSHOT.jar
 5:                9.3.15-SNAPSHOT | ${jetty.home}/lib/jetty-xml-9.3.15-SNAPSHOT.jar
 6:                9.3.15-SNAPSHOT | ${jetty.home}/lib/jetty-util-9.3.15-SNAPSHOT.jar
 7:                9.3.15-SNAPSHOT | ${jetty.home}/lib/jetty-io-9.3.15-SNAPSHOT.jar
 8:                9.3.15-SNAPSHOT | ${jetty.home}/lib/jetty-servlet-9.3.15-SNAPSHOT.jar
 9:                9.3.15-SNAPSHOT | ${jetty.home}/lib/jetty-webapp-9.3.15-SNAPSHOT.jar
10:                9.3.15-SNAPSHOT | ${jetty.home}/lib/jetty-deploy-9.3.15-SNAPSHOT.jar

Jetty Active XMLs:
------------------
 ${jetty.home}/etc/jetty.xml
 ${jetty.home}/etc/jetty-http.xml
 ${jetty.home}/etc/jetty-ssl.xml
 ${jetty.home}/etc/jetty-deploy.xml</pre></div><p>Now start Jetty.</p><div class="screenexample"><pre class="screen">[my-base]$ java -jar /home/user/jetty-distribution-9.3.15-SNAPSHOT/start.jar
2013-10-08 07:06:55.837:INFO:oejs.Server:main: jetty-9.3.15-SNAPSHOT
2013-10-08 07:06:55.853:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/home/user/my-base/webapps/] at interval 1
2013-10-08 07:06:55.872:INFO:oejs.ServerConnector:main: Started ServerConnector@72974691{HTTP/1.1}{0.0.0.0:8080}</pre></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="reviewing-ssl-config"></a>Reviewing the Configuration</h3></div></div></div><p>The following sections review this configuration.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="jetty-base-jetty-home"></a>$\{jetty.base} and $\{jetty.home}</h4></div></div></div><p>First notice the separation of <code class="literal">${jetty.base}</code> and <code class="literal">${jetty.home}</code>.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="literal">${jetty.home}</code> is where your distribution lies, unchanged, unedited.</li><li class="listitem"><code class="literal">${jetty.base}</code> is where your customizations are.</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="modules"></a>Modules</h4></div></div></div><p>Notice that you have <code class="literal">--module=&lt;name&gt;</code> here and there; you have wrapped up the goal of a module (libs, configuration XMLs, and properties) into a single unit, with dependencies on other modules.</p><p>You can see the list of modules:</p><div class="screenexample"><pre class="screen">[my-base]$ java -jar /home/user/jetty-distribution-9.3.15-SNAPSHOT/start.jar --list-modules

Jetty All Available Modules:
----------------------------

Module: annotations
      LIB: lib/jetty-annotations-${jetty.version}.jar
      LIB: lib/annotations/*.jar
      XML: etc/jetty-annotations.xml
  depends: [plus]

Module: client
      LIB: lib/jetty-client-${jetty.version}.jar
  depends: []

Module: debug
      XML: etc/jetty-debug.xml
  depends: [server]

Module: deploy
      LIB: lib/jetty-deploy-${jetty.version}.jar
      XML: etc/jetty-deploy.xml
  depends: [webapp]
  enabled: ${jetty.base}/start.ini

Module: ext
      LIB: lib/ext/*.jar
  depends: []

Module: http
      XML: etc/jetty-http.xml
  depends: [server]
  enabled: ${jetty.base}/start.ini

Module: http2
      LIB: lib/http2/*.jar
      XML: etc/jetty-http2.xml
  depends: [ssl, alpn]

Module: http2c
     LIB: lib/http2/*.jar
     XML: etc/jetty-http2c.xml
 depends: [http]

Module: https
      XML: etc/jetty-https.xml
  depends: [ssl]

Module: ipaccess
      XML: etc/jetty-ipaccess.xml
  depends: [server]

Module: jaas
      LIB: lib/jetty-jaas-${jetty.version}.jar
      XML: etc/jetty-jaas.xml
  depends: [server]

Module: jaspi
      LIB: lib/jetty-jaspi-${jetty.version}.jar
      LIB: lib/jaspi/*.jar
  depends: [security]

Module: jmx
      LIB: lib/jetty-jmx-${jetty.version}.jar
      XML: etc/jetty-jmx.xml
  depends: []

Module: jndi
      LIB: lib/jetty-jndi-${jetty.version}.jar
      LIB: lib/jndi/*.jar
  depends: [server]

Module: jsp
      LIB: lib/jsp/*.jar
  depends: [servlet]

Module: jvm
  depends: []

Module: logging
      XML: etc/jetty-logging.xml
  depends: []

Module: lowresources
      XML: etc/jetty-lowresources.xml
  depends: [server]

Module: monitor
      LIB: lib/jetty-monitor-${jetty.version}.jar
      XML: etc/jetty-monitor.xml
  depends: [client, server]

Module: npn
  depends: []

Module: plus
      LIB: lib/jetty-plus-${jetty.version}.jar
      XML: etc/jetty-plus.xml
  depends: [server, security, jndi]

Module: proxy
      LIB: lib/jetty-proxy-${jetty.version}.jar
      XML: etc/jetty-proxy.xml
  depends: [client, server]

Module: requestlog
      XML: etc/jetty-requestlog.xml
  depends: [server]

Module: resources
      LIB: resources
  depends: []

Module: rewrite
      LIB: lib/jetty-rewrite-${jetty.version}.jar
      XML: etc/jetty-rewrite.xml
  depends: [server]

Module: security
      LIB: lib/jetty-security-${jetty.version}.jar
  depends: [server]

Module: server
      LIB: lib/servlet-api-3.1.jar
      LIB: lib/jetty-schemas-3.1.jar
      LIB: lib/jetty-http-${jetty.version}.jar
      LIB: lib/jetty-continuation-${jetty.version}.jar
      LIB: lib/jetty-server-${jetty.version}.jar
      LIB: lib/jetty-xml-${jetty.version}.jar
      LIB: lib/jetty-util-${jetty.version}.jar
      LIB: lib/jetty-io-${jetty.version}.jar
      XML: etc/jetty.xml
  depends: []
  enabled: ${jetty.base}/start.ini

Module: servlet
      LIB: lib/jetty-servlet-${jetty.version}.jar
  depends: [server]

Module: servlets
      LIB: lib/jetty-servlets-${jetty.version}.jar
  depends: [servlet]

Module: setuid
      LIB: lib/setuid/jetty-setuid-java-1.0.1.jar
      XML: etc/jetty-setuid.xml
  depends: [server]

Module: ssl
      XML: etc/jetty-ssl.xml
  depends: [server]
  enabled: ${jetty.base}/start.ini

Module: stats
      XML: etc/jetty-stats.xml
  depends: [server]

Module: webapp
      LIB: lib/jetty-webapp-${jetty.version}.jar
  depends: [servlet]

Module: websocket
      LIB: lib/websocket/*.jar
  depends: [annotations]

Module: xinetd
      XML: etc/jetty-xinetd.xml
  depends: [server]

Jetty Active Module Tree:
-------------------------
 + Module: server [enabled]
   + Module: http [enabled]
   + Module: servlet [transitive]
   + Module: ssl [enabled]
     + Module: webapp [transitive]
       + Module: deploy [enabled]</pre></div><p>These are the modules by name, the libraries they bring in, the XML configurations they use, the other modules they depend on (even optional ones), and if the module is in use, where it was enabled.</p><p>While you can manage the list of active modules yourself, it is much easier to edit the <code class="literal">${jetty.base}/start.ini</code>.</p><p>If you want to start using a new module:</p><div class="screenexample"><pre class="screen">[my-base] $ java -jar ../jetty-distribution-9.3.15-SNAPSHOT/start.jar --add-to-start=https</pre></div><p>This adds the <code class="literal">--module=</code> lines and associated properties (the parameterized values mentioned above), to your <code class="literal">start.ini</code>.</p><div class="blockquote"><blockquote class="blockquote"><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><i class="fa fa-plus" aria-hidden="true"></i> Important</h3><p>Do not edit the modules and XML files in the <code class="literal">${jetty.home}</code> directory; there is no need to be moving or copying them unless you want to make your own modules or override the behavior of an existing module.</p></div></blockquote></div><p>Notice that your <code class="literal">${jetty.base}/start.ini</code> has no references to the XML files.
That&#8217;s because the module system and its graph of dependencies now dictate all of the XML files, and their load order.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="parameterizing"></a>Parameters</h4></div></div></div><p>Next is parameterizing all of the standard configuration XMLs.
In this example all of the SSL parameters are now just properties in the <code class="literal">start.ini</code>, reducing or eliminating the need to edit XML files.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="override-jetty.home"></a>Overriding $\{jetty.home} in $\{jetty.base}</h4></div></div></div><p>Finally, you can override anything you see in <code class="literal">${jetty.home}</code> in <code class="literal">${jetty.base}</code>, even XML configurations and libraries.</p><p>For more information on the <code class="literal">start.jar</code> in 9.1, see <a class="xref" href="start-jar.html" title="Using start.jar">Using start.jar</a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="summary-configuring-SSL-Jetty"></a>Summary of Configuring SSL</h3></div></div></div><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">Download and unpack Jetty into <code class="literal">/home/user/jetty-distribution-{VERSION}</code>.</li><li class="listitem"><p class="simpara">Go to your base directory and just use the distribution, no editing.</p><div class="screenexample"><pre class="screen">[my-base]$ java -jar /home/user/jetty-distribution-9.3.15-SNAPSHOT/start.jar</pre></div><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The Jetty distribution provides, out of the box, the XML configuration files, in this case <code class="literal">jetty-http.xml</code> and <code class="literal">jetty-ssl.xml</code>.
These can be found in the <code class="literal">${jetty.home}/etc/</code> directory.</li><li class="listitem">We have parameterized all of the configurable values in those XMLs.
You can now set the values using simple properties, either on the command line, or within the <code class="literal">${jetty.base}/start.ini</code>.</li><li class="listitem">When you activate the module for HTTP or HTTPs, Jetty automatically adds the appropriate libraries and XML to start Jetty.
Unless you have a highly custom setup (such as listening on two different ports, using SSL on each, each with its own keystore and configuration), there is no need to muck around in XML files.</li></ul></div></li><li class="listitem"><p class="simpara">Use modules to configure HTTPS:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">http &#8594; server</li><li class="listitem"><p class="simpara">https &#8594; ssl &#8594; server</p><p class="simpara">You can find the details about the modules in <code class="literal">${jetty.home}/modules/</code>.
For SSL they include <code class="literal">modules/http.mod</code>, <code class="literal">modules/https.mod</code>, <code class="literal">modules/ssl.mod</code>, and <code class="literal">modules/server.mod</code>.</p><p class="simpara">Ideally, this level of detail is not important to you.
What is important is that you want to use HTTPS and want to configure it.
You accomplish that by adding the <code class="literal">--module=https</code> to your <code class="literal">start.ini</code>.
By default, the module system keeps things sane, and transitively includes all dependent modules as well.</p></li></ul></div></li></ol></div><p>You can see what the configuration looks like, after all of the modules are resolved, without starting Jetty via:</p><div class="screenexample"><pre class="screen">[my-base] $ java -jar ../jetty-distribution-9.3.15-SNAPSHOT/start.jar --list-config</pre></div><p>Just because the JARs exist on disk does not mean that they are in use.
The configuration controls what is used.</p><p>Use the <code class="literal">--list-config</code> to see the configuration.
Notice that only a subset of the JARs from the distribution are in use.
The modules you have enabled determine that subset.</p><div class="screenexample"><pre class="screen">[my-base]$ java -jar ~/jetty-distribution-9.3.15-SNAPSHOT/start.jar --list-config</pre></div></div></div></div><script type="text/javascript">
      SyntaxHighlighter.all()
    </script><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="setting-port80-access.html"><i class="fa fa-chevron-left" aria-hidden="true"></i> Previous</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="jetty-config-guide.html"><i class="fa fa-chevron-up" aria-hidden="true"></i> Top</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="configuring-security-authentication.html">Next <i class="fa fa-chevron-right" aria-hidden="true"></i></a></td></tr><tr><td width="40%" align="left" valign="top">Setting Port 80 Access for a Non-Root User&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="index.html"><i class="fa fa-home" aria-hidden="true"></i> Home</a></td><td width="40%" align="right" valign="top">&nbsp;Authentication</td></tr></table></div><p xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><div class="jetty-callout">
            See an error or something missing?
            <span class="callout"><a href="http://github.com/eclipse/jetty.project">Contribute to this documentation at
                <span class="website"><i class="fa fa-github" aria-hidden="true"></i> Github!</span></a></span><span style="float: right"><i>(Generated: 2016-12-08)</i></span></div></p><script xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-1149868-7']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
    </script></body></html>

Back to the top