JBoss Enterprise Application Platform 6.3 Security Guide en US
JBoss Enterprise Application Platform 6.3 Security Guide en US
JBoss Enterprise Application Platform 6.3 Security Guide en US
Platform 6.3
Security Guide
Legal Notice
Co pyright 20 14 Red Hat, Inc..
This do cument is licensed by Red Hat under the Creative Co mmo ns Attributio n-ShareAlike 3.0
Unpo rted License. If yo u distribute this do cument, o r a mo dified versio n o f it, yo u must pro vide
attributio n to Red Hat, Inc. and pro vide a link to the o riginal. If the do cument is mo dified, all Red
Hat trademarks must be remo ved.
Red Hat, as the licenso r o f this do cument, waives the right to enfo rce, and agrees no t to assert,
Sectio n 4 d o f CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shado wman lo go , JBo ss, MetaMatrix, Fedo ra, the Infinity
Lo go , and RHCE are trademarks o f Red Hat, Inc., registered in the United States and o ther
co untries.
Linux is the registered trademark o f Linus To rvalds in the United States and o ther co untries.
Java is a registered trademark o f Oracle and/o r its affiliates.
XFS is a trademark o f Silico n Graphics Internatio nal Co rp. o r its subsidiaries in the United
States and/o r o ther co untries.
MySQL is a registered trademark o f MySQL AB in the United States, the Euro pean Unio n and
o ther co untries.
No de.js is an o fficial trademark o f Jo yent. Red Hat So ftware Co llectio ns is no t fo rmally
related to o r endo rsed by the o fficial Jo yent No de.js o pen so urce o r co mmercial pro ject.
The OpenStack Wo rd Mark and OpenStack Lo go are either registered trademarks/service
marks o r trademarks/service marks o f the OpenStack Fo undatio n, in the United States and o ther
co untries and are used with the OpenStack Fo undatio n's permissio n. We are no t affiliated with,
endo rsed o r spo nso red by the OpenStack Fo undatio n, o r the OpenStack co mmunity.
All o ther trademarks are the pro perty o f their respective o wners.
Abstract
This bo o k is a guide to securing Red Hat JBo ss Enterprise Applicatio n Platfo rm 6 and its patch
releases.
T able of Contents
.Preface
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7. . . . . . . . . .
1. Do c ument Co nventio ns
7
1.1. Typ o g rap hic Co nventio ns
7
1.2. Pull-q uo te Co nventio ns
8
1.3. No tes and Warning s
9
2 . G etting Help and G iving Feed b ac k
9
2 .1. Do Yo u Need Help ?
2 .2. We Need Feed b ac k!
9
10
. .art
P
. . .I.. Securit
......y
. .for
. . .Red
. . . .Hat
. . . .JBoss
. . . . . Ent
. . . .erprise
. . . . . . Applicat
. . . . . . . ion
. . . .Plat
. . . form
. . . . .6. . . . . . . . . . . . . . . . . . . . . . . . .1. 1. . . . . . . . . .
. .hapt
C
. . . .er
. .1. .. Int
. . .roduct
. . . . . .ion
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1. 2. . . . . . . . . .
1.1. Ab o ut Red Hat JBo s s Enterp ris e Ap p lic atio n Platfo rm 6
12
1.2. Ab o ut Sec uring JBo s s EAP 6
12
. .art
P
. . .II.. .Securing
. . . . . . . .t.he
. . Plat
. . . .form
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1. 3. . . . . . . . . .
. .hapt
C
. . . .er
. .2. .. Java
. . . . Securit
. . . . . . .y. Manager
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1. 4. . . . . . . . . .
2 .1. Ab o ut the Java Sec urity Manag er
2 .2. Ab o ut Java Sec urity Manag er Po lic ies
14
14
2 .3. Run JBo s s EAP 6 Within the Java Sec urity Manag er
2 .4. Write a Java Sec urity Manag er Po lic y
15
16
17
17
. .hapt
C
. . . .er
. .3.
. .Securit
. . . . . . y. .Realms
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1. 9. . . . . . . . . .
3 .1. Ab o ut Sec urity Realms
3 .2. Ad d a New Sec urity Realm
19
19
20
. .hapt
C
. . . .er
. .4. .. Encrypt
. . . . . . . .Net
. . .work
. . . .T
. .raffic
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2. 1. . . . . . . . . .
4 .1. Sp ec ify Whic h Netwo rk Interfac e JBo s s EAP 6 Us es
21
4 .2. Co nfig ure Netwo rk Firewalls to Wo rk with JBo s s EAP 6
4 .3. Netwo rk Po rts Us ed By JBo s s EAP 6
22
25
27
27
28
30
33
39
39
39
Key s to rag e
Examine FIPS p ro vid er info rmatio n
4 .9 .3. FIPS 140 -2 Co mp liant Pas s wo rd s
4 .9 .4. Enab le FIPS 140 -2 Cryp to g rap hy fo r SSL o n Red Hat Enterp ris e Linux 6
39
40
40
40
. .hapt
C
. . . .er
. .5.
. .Secure
. . . . . . t. he
. . .Management
. . . . . . . . . . . .Int
. . erfaces
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4. 4. . . . . . . . . .
5 .1. Default Us er Sec urity Co nfig uratio n
44
5 .2.
5 .3.
5 .4.
5 .5.
45
46
47
49
49
49
51
54
55
58
5 .11. LDAP
5 .11.1. Ab o ut LDAP
5 .11.2. Us e LDAP to Authentic ate to the Manag ement Interfac es
5 .11.3. Us ing O utb o und LDAP with 2-way SSL in the Manag ement Interfac e and CLI
58
58
59
62
. .hapt
C
. . . .er
. .6. .. Secure
. . . . . . .t he
. . . Management
. . . . . . . . . . . .Int
. . erfaces
. . . . . . . wit
. . .h. .Role. . . . Based
. . . . . . Access
. . . . . . . Cont
. . . . rol
. . . . . . . . . . . . . . . . . 6. 3. . . . . . . . . .
6 .1. Ab o ut Ro le-Bas ed Ac c es s Co ntro l (RBAC)
6 .2. Ro le-Bas ed Ac c es s Co ntro l in the Manag ement Co ns o le and CLI
6 .3. Sup p o rted Authentic atio n Sc hemes
6 .4. The Stand ard Ro les
63
63
64
64
6 .5. Ab o ut Ro le Permis s io ns
6 .6 . Ab o ut Co ns traints
6 .7. Ab o ut JMX and Ro le-Bas ed Ac c es s Co ntro l
6 .8 . Co nfig uring Ro le-Bas ed Ac c es s Co ntro l
65
66
67
67
67
68
69
70
70
71
74
77
78
81
84
85
The G ro up Searc h
87
89
91
6 .9 .9 . Creating Sc o p ed Ro les
91
93
93
95
96
97
97
99
. .hapt
C
. . . .er
. .7. .. Secure
. . . . . . .Passwords
. . . . . . . . . .and
...O
. .t.her
. . . Sensit
. . . . . .ive
. . .St
. .rings
. . . . .wit
..h
. . Password
. . . . . . . . . Vault
. . . . . . . . . . . . . . . . . .1.0. 7. . . . . . . . . .
7 .1. Pas s wo rd Vault Sys tem
7 .2. Create a Java Keys to re to Sto re Sens itive String s
10 7
10 7
7 .3. Mas k the Keys to re Pas s wo rd and Initializ e the Pas s wo rd Vault
10 9
111
112
7 .6 . Sto re and Retrieve Enc ryp ted Sens itive String s in the Java Keys to re
113
7 .7. Sto re and Res o lve Sens itive String s In Yo ur Ap p lic atio ns
116
. .hapt
C
. . . .er
. .8. .. Web,
. . . . .HT
..T
. .P. Connect
. . . . . . . .ors,
. . . .and
. . . .HT
. .T
. .P. Clust
. . . . .ering
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1.1. 9. . . . . . . . . .
8 .1. Co nfig ure a mo d _c lus ter Wo rker No d e
119
. .hapt
C
. . . .er
. .9. .. Pat
. . . ch
. . .Inst
. . . allat
. . . . ion
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1. 2. 5. . . . . . . . . .
9 .1. Ab o ut Patc hes and Up g rad es
9 .2. Ab o ut Patc hing Mec hanis ms
125
125
126
126
127
9 .4.2. Ins talling Patc hes in Zip Fo rm Us ing the Patc h Manag ement Sys tem
9 .4.3. Ro llb ac k the Ap p lic atio n o f a Patc h in Zip Fo rm Us ing the Patc h Manag ement Sys tem
128
130
132
133
134
. .art
P
. . .III.
. . Developing
. . . . . . . . . . .Secure
. . . . . . Applicat
. . . . . . . ions
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1. 36
...........
. .hapt
C
. . . .er
. .1. 0. .. Securit
. . . . . . .y. O
. .verview
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1. 37
...........
10 .1. Ab o ut Ap p lic atio n Sec urity
10 .2. Dec larative Sec urity
137
137
137
137
139
141
142
145
146
149
150
. .hapt
C
. . . .er
. .1. 1. .. Applicat
. . . . . . . .ion
. . .Securit
. . . . . . y. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1. 51
...........
11.1. Datas o urc e Sec urity
11.1.1. Ab o ut Datas o urc e Sec urity
151
151
152
152
152
152
153
153
154
156
157
157
158
158
159
16 0
16 0
16 8
16 9
170
170
170
171
172
. .hapt
C
. . . .er
. .1. 2. .. T
. .he
. . Securit
. . . . . . .y. Subsyst
. . . . . . . em
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1.7. 4. . . . . . . . . .
174
174
175
175
176
176
176
177
177
177
. .hapt
C
. . . .er
. .1. 3.
. . Aut
. . . hent
. . . . icat
. . . .ion
. . . and
. . . .Aut
. . . horiz
. . . . .at. ion
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1.7. 9. . . . . . . . . .
13.1. Kerb ero s and SPNEG O Integ ratio n
179
179
179
18 2
18 3
18 7
18 7
18 9
18 9
19 0
13.3. JAAS - Java Authentic atio n and Autho riz atio n Servic e
19 1
13.3.1. Ab o ut JAAS
13.3.2. JAAS Co re Clas s es
19 2
19 2
19 2
19 3
19 6
19 6
19 6
19 7
19 7
19 7
19 8
19 8
13.6 .2. Co nfig ure Java Autho riz atio n Co ntrac t fo r Co ntainers (JACC) Sec urity
19 9
20 0
20 0
13.6 .3.2. Co nfig ure XACML fo r Fine G rained Autho riz atio n
20 1
20 8
20 8
20 9
210
210
210
211
212
. .hapt
C
. . . .er
. .1. 4. .. Single
. . . . . . Sign
. . . . .O. n
. .(SSO
. . . . ). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2. 1. 5. . . . . . . . . .
215
215
216
216
216
218
14.6 . Ab o ut SPNEG O
219
219
14.8 . Co nfig ure Kerb ero s o r Mic ro s o ft Ac tive Direc to ry Des kto p SSO fo r Web Ap p lic atio ns
14.9 . Co nfig ure SPNEG O Fall Bac k to Fo rm Authentic atio n
219
223
. .hapt
C
. . . .er
. .1. 5.
. . Single
. . . . . . Sign. . . . .O. n
. . wit
. . .h. SAML
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2. 2. 5. . . . . . . . . .
15.1. Ab o ut Sec urity To ken Servic e (STS)
225
227
228
230
231
231
232
232
232
233
233
15.7.4. Co nfig ure Servic e Pro vid er us ing HTTP/REDIRECT Bind ing
236
239
240
241
242
. .hapt
C
. . . .er
. .1. 6. .. Login
. . . . . .Modules
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2.4. 4. . . . . . . . . .
16 .1. Us ing Mo d ules
244
244
245
246
247
250
258
259
26 0
26 3
26 3
26 4
26 5
26 5
26 6
26 7
26 8
26 9
274
. .hapt
C
. . . .er
. .1. 7. .. Role. . . . . Based
. . . . . . Securit
......y
. .in
. . Applicat
. . . . . . . ions
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2.7. 8. . . . . . . . . .
17.1. Java Authentic atio n and Autho riz atio n Servic e (JAAS)
278
17.2. Ab o ut Java Authentic atio n and Autho riz atio n Servic e (JAAS)
278
279
28 1
28 4
. .hapt
C
. . . .er
. .1. 8. .. Migrat
. . . . . .ion
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2.9. 2. . . . . . . . . .
18 .1. Co nfig ure Ap p lic atio n Sec urity Chang es
29 2
.Reference
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2. 9. 3. . . . . . . . . .
A .1. Inc lud ed Authentic atio n Mo d ules
29 3
A .2. Inc lud ed Autho riz atio n Mo d ules
319
320
A .4. Inc lud ed Sec urity Aud iting Pro vid er Mo d ules
324
324
327
. . . . . . . . .Hist
Revision
. . . ory
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .32
. . 9. . . . . . . . . .
Preface
Preface
1. Document Convent ions
This manual uses several conventions to highlight certain words and phrases and draw attention to
specific pieces of information.
Desktop
Desktop1
photos
scripts
stuff
svgs
svn
Source-code listings are also set in mo no -spaced ro man but add syntax highlighting as follows:
static int kvm_vm_ioctl_deassign_device(struct kvm *kvm,
int r = 0;
Preface
before, "
kvm_deassign_device(kvm, match);
kvm_free_assigned_device(kvm, match);
o ut:
mutex_unlock(& kvm->lock);
return r;
Note
Notes are tips, shortcuts or alternative approaches to the task at hand. Ignoring a note should
have no negative consequences, but you might miss out on a trick that makes your life easier.
Important
Important boxes detail things that are easily missed: configuration changes that only apply to
the current session, or services that need restarting before an update will apply. Ignoring a
box labeled Important will not cause data loss but may cause irritation and frustration.
Warning
Warnings should not be ignored. Ignoring warnings will most likely cause data loss.
Red Hat also hosts a large number of electronic mailing lists for discussion of Red Hat software and
technology. You can find a list of publicly available mailing lists at
https://www.redhat.com/mailman/listinfo. Click on the name of any mailing list to subscribe to that list
or to access the list archives.
10
P art I. Securit y for Red Hat JBoss Ent erprise Applicat ion Plat form 6
11
Chapter 1. Introduction
1.1. About Red Hat JBoss Ent erprise Applicat ion Plat form 6
Red Hat JBoss Enterprise Application Platform 6 (JBoss EAP 6) is a middleware platform built on
open standards and compliant with the Java Enterprise Edition 6 specification. It integrates JBoss
Application Server 7 with high-availability clustering, messaging, distributed caching, and other
technologies.
JBoss EAP 6 includes a new, modular structure that allows service enabling only when required,
improving start-up speed.
The Management Console and Management Command Line Interface make editing XML
configuration files unnecessary and add the ability to script and automate tasks.
In addition, JBoss EAP 6 includes APIs and development frameworks for quickly developing secure
and scalable Java EE applications.
Report a bug
12
13
14
A permission is the access which is granted to the code. Many permissions are provided as
part of the Java Enterprise Edition 6 (Java EE 6) specification.
Report a bug
15
Important
JBoss Enterprise Application Platform releases from 6.2.2 onwards require that the
system property jbo ss. mo d ul es. po l i cy-permi ssi o ns is set to true.
16
An application called po l i cyto o l is included with most JD K and JRE distributions, for the purpose
of creating and editing Java Security Manager security policies. D etailed information about
po l i cyto o l is linked from http://docs.oracle.com/javase/6/docs/technotes/tools/.
Pro ced u re 2.2. Set u p a n ew Java Secu rit y Man ag er Po licy
1. St art po l i cyto o l .
Start the po l i cyto o l tool in one of the following ways.
A. R ed H at En t erp rise Lin u x
From your GUI or a command prompt, run /usr/bi n/po l i cyto o l .
B. Micro so f t Win d o ws Server
Run po l i cyto o l . exe from your Start menu or from the bi n\ of your Java installation.
The location can vary.
2. C reat e a p o licy.
To create a policy, select Ad d P o l i cy Entry. Add the parameters you need, then click
D o ne.
3. Ed it an exist in g p o licy
Select the policy from the list of existing policies, and select the Ed i t P o l i cy Entry
button. Edit the parameters as needed.
4. D elet e an exist in g p o licy.
Select the policy from the list of existing policies, and select the R emo ve P o l i cy Entry
button.
Report a bug
17
command java -D java. securi ty. d ebug = hel p will produce help output with the full range of
debugging options. Setting the debug level to al l is useful when troubleshooting a security-related
failure whose cause is completely unknown, but for general use it will produce too much information.
A sensible general default is access: fai l ure.
Pro ced u re 2.3. En ab le g en eral d eb u g g in g
T h is p ro ced u re will en ab le a sen sib le g en eral level o f secu rit y- relat ed d eb u g
in f o rmat io n .
Add the following line to the server configuration file.
If the JBoss EAP 6 instance is running in a managed domain, the line is added to the
bi n/d o mai n. co nf file for Linux or the bi n\d o mai n. co nf. bat file for Windows.
If the JBoss EAP 6 instance is running as a standalone server, the line is added to the
bi n/stand al o ne. co nf file for Linux, or the bi n\stand al o ne. co nf. bat file for
Windows.
Li nux
JAVA_OPTS="$JAVA_OPTS -Djava.security.debug=access:failure"
Wi nd o ws
set "JAVA_OPTS=%JAVA_OPTS% -Djava.security.debug=access:failure"
R esu lt
A general level of security-related debug information has been enabled.
Report a bug
18
19
Run the following command to create a pointer a file named myfi l e. pro perti es, which
will contain the properties pertaining to the new role.
Note
The newly created properties file is not managed by the included ad d -user. sh and
ad d -user. bat scripts. It must be managed externally.
For a domain instance, use this command:
/host=master/core-service=management/securityrealm=MyDomainRealm/authentication=properties:add(path=myfile.prope
rties)
For a standalone instance, use this command:
/core-service=management/securityrealm=MyDomainRealm/authentication=properties:add(path=myfile.prope
rties)
R esu lt
Your new security realm is created. When you add users and roles to this new realm, the information
will be stored in a separate file from the default security realms. You can manage this new file using
your own applications or procedures.
Report a bug
20
1. St o p JB o ss EAP 6 .
Stop JBoss EAP 6 by sending an interrupt in the appropriate way for your operating system.
If you are running JBoss EAP 6 as a foreground application, the typical way to do this is to
press C trl + C .
2. R est art JB o ss EAP 6 , sp ecif yin g t h e b in d ad d ress.
Use the -b command-line switch to start JBoss EAP 6 on a specific interface.
21
EAP_HOME/bin/domain.sh -b 0.0.0.0
It is possible to edit your XML configuration file directly, to change the default bind addresses.
However, if you do this, you will no longer be able to use the -b command-line switch to specify an IP
address at runtime, so this is not recommended. If you do decide to do this, be sure to stop JBoss
EAP 6 completely before editing the XML file.
Report a bug
22
c. The So cket Bi nd i ng D ecl arati o ns screen appears. Initially, the stand ard so ckets group is shown. Choose a different group by selecting it from the combo
box on the right-hand side.
Note
If you use a standalone server, it has only one socket binding group.
The list of socket names and ports is shown, eight values per page. You can go through the
pages by using the arrow navigation below the table.
3. D et ermin e t h e p o rt s yo u n eed t o o p en .
D epending on the function of the particular port and the requirements of your environment,
some ports may need to be opened on your firewall.
4. C o n f ig u re yo u r f irewall t o f o rward t raf f ic t o JB o ss EAP 6 .
Perform these steps to configure your network firewall to allow traffic on the desired port.
a. Log into your firewall machine and access a command prompt, as the root user.
b. Issue the command system-co nfi g -fi rewal l to launch the firewall configuration
utility. A GUI or command-line utility launches, depending on the way you are logged
into the firewall system. This task makes the assumption that you are logged in via
SSH and using the command-line interface.
c. Use the T AB key on your keyboard to navigate to the C usto mi ze button, and press
the ENT ER key. The T rusted Servi ces screen appears.
d. D o not change any values, but use the T AB key to navigate to the Fo rward button,
and press ENT ER to advanced to the next screen. The O ther P o rts screen appears.
e. Use the T AB key to navigate to the <Ad d > button, and press ENT ER . The P o rt and
P ro to co l screen appears.
f. Enter 54 4 5 in the P o rt / P o rt R ang e field, then use the T AB key to move to the
P ro to co l field, and enter tcp. Use the T AB key to navigate to the O K button, and
press ENT ER .
g. Use the T AB key to navigate to the Fo rward button until you reach the P o rt
Fo rward i ng screen.
h. Use the T AB key to navigate to the <Ad d > button, and press the ENT ER key.
i. Fill in the following values to set up port forwarding for port 54 4 5.
Source interface: eth1
Protocol: tcp
Port / Port Range: 54 4 5
D estination IP address: 10 . 1. 1. 2
Port / Port Range: 54 4 5
23
Note
224.0.1.105:23364 is the default address and port for mod_cluster balancer advertising
UD P multicast.
Report a bug
24
Po rt
ajp
8009
http
8080
https
8443
jaco rb
3528
jaco rb
-ssl
3529
Mu lt ica
st Po rt
D escrip t io n
f u llso cket s
h aso cket
st an d ar
dso cket
Apache JServ
Protocol. Used for
HTTP clustering
and load balancing.
The default port for
deployed web
applications.
SSL-encrypted
connection between
deployed web
applications and
clients.
CORBA services for
JTS transactions
and other ORBdependent services.
SSL-encrypted
CORBA services.
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
No
No
25
N ame
Po rt
Mu lt ica
st Po rt
D escrip t io n
f u llso cket s
h aso cket
st an d ar
dso cket
jg ro up
sd i ag no
sti cs
7500
Yes
No
Yes
No
jg ro up
smpi ng
45700
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Multicast peer
discovery in HA
clusters using UD P.
Used for HA failure
detection over UD P.
Yes
No
Yes
No
Yes
No
Yes
No
JMS service.
Yes
Yes
No
No
Referenced by
HornetQ JMS
broadcast and
discovery groups.
Used by JMS
Remoting.
Yes
Yes
No
No
Yes
Yes
No
No
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
jg ro up
s-tcp
7600
jg ro up
s-tcpfd
jg ro up
s-ud p
57600
jg ro up
s-ud pfd
messag
i ng
messag
i ng g ro up
54200
messag
i ng thro ug
hput
mo d _cl
uster
5455
o sg i http
8090
55200
5445
23364
remo ti
4447
ng
txn4712
reco ver
yenvi ro
nment
26
45688
N ame
Po rt
txnstatusmanag e
r
4713
Mu lt ica
st Po rt
D escrip t io n
f u llso cket s
h aso cket
st an d ar
dso cket
Yes
Yes
Yes
Yes
Man ag emen t Po rt s
In addition to the socket binding groups, each host controller opens two more ports for management
purposes:
9 9 9 0 - The Web Management Console port
9 9 9 9 - The port used by the Management Console and Management API
Additionally, if HTTPS is enabled for the Management Console, 9443 is also opened as the default
port.
Report a bug
27
client generates the two-way encryption key for the SSL connection, encrypts it using the public key
of the server, and sends it back to the server. The server decrypts the two-way encryption key, using
its private key, and further communication between the two machines over this connection is
encrypted using the two-way encryption key.
Warning
Red Hat recommends that you explicitly disable SSL in favor of TLSv1.1 or TLSv1.2 in all
affected packages.
Report a bug
4 .6. Implement SSL Encrypt ion for t he JBoss EAP 6 Web Server
In t ro d u ct io n
Many web applications require an SSL-encrypted connection between clients and server, also known
as a HT T P S connection. You can use this procedure to enable HT T P S on your server or server
group.
Warning
Red Hat recommends that you explicitly disable SSL in favor of TLSv1.1 or TLSv1.2 in all
affected packages.
Prereq u isit es
A set of SSL encryption keys and an SSL encryption certificate. You may purchase these from a
certificate-signing authority, or you can generate them yourself using command-line utilities. To
generate encryption keys using utilities available on Red Hat Enterprise Linux, see Section 4.7,
Generate a SSL Encryption Key and Certificate .
The following details about your specific environment and setup:
The full directory name where the certificate files are stored.
The encryption password for your encryption keys.
Management CLI running and connected to your domain controller or standalone server.
Select appropriate cipher suites.
C ip h er Su it es
There are a number of available cryptographic primitives used as building blocks to form cipher
suites. The first table lists recommended cryptographic primitives. The second lists cryptographic
primitives which, while they may be used for compatibility with existing software, are not considered
as secure as those recommended.
28
Warning
Red Hat recommends selectively whitelisting a set of strong ciphers to use for ci pher-sui te.
Enabling weak ciphers is a significant security risk. Consult your JD K vendor's documentation
before deciding on particular cipher suites as there may be compatibility issues.
Note
This procedure uses commands appropriate for a JBoss EAP 6 configuration that uses a
managed domain. If you use a standalone server, modify Management CLI commands by
removing the /pro fi l e= d efaul t from the beginning of any management CLI commands.
Warning
Red Hat recommends that you explicitly disable SSL in favor of TLSv1.1 or TLSv1.2 in all
affected packages.
29
30
The following table describes the parameters used in the keytool command:
Paramet er
D escrip t io n
-genkeypair
-alias
-keyalg
-keystore
-storepass
-keypass
Note
D ue to an implementation limitation
this must be the same as the store
password.
--dname
When you execute the above command, you are prompted for the following information:
31
If you did not use the -storepass parameter on the command line, you are asked to
enter the keystore password. Re-enter the new password at the next prompt.
If you did not use the -keypass parameter on the command line, you are asked to enter
the key password. Press Enter to set this to the same value as the keystore password.
When the command completes, the file server. keysto re now contains the single key with
the alias jbo ss.
2. Verif y t h e key.
Verify that the key works properly by using the following command.
keytool -list -keystore server.keystore
You are prompted for the keystore password. The contents of the keystore are displayed (in
this case, a single key called jbo ss). Notice the type of the jbo ss key, which is
P ri vateKeyEntry. This indicates that the keystore contains both a public and private entry
for this key.
3. G en erat e a cert if icat e sig n in g req u est .
Run the following command to generate a certificate signing request using the public key
from the keystore you created in step 1.
keytool -certreq -keyalg RSA -alias jboss -keystore server.keystore
-file certreq.csr
You are prompted for the password in order to authenticate to the keystore. The keyto o l
command then creates a new certificate signing request called certreq . csr in the current
working directory.
4. T est t h e n ewly g en erat ed cert if icat e sig n in g req u est .
Test the contents of the certificate by using the following command.
openssl req -in certreq.csr -noout -text
The certificate details are shown.
5. O p t io n al: Su b mit yo u r cert if icat e sig n in g req u est t o a C ert if icat e Au t h o rit y ( C A) .
A Certificate Authority (CA) can authenticate your certificate so that it is considered
trustworthy by third-party clients. The CA supplies you with a signed certificate, and
optionally with one or more intermediate certificates.
6. O p t io n al: Exp o rt a self - sig n ed cert if icat e f ro m t h e keyst o re.
If you only need it for testing or internal purposes, you can use a self-signed certificate. You
can export one from the keystore you created in step 1 as follows:
keytool -export -alias jboss -keystore server.keystore -file
server.crt
32
You are prompted for the password in order to authenticate to the keystore. A self-signed
certificate, named server. crt, is created in the current working directory.
7. Imp o rt t h e sig n ed cert if icat e, alo n g wit h an y in t ermed iat e cert if icat es.
Import each certificate, in the order that you are instructed by the CA. For each certificate to
import, replace i ntermed i ate. ca or server. crt with the actual file name. If your
certificates are not provided as separate files, create a separate file for each certificate, and
paste its contents into the file.
Note
Your signed certificate and certificate keys are valuable assets. Be cautious with how
you transport them between servers.
D escrip t io n
C LI C o mman d
name
33
At t rib u t e
D escrip t io n
C LI C o mman d
verify-client
H T T P/H T T PS C o n n ect o r
/profile=default/subs
ystem=web/connector=
HTTPS/ssl=configurat
ion/:writeattribute(name=verif
y-client,value=want)
verify-depth
34
/profile=default/subs
ystem=web/connector=
HTTPS/ssl=configurat
ion/:writeattribute(name=verif
y-depth,value=10)
At t rib u t e
D escrip t io n
certificate-key-file
certificate-file
password
protocol
Warning
C LI C o mman d
/profile=default/subs
ystem=web/connector=
HTTPS/ssl=configurat
ion/:writeattribute(name=certi
ficate-keyfile,value=../domain
/configuration/serve
r.keystore)
/profile=default/subs
ystem=web/connector=
HTTPS/ssl=configurat
ion/:writeattribute(name=certi
ficatefile,value=server.cr
t)
/profile=default/subs
ystem=web/connector=
HTTPS/ssl=configurat
ion/:writeattribute(name=passw
ord,value=PASSWORD)
/profile=default/subs
ystem=web/connector=
HTTPS/ssl=configurat
ion/:writeattribute(name=proto
col,value=ALL)
/profile=default/subs
ystem=web/connector=
HTTPS/ssl=configurat
ion/:writeattribute(name=proto
col,value="TLSv1,
TLSv1.1,TLSv1.2")
35
At t rib u t e
D escrip t io n
cipher-suite
C LI C o mman d
/profile=default/subs
ystem=web/connector=
HTTPS/ssl=configurat
ion/:writeattribute(name=ciphe
r-suite,
value="TLS_RSA_WITH_
AES_128_CBC_SHA,TLS_
RSA_WITH_AES_256_CBC
_SHA")
Important
Using weak ciphers is a
significant security risk.
See
http://www.nist.gov/manu
script-publicationsearch.cfm?
pub_id=915295 for NIST
recommendations on
cipher suites.
For a list of available OpenSSL
ciphers, see
https://www.openssl.org/docs/a
pps/ciphers.html#CIPHER_STRI
NGS. Note that the following
are not supported:
@ SEC LEVEL, SUIT EB128,
SUIT EB128O NLY ,
SUIT EB19 2.
key-alias
36
/profile=default/subs
ystem=web/connector=
HTTPS/ssl=configurat
ion/:writeattribute(name=keyalias,value=KEY_ALIA
S)
At t rib u t e
D escrip t io n
truststore-type
keystore-type
ca-certificate-file
ca-certificate-password
ca-revocation-url
C LI C o mman d
/profile=default/subs
ystem=web/connector=
HTTPS/ssl=configurat
ion/:writeattribute(name=trust
storetype,value=jks)
/profile=default/subs
ystem=web/connector=
HTTPS/ssl=configurat
ion/:writeattribute(name=keyst
ore-type,value=jks)
/profile=default/subs
ystem=web/connector=
HTTPS/ssl=configurat
ion/:writeattribute(name=certi
ficatefile,value=ca.crt)
/profile=default/subs
ystem=web/connector=
HTTPS/ssl=configurat
ion/:writeattribute(name=cacertificatepassword,value=MASKE
D_PASSWORD)
/profile=default/subs
ystem=web/connector=
HTTPS/ssl=configurat
ion/:writeattribute(name=carevocationurl,value=ca.crl)
37
At t rib u t e
D escrip t io n
session-cache-size
session-timeout
C LI C o mman d
/profile=default/subs
ystem=web/connector=
HTTPS/ssl=configurat
ion/:writeattribute(name=sessi
on-cachesize,value=100)
/profile=default/subs
ystem=web/connector=
HTTPS/ssl=configurat
ion/:writeattribute(name=sessi
ontimeout,value=43200)
Report a bug
Ke y st o rage
Note that the IBM JCE does not provide a keystore. The keys are stored on the computer and do not
leave its physical boundary. If the keys are moved between computers they must be encrypted.
To run keyto o l in FIPS-compliant mode use the -pro vi d erC l ass option on each command like
this:
38
4 .9.4 . Enable FIPS 14 0-2 Crypt ography for SSL on Red Hat Ent erprise Linux 6
This task describes how to configure the web container (JBoss Web) of JBoss EAP 6 to FIPS 140-2
compliant cryptography for SSL. This task only covers the steps to do this on Red Hat Enterprise
Linux 6.
39
This task uses the Mozilla NSS library in FIPS mode for this feature.
Prereq u isit es
Red Hat Enterprise Linux 6 must already be configured to be FIPS 140-2 compliant. Refer to
https://access.redhat.com/knowledge/solutions/137833.
Pro ced u re 4 .6 . En ab le FIPS 14 0- 2 C o mp lian t C ryp t o g rap h y f o r SSL
1. C reat e t h e d at ab ase
Create the NSS database in a directory own by the jbo ss user.
$ mkdir -p /usr/share/jboss-as/nssdb
$ chown jboss /usr/share/jboss-as/nssdb
$ modutil -create -dbdir /usr/share/jboss-as/nssdb
2. C reat e N SS co n f ig u rat io n f ile
Create a new text file with the name nss_pkcsl l _fi ps. cfg in the /usr/share/jbo ss-as
directory with the following contents:
name = nss-fips
nssLibraryDirectory=/usr/lib64
nssSecmodDirectory=/usr/share/jboss-as/nssdb
nssModule = fips
The NSS configuration file must specify:
a name,
the directory where the NSS library is located, and
the directory where the NSS database was created as per step 1.
If you are not running a 64bit version of Red Hat Enterprise Linux 6 then set
nssLi braryD i recto ry to /usr/l i b instead of /usr/l i b6 4 .
3. En ab le Su n PK C S11 p ro vid er
Edit the java. securi ty configuration file for your JRE
($JAVA_HO ME/jre/l i b/securi ty/java. securi ty) and add the following line:
security.provider.1=sun.security.pkcs11.SunPKCS11
as/nss_pkcsll_fips.cfg
/usr/share/jboss-
Note that the configuration file specified in this line is the file created in step 2.
Any other securi ty. pro vi d er. X lines in this file must have the value of their X increased
by one to ensure that this provider is given priority.
4. En ab le FIPS mo d e f o r t h e N SS lib rary
Run the mo d uti l command as shown to enable FIPS mode:
modutil -fips true -dbdir /usr/share/jboss-as/nssdb
40
Note that the directory specified here is the one created in step 1.
You may get a security library error at this point requiring you to regenerate the library
signatures for some of the NSS shared objects.
5. C h an g e t h e p asswo rd o n t h e FIPS t o ken
Set the password on the FIPS token using the following command. Note that the name of the
token must be NSS FIP S 14 0 -2 C erti fi cate D B.
modutil -changepw "NSS FIP S 14 0 -2 C erti fi cate D B" -dbdir
/usr/share/jboss-as/nssdb
The password used for the FIPS token must be a FIPS compliant password.
6. C reat e cert if icat e u sin g N SS t o o ls
Enter the following command to create a certificate using the NSS tools.
certutil -S -k rsa -n jbossweb -t "u,u,u" -x -s "CN=localhost,
OU=MYOU, O=MYORG, L=MYCITY, ST=MYSTATE, C=MY" -d /usr/share/jbossas/nssdb
7. C o n f ig u re t h e H T T PS co n n ect o r t o u se t h e PK C S11 keyst o re
Add a HTTPS connector using the following command in the JBoss CLI Tool:
/subsystem=web/connector=https/:add(socketbinding=https,scheme=https,protocol=HTTP/1.1,secure=true)
Then add the SSL configuration with the following command, replacing PASSWORD with the
FIPS compliant password from step 5.
/subsystem=web/connector=https/ssl=configuration:add(name=https,pass
word=PASSWORD,keystore-type=PKCS11,
ciphersuite="SSL_RSA_WITH_3DES_EDE_CBC_SHA,SSL_DHE_RSA_WITH_3DES_EDE_CBC_
SHA,
TLS_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_DSS_WITH_AES_128_CBC_SHA,
TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA,
TLS_DHE_DSS_WITH_AES_256_CBC_SHA,TLS_DHE_RSA_WITH_AES_256_CBC_SHA,
TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA,TLS_ECDH_ECDSA_WITH_AES_128_CB
C_SHA,
TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_ECDSA_WITH_3DES_EDE_C
BC_SHA,
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_256_C
BC_SHA,
TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA,TLS_ECDH_RSA_WITH_AES_128_CBC_SH
A,
TLS_ECDH_RSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_S
HA,
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_S
41
HA,
TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA,TLS_ECDH_anon_WITH_AES_128_CBC_
SHA,
TLS_ECDH_anon_WITH_AES_256_CBC_SHA")
8. Verif y
Verify that the JVM can read the private key from the PKCS11 keystore by running the
following command:
keytool -list -storetype pkcs11
ciphersuite="SSL_RSA_WITH_3DES_EDE_CBC_SHA,SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA
,
TLS_RSA_WITH_AES_128_CBC_SHA,
TLS_DHE_DSS_WITH_AES_128_CBC_SHA,
TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA,
TLS_DHE_DSS_WITH_AES_256_CBC_SHA,TLS_DHE_RSA_WITH_AES_256_CBC_SHA,
TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA,TLS_ECDH_ECDSA_WITH_AES_128_CBC_S
HA,
TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_
SHA,
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_
SHA,
TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA,TLS_ECDH_RSA_WITH_AES_128_CBC_SHA,
TLS_ECDH_RSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA,TLS_ECDH_anon_WITH_AES_128_CBC_SHA
,
TLS_ECDH_anon_WITH_AES_256_CBC_SHA"
keystore-type="PKCS11"/>
< /connector>
Note that the ci pher-sui te attribute has linebreaks inserted to make it easier to read.
Report a bug
42
Note
HTTP access is considered to be remote, even if you connect to the localhost using HTTP.
The client sends a message to the server which includes a request to authenticate with the
local SASL mechanism.
The server generates a one-time token, writes it to a unique file, and sends a message to
the client with the full path of the file.
The client reads the token from the file and sends it to the server, verifying that it has local
access to the filesystem.
The server verifies the token and then deletes the file.
Remote clients, including local HTTP clients, use realm-based security. The default realm with the
permissions to configure the JBoss EAP 6 instance remotely using the management interfaces is
Manag ementR eal m. A script is provided which allows you to add users to this realm (or realms
you create). For more information on adding users, see the Getting Started chapter of the JBoss
EAP 6 Installation Guide. For each user, the username and a hashed password are stored in a file.
Man ag ed d o main
43
Note
Refer to the Management Interface Audit Logging section of the Administration and Configuration
Guide for more information on audit logging.
Note
Security realms can also be used for your own applications. The security realms discussed
here are specific to the management interfaces.
O u t b o u n d C o n n ect io n s
44
O u t b o u n d C o n n ect io n s
Some security realms connect to external interfaces, such as an LD AP server. An outbound
connection defines how to make this connection. A pre-defined connection type, l d apco nnecti o n, sets all of the required and optional attributes to connect to the LD AP server and verify
the credential.
For more information on how to configure LD AP authentication see Section 5.11.2, Use LD AP to
Authenticate to the Management Interfaces .
Man ag emen t In t erf aces
A management interface includes properties about how connect to and configure JBoss EAP. Such
information includes the named network interface, port, security realm, and other configurable
information about the interface. Two interfaces are included in a default installation:
http-i nterface is the configuration for the web-based Management Console.
nati ve-i nterface is the configuration for the command-line Management CLI and the RESTlike Management API.
Each of the main configurable elements of the host management subsystem are interrelated. A
security realm refers to an outbound connection, and a management interface refers to a security
realm.
Associated information can be found in Chapter 5, Secure the Management Interfaces.
Report a bug
Note
Other clients, such as JBoss Operations Network, also operate using the HTTP interface. If
you want to use these services, and simply disable the Management Console itself, you can
set the co nso l e-enabl ed attribute of the HTTP interface to fal se, instead of disabling the
interface completely.
/host=master/core-service=management/management-interface=httpinterface/:write-attribute(name=console-enabled,value=false)
To disable access to the HTTP interface, which also disables access to the web-based Management
Console, you can delete the HTTP interface altogether.
The following JBoss CLI command allows you to read the current contents of your HTTP interface, in
case you decide to add it again.
45
/ho st= master/co re-servi ce= manag ement/manag ement-i nterface= httpi nterface/: read -reso urce(recursi ve= true,pro xi es= fal se,i ncl ud erunti me= fal se,i ncl ud e-d efaul ts= true)
{
"outcome" => "success",
"result" => {
"console-enabled" => true,
"interface" => "management",
"port" => expression "${jboss.management.http.port:9990}",
"secure-port" => undefined,
"security-realm" => "ManagementRealm"
}
}
To re-enable access, issue the following commands to re-create the HTTP Interface with the default
values.
Report a bug
5.4 . Remove Silent Aut hent icat ion from t he Default Securit y Realm
Su mmary
The default installation of JBoss EAP 6 contains a method of silent authentication for a local
Management CLI user. This allows the local user the ability to access the Management CLI without
username or password authentication. This functionality is enabled as a convenience, and to assist
local users running Management CLI scripts without requiring authentication. It is considered a
useful feature given that access to the local configuration typically also gives the user the ability to
add their own user details or otherwise disable security checks.
The convenience of silent authentication for local users can be disabled where greater security
control is required. This can be achieved by removing the l o cal element within the securi tyreal m section of the configuration file. This applies to both the stand al o ne. xml for a Standalone
Server instance, or ho st. xml for a Managed D omain. You should only consider the removal of the
l o cal element if you understand the impact that it might have on your particular server
configuration.
46
The preferred method of removing silent authentication is by use of the Management CLI, which
directly removes the l o cal element visible in the following example.
Prereq u isit es
Start the JBoss EAP 6 instance.
Launch the Management CLI.
Pro ced u re 5.1. R emo ve Silen t Au t h en t icat io n f ro m t h e D ef au lt Secu rit y R ealm
R emo ve silen t au t h en t icat io n wit h t h e Man ag emen t C LI
Remove the l o cal element from the Management Realm and Application Realm as required.
Remove the l o cal element from the Management Realm.
A. Fo r St an d alo n e Servers
/core-service=management/securityrealm=ManagementRealm/authentication=local:remove
B. Fo r Man ag ed D o main s
/host=HOST_NAME/core-service=management/securityrealm=ManagementRealm/authentication=local:remove
Remove the l o cal element from the Application Realm.
A. Fo r St an d alo n e Servers
47
/core-service=management/securityrealm=ApplicationRealm/authentication=local:remove
B. Fo r Man ag ed D o main s
/host=HOST_NAME/core-service=management/securityrealm=ApplicationRealm/authentication=local:remove
R esu lt
The silent authentication mode is removed from the Manag ementR eal m and the
Appl i cati o nR eal m.
Report a bug
Note
In a managed domain the remoting connector is removed from the JMX subsystem by default.
This command is provided for your information, in case you add it during development.
Report a bug
48
The management interfaces are configured to use the Manag ementR eal m security realm by default.
The ManagementRealm stores its user password combinations in the file mg mtusers. pro perti es.
Examp le 5.9 . Sp ecif y a Secu rit y R ealm t o u se f o r t h e H T T P Man ag emen t In t erf ace
/ho st= master/co re-servi ce= manag ement/manag ement-i nterface= httpi nterface/: wri te-attri bute(name= securi ty-real m,val ue= TestRealm)
Report a bug
49
Note
This keystore must be in JKS format as the management console is not compatible with
keystores in JCEKS format.
In a terminal emulator, enter the following command. For the parameters alias, keypass,
keystore, storepass and dname, replace the example values with values of your choice.
The parameter validity specifies for how many days the key is valid. A value of 730 equals
two years.
keytool -genkeypair -alias appserver -storetype jks -keyalg RSA keysize 2048 -keypass password1 -keystore
EAP_HOME/stand al o ne/co nfi g urati o n/i d enti ty. jks -storepass
password1 -dname "CN=appserver,OU=Sales,O=Systems
Inc,L=Raleigh,ST=NC,C=US" -validity 730 -v
2. En su re t h e Man ag emen t C o n so le B in d s t o H T T PS
A. St an d alo n e Mo d e
Ensure the management console binds to HT T P S for its interface by adding the
manag ement-https configuration and removing the manag ement-http configuration.
Ensure the JBoss EAP instance is running, then enter the following management CLI
commands:
/co re-servi ce= manag ement/manag ement-i nterface= httpi nterface: wri te-attri bute(name= secure-so cket-bi nd i ng ,
val ue= manag ement-https)
/co re-servi ce= manag ement/manag ement-i nterface= httpi nterface: und efi ne-attri bute(name= so cket-bi nd i ng )
50
Note
At this point the JBoss EAP log may display the following error message. This is to
be expected because the SSL configuration is not yet completed.
JBAS015103: A secure port has been specified for the HTTP
interface but no SSL configuration in the realm.
B. D o main Mo d e
Change the socket element within the management-interface section by adding secureport and removing port configuration.
Ensure the JBoss EAP instance is running, then enter the following management CLI
commands:
/ho st= master/co re-servi ce= manag ement/manag ement-i nterface= httpi nterface: wri te-attri bute(name= secure-po rt,val ue= 9 4 4 3)
/ho st= master/co re-servi ce= manag ement/manag ement-i nterface= httpi nterface: und efi ne-attri bute(name= po rt)
Note
At this point the JBoss EAP log may display the following error message. This is to
be expected because the SSL configuration is not yet completed.
JBAS015103: A secure port has been specified for the HTTP
interface but no SSL configuration in the realm.
3. O p t io n al: C u st o m so cket - b in d in g g ro u p
If you are using a custom socket-binding group, ensure the management-https binding
is defined (it is present by default, bound to port 9 4 4 3). Edit the master configuration file - for
example stand al o ne. xml - to match the following.
<socket-binding-group name="standard-sockets" defaultinterface="public" port-offset="${jboss.socket.binding.portoffset:0}">
<socket-binding name="management-native"
interface="management"
port="${jboss.management.native.port:9999}"/>
51
<socket-binding name="management-http"
interface="management" port="${jboss.management.http.port:9990}"/>
<socket-binding name="management-https"
interface="management" port="${jboss.management.https.port:9443}"/>
4. C reat e a n ew Secu rit y R ealm
Enter the following commands to create a new security realm named
Manag ementR eal mHT T P S:
/host=master/core-service=management/securityrealm=ManagementRealmHTTPS/:add
/host=master/core-service=management/securityrealm=ManagementRealmHTTPS/authentication=properties/:add(path=Man
agementUsers.properties, relative-to=jboss.domain.config.dir)
5. C o n f ig u re Man ag emen t In t erf ace t o u se t h e n ew secu rit y realm
Enter the following commands:
/host=master/core-service=management/management-interface=httpinterface/:write-attribute(name=securityrealm,value=ManagementRealmHTTPS)
6. C o n f ig u re t h e man ag emen t co n so le t o u se t h e keyst o re.
Enter the following management CLI command. For the parameters file, password and
alias their values must be copied from the step Create a keystore to secure the management
console.
/core-service=management/securityrealm=ManagementRealmHTTPS/server-identity=ssl:add(keystorepath=identity.jks,keystore-relative-to=jboss.server.config.dir,
keystore-password=password1, alias=appserver)
The expected output from this command is:
{
"outcome" => "success",
"response-headers" => {
"operation-requires-reload" => true,
"process-state" => "reload-required"
}
}
7. R est art t h e JB o ss EAP server.
On restarting the server the log should contain the following, just before the text which states
the number of services that are started. The management console is now listening on port
9443, which confirms that the procedure was successful.
14:53:14,720 INFO [org.jboss.as] (Controller Boot Thread)
JBAS015962: Http management interface listening on
https://127.0.0.1:9443/management
52
Note
For security reasons it is recommended that you mask the keystore password. For details on
how to do this see Section 7.1, Password Vault System .
Report a bug
5.8. Use Dist inct Int erfaces for HT T P and HT T PS connect ions t o t he
Management Int erface
The Management Interface can listen on distinct interfaces for HTTP and HTTPS connections. One
scenario for this is to listen for encrypted traffic on an external network, and use unencrypted traffic
on an internal network.
The secure-i nterface attribute specifies the network interface on which the host's socket for
HTTPS management communication should be opened, if a different interface should be used from
that specified by the i nterface attribute. If it is not specified then the interface specified by the
i nterface attribute is used.
The secure-i nterface attribute has no effect if the secure-po rt attribute is not set.
Note that when the server listens for HTTP and HTTPS traffic on the same interface, HTTPS requests
received by the HTTP listener are automatically redirected to the HTTPS port. When distinct interfaces
are used for HTTP and HTTPS traffic, no redirection is performed when an HTTPS request is received
by the HTTP listener.
Here is an example EAP_HOME/d o mai n/co nfi g urati o n/ho st. xml configuration that sets the
secure-i nterface attribute to listen for HTTPS traffic on a distinct interface from HTTP traffic:
<?xml version='1.0' encoding='UTF-8'?>
<host name="master" xmlns="urn:jboss:domain:3.0">
<management>
<security-realms>
<security-realm name="ManagementRealm">
<authentication>
<local default-user="$local" />
<properties path="mgmt-users.properties" relativeto="jboss.domain.config.dir"/>
</authentication>
</security-realm>
</security-realms>
<management-interfaces>
<native-interface security-realm="ManagementRealm">
<socket interface="management"
port="${jboss.management.native.port:9999}"/>
</native-interface>
<http-interface security-realm="ManagementRealm">
<socket interface="management"
53
5.9. Using 2-way SSL for t he Management int erface and t he CLI
2-way SSL authentication, also known as client authentication, authenticates both the client and the
server using SSL certificates. This provides assurance that not only is the server who it says it is, but
the client is also who it says it is.
In this topic the following conventions are used:
HOST1
The JBoss server hostname. For example; jbo ss. red hat. co m
HOST2
A suitable name for the client. For example: mycl i ent. Note this is not necessarily an
actual hostname.
CA_HOST1
The D N (distinguished name) to use for the HOST1 certificate. For example
cn= jbo ss,d c= red hat,d c= co m.
CA_HOST2
The D N (distinguished name) to use for the HOST2 certificate. For example
cn= mycl i ent,d c= red hat,d c= co m.
Prereq u isit es
54
If you are going to use a password vault to store the keystore and truststore passwords
(recommended), the password vault should already be created. Refer to Section 7.1, Password
Vault System .
Pro ced u re 5.3.
1. Generate the stores:
keytool -genkeypair -alias HOST1_alias -keyalg RSA -keysize 1024 validity 365 -keystore host1.keystore.jks -dname "CA_HOST1" -keypass
secret -storepass secret
keytool -genkeypair -alias HOST2_alias -keyalg RSA -keysize 1024 validity 365 -keystore host2.keystore.jks -dname "CA_HOST2" -keypass
secret -storepass secret
2. Export the certificates:
keytool -exportcert -keystore HOST1.keystore.jks -alias
HOST1_alias -keypass secret -storepass secret -file HOST1.cer
keytool -exportcert -keystore HOST2.keystore.jks -alias
HOST2_alias -keypass secret -storepass secret -file HOST2.cer
3. Import the certificates into the opposing trust stores:
keytool -importcert -keystore HOST1.truststore.jks -storepass secret
-alias HOST2_alias -trustcacerts -file HOST2.cer
keytool -importcert -keystore HOST2.truststore.jks -storepass secret
-alias HOST1_alias -trustcacerts -file HOST1.cer
4. D efine a CertificateRealm in the configuration for your installation (ho st. xml or
stand al o ne. xml ) and point the interface to it:
This can be done by manually editing the configuration file (not recommended) or by using
the following commands:
/co re-servi ce= manag ement/securi ty-real m= C erti fi cateR eal m: ad d ()
/co re-servi ce= manag ement/securi ty-real m= C erti fi cateR eal m/serveri d enti ty= ssl : ad d (keysto repath= /path/to /HO ST 1. keysto re. jks,keysto re-passwo rd = secret,
al i as= HO ST 1_al i as)
/co re-servi ce= manag ement/securi tyreal m= C erti fi cateR eal m/authenti cati o n= truststo re: ad d (keysto repath= /path/to /HO ST 1. truststo re. jks,keysto re-passwo rd = secret)
55
Important
The provided commands apply to standalone mode only. For domain mode, add
/ho st= master before each command.
5. Change the security-realm of the native-interface to the new Certificate Realm.
/ho st= master/co re-servi ce= manag ement/manag ement-i nterface= nati vei nterface: wri te-attri bute(name= securi tyreal m,val ue= C erti fi cateR eal m)
6. Add the SSL configuration for the CLI, which uses EAP_HOME/bi n/jbo ss-cl i . xml as a
settings file. Either use a password vault to store the keystore and truststore passwords
(recommended), or store them in plain text:
A. To store the keystore and truststore passwords in a password vault:
Edit EAP_HOME/bi n/jbo ss-cl i . xml and add the SSL configuration (using the
appropriate values for the variables). Also add the vault configuration, replacing each
value with those of your vault.
<ssl>
<vault>
<vault-option name="KEYSTORE_URL" value="pathto/vault/vault.keystore"/>
<vault-option name="KEYSTORE_PASSWORD" value="MASK5WNXs8oEbrs"/>
<vault-option name="KEYSTORE_ALIAS" value="vault"/>
<vault-option name="SALT" value="12345678"/>
<vault-option name="ITERATION_COUNT" value="50"/>
<vault-option name="ENC_FILE_DIR" value="path-to/jbosseap/vault/"/>
</vault>
<alias>$HOST2alias</alias>
<key-store>/path/to/HOST2.keystore.jks</key-store>
<key-store-password>VAULT::VB::cli_pass::1</key-store-password>
<key-password>VAULT::VB::cli_pass::1</key-password>
<trust-store>/path/to/HOST2.truststore.jks</trust-store>
<trust-store-password>VAULT::VB::cli_pass::1</trust-storepassword>
<modify-trust-store>true</modify-trust-store>
</ssl>
B. To store the keystore and truststore passwords in plain text:
Edit EAP_HOME/bi n/jbo ss-cl i . xml and add the SSL configuration (using the
appropriate values for the variables):
<ssl>
<alias>$HOST2alias</alias>
<key-store>/path/to/HOST2.keystore.jks</key-store>
<key-store-password>secret</key-store-password>
56
<trust-store>/path/to/HOST2.truststore.jks</trust-store>
<trust-store-password>secret</trust-store-password>
<modify-trust-store>true</modify-trust-store>
</ssl>
Report a bug
5.11. LDAP
5.11.1. About LDAP
Lightweight D irectory Access Protocol (LD AP) is a protocol for storing and distributing directory
information across a network. This directory information includes information about users, hardware
devices, access roles and restrictions, and other information.
Some common implementations of LD AP include OpenLD AP, Microsoft Active D irectory, IBM Tivoli
D irectory Server, Oracle Internet D irectory, and others.
JBoss EAP 6 includes several authentication and authorization modules which allow you to use a
LD AP server as the authentication and authorization authority for your Web and EJB applications.
Report a bug
57
R eq u ired
D escrip t io n
url
yes
search-d n
no
search-cred enti al s
no
i ni ti al -co ntext-facto ry
no
securi ty-real m
no
58
59
<authentication>
</ldap>
</authentication>
< /security-realm>
Warning
It is important to ensure that you do not allow empty LD AP passwords; unless you specifically
desire this in your environment, it is a serious security concern.
EAP 6.1 includes a patch for CVE-2012-5629, which sets the allowEmptyPasswords option for
the LD AP login modules to false if the option is not already configured. For older versions, this
option should be configured manually
60
Report a bug
5.11.3. Using Out bound LDAP wit h 2-way SSL in t he Management Int erface and
CLI
JBoss EAP 6 can be configured to use an outbound connection to a LD AP server using 2-way SSL
for authentication in the Management Interface and CLI.
Prereq u isit es
An LD AP-enabled security realm must be created. See Section 5.11.2, Use LD AP to Authenticate
to the Management Interfaces for details on creating the security realm.
Pro ced u re 5.4 . C o n f ig u re O u t b o u n d LD AP wit h 2- way SSL
1. Configure the security realm keystore and truststore. The security realm must contain a
keystore configured with the key that the JBoss EAP 6 server will use to authenticate against
the LD AP server. The security realm must also contain a truststore configured with the LD AP
server's certificates. See Section 5.9, Using 2-way SSL for the Management interface and the
CLI for instructions on configuring keystores and truststores.
2. Add the outbound connection to the LD AP server, specifying the configured security realm:
/core-service=management/ldapconnection=LocalLdap:add(url="ldaps://LDAP_HOST:LDAP_PORT")
/core-service=management/ldap-connection=LocalLdap:writeattribute(name=security-realm,value="LdapSSLRealm")
3. Configure LD AP authentication within the security realm and the management interfaces as
shown in Section 5.11.2, Use LD AP to Authenticate to the Management Interfaces .
Report a bug
61
62
Chapt er 6 . Secure t he Management Int erfaces wit h Role- Based Access Cont rol
Attempting to access a resource that is not addressable will result in a reso urce no t
fo und error.
If a user attempts to write or read a resource that they can address but lack the appropriate
write or read permissions, a P ermi ssi o n D eni ed error is returned.
Report a bug
63
responsible for the physical or virtual hosts of the application server so they can ensure
that servers can be shutdown and restarted corrected when needed.
Operators cannot modify server configuration or access sensitive data or operations.
Main t ain er
The Maintainer role has access to view and modify runtime state and all configuration
except sensitive data and operations. The Maintainer role is the general purpose role that
doesn't have access to sensitive data and operation. The Maintainer role allows users to be
granted almost complete access to administer the server without giving those users access
to passwords and other sensitive information.
Maintainers cannot access sensitive data or operations.
Ad min ist rat o r
The Administrator role has unrestricted access to all resources and operations on the
server except the audit logging system. The Administrator role has access to sensitive data
and operations. This role can also configure the access control system. The Administrator
role is only required when handling sensitive data or configuring users and roles.
Administrators cannot access the audit logging system and cannot change themselves to
the Auditor or SuperUser role.
Su p erU ser
The SuperUser role has no restrictions and has complete access to all resources and
operations of the server including the audit logging system. This role is equivalent to the
administrator users of earlier versions of JBoss EAP 6 (6.0 and 6.1). If RBAC is disabled, all
management users have permissions equivalent to the SuperUser role.
D ep lo yer
The D eployer role has the same permissions as the Monitor, but can modify configuration
and state for deployments and any other resource type enabled as an application resource.
Au d it o r
The Auditor role has all the permissions of the Monitor role and can also view (but not
modify) sensitive data, and has full access to the audit logging system. The Auditor role is
the only role other than SuperUser that can access the audit logging system.
Auditors cannot modify sensitive data or resources. Only read access is permitted.
Report a bug
64
Chapt er 6 . Secure t he Management Int erfaces wit h Role- Based Access Cont rol
Monitor
Operator
Maintain
er
X
D eployer
Auditor
Administr SuperUs
ator
er
X
X
X
X
X[1]
X[1]
65
The only roles permitted to write to sensitive resources are Administrator and SuperUser.
The Auditor role is only able to read sensitive resources. No other roles have access.
Sensitivity constraint configuration is in the Management API at /co reservi ce= manag ement/access= autho ri zati o n/co nstrai nt= sensi ti vi tycl assi fi cati o n.
Vau lt Exp ressio n C o n st rain t
The Vault Expression constraint defines if reading or writing vault expressions is consider a
sensitive operation. By default both reading and writing vault expressions is a sensitive
operation.
Vault Expression constraint configuration is in the Management API at /co reservi ce= manag ement/access= autho ri zati o n/co nstrai nt= vaul t-expressi o n.
Constraints can not be configured in the Management Console at this time.
Report a bug
66
Chapt er 6 . Secure t he Management Int erfaces wit h Role- Based Access Cont rol
everything that can be done in the management console can be done there, but a number of
additional tasks can be performed with the management CLI that cannot be done with the
management console.
The following additional tasks can be performed in the CLI:
Enable and disable RBAC
Change permission combination policy
Configuring Application Resource and Resource Sensitivity Constraints
Report a bug
67
<access-control provider="rbac">
<role-mapping>
<role name="SuperUser">
<include>
<user name="$local"/>
</include>
</role>
</role-mapping>
</access-control>
</management>
Report a bug
68
Chapt er 6 . Secure t he Management Int erfaces wit h Role- Based Access Cont rol
Use the wri te-attri bute operation of the access authorization resource to set the
permi ssi o n-co mbi nati o n-po l i cy attribute to the required policy name.
/core-service=management/access=authorization:writeattribute(name=permission-combination-policy, value=POLICYNAME)
The valid policy names are rejecting and permissive.
[standalone@ localhost:9999 /] /coreservice=management/access=authorization:writeattribute(name=permission-combination-policy, value=rejecting)
{"outcome" => "success"}
[standalone@ localhost:9999 access=authorization]
If the server is offline the XML configuration can be edited to change the permission combination
policy value. To do this, edit the permi ssi o n-co mbi nati o n-po l i cy attribute of the accesscontrol element.
< access-control provider="rbac" permission-combinationpolicy="rejecting">
<role-mapping>
<role name="SuperUser">
<include>
<user name="$local"/>
</include>
</role>
</role-mapping>
< /access-control>
Report a bug
69
70
Chapt er 6 . Secure t he Management Int erfaces wit h Role- Based Access Cont rol
71
When successful, the Ad d User dialog closes, and the list of users is updated to reflect the
changes made. If unsuccessful a Fai l ed to save ro l e assi g nment message is
displayed.
Pro ced u re 6 .5. U p d at e t h e ro le assig n men t f o r a u ser
1. Login to the Management console.
2. Navigate to the U sers tab of the R o l e Assi g nment section.
3. Select user from the list.
4. Click Ed it . The selection panel enters edit mode.
72
Chapt er 6 . Secure t he Management Int erfaces wit h Role- Based Access Cont rol
b. To remove an assigned role, selected the required role from the assigned roles list on
the right and click the button with the left-facing arrow next to the assigned roles list.
The role moves from the assigned list to the available list.
c. To add an excluded role, select the required role from the list of available roles on the
left and click button with the right-facing arrow next to the excluded roles list. The role
moves from the available list to the excluded list.
d. To remove an excluded role, selected the required role from the excluded roles list on
the right and click the button with the left-facing arrow next to the excluded roles list.
The role moves from the excluded list to the available list.
5. Click Save to finish.
When successful, the edit view closes, and the list of users is updated to reflect the changes
made. If unsuccessful a Fai l ed to save ro l e assi g nment message is displayed.
Pro ced u re 6 .6 . R emo ve ro le assig n men t f o r a u ser
1. Login to the Management console.
2. Navigate to the U sers tab of the Role Assignment section.
3. Select the user from the list.
4. Click R emo ve. The R emo ve R o l e Assi g nment confirmation prompt appears.
5. Click C o n f irm.
When successful, the user will no longer appear in the list of user role assignments.
Important
Removing the user from the list of role assignments does not remove the user from the system,
nor does it guarantee that no roles will be assigned to the user. Roles might still be assigned
from group membership.
Report a bug
73
1. Use the :read-children-names operation to get a complete list of the configured roles:
/core-service=management/access=authorization:read-childrennames(child-type=role-mapping)
[standalone@ localhost:9999 access=authorization] :read-childrennames(child-type=role-mapping)
{
"outcome" => "success",
"result" => [
"Administrator",
"Deployer",
"Maintainer",
"Monitor",
"Operator",
"SuperUser"
]
}
2. Use the read -reso urce operation of a specified role-mapping to get the full details of a
specific role:
/core-service=management/access=authorization/rolemapping=ROLENAME:read-resource(recursive=true)
[standalone@ localhost:9999 access=authorization] ./rolemapping=Administrator:read-resource(recursive=true)
{
"outcome" => "success",
"result" => {
"include-all" => false,
"exclude" => undefined,
"include" => {
"user-theboss" => {
"name" => "theboss",
"realm" => undefined,
"type" => "USER"
},
"user-harold" => {
"name" => "harold",
"realm" => undefined,
"type" => "USER"
},
"group-SysOps" => {
"name" => "SysOps",
"realm" => undefined,
"type" => "GROUP"
}
}
}
}
[standalone@ localhost:9999 access=authorization]
Pro ced u re 6 .8. Ad d a n ew ro le
74
Chapt er 6 . Secure t he Management Int erfaces wit h Role- Based Access Cont rol
This procedure shows how to add a role-mapping entry for a role. This must be done before the role
can be configured.
Use the ad d operation to add a new role configuration.
/core-service=management/access=authorization/rolemapping=ROLENAME:add
ROLENAME is the name of the role that the new mapping is for.
[standalone@ localhost:9999 access=authorization] ./rolemapping=Auditor:add
{"outcome" => "success"}
[standalone@ localhost:9999 access=authorization]
Pro ced u re 6 .9 . Ad d a u ser as in clu d ed in a ro le
This procedure shows how to add a user to the included list of a role.
If no configuration for a role has been done, then a role-mapping entry for it must be done first.
Use the ad d operation to add a user entry to the includes list of the role.
/core-service=management/access=authorization/rolemapping=ROLENAME/include=ALIAS:add(name=USERNAME, type=USER)
ROLENAME is the name of the role being configured.
ALIAS is a unique name for this mapping. Red Hat recommends that you use a naming
convention for your aliases such as user-USERNAME.
USERNAME is the name of the user being added to the include list.
[standalone@ localhost:9999 access=authorization] ./rolemapping=Auditor/include=user-max:add(name=max, type=USER)
{"outcome" => "success"}
[standalone@ localhost:9999 access=authorization]
Pro ced u re 6 .10. Ad d a u ser as exclu d ed in a ro le
This procedure shows how to add a user to the excluded list of a role.
If no configuration for a role has been done, then a role-mapping entry for it must be done first.
Use the ad d operation to add a user entry to the excludes list of the role.
/core-service=management/access=authorization/rolemapping=ROLENAME/exclude=ALIAS:add(name=USERNAME, type=USER)
ROLENAME is the name of the role being configured.
USERNAME is the name of the user being added to the exclude list.
ALIAS is a unique name for this mapping. Red Hat recommends that you use a naming
convention for your aliases such as user-USERNAME.
75
76
Chapt er 6 . Secure t he Management Int erfaces wit h Role- Based Access Cont rol
Users authenticated using either the mg mt-users. pro perti es file or an LD AP server, can be
members of user groups. A user group is an arbitrary label that can be assigned to one or more
users.
The RBAC system can be configured to automatically assign roles to users depending on what user
groups they are members of. It can also exclude users from roles based on group membership.
When using the mg mt-users. pro perti es file, group information is stored in the mg mtg ro ups. pro perti es file. When using LD AP the group information is stored in the LD AP sever and
maintained by those responsible for the LD AP server.
Report a bug
77
78
Chapt er 6 . Secure t he Management Int erfaces wit h Role- Based Access Cont rol
When successful, the Ad d G ro up dialog closes, and the list of groups is updated to reflect
the changes made. If unsuccessful a Fai l ed to save ro l e assi g nment message is
displayed.
Pro ced u re 6 .14 . U p d at e a ro le assig n men t f o r a g ro u p
1. Login to the Management console.
2. Navigate to the G R O U PS tab of the Role Assignment section.
3. Select the group from the list.
4. Click Edit. The Selection view enters Edit mode.
79
To remove an assigned role, selected the required role from the assigned roles list on the
right and click the button with the left-facing arrow next to the assigned roles list. The role
moves from the assigned list to the available list.
To add an excluded role, select the required role from the list of available roles on the left
and click button with the right-facing arrow next to the excluded roles list. The role moves
from the available list to the excluded list.
To remove an excluded role, selected the required role from the excluded roles list on the
right and click the button with the left-facing arrow next to the excluded roles list. The role
moves from the excluded list to the available list.
5. Click Save to finish.
When successful, the edit view closes, and the list of groups is updated to reflect the changes
made. If unsuccessful a Failed t o save ro le assig n men t message is displayed.
Pro ced u re 6 .15. R emo ve ro le assig n men t f o r a g ro u p
1. Login to the Management console.
2. Navigate to the G R O U PS tab of the R o le Assig n men t section.
3. Select the group from the list.
4. Click R emo ve. The R emo ve R o l e Assi g nment confirmation prompt appears.
5. Click C o nfi rm.
When successful, the role will no longer appear in the list of group role assignments.
Removing the group from the list of role assignments does not remove the user group from the
system, nor does it guarantee that no roles will be assigned to members of that group. Each
group member might still have a role assigned to them directly.
Report a bug
80
Chapt er 6 . Secure t he Management Int erfaces wit h Role- Based Access Cont rol
/core-service=management/access=authorization:read-childrennames(child-type=role-mapping)
[standalone@ localhost:9999 access=authorization] :read-childrennames(child-type=role-mapping)
{
"outcome" => "success",
"result" => [
"Administrator",
"Deployer",
"Maintainer",
"Monitor",
"Operator",
"SuperUser"
]
}
2. Use the read -reso urce operation of a specified role-mapping to get the full details of a
specific role:
/core-service=management/access=authorization/rolemapping=ROLENAME:read-resource(recursive=true)
[standalone@ localhost:9999 access=authorization] ./rolemapping=Administrator:read-resource(recursive=true)
{
"outcome" => "success",
"result" => {
"include-all" => false,
"exclude" => undefined,
"include" => {
"user-theboss" => {
"name" => "theboss",
"realm" => undefined,
"type" => "USER"
},
"user-harold" => {
"name" => "harold",
"realm" => undefined,
"type" => "USER"
},
"group-SysOps" => {
"name" => "SysOps",
"realm" => undefined,
"type" => "GROUP"
}
}
}
}
[standalone@ localhost:9999 access=authorization]
Pro ced u re 6 .17. Ad d a n ew ro le
81
This procedure shows how to add a role-mapping entry for a role. This must be done before the role
can be configured.
Use the ad d operation to add a new role configuration.
/core-service=management/access=authorization/rolemapping=ROLENAME:add
[standalone@ localhost:9999 access=authorization] ./rolemapping=Auditor:add
{"outcome" => "success"}
[standalone@ localhost:9999 access=authorization]
Pro ced u re 6 .18. Ad d a G ro u p as in clu d ed in a ro le
This procedure shows how to add a Group to the included list of a role.
If no configuration for a role has been done, then a role-mapping entry for it must be done first.
Use the ad d operation to add a Group entry to the includes list of the role.
/core-service=management/access=authorization/rolemapping=ROLENAME/include=ALIAS:add(name=GROUPNAME, type=GROUP)
ROLENAME is the name of the role being configured.
GROUPNAME is the name of the group being added to the include list.
ALIAS is a unique name for this mapping. Red Hat recommends that you use a naming
convention for your aliases such as g ro up-GROUPNAME.
[standalone@ localhost:9999 access=authorization] ./rolemapping=Auditor/include=group-investigators:add(name=investigators,
type=GROUP)
{"outcome" => "success"}
[standalone@ localhost:9999 access=authorization]
Pro ced u re 6 .19 . Ad d a g ro u p as exclu d ed in a ro le
This procedure shows how to add a group to the excluded list of a role.
If no configuration for a role has been done, then a role-mapping entry for it must be created first.
Use the ad d operation to add a group entry to the excludes list of the role.
/core-service=management/access=authorization/rolemapping=ROLENAME/exclude=ALIAS:add(name=GROUPNAME, type=GROUP)
ROLENAME is the name of the role being configured
GROUPNAME is the name of the group being added to the include list
ALIAS is a unique name for this mapping. Red Hat recommends that you use a naming
convention for your aliases such as g ro up-GROUPNAME.
82
Chapt er 6 . Secure t he Management Int erfaces wit h Role- Based Access Cont rol
6.9.7. About Aut horiz at ion and Group Loading wit h LDAP
83
6.9.7. About Aut horiz at ion and Group Loading wit h LDAP
An LD AP directory contains entries for user accounts and groups, cross referenced by attributes.
D epending on the LD AP server configuration, a user entity may map the groups the user belongs to
through memberO f attributes; a group entity may map which users belong to it through
uni q ueMember attributes; or both mappings may be maintained by the LD AP server.
Users generally authenticate against the server using a simple user name. When searching for group
membership information, depending on the directory server in use, searches could be performed
using this simple name or using the distinguished name of the user's entry in the directory.
The authentication step of a user connecting to the server always happens first. Once the user is
successfully authenticated the server loads the user's groups. The authentication step and the
authorization step each require a connection to the LD AP server. The realm optimizes this process by
reusing the authentication connection for the group loading step. As will be shown within the
configuration steps below it is possible to define rules within the authorization section to convert a
user's simple user name to their distinguished name. The result of a " user name to distinguished
name mapping" search during authentication is cached and reused during the authorization query
when the fo rce attribute is set to " false" . When fo rce is true, the search is performed again during
authorization (while loading groups). This is typically done when different servers perform
authentication and authorization.
< authorization>
<ldap connection="...">
<username-to-dn force="true">
<username-is-dn />
</username-to-dn>
</group-to-principal>
</group-search>
</ldap>
< /authorization>
Important
These examples specify some attributes with their default values. This is done for
demonstration. Attributes that specify their default values are removed from the configuration
when it is persisted by the server. The exception is the fo rce attribute. It is required, even
when set to the default value of fal se.
84
Chapt er 6 . Secure t he Management Int erfaces wit h Role- Based Access Cont rol
The username-to -d n element specifies how to map the user name to the distinguished name of
their entry in the LD AP directory. This element is only required when both of the following are true:
The authentication and authorization steps are against different LD AP servers.
The group search uses the distinguished name.
1:1 u sern ame- t o - d n
This specifies that the user name entered by the remote user is the user's distinguished
name.
< username-to-dn force="false">
<username-is-dn />
< /username-to-dn>
This defines a 1:1 mapping and there is no additional configuration.
u sern ame- f ilt er
The next option is very similar to the simple option described above for the authentication
step. A specified attribute is searched for a match against the supplied user name.
< username-to-dn force="true">
85
Important
The XML must remain valid after the filter is defined so if any special characters are
used such as & ensure the proper form is used. For example & amp; for the &
character.
T he Gro up Se arch
There are two different styles that can be used when searching for group membership information.
The first style is where the user's entry contains an attribute that references the groups the user is a
member of. The second style is where the group contains an attribute referencing the users entry.
When there is a choice of which style to use Red Hat recommends that the configuration for a user's
entry referencing the group is used. This is because with this method group information can be
loaded by reading attributes of known distinguished names without having to perform any searches.
The other approach requires extensive searches to identify the groups that reference the user.
Before describing the configuration here are some LD IF examples to illustrate this.
86
Chapt er 6 . Secure t he Management Int erfaces wit h Role- Based Access Cont rol
objectClass: group
objectClass: uidObject
uid: GroupOne
distinguishedName: uid=GroupOne,ou=groups,dc=principal-togroup,dc=example,dc=org
memberOf: uid=GroupFive,ou=subgroups,ou=groups,dc=principal-togroup,dc=example,dc=org
dn: uid=GroupFive,ou=subgroups,ou=groups,dc=principal-togroup,dc=example,dc=org
objectClass: extensibleObject
objectClass: top
objectClass: groupMember
objectClass: group
objectClass: uidObject
uid: GroupFive
distinguishedName: uid=GroupFive,ou=subgroups,ou=groups,dc=principalto-group,dc=example,dc=org
87
uid: GroupFive
uniqueMember: uid=TestUserFive,ou=users,dc=group-toprincipal,dc=example,dc=org
uniqueMember: uid=GroupOne,ou=groups,dc=group-toprincipal,dc=example,dc=org
...
< /group-search>
g ro up-name: This attribute is used to specify the form that should be used for the group name
returned as the list of groups of which the user is a member. This can either be the simple form of
the group name or the group's distinguished name. If the distinguished name is required this
attribute can be set to D IST ING UISHED _NAME. D efaults to SIMP LE.
i terati ve: This attribute is used to indicate if, after identifying the groups a user is a member of,
we should also iteratively search based on the groups to identify which groups the groups are a
member of. If iterative searching is enabled we keep going until either we reach a group that is not
a member if any other groups or a cycle is detected. D efaults to fal se.
Cyclic group membership is not a problem. A record of each search is kept to prevent groups that
have already been searched from being searched again.
Important
For iterative searching to work the group entries need to look the same as user entries. The
same approach used to identify the groups a user is a member of is then used to identify the
groups of which the group is a member. This would not be possible if for group to group
membership the name of the attribute used for the cross reference changes or if the direction of
the reference changes.
g ro up-d n-attri bute: On an entry for a group which attribute is its distinguished name.
D efaults to d n.
g ro up-name-attri bute: On an entry for a group which attribute is its simple name. D efaults to
ui d .
<ldap connection="LocalLdap">
<username-to-dn>
<username-filter base-dn="ou=users,dc=principal-to-
88
Chapt er 6 . Secure t he Management Int erfaces wit h Role- Based Access Cont rol
</username-to-dn>
</group-search>
</ldap>
< /authorization>
The most important aspect of this configuration is that the pri nci pal -to -g ro up element has been
added with a single attribute.
g ro up-attri bute: The name of the attribute on the user entry that matches the distinguished
name of the group the user is a member of. D efaults to memberO f.
<ldap connection="LocalLdap">
<username-to-dn>
</username-to-dn>
</group-to-principal>
</group-search>
</ldap>
</authorization>
Here an element g ro up-to -pri nci pal is added. This element is used to define how searches for
groups that reference the user entry will be performed. The following attributes are set:
base-d n: The distinguished name of the context to use to begin the search.
recursi ve: Whether sub-contexts also be searched. D efaults to fal se.
search-by: The form of the role name used in searches. Valid values are SIMP LE and
D IST ING UISHED _NAME. D efaults to D IST ING UISHED _NAME.
Within the group-to-principal element there is a membership-filter element to define the cross reference.
pri nci pal -attri bute: The name of the attribute on the group entry that references the user
entry. D efaults to member.
Report a bug
89
90
Chapt er 6 . Secure t he Management Int erfaces wit h Role- Based Access Cont rol
91
Important
A Sco p ed R o le cannot be deleted if users or groups are assigned to it. Remove the role
assignments first, and then delete it.
1. Login to the Management Console
2. Navigate to the Sco p ed R o les area of the R o les tab.
3. Select the scoped role to be removed in the table.
4. Click the R emo ve button. The R emo ve Sco ped R o l e dialog appears.
5. Click C o n f irm.The dialog closes and the role is removed.
Report a bug
Examp le 6 .5. Make read in g syst em p ro p ert ies a sen sit ive o p erat io n
[domain@ localhost:9999 /] cd /coreservice=management/access=authorization/constraint=sensitivityclassification/type=core/classification=system-property
[domain@ localhost:9999 classification=system-property] :writeattribute(name=configured-requires-read, value=true)
{
"outcome" => "success",
92
Chapt er 6 . Secure t he Management Int erfaces wit h Role- Based Access Cont rol
What roles will be able to perform what operations depending on the configuration of these attributes
is summarized in Table 6.2, Sensitivity Constraint Configuration outcomes .
T ab le 6 .2. Sen sit ivit y C o n st rain t C o n f ig u rat io n o u t co mes
Valu e
req ui res-read
req ui res-wri te
true
Read is sensitive.
Write is sensitive.
Addressing is sensitive.
Only Aud i to r,
Ad mi ni strato r,
SuperUser can read.
Only Aud i to r,
Ad mi ni strato r,
SuperUser can address.
fal se
Report a bug
93
94
Chapt er 6 . Secure t he Management Int erfaces wit h Role- Based Access Cont rol
Important
Application Resource Constraints apply to all resources that match its configuration. For
example, It is not possible to grant a D epl o yer user access to one datasource resource but
not another. If this level of separation is required then it is recommended to configure the
resources in different server groups and create different scoped D epl o yer roles for each
group.
Report a bug
Examp le 6 .7. Makin g writ in g t o vau lt exp ressio n s a n o n sen sit ive o p erat io n
[domain@ localhost:9999 /] cd /coreservice=management/access=authorization/constraint=vault-expression
[domain@ localhost:9999 constraint=vault-expression] :writeattribute(name=configured-requires-write, value=false)
{
"outcome" => "success",
"result" => undefined,
"server-groups" => {"main-server-group" => {"host" => {"master" =>
{
"server-one" => {"response" => {"outcome" => "success"}},
"server-two" => {"response" => {"outcome" => "success"}}
}}}}
}
[domain@ localhost:9999 constraint=vault-expression] :read-resource
{
"outcome" => "success",
"result" => {
"configured-requires-read" => undefined,
"configured-requires-write" => false,
"default-requires-read" => true,
"default-requires-write" => true
}
}
[domain@ localhost:9999 constraint=vault-expression]
95
What roles will be able to read and write to vault expressions depending on this configuration is
summarized in Table 6.3, Vault Expression Constraint Configuration outcomes .
T ab le 6 .3. Vau lt Exp ressio n C o n st rain t C o n f ig u rat io n o u t co mes
Valu e
true
fal se
req ui res-read
req ui res-wri te
Mo ni to r, Ad mi ni strato r, and
SuperUser can write. D epl o yers can
also write if the vault expression is in an
Application Resource.
Report a bug
96
Chapt er 6 . Secure t he Management Int erfaces wit h Role- Based Access Cont rol
default: false
PATH: /subsystem=datasources/jdbc-driver=*
C lassif icat io n : xa- d at a- so u rce
default: false
PATH: /subsystem=datasources/xa-data-source=*
PATH: /deployment=*/subsystem=datasources/xa-data-source=*
PATH: /deployment=*/subdeployment=*/subsystem=datasources/xa-data-source=*
T yp e: lo g g in g
C lassif icat io n : lo g g er
default: false
PATH: /subsystem=logging/logger=*
PATH: /subsystem=logging/logging-profile=*/logger=*
C lassif icat io n : lo g g in g - p ro f ile
default: false
PATH: /subsystem=logging/logging-profile=*
T yp e: mail
C lassif icat io n : mail- sessio n
default: false
PATH: /subsystem=mail/mail-session=*
T yp e: n amin g
C lassif icat io n : b in d in g
default: false
PATH: /subsystem=naming/binding=*
T yp e: reso u rce- ad ap t ers
C lassif icat io n : reso u rce- ad ap t ers
default: false
PATH: /subsystem=resource-adapters/resource-adapter=*
T yp e: secu rit y
C lassif icat io n : secu rit y- d o main
default: false
PATH: /subsystem=security/security-domain=*
97
Report a bug
98
Chapt er 6 . Secure t he Management Int erfaces wit h Role- Based Access Cont rol
99
requires-write: true
PATH: / OPERATION: read-config-as-xml
C lassif icat io n : secu rit y- d o main
requires-addressable: true
requires-read: true
requires-write: true
PATH: /subsystem=security/security-domain=*
C lassif icat io n : secu rit y- d o main - ref
requires-addressable: true
requires-read: true
requires-write: true
PATH: /subsystem=datasources/xa-data-source=* ATTRIBUTE: security-domain
PATH: /subsystem=datasources/data-source=* ATTRIBUTE: security-domain
PATH: /subsystem=ejb3 ATTRIBUTE: default-security-domain
PATH: /subsystem=resource-adapters/resource-adapter=*/connection-definitions=*
ATTRIBUTE: security-domain, recovery-security-domain, security-application, securitydomain-and-application
C lassif icat io n : secu rit y- realm
requires-addressable: true
requires-read: true
requires-write: true
PATH: /core-service=management/security-realm=*
C lassif icat io n : secu rit y- realm- ref
requires-addressable: true
requires-read: true
requires-write: true
PATH: /subsystem=remoting/connector=* ATTRIBUTE: security-realm
PATH: /core-service=management/management-interface=native-interface ATTRIBUTE:
security-realm
PATH: /core-service=management/management-interface=http-interface ATTRIBUTE:
security-realm
PATH: /subsystem=remoting/remote-outbound-connection=* ATTRIBUTE: security-realm
C lassif icat io n : secu rit y- vau lt
requires-addressable: false
100
Chapt er 6 . Secure t he Management Int erfaces wit h Role- Based Access Cont rol
requires-read: false
requires-write: true
PATH: /core-service=vault
C lassif icat io n : service- co n t ain er
requires-addressable: false
requires-read: false
requires-write: true
PATH: /core-service=service-container
C lassif icat io n : sn ap sh o t s
requires-addressable: false
requires-read: false
requires-write: false
PATH: / ATTRIBUTE: take-snapshot, list-snapshots, delete-snapshot
C lassif icat io n : so cket - b in d in g - ref
requires-addressable: false
requires-read: false
requires-write: false
PATH: /subsystem=mail/mail-session=*/server=pop3 ATTRIBUTE: outbound-socketbinding-ref
PATH: /subsystem=mail/mail-session=*/server=imap ATTRIBUTE: outbound-socketbinding-ref
PATH: /subsystem=remoting/connector=* ATTRIBUTE: socket-binding
PATH: /subsystem=web/connector=* ATTRIBUTE: socket-binding
PATH: /subsystem=remoting/local-outbound-connection=* ATTRIBUTE: outboundsocket-binding-ref
PATH: /socket-binding-group=*/local-destination-outbound-socket-binding=*
ATTRIBUTE: socket-binding-ref
PATH: /subsystem=remoting/remote-outbound-connection=* ATTRIBUTE: outboundsocket-binding-ref
PATH: /subsystem=mail/mail-session=*/server=smtp ATTRIBUTE: outbound-socketbinding-ref
PATH: /subsystem=transactions ATTRIBUTE: process-id-socket-binding, status-socketbinding, socket-binding
C lassif icat io n : so cket - co n f ig
101
requires-addressable: false
requires-read: false
requires-write: true
PATH: /interface=* OPERATION: resolve-internet-address
PATH: /core-service=management/management-interface=native-interface ATTRIBUTE:
port, interface, socket-binding
PATH: /socket-binding-group=*
PATH: /core-service=management/management-interface=http-interface ATTRIBUTE:
port, secure-port, interface, secure-socket-binding, socket-binding
PATH: / OPERATION: resolve-internet-address
PATH: /subsystem=transactions ATTRIBUTE: process-id-socket-max-ports
C lassif icat io n : syst em- p ro p ert y
requires-addressable: false
requires-read: false
requires-write: true
PATH: /core-service=platform-mbean/type=runtime ATTRIBUTE: system-properties
PATH: /system-property=*
PATH: / OPERATION: resolve-expression
T yp e: d at aso u rces
C lassif icat io n : d at a- so u rce- secu rit y
requires-addressable: false
requires-read: true
requires-write: true
PATH: /subsystem=datasources/xa-data-source=* ATTRIBUTE: user-name, securitydomain, password
PATH: /subsystem=datasources/data-source=* ATTRIBUTE: user-name, securitydomain, password
T yp e: jd r
C lassif icat io n : jd r
requires-addressable: false
requires-read: false
requires-write: true
PATH: /subsystem=jdr OPERATION: generate-jdr-report
102
Chapt er 6 . Secure t he Management Int erfaces wit h Role- Based Access Cont rol
T yp e: jmx
C lassif icat io n : jmx
requires-addressable: false
requires-read: false
requires-write: true
PATH: /subsystem=jmx
T yp e: mail
C lassif icat io n : mail- server- secu rit y
requires-addressable: false
requires-read: false
requires-write: true
PATH: /subsystem=mail/mail-session=*/server=pop3 ATTRIBUTE: username, tls, ssl,
password
PATH: /subsystem=mail/mail-session=*/server=imap ATTRIBUTE: username, tls, ssl,
password
PATH: /subsystem=mail/mail-session=*/custom=* ATTRIBUTE: username, tls, ssl,
password
PATH: /subsystem=mail/mail-session=*/server=smtp ATTRIBUTE: username, tls, ssl,
password
T yp e: n amin g
C lassif icat io n : jn d i- view
requires-addressable: false
requires-read: true
requires-write: true
PATH: /subsystem=naming OPERATION: jndi-view
C lassif icat io n : n amin g - b in d in g
requires-addressable: false
requires-read: false
requires-write: false
PATH: /subsystem=naming/binding=*
T yp e: remo t in g
C lassif icat io n : remo t in g - secu rit y
requires-addressable: false
103
requires-read: true
requires-write: true
PATH: /subsystem=remoting/connector=* ATTRIBUTE: authentication-provider, securityrealm
PATH: /subsystem=remoting/remote-outbound-connection=* ATTRIBUTE: username,
security-realm
PATH: /subsystem=remoting/connector=*/security=sasl
T yp e: reso u rce- ad ap t ers
C lassif icat io n : reso u rce- ad ap t er- secu rit y
requires-addressable: false
requires-read: true
requires-write: true
PATH: /subsystem=resource-adapters/resource-adapter=*/connection-definitions=*
ATTRIBUTE: security-domain, recovery-username, recovery-security-domain, securityapplication, security-domain-and-application, recovery-password
T yp e: secu rit y
C lassif icat io n : misc- secu rit y
requires-addressable: false
requires-read: true
requires-write: true
PATH: /subsystem=security ATTRIBUTE: deep-copy-subject-mode
T yp e: web
C lassif icat io n : web - access- lo g
requires-addressable: false
requires-read: false
requires-write: false
PATH: /subsystem=web/virtual-server=*/configuration=access-log
C lassif icat io n : web - co n n ect o r
requires-addressable: false
requires-read: false
requires-write: false
PATH: /subsystem=web/connector=*
C lassif icat io n : web - ssl
104
Chapt er 6 . Secure t he Management Int erfaces wit h Role- Based Access Cont rol
requires-addressable: false
requires-read: true
requires-write: true
PATH: /subsystem=web/connector=*/configuration=ssl
C lassif icat io n : web - sso
requires-addressable: false
requires-read: true
requires-write: true
PATH: /subsystem=web/virtual-server=*/configuration=sso
C lassif icat io n : web - valve
requires-addressable: false
requires-read: false
requires-write: false
PATH: /subsystem=web/valve=*
Report a bug
105
Warning
The JCEKS keystore implementations differ between Java vendors. You must generate the
vaul t. keysto re using the keyto o l from the same vendor as the JD K you use.
Using a vault generated by the keyto o l from one vendor's JD K in an EAP instance running
on a JD K from a different vendor results in the following exception:
java.io.IOException:
com.sun.crypto.provider.SealedObjectForKeyProtector
106
Chapt er 7 . Secure Passwords and O t her Sensit ive St rings wit h Password Vault
The alias is a unique identifier for the vault or other data stored in the keystore. The
alias in the example command at the end of this procedure is vaul t. Aliases are
case-insensitive.
keyalg
The algorithm to use for encryption. The example in this procedure uses AES. Use
the documentation for your JRE and operating system to see which other choices
may be available to you.
keysiz e
The size of an encryption key impacts how difficult it is to decrypt through brute
force. The example in this procedure uses 128. For information on appropriate
values, see the documentation distributed with the keyto o l .
keyst o re
The keystore is a database which holds encrypted information and the information
about how to decrypt it. If you do not specify a keystore, the default keystore to use
is a file called . keysto re in your home directory. The first time you add data to a
keystore, it is created. The example in this procedure uses the vaul t. keysto re
keystore.
The keyto o l command has many other options. See the documentation for your JRE or
your operating system for more details.
3. D et ermin e t h e an swers t o q u est io n s t h e keysto re co mman d will ask.
The keysto re needs the following information in order to populate the keystore entry:
K eyst o re p asswo rd
When you create a keystore, you must set a password. In order to work with the
keystore in the future, you need to provide the password. Create a strong password
that you will remember. The keystore is only as secure as its password and the
security of the file system and operating system where it resides.
K ey p asswo rd ( o p t io n al)
In addition to the keystore password, you can specify a password for each key it
holds. In order to use such a key, the password needs to be given each time it is
used. Usually, this facility is not used.
First n ame ( g iven n ame) an d last n ame ( su rn ame)
This, and the rest of the information in the list, helps to uniquely identify the key and
place it into a hierarchy of other keys. It does not necessarily need to be a name at
all, but it should be two words, and must be unique to the key. The example in this
procedure uses Acco unti ng Ad mi ni strato r. In directory terms, this becomes
the common name of the certificate.
O rg an iz at io n al u n it
This is a single word that identifies who uses the certificate. It may be the
application or the business unit. The example in this procedure uses
Acco unti ng Servi ces. Typically, all keystores used by a group or application
use the same organizational unit.
O rg an iz at io n
107
R esu lt
A file named vaul t. keysto re is created in the EAP_HOME/vaul t/ directory. It stores a single key,
called vaul t, which will be used to store encrypted strings, such as passwords, for JBoss EAP 6.
Report a bug
7.3. Mask t he Keyst ore Password and Init ializ e t he Password Vault
108
Chapt er 7 . Secure Passwords and O t her Sensit ive St rings wit h Password Vault
Prereq u isit es
Section 7.2, Create a Java Keystore to Store Sensitive Strings
1. R u n t h e vaul t. sh co mman d .
Run EAP_HOME/bi n/vaul t. sh. Start a new interactive session by typing 0 .
2. En t er t h e d irect o ry wh ere en cryp t ed f iles will b e st o red .
This directory should be accessible to only limited users. At a minimum the user account
under which JBoss EAP is running requires read-write access. If you followed Section 7.2,
Create a Java Keystore to Store Sensitive Strings , your keystore is in a directory called
EAP_HOME/vaul t/.
3. En t er t h e p at h t o t h e keyst o re.
Enter the full path to the keystore file. This example uses
EAP_HOME/vaul t/vaul t. keysto re.
4. En cryp t t h e keyst o re p asswo rd .
The following steps encrypt the keystore password, so that you can use it in configuration
files and applications securely.
a. En t er t h e keyst o re p asswo rd .
When prompted, enter the keystore password.
b. En t er a salt valu e.
Enter an 8-character salt value. The salt value, together with the iteration count
(below), are used to create the hash value.
c. En t er t h e it erat io n co u n t .
Enter a number for the iteration count.
d. Make a n o t e o f t h e masked p asswo rd in f o rmat io n .
The masked password, the salt, and the iteration count are printed to standard
output. Make a note of them in a secure location. An attacker could use them to
decrypt the password.
e. En t er t h e alias o f t h e vau lt .
When prompted, enter the alias of the vault. If you followed Section 7.2, Create a
Java Keystore to Store Sensitive Strings to create your vault, the alias is vaul t.
109
D escrip t io n
KEYSTORE_URL
KEYSTORE_PASSWORD
KEYSTORE_ALIAS
SALT
ITERATION_COUNT
ENC_FILE_D IR
110
Chapt er 7 . Secure Passwords and O t her Sensit ive St rings wit h Password Vault
Note
If you use Microsoft Windows Server, in the CLI command, escape each \ character in
a directory path with an additional \ character. For example,
C : \\d ata\\vaul t\\vaul t. keysto re. This is because single \ character is used
for character escaping.
A. Man ag ed D o main
/host=YOUR_HOST/core-service=vault:add(vault-options=
[("KEYSTORE_URL" => "PATH_TO_KEYSTORE"), ("KEYSTORE_PASSWORD" =>
"MASKED_PASSWORD"), ("KEYSTORE_ALIAS" => "ALIAS"), ("SALT" =>
"SALT"),("ITERATION_COUNT" => "ITERATION_COUNT"),
("ENC_FILE_DIR" => "ENC_FILE_DIR")])
B. St an d alo n e Server
/core-service=vault:add(vault-options=[("KEYSTORE_URL" =>
"PATH_TO_KEYSTORE"), ("KEYSTORE_PASSWORD" => "MASKED_PASSWORD"),
("KEYSTORE_ALIAS" => "ALIAS"), ("SALT" => "SALT"),
("ITERATION_COUNT" => "ITERATION_COUNT"), ("ENC_FILE_DIR" =>
"ENC_FILE_DIR")])
The following is an example of the command with hypothetical values:
/core-service=vault:add(vault-options=[("KEYSTORE_URL" =>
"/home/user/vault/vault.keystore"), ("KEYSTORE_PASSWORD" => "MASK3y28rCZlcKR"), ("KEYSTORE_ALIAS" => "vault"), ("SALT" =>
"12438567"),("ITERATION_COUNT" => "50"), ("ENC_FILE_DIR" =>
"/home/user/vault/")])
R esu lt
JBoss EAP 6 is configured to decrypt masked strings using the password vault. To add strings to the
vault and use them in your configuration, refer to the following topic: Section 7.6, Store and Retrieve
Encrypted Sensitive Strings in the Java Keystore .
Report a bug
111
2. Create a module containing the class from the previous step, and specify a dependency on
o rg . pi cketbo x where the interface is Securi tyVaul t.
3. Enable the custom Password Vault in the JBoss EAP server configuration by adding the vault
element with the following attributes:
co d e
The fully qualified name of class that implements Securi tyVaul t.
mo d u le
The name of the module that contains the custom class.
Optionally, you can use vaul t-o pti o ns parameters to initialize the custom class for a
Password Vault. For example:
/coreservice=vault:add(code="custom.vault.implementation.CustomSecurity
Vault", module="custom.vault.module", vault-options=
[("KEYSTORE_URL" => "PATH_TO_KEYSTORE"), ("KEYSTORE_PASSWORD" =>
"MASKED_PASSWORD"), ("KEYSTORE_ALIAS" => "ALIAS"), ("SALT" =>
"SALT"),("ITERATION_COUNT" => "ITERATION_COUNT"), ("ENC_FILE_DIR"
=> "ENC_FILE_DIR")])
R esu lt
JBoss EAP 6 is configured to decrypt masked strings using a custom implementation of the
password vault.
Report a bug
7.6. St ore and Ret rieve Encrypt ed Sensit ive St rings in t he Java
Keyst ore
Su mmary
Including passwords and other sensitive strings in plain-text configuration files is insecure. JBoss
EAP 6 includes the ability to store and mask these sensitive strings in an encrypted keystore, and use
masked values in configuration files.
Prereq u isit es
Section 7.2, Create a Java Keystore to Store Sensitive Strings
Section 7.3, Mask the Keystore Password and Initialize the Password Vault
Section 7.4, Configure JBoss EAP 6 to Use the Password Vault
The EAP_HOME/bi n/vaul t. sh application must be accessible via a command-line interface.
Pro ced u re 7.4 . Set u p t h e Java K eyst o re
1. R u n t h e vaul t. sh co mman d .
Run EAP_HOME/bi n/vaul t. sh. Start a new interactive session by typing 0 .
112
Chapt er 7 . Secure Passwords and O t her Sensit ive St rings wit h Password Vault
Note
D o not forget to include the trailing slash on the directory name. Either use / or \,
depending on your operating system.
3. En t er t h e p at h t o t h e keyst o re.
Enter the full path to the keystore file. This example uses
EAP_HOME/vaul t/vaul t. keysto re.
4. En t er t h e keyst o re p asswo rd , vau lt n ame, salt , an d it erat io n co u n t .
When prompted, enter the keystore password, vault name, salt, and iteration count. A
handshake is performed.
5. Select t h e o p t io n t o st o re a p asswo rd .
Select option 0 to store a password or other sensitive string.
6. En t er t h e valu e.
When prompted, enter the value twice. If the values do not match, you are prompted to try
again.
7. En t er t h e vau lt b lo ck.
Enter the vault block, which is a container for attributes which pertain to the same resource.
An example of an attribute name would be d s_Exampl eD S. This will form part of the
reference to the encrypted string, in your datasource or other service definition.
8. En t er t h e at t rib u t e n ame.
Enter the name of the attribute you are storing. An example attribute name would be
passwo rd .
R esu lt
A message such as the one below shows that the attribute has been saved.
Secured attribute value has been stored in vault.
9. Make n o t e o f t h e in f o rmat io n ab o u t t h e en cryp t ed st rin g .
A message prints to standard output, showing the vault block, attribute name, shared key,
and advice about using the string in your configuration. Make note of this information in a
secure location. Example output is shown below.
113
********************************************
Vault Block:ds_ExampleDS
Attribute Name:password
Configuration should be done as follows:
VAULT::ds_ExampleDS::password::1
********************************************
10. U se t h e en cryp t ed st rin g in yo u r co n f ig u rat io n .
Use the string from the previous step in your configuration, in place of a plain-text string. A
datasource using the encrypted password above is shown below.
...
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS"
enabled="true" use-java-context="true" pool-name="H2DS">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=1</connection-url>
<driver>h2</driver>
<pool></pool>
<security>
<user-name>sa</user-name>
<password>${VAULT::ds_ExampleDS::password::1}</password>
</security>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xadatasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
...
You can use an encrypted string anywhere in your domain or standalone configuration file
where expressions are allowed.
Note
To check if expressions are allowed within a particular subsystem, run the following
CLI command against that subsystem:
/host=master/core-service=management/securityrealm=TestRealm:read-resource-description(recursive=true)
From the output of running this command, look for the value for the expressi o nsal l o wed parameter. If this is true, then you can use expressions within the
configuration of this particular subsystem.
114
Chapt er 7 . Secure Passwords and O t her Sensit ive St rings wit h Password Vault
After you store your string in the keystore, use the following syntax to replace any clear-text
string with an encrypted one.
${VAULT::VAULT_BLOCK::ATTRIBUTE_NAME::ENCRYPTED_VALUE}
Here is a sample real-world value, where the vault block is d s_Exampl eD S and the attribute
is passwo rd .
<password>${VAULT::ds_ExampleDS::password::1}</password>
Report a bug
7.7. St ore and Resolve Sensit ive St rings In Your Applicat ions
O verview
Configuration elements of JBoss EAP 6 support the ability to resolve encrypted strings against
values stored in a Java Keystore, via the Security Vault mechanism. You can add support for this
feature to your own applications.
First, add the password to the vault. Second, replace the clear-text password with the one stored in
the vault. You can use this method to obscure any sensitive string in your application.
Prereq u isit es
Before performing this procedure, make sure that the directory for storing your vault files exists. It
does not matter where you place them, as long as the user who executes JBoss EAP 6 has
permission to read and write the files. This example places the vaul t/ directory into the
/ho me/USER/vaul t/ directory. The vault itself is a file called vaul t. keysto re inside the vaul t/
directory.
115
0: Store a password
The string that will be added to the Java code is the last value of the output, the line beginning
with VAULT .
The following servlet uses the vaulted string instead of a clear-text password. The clear-text version
is commented out so that you can see the difference.
p ackage vaulterror.web;
i mport java.io.IOException;
i mport java.io.Writer;
i mport
i mport
i mport
i mport
i mport
i mport
i mport
i mport
javax.annotation.Resource;
javax.annotation.sql.DataSourceDefinition;
javax.servlet.ServletException;
javax.servlet.annotation.WebServlet;
javax.servlet.http.HttpServlet;
javax.servlet.http.HttpServletRequest;
javax.servlet.http.HttpServletResponse;
javax.sql.DataSource;
/ *@ DataSourceDefinition(
name = "java:jboss/datasources/LoginDS",
user = "sa",
116
Chapt er 7 . Secure Passwords and O t her Sensit ive St rings wit h Password Vault
password = "sa",
className = "org.h2.jdbcx.JdbcDataSource",
url = "jdbc:h2:tcp://localhost/mem:test"
) */
@ DataSourceDefinition(
name = "java:jboss/datasources/LoginDS",
user = "sa",
password = "VAULT::DS::thePass::1",
className = "org.h2.jdbcx.JdbcDataSource",
url = "jdbc:h2:tcp://localhost/mem:test"
)
@ WebServlet(name = "MyTestServlet", urlPatterns = { "/my/" },
loadOnStartup = 1)
p ublic class MyTestServlet extends HttpServlet {
@ Resource(lookup = "java:jboss/datasources/LoginDS")
private DataSource ds;
@ Override
117
Note
Where Management CLI commands are given, they assume you use a managed domain. If you
use a standalone server, remove the /pro fi l e= ful l -ha portion of the commands.
118
c. Modify the external IP address for the manag ement, publ i c and unsecure
interfaces by typing the following commands. Be sure to replace
EXT ER NAL_IP _AD D R ESS in the command with the actual external IP address of the
host.
/i nterface= manag ement: wri te-attri bute(name= i netad d ress,val ue= "${jbo ss. bi nd . ad d ress. manag ement: EXTERNAL_IP_
ADDRESS}"
/i nterface= publ i c: wri te-attri bute(name= i netad d ress,val ue= "${jbo ss. bi nd . ad d ress. publ i c: EXTERNAL_IP_ADDR
ESS}"
/i nterface= unsecure: wri te-attri bute(name= i netad d ress,val ue= "${jbo ss. bi nd . ad d ress. unsecure: EXTERNAL_IP_AD
DRESS}"
: rel o ad
You should see the following result for each command.
"outcome" => "success"
d. For hosts that participate in a managed domain but are not the master, you must
change the host name from master to a unique name. This name must be unique
across slaves and will be used for the slave to identify to the cluster, so make a note
of the name you use.
i. Start the JBoss EAP slave host using the following syntax:
bi n/d o mai n. sh --ho st-co nfi g = HOST_SLAVE_XML_FILE_NAME
For example:
bi n/d o mai n. sh --ho st-co nfi g = ho st-sl ave0 1. xml
ii. Launch the Management CLI.
iii. Use the following syntax to replace the host name:
/ho st= master: wri teattri bute(name= "name",val ue= UNIQUE_HOST_SLAVE_NAME)
For example:
/ho st= master: wri te-attri bute(name= "name",val ue= "ho stsl ave0 1")
You should see the following result.
"outcome" => "success"
This modifies the XML in the ho st-sl ave0 1. xml file as follows:
<host name="host-slave01" xmlns="urn:jboss:domain:1.6">
119
e. For newly configured hosts that need to join a managed domain, you must remove the
l o cal element and add the remo te element ho st attribute that points to the domain
controller. This step does not apply for a standalone server.
i. Start the JBoss EAP slave host using the following syntax:
bi n/d o mai n. sh --ho st-co nfi g = HOST_SLAVE_XML_FILE_NAME
For example:
bi n/d o mai n. sh --ho st-co nfi g = ho st-sl ave0 1. xml
ii. Launch the Management CLI.
iii. Use the following syntax specify the domain controller:
/ho st= UNIQ UE_HO ST _SLAVE_NAME/: wri te-remo te-d o mai nco ntro l l er(ho st= DOMAIN_CONTROLLER_IP_ADDRESS,po rt= ${jbo
ss. d o mai n. master. po rt: 9 9 9 9 },securi tyreal m= "Manag ementR eal m")
For example:
/ho st= ho st-sl ave0 1/: wri te-remo te-d o mai nco ntro l l er(ho st= "19 2. 16 8. 1. 20 0 ",po rt= ${jbo ss. d o mai n. m
aster. po rt: 9 9 9 9 },securi ty-real m= "Manag ementR eal m")
You should see the following result.
"outcome" => "success"
This modifies the XML in the ho st-sl ave0 1. xml file as follows:
<domain-controller>
<remote host="192.168.1.200"
port="${jboss.domain.master.port:9999}" securityrealm="ManagementRealm"/>
</domain-controller>
2. C o n f ig u re au t h en t icat io n f o r each slave server.
Each slave server needs a username and password created in the domain controller's or
standalone master's Manag ementR eal m. On the domain controller or standalone master,
run the EAP_HOME/bi n/ad d -user. sh command. Add a user with the same username as
the slave, to the Manag ementR eal m. When asked if this user will need to authenticate to an
external JBoss AS instance, answer yes. An example of the input and output of the command
is below, for a slave called sl ave1, with password chang eme.
user:bin user$ ./add-user.sh
What type of user do you wish to add?
a) Management User (mgmt-users.properties)
b) Application User (application-users.properties)
(a): a
120
121
a. Use the vaul t. sh script to generate a masked password. It will generate a string
like the following:
VAULT : : secret: : passwo rd : : O D VmY mJjNG MtZD U2ZC 0 0 Y mNl LWE4 O D MtZj
Q 1NWNmND U4 ZD c1T El O R V9 C UkVBS3Zhd Wx0 .
You can find more information on the vault in the Password Vaults for Sensitive
Strings section of this guide starting here: Section 7.1, Password Vault System .
b. Launch the Management CLI, using the EAP_HOME/bi n/jbo ss-cl i . sh
command in Linux or the EAP_HOME\bi n\jbo ss-cl i . bat command in
Microsoft Windows Server. Type co nnect to connect to the domain controller on
the localhost, or co nnect IP_ADDRESS to connect to a domain controller on a
remote server.
c. Specify the secret value by typing the following command. Be sure to replace the
SEC R ET _VALUE with the masked password generated in the previous step.
/co re-servi ce= manag ement/securi tyreal m= Manag ementR eal m/serveri d enti ty= secret: ad d (val ue= "${VAULT : : secret: : passwo rd : : SEC
RET_VALUE}")
: rel o ad
You should see the following result for each command.
"outcome" => "success"
Note
When creating a password in the vault, it must be specified in plain text, not
Base64-encoded.
122
Note
The password must be entered in plain text and will be visible to anyone
who issues a ps -ef command.
B. Place the password in a properties file and pass the properties file URL as a
command line argument.
i. Add the key/value pair to a properties file. For example:
server.identity.password=changeme
ii. Start the server with the command line arguments
--properties=URL_TO_PROPERTIES_FILE
.
5. R est art t h e server.
The slave will now authenticate to the master using its host name as the username and the
encrypted string as its password.
R esu lt
Your standalone server, or servers within a server group of a managed domain, are now configured
as mod_cluster worker nodes. If you deploy a clustered application, its sessions are replicated to all
cluster nodes for failover, and it can accept requests from an external Web server or load balancer.
Each node of the cluster discovers the other nodes using automatic discovery, by default.To
configure automatic discovery, and the other specific settings of the mo d _cl uster subsystem, see
Configure the mod_cluster Subsystem in the Administration and Configuration Guide. To configure the
Apache HTTP Server, see Use an External Web Server as the Web Front-end for JBoss EAP 6 Applications
in the Administration and Configuration Guide.
Report a bug
123
Important
A JBoss product installation must always only be updated using one patch method: either zip
or RPM patches. Only security and cumulative patches will be available via RPM, and
customers using an RPM installation will not be able to update using zip patches.
JBoss patches can be either an asynchronous update, or a planned update:
Asynchronous updates: individual patches which are released outside the normal update cycle of
the existing product. These may include security patches, as well as other individual patches
provided by Red Hat Global Support Services (GSS) to fix specific issues.
Planned updates: These include cumulative patches, as well as micro, minor or major upgrades
of an existing product. Cumulative patches include all previously developed updates for that
version of the product.
D eciding whether a patch is released as part of a planned update or an asynchronous update
depends on the severity of the issue being fixed. An issue of low impact is typically deferred, and is
resolved in the next cumulative patch or minor release of the affected product. Issues of moderate or
higher impact are typically addressed in order of importance as an asynchronous update to the
affected product, and contain a fix for only a specific issue.
Security updates for JBoss products are provided by an erratum (for both zip and RPM methods).
The erratum encapsulates a list of the resolved flaws, their severity ratings, the affected products,
textual description of the flaws, and a reference to the patches. Bug fix updates are not announced
via an erratum.
124
Important
It is important to note that after a patch has been applied, the jars picked up at runtime are
picked up from the
EAP_HOME/mo d ul es/system/l ayers/base/. o verl ays/$P AT C H_ID /$MO D ULE
directory. The original files are left in
EAP_HOME/mo d ul es/system/l ayers/base/$MO D ULE. The patching mechanism cripples
the original jar files for security reasons. This means that if you apply a patch which updates a
module, the original module's jar files are altered to be unusable. If the patch is rolled back,
the original files will be reverted back to a usable state. This also means that the proper
rollback procedure must be used to rollback any applied patch. See Section 9.4.3, Rollback
the Application of a Patch in Z ip Form Using the Patch Management System for the proper
rollback procedure.
For more information on how Red Hat rates JBoss security flaws, refer to: Section 9.6, Severity and
Impact Rating of JBoss Security Patches
Red Hat maintains a mailing list for notifying subscribers about security related flaws. See
Section 9.3, Subscribe to Patch Mailing Lists
Report a bug
Important
JBoss EAP 6 server instances which have been installed using the RPM method cannot be
updated using the patch management system. Refer to Section 9.5, Patching an RPM
Installation to update RPM-installed JBoss EAP 6 servers.
Note
The patch management system can only be used with patches produced for versions of JBoss
EAP 6.2 and later. For patches for versions of JBoss EAP prior to 6.2, you should instead refer
to the relevant version's documentation available at
https://access.redhat.com/site/documentation/.
In addition to applying patches, the patch management system can provide basic information on the
state of installed patches, and also provides a way to immediately rollback the application of a
patch.
When applying or rolling back a patch, the patch management system will check the modules and
other miscellaneous files that it is changing for any user modifications. If a user modification is
detected, and a conflict-handling switch has not been specified, the patch management system will
abort the operation and warn that there is a conflict. The warning will include a list of the modules
and other files that are in conflict. To complete the operation, it must be retried with a switch
specifying how to resolve the conflict: either to preserve the user modifications, or to override them.
The table below lists the arguments and switches for the Management CLI patch command.
T ab le 9 .1. patch C o mman d Arg u men t s an d Swit ch es
Arg u men t o r Swit ch
D escrip t io n
appl y
--o verri d e-al l
Applies a patch.
If there is a conflict, the patch operation
overrides any user modifications.
If there is a conflict as a result of any modified
modules, this switch overrides those
modifications with the contents of the patch
operation.
For specified miscellaneous files only, this will
override the conflicting modified files with the
files in the patch operation.
For specified miscellaneous files only, this will
preserve the conflicting modified files.
--preserve= path(,path)
126
D escrip t io n
i nfo
hi sto ry
ro l l back
--patch-i d = PATCH_ID
--reset-co nfi g urati o n= TRUE| FALSE
--ro l l back-to
Report a bug
9.4 .2. Inst alling Pat ches in Zip Form Using t he Pat ch Management Syst em
Su mmary
Patches that are in the zip format can be installed using the JBoss EAP 6 patch management system
via either the Management CLI or the Management Console.
Important
The patch management system is a feature that was added in JBoss EAP 6.2. For versions of
JBoss EAP prior to 6.2, the process to install patches in zip form is different, and you should
instead refer to the relevant version's documentation available at
https://access.redhat.com/site/documentation/.
Prereq u isit es
Valid access and subscription to the Red Hat Customer Portal.
A current subscription to a JBoss product installed in zip format.
Access to the Management CLI or the Management Console for the JBoss EAP 6 server to be
updated. Refer to Launch the Management CLI or Log in to the Management Console in the
Administration and Configuration Guide.
Warning
Before installing a patch, you should backup your JBoss product along with all customized
configuration files.
127
128
9.4 .3. Rollback t he Applicat ion of a Pat ch in Zip Form Using t he Pat ch
Management Syst em
Su mmary
The JBoss EAP 6 patch management system can be used to rollback the application of a previously
applied zip patch, via either the Management CLI or the Management Console.
Warning
Rolling back the application of a patch using the patch management system is not intended
as a general uninstall functionality. It is only intended to be used immediately after the
application of a patch which had undesirable consequences.
Important
The patch management system is a feature that was added in JBoss EAP 6.2. For versions of
JBoss EAP prior to 6.2, the process to rollback patches in zip form is different, and you should
instead refer to the relevant version's documentation available at
https://access.redhat.com/site/documentation/.
Prereq u isit es
A patch that was previously applied using the JBoss EAP 6 patch management system.
Access to the Management CLI or the Management Console for the JBoss EAP 6 server. Refer to
Launch the Management CLI or Log in to the Management Console in the Administration and
Configuration Guide.
Warning
When following either procedure, use caution when specifying the value of the R eset
C o nfi g urati o n option:
If set to T R UE, the patch rollback process will also rollback the JBoss EAP 6 server
configuration files to their pre-patch state. Any changes that were made to the JBoss EAP 6
server configuration files after the patch was applied will be lost.
If set to FALSE, the server configuration files will not be rolled back. In this situation, it is
possible that the server will not start after the rollback, as the patch may have altered
configurations, such as namespaces, which may no longer be valid and have to be fixed
manually.
129
A. For cumulative patches, the patch ID is the value of the first cumul ati ve-patch-i d
shown in the patch i nfo output.
B. Individual security or bug fix patch ID s are listed as the value of the first patches shown
in the patch i nfo output, with the most recently applied individual patch listed first.
2. From the Management CLI, rollback the patch with the appropriate patch ID from the previous
step.
[standalone@ localhost:9999 /] patch ro l l back --patch-i d = PATCH_ID -reset-co nfi g urati o n= TRUE
The patch tool will warn if there are any conflicts in attempting the rollback the patch. Refer to
Section 9.4.1, The Patch Management System for available patch command switches to rerun the command to resolve any conflicts.
3. Restart the JBoss EAP 6 server for the patch rollback to take effect:
[standalone@ localhost:9999 /] shutd o wn --restart= true
Pro ced u re 9 .5. R o llb ack a p at ch f ro m a JB o ss EAP 6 server in st an ce u sin g t h e
Man ag emen t C o n so le
1. In the Management Console:
A. For a standalone server: click on the R unti me tab at the top of the screen, then click
P atch Manag ement.
B. For a managed domain: click on the D o mai n tab at the top of the screen, select the
relevant host from the Ho st drop-down menu, then click P atch Manag ement.
2. In the R ecent P atch Hi sto ry table, select the patch that you want to rollback, then click
R o l l back.
a. For a managed domain host, on the next screen select whether to shutdown the
servers on the host, and click Next.
3. Choose your options for the rollback process, then click Next.
4. Confirm the options and the patch to be rolled back, then click Next.
a. If the O verri d e al l option was not selected and there are any conflicts in
attempting to rollback the patch, a warning will be displayed. Click Vi ew erro r
d etai l s to see the detail of the conflicts. If there is a conflict, you can either cancel
the operation, or click C ho o se O pti o ns and try the operation again with the
O verri d e al l check box selected. Overriding conflicts will result in the rollback
operation overriding any user modifications.
5. After the patch has been successfully rolled back, select whether to restart the JBoss EAP 6
server now for the changes to take effect, and click Fi ni sh.
R esu lt
The patch, and optionally also the server configuration files, are rolled back on the JBoss EAP 6
server instance.
Report a bug
130
Warning
Before installing a patch, you must backup your JBoss product along with all customized
configuration files.
1. Get notified about the security patch either via being a subscriber to the JBoss watch mailing
list or by browsing the JBoss watch mailing list archives.
2. Read the errata for the security patch and confirm that it applies to a JBoss product in your
environment.
3. If the security patch applies to a JBoss product in your environment, then follow the link to
download the updated RPM package which is included in the errata.
4. Use
yum upd ate
to install the patch.
Important
When updating an RPM installation, your JBoss product is updated cumulatively with
all RPM-released fixes.
R esu lt
The JBoss product is patched with the latest update using the RPM format.
Report a bug
131
9.6. Severit y and Impact Rat ing of JBoss Securit y Pat ches
To communicate the risk of each JBoss security flaw, Red Hat uses a four-point severity scale of low,
moderate, important and critical, in addition to Common Vulnerability Scoring System (CVSS)
version 2 base scores which can be used to identify the impact of the flaw.
T ab le 9 .2. Severit y R at in g s o f JB o ss Secu rit y Pat ch es
Severit y
D escrip t io n
Critical
Important
Moderate
Low
The impact component of a CVSS v2 score is based on a combined assessment of three potential
impacts: Confidentiality (C), Integrity (I) and Availability (A). Each of these can be rated as None (N),
Partial (P) or Complete (C).
Because the JBoss server process runs as an unprivileged user and is isolated from the host
operating system, JBoss security flaws are only rated as having impacts of either None (N) or Partial
(P).
132
The example below shows a CVSS v2 impact score, where exploiting the flaw would have no
impact on system confidentiality, partial impact on system integrity and complete impact on system
availability (that is, the system would become completely unavailable for any use, for example, via
a kernel crash).
C : N/I: P /A: C
Combined with the severity rating and the CVSS score, organizations can make informed decisions
on the risk each issue places on their unique environment and schedule upgrades accordingly.
For more information about CVSS2, please see: CVSS2 Guide.
Report a bug
133
Report a bug
134
135
136
Both Enterprise Java Beans (EJBs) and servlets can declare one or more <security-role-ref>
elements.
137
Note
This fragment is an example only. In deployments, the elements in this section must contain
role names and links relevant to the EJB deployment.
< web-app>
<servlet>
<servlet-name>AServlet</servlet-name>
...
<security-role-ref>
<role-name>TheServletRole</role-name>
<role-link>TheApplicationRole</role-link>
</security-role-ref>
</servlet>
...
< /web-app>
Report a bug
138
Alternatively, the application assembler can use the <run-as> or <role-name> child element to specify
that a specific security role supplied by the <role-name> element value must be used as the security
identity for method invocations made by the EJB.
Note that this does not change the caller's identity as seen by the
EJBC o ntext. g etC al l erP ri nci pal () method. Rather, the caller's security roles are set to the
single role specified by the <run-as> or <role-name> element value.
One use case for the <run-as> element is to prevent external clients from accessing internal EJBs.
You configure this behavior by assigning the internal EJB <method-permission> elements, which
restrict access to a role never assigned to an external client. EJBs that must in turn use internal EJBs
are then configured with a <run-as> or <role-name> equal to the restricted role. The following
descriptor fragment describes an example<security-identity> element usage.
< ejb-jar>
<enterprise-beans>
<session>
<ejb-name>ASessionBean</ejb-name>
<security-identity>
<use-caller-identity/>
</security-identity>
</session>
<session>
<ejb-name>RunAsBean</ejb-name>
<security-identity>
<run-as>
<role-name>InternalRole</role-name>
</run-as>
</security-identity>
</session>
</enterprise-beans>
< session>
<ejb-name>RunAsBean</ejb-name>
<security-identity>
<run-as-principal>internal</run-as-principal>
</security-identity>
< /session>
The <run-as> element is also available in servlet definitions in a web. xml file. The following
example shows how to assign the role Internal R o l e to a servlet:
139
<servlet>
<servlet-name>AServlet</servlet-name>
<!-- ... -->
<run-as>
<role-name>InternalRole</role-name>
</run-as>
</servlet>
Calls from this servlet are associated with the anonymous pri nci pal . The <run-as-principal>
element is available in the jbo ss-web. xml file to assign a specific principal to go along with the
run-as role. The following fragment shows how to associate a principal named i nternal to the
servlet above.
<servlet>
<servlet-name>AServlet</servlet-name>
<run-as-principal>internal</run-as-principal>
</servlet>
Report a bug
Examp le 10.3. An ejb - jar.xml d escrip t o r f rag men t t h at illu st rat es t h e secu rit y- ro le
elemen t u sag e.
<assembly-descriptor>
<security-role>
14 0
<role-name>TheApplicationRole</role-name>
</security-role>
</assembly-descriptor>
< /ejb-jar>
Examp le 10.4 . An examp le web .xml d escrip t o r f rag men t t h at illu st rat es t h e secu rit yro le elemen t u sag e.
<role-name>TheApplicationRole</role-name>
</security-role>
< /web-app>
Report a bug
14 1
declare that no one should have access to a method that has the excl ud e-l i st element. If an EJB
has methods that have not been declared as accessible by a role using a metho d -permi ssi o n
element, the EJB methods default to being excluded from use. This is equivalent to defaulting the
methods into the excl ud e-l i st.
< method>
<ejb-name>EJBNAME</ejb-name>
<method-name>*</method-name>
< /method>
The second style is used for referring to a specified method of the home or component interface of the
named enterprise bean:
<method>
<ejb-name>EJBNAME</ejb-name>
<method-name>METHOD</method-name>
</method>
If there are multiple methods with the same overloaded name, this style refers to all of the overloaded
14 2
methods.
The third style is used to refer to a specified method within a set of methods with an overloaded name:
< method>
<ejb-name>EJBNAME</ejb-name>
<method-name>METHOD</method-name>
<method-params>
<method-param>PARAMETER_1</method-param>
<method-param>PARAMETER_N</method-param>
</method-params>
< /method>
The method must be defined in the specified enterprise bean's home or remote interface. The methodparam element values are the fully qualified name of the corresponding method parameter type. If
there are multiple methods with the same overloaded signature, the permission applies to all of the
matching overloaded methods.
The optional metho d -i ntf element can be used to differentiate methods with the same name and
signature that are defined in both the home and remote interfaces of an enterprise bean.
Example 10.5, An ejb-jar.xml descriptor fragment that illustrates the method-permission element
usage. provides complete examples of the metho d -permi ssi o n element usage.
Examp le 10.5. An ejb - jar.xml d escrip t o r f rag men t t h at illu st rat es t h e met h o d p ermissio n elemen t u sag e.
< ejb-jar>
<assembly-descriptor>
<method-permission>
<role-name>employee</role-name>
<role-name>temp-employee</role-name>
<method>
<ejb-name>EmployeeService</ejb-name>
<method-name>*</method-name>
</method>
</method-permission>
<method-permission>
<role-name>employee</role-name>
<method>
<ejb-name>AardvarkPayroll</ejb-name>
<method-name>findByPrimaryKey</method-name>
</method>
<method>
<ejb-name>AardvarkPayroll</ejb-name>
<method-name>getEmployeeInfo</method-name>
14 3
</method>
<method>
<ejb-name>AardvarkPayroll</ejb-name>
<method-name>updateEmployeeInfo</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
</method-permission>
<method-permission>
<description>The admin role may access any method of the
EmployeeServiceAdmin bean </description>
<role-name>admin</role-name>
<method>
<ejb-name>EmployeeServiceAdmin</ejb-name>
<method-name>*</method-name>
</method>
</method-permission>
<method-permission>
<description>Any authenticated user may access any method
of the
EmployeeServiceHelp bean</description>
<unchecked/>
<method>
<ejb-name>EmployeeServiceHelp</ejb-name>
<method-name>*</method-name>
</method>
</method-permission>
<exclude-list>
<method>
<ejb-name>EmployeeFiring</ejb-name>
<method-name>fireTheCTO</method-name>
</method>
</exclude-list>
</assembly-descriptor>
< /ejb-jar>
Report a bug
14 4
@DeclareRoles
D eclares each security role declared in the code. For information about configuring roles,
refer to the Java EE 6 Tutorial Specifying Authorized Users by D eclaring Security Roles.
@RolesAllowed, @PermitAll, an d @DenyAll
Specifies method permissions for annotations. For information about configuring
annotation method permissions, refer to the Java EE 6 Tutorial Specifying Authorized Users
by D eclaring Security Roles.
@RunAs
Configures the propagated security identity of a component. For information about
configuring propagated security identities using annotations, refer to the Java EE 6 Tutorial
Propagating a Security Identity (Run-As).
Report a bug
14 5
14 6
The optional <login-config> element is used to configure the authentication method that should be
used, the realm name that should be used for the application, and the attributes that are needed by
the form login mechanism.
< web-app>
<security-constraint>
<web-resource-collection>
<web-resource-name>Secure Content</web-resource-name>
<url-pattern>/restricted/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>AuthorizedUser</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
14 7
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
<security-role>
<role-name>AuthorizedUser</role-name>
</security-role>
< /web-app>
Report a bug
Authentication Requests
Each session is identified by a session ID , a 16 byte string generated from random values.
These values are retrieved from /d ev/urand o m (Linux) by default, and hashed with MD 5.
Checks are performed at session ID creation to ensure that the ID created is unique.
Once verified, the session ID is assigned as part of a cookie, and then returned to the client. This
cookie is expected in subsequent client requests and is used to identify the user session.
The cookie passed to the client is a name value pair with several optional attributes. The identifier
attribute is called JSESSIO NID . Its value is a hex-string of the session ID . This cookie is configured
to be non-persistent. This means that on the client side it will be deleted when the browser exits. On
14 8
the server side, sessions expire after 30 minutes of inactivity, at which time session objects and their
credential information are deleted.
Say a user attempts to access a web application that is protected with form-based authentication.
Fo rmAuthenti cato r caches the request, creates a new session if necessary, and redirects the user
to the login page defined in l o g i n-co nfi g . (In the previous example code, the login page is
l o g i n. html .) The user then enters their user name and password in the HTML form provided. User
name and password are passed to Fo rmAuthenti cato r via the j_securi ty_check form action.
The Fo rmAuthenti cato r then authenticates the user name and password against the realm
attached to the web application context. In JBoss Enterprise Application Platform, the realm is
JBo ssWebR eal m. When authentication is successful, Fo rmAuthenti cato r retrieves the saved
request from the cache and redirects the user to their original request.
Note
The server recognizes form authentication requests only when the URI ends with
/j_securi ty_check and at least the j_username and j_passwo rd parameters exist.
Report a bug
14 9
150
Report a bug
< ejb-jar>
<enterprise-beans>
<session>
<ejb-name>ASessionBean</ejb-name>
<!-- ... -->
<security-identity>
<use-caller-identity/>
</security-identity>
</session>
<!-- ... -->
</enterprise-beans>
< /ejb-jar>
< ejb-jar>
<enterprise-beans>
151
<session>
<ejb-name>RunAsBean</ejb-name>
<!-- ... -->
<security-identity>
<run-as>
<role-name>InternalRole</role-name>
</run-as>
</security-identity>
</session>
</enterprise-beans>
<!-- ... -->
< /ejb-jar>
By default, when you use <run-as>, a principal named ano nymo us is assigned to outgoing
calls. To assign a different principal, uses the <run-as-pri nci pal >.
< session>
<ejb-name>RunAsBean</ejb-name>
<security-identity>
<run-as-principal>internal</run-as-principal>
</security-identity>
< /session>
See also :
Section 11.2.1.1, About EJB Security Identity
Section A.6, EJB Security Parameter Reference
Report a bug
152
< method-permission>
<description>The employee and temp-employee roles may access any
method
of the EmployeeService bean </description>
<role-name>employee</role-name>
<role-name>temp-employee</role-name>
<method>
<ejb-name>EmployeeService</ejb-name>
<method-name>*</method-name>
</method>
< /method-permission>
< method-permission>
<description>The employee role may access the findByPrimaryKey,
getEmployeeInfo, and the updateEmployeeInfo(String) method of
the AcmePayroll bean </description>
<role-name>employee</role-name>
<method>
<ejb-name>AcmePayroll</ejb-name>
<method-name>findByPrimaryKey</method-name>
</method>
<method>
<ejb-name>AcmePayroll</ejb-name>
<method-name>getEmployeeInfo</method-name>
</method>
<method>
<ejb-name>AcmePayroll</ejb-name>
<method-name>updateEmployeeInfo</method-name>
<method-params>
153
<method-param>java.lang.String</method-param>
</method-params>
</method>
< /method-permission>
< method-permission>
<description>Any authenticated user may access any method of the
EmployeeServiceHelp bean</description>
<unchecked/>
<method>
<ejb-name>EmployeeServiceHelp</ejb-name>
<method-name>*</method-name>
</method>
< /method-permission>
Examp le 11.8. C o mp let ely exclu d e sp ecif ic EJB met h o d s f ro m b ein g u sed
< exclude-list>
<description>No fireTheCTO methods of the EmployeeFiring bean may be
used in this deployment</description>
<method>
<ejb-name>EmployeeFiring</ejb-name>
<method-name>fireTheCTO</method-name>
</method>
< /exclude-list>
Examp le 11.9 . A co mp let e <assembl y-d escri pto r> co n t ain in g several <metho d permi ssi o n> b lo cks
< ejb-jar>
<assembly-descriptor>
<method-permission>
<role-name>employee</role-name>
<role-name>temp-employee</role-name>
<method>
<ejb-name>EmployeeService</ejb-name>
<method-name>*</method-name>
</method>
</method-permission>
<method-permission>
154
findByPrimaryKey,
<role-name>employee</role-name>
<method>
<ejb-name>AcmePayroll</ejb-name>
<method-name>findByPrimaryKey</method-name>
</method>
<method>
<ejb-name>AcmePayroll</ejb-name>
<method-name>getEmployeeInfo</method-name>
</method>
<method>
<ejb-name>AcmePayroll</ejb-name>
<method-name>updateEmployeeInfo</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
</method-permission>
<method-permission>
<role-name>admin</role-name>
<method>
<ejb-name>EmployeeServiceAdmin</ejb-name>
<method-name>*</method-name>
</method>
</method-permission>
<method-permission>
EmployeeServiceHelp bean</description>
<unchecked/>
<method>
<ejb-name>EmployeeServiceHelp</ejb-name>
<method-name>*</method-name>
</method>
</method-permission>
<exclude-list>
<method>
<ejb-name>EmployeeFiring</ejb-name>
<method-name>fireTheCTO</method-name>
</method>
</exclude-list>
</assembly-descriptor>
< /ejb-jar>
Report a bug
155
@ Stateless
@ RolesAllowed({"admin"})
@ SecurityDomain("other")
p ublic class WelcomeEJB implements Welcome {
156
@ PermitAll
public String WelcomeEveryone(String msg) {
return "Welcome to " + msg;
}
@ RunAs("tempemployee")
public String GoodBye(String msg) {
}
In this code, all roles can access method Wel co meEveryo ne. The G o o d Bye method uses the
tempempl o yee role when making calls. Only the ad mi n role can access method
G o o d byeAd mi n, and any other methods with no security annotation.
Report a bug
Warning
Red Hat recommends that you explicitly disable SSL in favor of TLSv1.1 or TLSv1.2 in all
affected packages.
JBoss Remoting also provides automatic discovery via Multicast or JND I.
It is used by many of the subsystems within JBoss EAP 6, and also enables you to design,
implement, and deploy services that can be remotely invoked by clients over several different
transport mechanisms. It also allows you to access existing services in JBoss EAP 6.
D at a Marsh allin g
157
The Remoting system also provides data marshalling and unmarshalling services. D ata marshalling
refers to the ability to safely move data across network and platform boundaries, so that a separate
system can perform work on it. The work is then sent back to the original system and behaves as
though it were handled locally.
Arch it ect u re O verview
When you design a client application which uses Remoting, you direct your application to
communicate with the server by configuring it to use a special type of resource locator called an
Invo kerLo cato r, which is a simple String with a URL-type format. The server listens for requests for
remote resources on a co nnecto r, which is configured as part of the remo ti ng subsystem. The
co nnecto r hands the request off to a configured ServerInvo cati o nHand l er. Each
ServerInvo cati o nHand l er implements a method i nvo ke(Invo cati o nR eq uest), which
knows how to handle the request.
The JBoss Remoting framework contains three layers that mirror each other on the client and server
side.
JB o ss R emo t in g Framewo rk Layers
The user interacts with the outer layer. On the client side, the outer layer is the C l i ent class,
which sends invocation requests. On the server side, it is the InvocationHandler, which is
implemented by the user and receives invocation requests.
The transport is controlled by the invoker layer.
The lowest layer contains the marshaller and unmarshaller, which convert data formats to wire
formats.
Report a bug
158
Pu ll C allb acks
For a pull callback, your client adds itself to the server's list of listeners using the
C l i ent. ad d Li stener() method. It then polls the server periodically for synchronous delivery of
callback data. This poll is performed using the C l i ent. g etC al l backs().
Pu sh C allb ack
A push callback requires your client application to run its own InvocationHandler. To do this, you
need to run a Remoting service on the client itself. This is referred to as a callback server. The
callback server accepts incoming requests asynchronously and processes them for the requester (in
this case, the server). To register your client's callback server with the main server, pass the callback
server's Invo kerLo cato r as the second argument to the ad d Li stener method.
Report a bug
Note
The Remoting subsystem configuration is not exposed to the web-based Management
Console, but it is fully configurable from the command-line based Management CLI. Editing the
XML by hand is not recommended.
Ad ap t in g t h e C LI C o mman d s
159
The CLI commands are formulated for a managed domain, when configuring the d efaul t profile. To
configure a different profile, substitute its name. For a standalone server, omit the
/pro fi l e= d efaul t part of the command.
C o n f ig u rat io n O u t sid e t h e R emo t in g Su b syst em
There are a few configuration aspects which are outside of the remo ti ng subsystem:
N et wo rk In t erf ace
The network interface used by the remo ti ng subsystem is the unsecure interface defined
in the d o mai n/co nfi g urati o n/d o mai n. xml or
stand al o ne/co nfi g urati o n/stand al o ne. xml .
< interfaces>
<interface name="management"/>
<interface name="public"/>
<interface name="unsecure"/>
< /interfaces>
The per-host definition of the unsecure interface is defined in the ho st. xml in the same
directory as the d o mai n. xml or stand al o ne. xml . This interface is also used by several
other subsystems. Exercise caution when modifying it.
< interfaces>
<interface name="management">
<inet-address
value="${jboss.bind.address.management:127.0.0.1}"/>
</interface>
<interface name="public">
<inet-address value="${jboss.bind.address:127.0.0.1}"/>
</interface>
<interface name="unsecure">
<inet-address
value="${jboss.bind.address.unsecure:127.0.0.1}"/>
</interface>
< /interfaces>
so cket - b in d in g
The default socket-binding used by the remo ti ng subsystem binds to TCP port 4777. Refer
to the documentation about socket bindings and socket binding groups for more
information if you need to change this.
R emo t in g C o n n ect o r R ef eren ce f o r EJB
The EJB subsystem contains a reference to the remoting connector for remote method
invocations. The following is the default configuration:
160
Wo rker T h read Po o l
The worker thread pool is the group of threads which are available to process work which comes in
through the Remoting connectors. It is a single element <wo rker-thread -po o l >, and takes several
attributes. Tune these attributes if you get network timeouts, run out of threads, or need to limit
memory usage. Specific recommendations depend on your specific situation. Contact Red Hat
Global Support Services for more information.
T ab le 11.1. Wo rker T h read Po o l At t rib u t es
At t rib u t e
D escrip t io n
C LI C o mman d
read-threads
write-threads
task-keepalive
task-max-threads
161
At t rib u t e
D escrip t io n
C LI C o mman d
task-core-threads
task-limit
C o n n ect o r
The connector is the main Remoting configuration element. Multiple connectors are allowed. Each
consists of a element <co nnecto r> element with several sub-elements, as well as a few possible
attributes. The default connector is used by several subsystems of JBoss EAP 6. Specific settings for
the elements and attributes of your custom connectors depend on your applications, so contact Red
Hat Global Support Services for more information.
T ab le 11.2. C o n n ect o r At t rib u t es
At t rib u t e
D escrip t io n
C LI C o mman d
socket-binding
authentication-provider
security-realm
D escrip t io n
C LI C o mman d
sasl
N/A
162
At t rib u t e
D escrip t io n
C LI C o mman d
properties
O u t b o u n d C o n n ect io n s
You can specify three different types of outbound connection:
Outbound connection to a URI.
Local outbound connection connects to a local resource such as a socket.
Remote outbound connection connects to a remote resource and authenticates using a security
realm.
All of the outbound connections are enclosed in an <o utbo und -co nnecti o ns> element. Each of
these connection types takes an o utbo und -so cket-bi nd i ng -ref attribute. The outboundconnection takes a uri attribute. The remote outbound connection takes optional username and
securi ty-real m attributes to use for authorization.
T ab le 11.4 . O u t b o u n d C o n n ect io n Elemen t s
At t rib u t e
D escrip t io n
outbound-connection
local-outbound-connection
remote-outbound-connection
C LI C o mman d
SASL Elemen t s
Before defining the SASL child elements, you need to create the initial SASL element. Use the
following command:
/profile=default/subsystem=remoting/connector=remotingconnector/security=sasl:add
163
The child elements of the SASL element are described in the table below.
At t rib u t e
D escrip t io n
include-mechanisms
qop
strength
reuse-session
server-auth
policy
164
C LI C o mman d
/profile=default/subs
ystem=remoting/conne
ctor=remotingconnector/security=s
asl:writeattribute(name=inclu
de-mechanisms,value=
["DIGEST","PLAIN","G
SSAPI"])
/profile=default/subs
ystem=remoting/conne
ctor=remotingconnector/security=s
asl:writeattribute(name=qop,v
alue=["auth"])
/profile=default/subs
ystem=remoting/conne
ctor=remotingconnector/security=s
asl:writeattribute(name=stren
gth,value=
["medium"])
/profile=default/subs
ystem=remoting/conne
ctor=remotingconnector/security=s
asl:writeattribute(name=reuse
-session,value=false)
/profile=default/subs
ystem=remoting/conne
ctor=remotingconnector/security=s
asl:writeattribute(name=serve
r-auth,value=false)
At t rib u t e
An
enclosing
D escrip
t io n element which
contains zero or more of the
following elements, which each
take a single val ue.
forward-secrecy whether
mechanisms are required to
implement forward secrecy
(breaking into one session
will not automatically
provide information for
breaking into future
sessions)
no-active whether
mechanisms susceptible to
non-dictionary attacks are
permitted. A value of fal se
permits, and true denies.
no-anonymous whether
mechanisms that accept
anonymous login are
permitted. A value of fal se
permits, and true denies.
no-dictionary whether
mechanisms susceptible to
passive dictionary attacks
are allowed. A value of
fal se permits, and true
denies.
no-plain-text whether
mechanisms which are
susceptible to simple plain
passive attacks are allowed.
A value of fal se permits,
and true denies.
pass-credentials whether
mechanisms which pass
client credentials are
allowed.
C LI
C o mman d
/profile=default/subs
ystem=remoting/conne
ctor=remotingconnector/security=s
asl/saslpolicy=policy:add
/profile=default/subs
ystem=remoting/conne
ctor=remotingconnector/security=s
asl/saslpolicy=policy:writeattribute(name=forwa
rdsecrecy,value=true)
/profile=default/subs
ystem=remoting/conne
ctor=remotingconnector/security=s
asl/saslpolicy=policy:writeattribute(name=noactive,value=false)
/profile=default/subs
ystem=remoting/conne
ctor=remotingconnector/security=s
asl/saslpolicy=policy:writeattribute(name=noanonymous,value=fals
e)
/profile=default/subs
ystem=remoting/conne
ctor=remotingconnector/security=s
asl/saslpolicy=policy:writeattribute(name=nodictionary,value=tru
e)
/profile=default/subs
ystem=remoting/conne
ctor=remotingconnector/security=s
asl/sasl-
165
At t rib u t e
D escrip t io n
policy=policy:writeC LI
C o mman d
attribute(name=noplaintext,value=false)
/profile=default/subs
ystem=remoting/conne
ctor=remotingconnector/security=s
asl/saslpolicy=policy:writeattribute(name=passcredentials,value=tr
ue)
properties
/profile=default/subs
ystem=remoting/conne
ctor=remotingconnector/security=s
asl/property=myprop:
add(value=1)
/profile=default/subs
ystem=remoting/conne
ctor=remotingconnector/security=s
asl/property=myprop2
:add(value=2)
This example contains many hypothetical values, and is presented to put the elements and
attributes discussed previously into context.
<sasl>
166
<policy>
</policy>
<properties>
</properties>
</sasl>
<properties>
</properties>
</connector>
<outbound-connections>
<outbound-connection name="my-outbound-connection"
uri="http://myhost:7777/"/>
<remote-outbound-connection name="my-remote-connection"
outbound-socket-binding-ref="my-remote-socket" username="myUser"
security-realm="ApplicationRealm"/>
</outbound-connections>
< /subsystem>
167
remote.connection.default.username=appuser
remote.connection.default.password=apppassword
Create a custom Remoting connector on the domain or standalone server, which uses your new
security realm.
D eploy your EJB to the server group which is configured to use the profile with the custom
Remoting connector, or to your standalone server if you are not using a managed domain.
Report a bug
Note
The newly created properties file is not managed by the included ad d -user. sh and
ad d -user. bat scripts. It must be managed externally.
For a domain instance, use this command:
/host=master/core-service=management/securityrealm=MyDomainRealm/authentication=properties:add(path=myfile.prope
rties)
For a standalone instance, use this command:
/core-service=management/securityrealm=MyDomainRealm/authentication=properties:add(path=myfile.prope
rties)
168
R esu lt
Your new security realm is created. When you add users and roles to this new realm, the information
will be stored in a separate file from the default security realms. You can manage this new file using
your own applications or procedures.
Report a bug
Warning
Red Hat recommends that you explicitly disable SSL in favor of TLSv1.1 or TLSv1.2 in all
affected packages.
Report a bug
169
Su mmary
RESTEasy supports the @RolesAllowed, @PermitAll, and @D enyAll annotations on JAX-RS
methods. However, it does not recognize these annotations by default. Follow these steps to
configure the web. xml file and enable role-based security.
Warning
D o not activate role-based security if the application uses EJBs. The EJB container will
provide the functionality, instead of RESTEasy.
Pro ced u re 11.1. En ab le R o le- B ased Secu rit y f o r a R EST Easy JAX- R S Web Service
1. Open the web. xml file for the application in a text editor.
2. Add the following <context-param> to the file, within the web-app tags:
<context-param>
<param-name>resteasy.role.based.security</param-name>
<param-value>true</param-value>
</context-param>
3. D eclare all roles used within the RESTEasy JAX-RS WAR file, using the <security-role> tags:
<security-role>
<role-name>ROLE_NAME</role-name>
</security-role>
<security-role>
<role-name>ROLE_NAME</role-name>
</security-role>
4. Authorize access to all URLs handled by the JAX-RS runtime for all roles:
<security-constraint>
<web-resource-collection>
<web-resource-name>Resteasy</web-resource-name>
<url-pattern>/PATH</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>ROLE_NAME</role-name>
<role-name>ROLE_NAME</role-name>
</auth-constraint>
</security-constraint>
R esu lt
Role-based security has been enabled within the application, with a set of defined roles.
170
<context-param>
<param-name>resteasy.role.based.security</param-name>
<param-value>true</param-value>
</context-param>
<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<security-constraint>
<web-resource-collection>
<web-resource-name>Resteasy</web-resource-name>
<url-pattern>/security</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
<role-name>user</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<role-name>admin</role-name>
</security-role>
<security-role>
<role-name>user</role-name>
</security-role>
</web-app>
Report a bug
171
172
<authentication>
<module-option name="password-stacking"
value="useFirstPass"/>
</login-module>
<module-option name="usersProperties"
value="${jboss.domain.config.dir}/application-users.properties"/>
<module-option name="rolesProperties"
value="${jboss.domain.config.dir}/application-roles.properties"/>
173
<module-option name="realm"
value="ApplicationRealm"/>
<module-option name="password-stacking"
value="useFirstPass"/>
</login-module>
</authentication>
</security-domain>
<authorization>
</authorization>
</security-domain>
<authorization>
</authorization>
</security-domain>
</security-domains>
<vault>
...
</vault>
< /subsystem>
The <securi ty-manag ement>, <subject-facto ry> and <securi ty-pro perti es> elements
are not present in the default configuration. The <subject-facto ry> and <securi typro perti es> elements have been deprecated in JBoss EAP 6.1 onwards.
Report a bug
174
Contains names and values of properties which are set on the java.security.Security class.
Report a bug
175
/profile=full/subsystem=security/:write-attribute(name=deep-copysubject-mode,value=TRUE)
Report a bug
176
Report a bug
177
178
flag="requisite">
<module-option name="password-stacking"
value="useFirstPass"/>
<module-option name="serverSecurityDomain"
value="host"/>
</login-module>
179
<property name="java.security.krb5.realm"
value="MY_REALM"/>
</system-properties>
3. C o n f ig u re Web Ap p licat io n
It is not possible to override the authenticators, but it is possible to add the
Neg o ti ati o nAuthenti cato r as a valve to your jboss-web.xml descriptor to configure the
web application.
Note
The valve requires the securi ty-co nstrai nt and l o g i n-co nfi g to be defined in
the web.xml file as this is used to decide which resources are secured. However, the
chosen auth-metho d is overridden by this authenticator.
180
Report a bug
13.1.3. Configure JBoss Negot iat ion for Microsoft Windows Domain
This section describes how to configure the accounts required for JBoss Negotiation to be used
when JBoss EAP is running on a Microsoft Windows server, which is a part of the Active D irectory
domain.
In this section, the hostname that is used to access the server as is referred to as {ho stname}, realm
is referred to as {real m}, domain is referred to as {d o mai n}, and the server hosting the JBoss EAP
instance is referred to as {machi ne_name}.
Pro ced u re 13.2. C o n f ig u re JB o ss N eg o t iat io n f o r Micro so f t Win d o ws D o main
1. C lear Exist in g Service Prin cip al Map p in g s
On a Microsoft Windows network some mappings are created automatically. D elete the
automatically created mappings to map the identity of the server to the service principal for
negotiation to take place correctly. The mapping enables the web browser on the client
computer to trust the server and attempt SPNEGO. The client computer verifies with the
domain controller for a mapping in the form of HT T P {ho stname}.
The following are the steps to delete the existing mappings:
List the mapping registered with the domain for the computer using the command, setspn
-L {machi ne_name}.
D elete the existing mappings using the commands, setspn -D HT T P /{ho stname}
{machi ne_name} and setspn -D ho st/{ho stname} {machi ne_name}.
2. Create a host user account.
Note
Ensure the host user name is different from the {machi ne_name}.
In the rest of the section the host user name is referred to as {user_name}.
3. D ef in e t h e map p in g b et ween t h e {user_name} an d {ho stname}.
Run the following command to configure the Service Principal Mapping, ktpass -pri nc
HT T P /{ho stname}@ {real m} -pass * -mapuser {d o mai n}\{user_name}.
Enter the password for the user name when prompted.
Note
Reset the password for the user name as it is a prerequisite for exporting the keytab.
Verify the mapping by running the following command, setspn -L {user_name}
4. Exp o rt t h e keyt ab o f t h e u ser t o t h e server o n wh ich EAP JB o ss is in st alled .
181
Run the following command to export the keytab, ktab -k servi ce. keytab -a
HT T P /{ho stname}@ {real m}.
Note
This command exports the ticket for the HTTP/{hostname} principal to the keytab
servi ce. keytab, which is used to configure the host security domain on JBoss.
5. D efine the principal within the security domain as follows:
<module-option name="principal">HTTP/{hostname}@ {realm}</moduleoption>
Report a bug
13.1.4 . Kerberos Aut hent icat ion for Picket Link IDP
The following sections explain how to set up Kerberos authentication for PicketLink ID P.
Pro ced u re 13.3. In st all JB o ss EAP 6 an d set u p K erb ero s
1. D ownload and install JBoss EAP 6. Refer to installation instructions in the Installation Guide.
2. Whether you are using Oracle Java or IBM Java, you must use unlimited JCE. Without
unlimited JCE, the JBoss server cannot negotiate on the proper SPNEGO mechanism type
(using 1.3.6.1.5.2.5, which is G SS_IAKER B_MEC HANISM).
3. Use the example below to configure JBoss to use your desired Java version.
e xport JAVA_HOME=JDK/JRE_directory
Pro ced u re 13.4 . T est yo u r K erb ero s set u p u sin g JB o ss N eg o t iat io n T o o lkit
1. Use the JBoss Negotiation Toolkit available at Github
2. Modify the configuration files and use the mvn cl ean i nstal l command to build the
project.
3. Copy the file jbo ss-neg o ti ati o n-to o l ki t/targ et/jbo ss-neg o ti ati o nto o l ki t. war to $JBO SS_HO ME/stand al o ne/d epl o yments/.
4. Verify that all the three sections pass through the JBoss Negotiation Toolkit.
Pro ced u re 13.5. Set u p Picket Lin k ID P
C h an g es t o i d p. war
The example provided uses the i d p. war and empl o yee. war archives, which can be located in the
PicketLink Quickstarts repository. Modify the files in i d p. war as described below.
1. Add o rg . jbo ss. securi ty. neg o ti ati o n module to
$JBO SS_HO ME/stand al o ne/d epl o yments/i d p. war/MET A-INF/jbo ssd epl o yment-structure. xml because ID P is using the JBoss Negotiation module.
182
<jboss-deployment-structure>
<deployment>
<dependencies>
</dependencies>
</deployment>
</jboss-deployment-structure>
2. Add an additional valve
o rg . jbo ss. securi ty. neg o ti ati o n. Neg o ti ati o nAuthenti cato r for SPNEGO to
$JBO SS_HO ME/stand al o ne/d epl o yments/i d p. war/WEB-INF/jbo ss-web. xml .
3. Change securi ty-d o mai n from i d p to SP NEG O in
$JBO SS_HO ME/stand al o ne/d epl o yments/i d p. war/WEB-INF/jbo ss-web. xml as
follows:
< jboss-web>
<security-domain>SPNEGO</security-domain>
<context-root>idp</context-root>
<valve>
<classname>org.picketlink.identity.federation.bindings.tomcat.idp.IDPWebB
rowserSSOValve</class-name>
<param>
<param-name>passUserPrincipalToAttributeManager</paramname>
<param-value>true</param-value>
</param>
</valve>
<valve>
<classname>org.jboss.security.negotiation.NegotiationAuthenticator</class
-name>
</valve>
< /jboss-web>
4. Add or change the security-role added to your principal by Kerberos server setup to
$JBO SS_HO ME/stand al o ne/d epl o yments/i d p. war/WEB-INF/web. xml .
5. Modify the file $JBO SS_HO ME/stand al o ne/d epl o yments/i d p. war/WEBINF/pi cketl i nk. xml as follows:
< PicketLink xmlns="urn:picketlink:identity-federation:config:2.1">
<PicketLinkIDP xmlns="urn:picketlink:identityfederation:config:2.1">
<IdentityURL>${idp.url::http://localhost:8080/idp/}</IdentityURL>
<Trust>
<Domains>redhat.com,localhost,amazonaws.com</Domains>
</Trust>
</PicketLinkIDP>
<Handlers xmlns="urn:picketlink:identityfederation:handler:config:2.1">
183
<Handler
class="org.picketlink.identity.federation.web.handlers.saml2.SAML2Is
suerTrustHandler" />
<Handler
class="org.picketlink.identity.federation.web.handlers.saml2.SAML2Lo
gOutHandler" />
<Handler
class="org.picketlink.identity.federation.web.handlers.saml2.SAML2A
uthenticationHandler" />
<Handler
class="org.picketlink.identity.federation.web.handlers.saml2.RolesG
enerationHandler" />
</Handlers>
<!-- The configuration bellow defines a token timeout and a clock
skew. Both configurations will be used during the SAML Assertion
creation. This configuration is optional. It is defined only to
show you how to set the token timeout and clock skew configuration.
-->
<PicketLinkSTS xmlns="urn:picketlink:identityfederation:config:1.0" TokenTimeout="5000" ClockSkew="0">
<TokenProviders>
<TokenProvider
ProviderClass="org.picketlink.identity.federation.core.saml.v1.prov
iders.SAML11AssertionTokenProvider"
TokenType="urn:oasis:names:tc:SAML:1.0:assertion"
TokenElement="Assertion"
TokenElementNS="urn:oasis:names:tc:SAML:1.0:assertion" />
<TokenProvider
ProviderClass="org.picketlink.identity.federation.core.saml.v2.prov
iders.SAML20AssertionTokenProvider"
TokenType="urn:oasis:names:tc:SAML:2.0:assertion"
TokenElement="Assertion"
TokenElementNS="urn:oasis:names:tc:SAML:2.0:assertion" />
</TokenProviders>
</PicketLinkSTS>
< /PicketLink>
6. Change Id enti tyUR L to match the host name of server you are running ID P on.
7. Change T rust to contain the domain names trusted by the Identity Provider.
8. Modify the empl o yee. war. Add or change security-roles added to your principal by
Kerberos server setup to
$JBO SS_HO ME/stand al o ne/d epl o yments/empl o yee. war/WEB-INF/web. xml .
9. Modify the securi ty d o mai n configuration in the file
$JBO SS_HO ME/stand al o ne/co nfi g urati o n/stand al o ne. xml . Role mapping
configuration is the same as that in normal security domain configurations.
< security-domain name="host" cache-type="default">
<authentication>
<module-option name="principal"
value="HTTP/something.com@ yourdomain.COM"/>
<module-option
184
name="storeKey" value="true"/>
</login-module>
</authentication>
< /security-domain>
< security-domain name="SPNEGO" cache-type="default">
<authentication>
</login-module>
</authentication>
< /security-domain>
< security-domain name="sp" cache-type="default">
<authentication>
<login-module
code="org.picketlink.identity.federation.bindings.jboss.auth.SAML2L
oginModule"
flag="required" />
</authentication>
< /security-domain>
Note
In case of using IBM JD K, options for Kerberos module are different. You must set the system
property jbo ss. securi ty. d i sabl e. secd o mai n. o pti o n to true. Refer to
Section 13.2.2, Configure Authentication in a Security D omain for details. Update the login
module to the following:
Pro ced u re 13.6 . Verif y K erb ero s au t h en t icat io n set u p f o r Picket Lin k ID P
1. Start JBoss EAP server using $JBO SS_HO ME/bi n/stand al o ne. sh.
2. Setup your Kerberos system. There are a number of ways to do so. For example, using one of
the following options:
FreeIPA: there are multiple configuration options. You must choose the one that is suitable
to your setup.
ApacheD S
185
3. Setup your browser, for example Firefox, to use Kerberos. Follow the instructions provided
here: https://access.redhat.com/documentation/enUS/Red_Hat_Enterprise_Linux/5/html/D eployment_Guide/sso-config-firefox.html
4. Verify that you are able to access the http: //Y O UR _D O MAIN: 80 80 /empl o yee from
Firefox configured as mentioned above.
Report a bug
186
Export the client's certificate and create a truststore by importing this certificate:
keytool -exportcert -keystore client.keystore -storetype pkcs12 storepass change_it -alias client -keypass change_it -file
client.keystore
keytool -import -file client.keystore -alias client -keystore
client.truststore
4. C h an g e t h e JB o ss EAP 6 .3 Server In st allat io n t o En ab le SSL
Add the following connector to the web subsystem to enable SSL:
<connector name="https" protocol="HTTP/1.1" scheme="https" socketbinding="https" enable-lookups="false" secure="true">
<ssl name="localhost-ssl" key-alias="server" password="change_it"
certificate-key-file="${jboss.server.config.dir}/server.keystore"
protocol="TLSv1"
verify-client="want"
ca-certificatefile="${jboss.server.config.dir}/client.truststore"/>
</connector>
5. R est art t h e Server
Restart the server and verify that it is responding on: https://localhost:8443
6. T ru st t h e C ert if icat e
You will be prompted to trust the server certificate.
C o n f ig u re t h e C lien t C ert if icat e in yo u r B ro wser
Before accessing the application, you must import the cl i ent. keysto re to your browser. This file
holds the client certificate. When you access the application, the browser prompts you to select the
certificate you need to use to authenticate with the server. Select the desired certificate.
Secu rit y D o main C o n f ig u rat io n
Add the following security domain to your server installation. If you're in standalone mode, you must
add it to the JBO SS_HO ME/stand al o ne/co nfi g urati o n/stand al o ne. xml :
<security-domain name="idp" cache-type="default">
<authentication>
<login-module code="CertificateRoles" flag="optional">
<module-option name="password-stacking" value="useFirstPass"/>
<module-option name="securityDomain" value="idp"/>
<module-option name="verifier"
value="org.jboss.security.auth.certs.AnyCertVerifier"/>
</login-module>
<login-module
code="org.picketlink.identity.federation.bindings.jboss.auth.RegExUserNam
eLoginModule" flag="optional">
<module-option name="regex" value="CN=(.*?),"/>
</login-module>
187
< login-module
code="org.picketlink.identity.federation.bindings.jboss.auth.RegExUserN
ameLoginModule" flag="required">
<module-option name="password-stacking" value="useFirstPass"/>
<module-option name="regex" value="UID=(.*?),"/>
< /login-module>
For further details about regular expressions, see java. uti l . reg ex. P attern class
documentation at http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html.
Report a bug
188
JBoss EAP 6 uses a pluggable system of authentication modules to provide flexibility and integration
with the authentication systems you already use in your organization. Each security domain
contains one or more configured authentication modules. Each module includes additional
configuration parameters to customize its behavior. The easiest way to configure the authentication
subsystem is within the web-based management console.
Authentication is not the same as authorization, although they are often linked. Many of the included
authentication modules can also handle authorization.
Report a bug
D et ails
required
189
Flag
D et ails
requisite
sufficient
optional
4. Ed it au t h en t icat io n set t in g s
After you have added your module, you can modify its C o d e or Fl ag s by clicking Ed i t in
the D etai l s section of the screen. Be sure the Attri butes tab is selected.
5. O p t io n al: Ad d o r remo ve mo d u le o p t io n s.
If you need to add options to your module, click its entry in the Lo g i n Mo d ul es list, and
select the Mo d ul e O pti o ns tab in the D etai l s section of the page. Click the Ad d button,
and provide the key and value for the option. Use the R emo ve button to remove an option.
R esu lt
Your authentication module is added to the security domain, and is immediately available to
applications which use the security domain.
T h e jbo ss. securi ty. securi ty_d o mai n Mo d u le O p t io n
By default, each login module defined in a security domain has the
jbo ss. securi ty. securi ty_d o mai n module option added to it automatically. This option
causes problems with login modules which check to make sure that only known options are defined.
The IBM Kerberos login module, co m. i bm. securi ty. auth. mo d ul e. Krb5Lo g i nMo d ul e is one
of these.
You can disable the behavior of adding this module option by setting the system property to true
when starting JBoss EAP 6. Add the following to your start-up parameters.
-Djboss.security.disable.secdomain.option=true
You can also set this property using the web-based Management Console. In a standalone server,
you can set system properties in the P ro fi l e section of the configuration. In a managed domain,
you can set system properties for each server group.
Report a bug
13.3. JAAS - Java Aut hent icat ion and Aut horiz at ion Service
190
191
D uring the authentication process, a subject is populated with associated identities, or principals. A
subject may have many principals. For example, a person may have a name principal (John D oe), a
social security number principal (123-45-6789), and a user name principal (johnd), all of which help
distinguish the subject from other subjects. To retrieve the principals associated with a subject, two
methods are available:
192
you can plug different login modules into an application without changing the application itself. The
following code shows the steps required by an application to authenticate a subject.
lc.login();
System.out.println("authentication failed");
e.printStackTrace();
lc.logout();
} catch(LoginException e) {
System.out.println("logout failed");
e.printStackTrace();
implements CallbackHandler
{
IOException, UnsupportedCallbackException
NameCallback nc = (NameCallback)callbacks[i];
nc.setName(username);
PasswordCallback pc = (PasswordCallback)callbacks[i];
pc.setPassword(password);
} else {
"Unrecognized
Callback");
}
D evelopers integrate with an authentication technology by creating an implementation of the
Lo g i nMo d ul e interface. This allows an administrator to plug different authentication technologies
into an application. You can chain together multiple Lo g i nMo d ul es to allow for more than one
authentication technology to participate in the authentication process. For example, one
Lo g i nMo d ul e may perform user name/password-based authentication, while another may interface
to hardware devices such as smart card readers or biometric authenticators.
193
The life cycle of a Lo g i nMo d ul e is driven by the Lo g i nC o ntext object against which the client
creates and issues the login method. The process consists of two phases. The steps of the process
are as follows:
The Lo g i nC o ntext creates each configured Lo g i nMo d ul e using its public no-arg
constructor.
Each Lo g i nMo d ul e is initialized with a call to its initialize method. The Subject argument is
guaranteed to be non-null. The signature of the initialize method is: publ i c vo i d
i ni ti al i ze(Subject subject, C al l backHand l er cal l backHand l er, Map
shared State, Map o pti o ns)
The l o g i n method is called to start the authentication process. For example, a method
implementation might prompt the user for a user name and password and then verify the
information against data stored in a naming service such as NIS or LD AP. Alternative
implementations might interface to smart cards and biometric devices, or simply extract user
information from the underlying operating system. The validation of user identity by each
Lo g i nMo d ul e is considered phase 1 of JAAS authentication. The signature of the l o g i n
method is bo o l ean l o g i n() thro ws Lo g i nExcepti o n . A Lo g i nExcepti o n indicates
failure. A return value of true indicates that the method succeeded, whereas a return value of false
indicates that the login module should be ignored.
If the Lo g i nC o ntext's overall authentication succeeds, co mmi t is invoked on each
Lo g i nMo d ul e. If phase 1 succeeds for a Lo g i nMo d ul e, then the commit method continues
with phase 2 and associates the relevant principals, public credentials, and/or private credentials
with the subject. If phase 1 fails for a Lo g i nMo d ul e, then co mmi t removes any previously
stored authentication state, such as user names or passwords. The signature of the co mmi t
method is: bo o l ean co mmi t() thro ws Lo g i nExcepti o n . Failure to complete the commit
phase is indicated by throwing a Lo g i nExcepti o n. A return of true indicates that the method
succeeded, whereas a return of false indicates that the login module should be ignored.
If the Lo g i nC o ntext's overall authentication fails, then the abo rt method is invoked on each
Lo g i nMo d ul e. The abo rt method removes or destroys any authentication state created by the
login or initialize methods. The signature of the abo rt method is bo o l ean abo rt() thro ws
Lo g i nExcepti o n . Failure to complete the abo rt phase is indicated by throwing a
Lo g i nExcepti o n. A return of true indicates that the method succeeded, whereas a return of
false indicates that the login module should be ignored.
To remove the authentication state after a successful login, the application invokes l o g o ut on
the Lo g i nC o ntext. This in turn results in a l o g o ut method invocation on each
Lo g i nMo d ul e. The l o g o ut method removes the principals and credentials originally
associated with the subject during the co mmi t operation. Credentials should be destroyed upon
removal. The signature of the l o g o ut method is: bo o l ean l o g o ut() thro ws
Lo g i nExcepti o n . Failure to complete the logout process is indicated by throwing a
Lo g i nExcepti o n. A return of true indicates that the method succeeded, whereas a return of
false indicates that the login module should be ignored.
When a Lo g i nMo d ul e must communicate with the user to obtain authentication information, it uses
a C al l backHand l er object. Applications implement the CallbackHandler interface and pass it to
the Lo g i nC o ntext, which send the authentication information directly to the underlying login
modules.
Login modules use the C al l backHand l er both to gather input from users, such as a password or
smart card PIN, and to supply information to users, such as status information. By allowing the
application to specify the C al l backHand l er, underlying Lo g i nMo d ul es remain independent
from the different ways applications interact with users. For example, a C al l backHand l er's
194
implementation for a GUI application might display a window to solicit user input. On the other hand,
a C al l backHand l er implementation for a non-GUI environment, such as an application server,
might simply obtain credential information by using an application server API. The CallbackHandler
interface has one method to implement:
throws java.io.IOException,
UnsupportedCallbackException;
The C al l back interface is the last authentication class we will look at. This is a tagging interface for
which several default implementations are provided, including the NameC al l back and
P asswo rd C al l back used in an earlier example. A Lo g i nMo d ul e uses a C al l back to request
information required by the authentication mechanism. Lo g i nMo d ul es pass an array of
C al l backs directly to the C al l backHand l er. hand l e method during the authentication's login
phase. If a cal l backhand l er does not understand how to use a C al l back object passed into the
handle method, it throws an Unsuppo rted C al l backExcepti o n to abort the login call.
Report a bug
13.4 . Java Aut hent icat ion SPI for Cont ainers (JASPI)
13.4 .1. About Java Aut hent icat ion SPI for Cont ainers (JASPI) Securit y
Java Authentication SPI for Containers (JASPI or JASPIC) is a pluggable interface for Java
applications. It is defined in JSR-196 of the Java Community Process. Refer to
http://www.jcp.org/en/jsr/detail?id=196 for details about the specification.
Report a bug
13.4 .2. Configure Java Aut hent icat ion SPI for Cont ainers (JASPI) Securit y
To authenticate against a JASPI provider, add a <authenti cati o n-jaspi > element to your
security domain. The configuration is similar to a standard authentication module, but login module
elements are enclosed in a <l o g i n-mo d ul e-stack> element. The structure of the configuration is:
< authentication-jaspi>
<login-module-stack name="...">
</login-module>
</login-module-stack>
<auth-module code="..." login-module-stack-ref="...">
The login module itself is configured in exactly the same way as a standard authentication module.
195
Because the web-based management console does not expose the configuration of JASPI
authentication modules, you need to stop JBoss EAP 6 completely before adding the configuration
directly to EAP_HOME/d o mai n/co nfi g urati o n/d o mai n. xml or
EAP_HOME/stand al o ne/co nfi g urati o n/stand al o ne. xml .
Report a bug
196
D et ails
required
requisite
sufficient
optional
4. Ed it au t h o riz at io n set t in g s
After you have added your module, you can modify its C o d e or Fl ag s by clicking Ed i t in
the D etai l s section of the screen. Be sure the Attri butes tab is selected.
5. O p t io n al: Ad d o r remo ve mo d u le o p t io n s.
If you need to add options to your module, click its entry in the P o l i ci es list, and select the
Mo d ul e O pti o ns tab in the D etai l s section of the page. Click Ad d and provide the key
and value for the option. Use the R emo ve button to remove an option.
R esu lt
Your authorization policy module is added to the security domain, and is immediately available to
applications which use the security domain.
Report a bug
13.6. Java Aut horiz at ion Cont ract for Cont ainers (JACC)
13.6.1. About Java Aut horiz at ion Cont ract for Cont ainers (JACC)
Java Authorization Contract for Containers (JACC) is a standard which defines a contract between
containers and authorization service providers, which results in the implementation of providers for
use by containers. It was defined in JSR-115, which can be found on the Java Community Process
website at http://jcp.org/en/jsr/detail?id=115. It has been part of the core Java Enterprise Edition (Java
197
13.6.2. Configure Java Aut horiz at ion Cont ract for Cont ainers (JACC) Securit y
To configure Java Authorization Contract for Containers (JACC), you need to configure your security
domain with the correct module, and then modify your jbo ss-web. xml to include the correct
parameters.
Ad d JAC C Su p p o rt t o t h e Secu rit y D o main
To add JACC support to the security domain, add the JAC C authorization policy to the authorization
stack of the security domain, with the req ui red flag set. The following is an example of a security
domain with JACC support. However, the security domain is configured in the Management Console
or Management CLI, rather than directly in the XML.
<authentication>
</login-module>
</authentication>
<authorization>
</authorization>
< /security-domain>
C o n f ig u re a Web Ap p licat io n t o U se JAC C
The jbo ss-web. xml is located in the WEB-INF/ directory of your deployment, and contains
overrides and additional JBoss-specific configuration for the web container. To use your JACCenabled security domain, you need to include the <securi ty-d o mai n> element, and also set the
<use-jbo ss-autho ri zati o n> element to true. The following application is properly configured
to use the JACC security domain above.
< jboss-web>
<security-domain>jacc</security-domain>
<use-jboss-authorization>true</use-jboss-authorization>
< /jboss-web>
C o n f ig u re an EJB Ap p licat io n t o U se JAC C
Configuring EJBs to use a security domain and to use JACC differs from Web Applications. For an
EJB, you can declare method permissions on a method or group of methods, in the ejb-jar. xml
descriptor. Within the <ejb-jar> element, any child <metho d -permi ssi o n> elements contain
information about JACC roles. Refer to the example configuration for more details. The
EJBMetho d P ermi ssi o n class is part of the Java Enterprise Edition 6 API, and is documented at
http://docs.oracle.com/javaee/6/api/javax/security/jacc/EJBMethodPermission.html.
198
< ejb-jar>
<assembly-descriptor>
<method-permission>
<role-name>employee</role-name>
<role-name>temp-employee</role-name>
<method>
<ejb-name>EmployeeService</ejb-name>
<method-name>*</method-name>
</method>
</method-permission>
</assembly-descriptor>
< /ejb-jar>
You can also constrain the authentication and authorization mechanisms for an EJB by using a
security domain, just as you can do for a web application. Security domains are declared in the
jbo ss-ejb3. xml descriptor, in the <securi ty> child element. In addition to the security domain,
you can also specify the run-as principal, which changes the principal the EJB runs as.
<ejb-name>*</ejb-name>
<security-domain>myDomain</security-domain>
<run-as-principal>myPrincipal</run-as-principal>
</security>
</assembly-descriptor>
< /ejb-jar>
Report a bug
199
200
</SubjectMatch>
</Subject>
</Subjects>
</Target>
<!-- Use permissions associated with the employee role -->
<PolicySetIdReference>PPS:employee:role</PolicySetIdReference>
</PolicySet>
Man ag er
<PolicySet xmlns="urn:oasis:names:tc:xacml:2.0:policy:schema:os"
PolicySetId="RPS:manager:role"
PolicyCombiningAlgId="urn:oasis:names:tc:xacml:1.0:policycombining-algorithm:permit-overrides">
<Target>
<Subjects>
<Subject>
<SubjectMatch
MatchId="urn:oasis:names:tc:xacml:1.0:function:anyURI-equal">
<AttributeValue
DataType="http://www.w3.org/2001/XMLSchema#anyURI">manager</Attri
buteValue>
<SubjectAttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:2.0:subject:role"
DataType="http://www.w3.org/2001/XMLSchema#anyURI"/>
</SubjectMatch>
</Subject>
</Subjects>
</Target>
<!-- Use permissions associated with the manager role -->
<PolicySetIdReference>PPS:manager:role</PolicySetIdReference>
</PolicySet>
201
Effect="Permit">
<Target>
<Resources>
<Resource>
<ResourceMatch
MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
<AttributeValue
DataType="http://www.w3.org/2001/XMLSchema#string">purchase order
</AttributeValue>
<ResourceAttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"
DataType="http://www.w3.org/2001/XMLSchema#string" />
</ResourceMatch>
</Resource>
</Resources>
<Actions>
<Action>
<ActionMatch
MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
<AttributeValue
DataType="http://www.w3.org/2001/XMLSchema#string">create</Attrib
uteValue>
<ActionAttributeDesignator
AttributeId="urn:action-id"
DataType="http://www.w3.org/2001/XMLSchema#string" />
</ActionMatch>
</Action>
</Actions>
</Target>
</Rule>
</Policy>
<!-- HasPrivilegesOfRole Policy for employee role -->
<Policy
PolicyId="Permission:to:have:employee:role:permissions"
RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rulecombining-algorithm:permit-overrides">
<Target />
<!-- Permission to have employee role permissions -->
<Rule RuleId="Permission:to:have:employee:permissions"
Effect="Permit">
<Condition>
<Apply
FunctionId="urn:oasis:names:tc:xacml:1.0:function:and">
<Apply
FunctionId="urn:oasis:names:tc:xacml:1.0:function:anyURI-is-in">
<AttributeValue
DataType="http://www.w3.org/2001/XMLSchema#anyURI">employee</Attr
ibuteValue>
<ResourceAttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:2.0:subject:role"
DataType="http://www.w3.org/2001/XMLSchema#anyURI" />
</Apply>
202
<Apply
FunctionId="urn:oasis:names:tc:xacml:1.0:function:anyURI-is-in">
<AttributeValue
DataType="http://www.w3.org/2001/XMLSchema#anyURI">urn:oasis:name
s:tc:xacml:2.0:actions:hasPrivilegesOfRole
</AttributeValue>
<ActionAttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"
DataType="http://www.w3.org/2001/XMLSchema#anyURI" />
</Apply>
</Apply>
</Condition>
</Rule>
</Policy>
</PolicySet>
Man ag er
<PolicySet xmlns="urn:oasis:names:tc:xacml:2.0:policy:schema:os"
PolicySetId="PPS:manager:role"
PolicyCombiningAlgId="urn:oasis:names:tc:xacml:1.0:policycombining-algorithm:permit-overrides">
<Target />
<!-- Permissions specifically for the manager role -->
<Policy
PolicyId="Permissions:specifically:for:the:manager:role"
RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combiningalgorithm:permit-overrides">
<Target />
<!-- Permission to sign a purchase order -->
<Rule RuleId="Permission:to:sign:a:purchase:order"
Effect="Permit">
<Target>
<Resources>
<Resource>
<ResourceMatch
MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
<AttributeValue
DataType="http://www.w3.org/2001/XMLSchema#string">purchase order
</AttributeValue>
<ResourceAttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"
DataType="http://www.w3.org/2001/XMLSchema#string" />
</ResourceMatch>
</Resource>
</Resources>
<Actions>
<Action>
<ActionMatch
MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
203
<AttributeValue
DataType="http://www.w3.org/2001/XMLSchema#string">sign</Attribut
eValue>
<ActionAttributeDesignator
AttributeId="urn:action-id"
DataType="http://www.w3.org/2001/XMLSchema#string" />
</ActionMatch>
</Action>
</Actions>
</Target>
</Rule>
</Policy>
<!-- HasPrivilegesOfRole Policy for manager role -->
<Policy
PolicyId="Permission:to:have:manager:role:permissions"
RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rulecombining-algorithm:permit-overrides">
<Target />
<!-- Permission to have manager role permissions -->
<Rule RuleId="Permission:to:have:manager:permissions"
Effect="Permit">
<Condition>
<Apply
FunctionId="urn:oasis:names:tc:xacml:1.0:function:and">
<Apply
FunctionId="urn:oasis:names:tc:xacml:1.0:function:anyURI-is-in">
<AttributeValue
DataType="http://www.w3.org/2001/XMLSchema#anyURI">manager</Attri
buteValue>
<ResourceAttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:2.0:subject:role"
DataType="http://www.w3.org/2001/XMLSchema#anyURI" />
</Apply>
<Apply
FunctionId="urn:oasis:names:tc:xacml:1.0:function:anyURI-is-in">
<AttributeValue
DataType="http://www.w3.org/2001/XMLSchema#anyURI">urn:oasis:name
s:tc:xacml:2.0:actions:hasPrivilegesOfRole
</AttributeValue>
<ActionAttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"
DataType="http://www.w3.org/2001/XMLSchema#anyURI" />
</Apply>
</Apply>
</Condition>
</Rule>
</Policy>
<!-- Include permissions associated with employee role ->
<PolicySetIdReference>PPS:employee:role</PolicySetIdReference>
</PolicySet>
204
4. Create a Policy D ecision Point (PD P) and pass it in the Configuration File.
5. In the Policy Enforcement Point (PEP), create an XACML request based on the context. Pass
the XACML request to the PD P to get one of the following access decisions:
205
Permit
D eny
Indeterminate
Not Applicable
206
<Request
xmlns="urn:oasis:names:tc:xacml:2.0:context:schema:os"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:oasis:names:tc:xacml:2.0:context:schema:o
s
access_control-xacml-2.0-context-schema-os.xsd">
<Subject>
<Attribute
AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id"
DataType="http://www.w3.org/2001/XMLSchema#string">
<AttributeValue>Anne</AttributeValue>
</Attribute>
<Attribute
AttributeId="urn:oasis:names:tc:xacml:2.0:subject:role"
DataType="http://www.w3.org/2001/XMLSchema#anyURI">
<AttributeValue>manager</AttributeValue>
</Attribute>
</Subject>
<Resource>
<Attribute
AttributeId="urn:oasis:names:tc:xacml:2.0:subject:role"
DataType="http://www.w3.org/2001/XMLSchema#anyURI">
<AttributeValue>manager</AttributeValue>
</Attribute>
</Resource>
<Action>
<Attribute
AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"
DataType="http://www.w3.org/2001/XMLSchema#anyURI">
<AttributeValue>urn:nobody</AttributeValue>
</Attribute>
</Action>
</Request>
Report a bug
207
Report a bug
208
Your security auditing module is added to the security domain, and is immediately available to
applications which use the security domain.
Report a bug
D escrip t io n
Po ssib le valu es
B eh avio r
D ef au lt
head ers,param
eters
Any comma
separated string
indicating keys of
headers,
parameters,
cookies, and
attributes.
Any component
(or commaseparated group
of components)
specified will be
audited out of
web requests.
Currently, the
matching of the
masks is fuzzy
rather than strict.
For example, a
mask of
autho ri zati o n
will mask both the
header called
authorization and
the parameter
called
custom_authorizati
on. A future
release may
introduce strict
masks.
j_password,autho
rization
Report a bug
209
You can map principals (authentication), roles (authorization), or credentials (attributes which are
not principals or roles).
Role Mapping is used to add, replace, or remove roles to the subject after authentication.
Principal mapping is used to modify a principal after authentication.
Attribute mapping is used to convert attributes from an external system to be used by your
application, and vice versa.
Report a bug
210
To edit an option that already exists, click R emo ve to remove it, and add it again with the new
value.
Use the R emo ve button to remove an option.
R esu lt
Your security mapping module is added to the security domain, and is immediately available to
applications which use the security domain.
Report a bug
Warning
If an application is part of a security domain that uses an authentication cache, user
authentications for that application will also be available to other applications in that security
domain.
<security-domains>
<authentication>
211
<login-module code="Remoting"
flag="optional">
<module-option name="password-stacking"
value="useFirstPass"/>
</login-module>
<login-module code="RealmDirect"
flag="required">
<module-option name="password-stacking"
value="useFirstPass"/>
</login-module>
</authentication>
</security-domain>
<authorization>
<policy-module code="Delegating"
flag="required"/>
</authorization>
</security-domain>
<authorization>
<policy-module code="Delegating"
flag="required"/>
</authorization>
</security-domain>
</security-domains>
< /subsystem>
You can configure additional security domains as needed using the Management
Console or CLI.
b. En ab le t h e secu rit y d o main in t h e ap p licat io n ' s d escrip t o r f ile
The security domain is specified in the <securi ty-d o mai n> child element of the
<jbo ss-web> element in the application's WEB-INF/jbo ss-web. xml file. The
following example configures a security domain named my-d o mai n.
< jboss-web>
<security-domain>my-domain</security-domain>
< /jboss-web>
This is only one of many settings which you can specify in the WEB-INF/jbo ssweb. xml descriptor.
2. Ad d t h e R eq u ired An n o t at io n t o t h e EJB
You configure security in the EJB using the @ Securi tyD o mai n and @ R o l esAl l o wed
annotations. The following EJB code example limits access to the o ther security domain by
users in the g uest role.
p ackage example.ejb3;
i mport java.security.Principal;
i mport javax.annotation.Resource;
212
i mport javax.annotation.security.RolesAllowed;
i mport javax.ejb.SessionContext;
i mport javax.ejb.Stateless;
i mport org.jboss.ejb3.annotation.SecurityDomain;
/ **
* Simple secured EJB using EJB security annotations
* Allow access to "other" security domain by users in a "guest"
role.
*/
@ Stateless
@ RolesAllowed({ "guest" })
@ SecurityDomain("other")
p ublic class SecuredEJB {
/**
* Secured EJB method using security annotations
*/
public String getSecurityInfo() {
// Session context injected using the resource annotation
Principal principal = ctx.getCallerPrincipal();
return principal.toString();
}
For more code examples, see the ejb-securi ty quickstart in the JBoss EAP 6 Quickstarts
bundle, which is available from the Red Hat Customer Portal.
Report a bug
213
14 .2. About Clust ered Single Sign On (SSO) for Web Applicat ions
Single Sign On (SSO) is the ability for users to authenticate to a single web application, and by
means of a successful authentication, will successfully authenticate to multiple other applications
without needing to be prompted at each one. Clustered SSO stores the authentication and
authorization information in a clustered cache. This allows for applications on multiple different
servers to share the information, and also makes the information resilient to a failure of one of the
hosts.
A SSO configuration is called a valve. A valve is connected to a security domain, which is configured
at the level of the server or server group. Each application which should share the same cached
authentication information is configured to use the same valve. This configuration is done in the
application's jbo ss-web. xml .
Some common SSO valves supported by the web subsystem of JBoss EAP 6 include:
Apache Tomcat ClusteredSingleSignOn
Apache Tomcat ID PWebBrowserSSOValve
SPNEGO-based SSO provided by PicketLink
D epending on the specific type of valve, you may need to do some additional configuration in your
security domain, in order for your valve to work properly.
214
Report a bug
215
The web subsystem needs to be configured to use SSO. The following command enables SSO on
the virtual server called d efaul t-ho st, and the cookie domain d o mai n. co m. The cache name
is sso , and reauthentication is disabled.
216
/profile=ha/subsystem=web/virtual-server=defaulthost/sso=configuration:add(cache-container="web",cachename="sso",reauthenticate="false",domain="domain.com")
Each application which will share the SSO information must be configured to use the same
<security-domain> in its jbo ss-web. xml deployment descriptor and the same Realm in its
web. xml configuration file.
C o n f ig u re C lu st ered o r N o n - C lu st ered SSO
Configure sso under the web subsystem in the server profile. The C l ustered Si ng l eSi g nO n
version is used when attribute cache-co ntai ner is present, otherwise standard Si ng l eSi g nO n
class is used.
In valid at e a Sessio n
An application can programmatically invalidate a session by invoking method
javax. servl et. http. HttpSessi o n. i nval i d ate().
Report a bug
217
14 .8. Configure Kerberos or Microsoft Act ive Direct ory Deskt op SSO
for Web Applicat ions
In t ro d u ct io n
To authenticate your web or EJB applications using your organization's existing Kerberos-based
authentication and authorization infrastructure, such as Microsoft Active D irectory, you can use the
JBoss Negotiation capabilities built into JBoss EAP 6. If you configure your web application
properly, a successful desktop or network login is sufficient to transparently authenticate against
your web application, so no additional login prompt is required.
D if f eren ce f ro m Previo u s Versio n s o f t h e Plat f o rm
There are a few noticeable differences between JBoss EAP 6 and earlier versions:
Security domains are configured for each profile of a managed domain, or for each standalone
server. They are not part of the deployment itself. The security domain a deployment should use is
named in the deployment's jbo ss-web. xml or jbo ss-ejb3. xml file.
218
Security properties are configured as part of a security domain. They are not part of the
deployment.
You can no longer override the authenticators as part of your deployment. However, you can add
a NegotiationAuthenticator valve to your jbo ss-web. xml descriptor to achieve the same effect.
The valve still requires the <securi ty-co nstrai nt> and <l o g i n-co nfi g > elements to be
defined in the web. xml . These are used to decide which resources are secured. However, the
chosen auth-method will be overridden by the NegotiationAuthenticator valve in the jbo ssweb. xml .
The C O D E attributes in security domains now use a simple name instead of a fully-qualified class
name. The following table shows the mappings between the classes used for JBoss Negotiation,
and their classes.
T ab le 14 .1. Lo g in Mo d u le C o d es an d C lass N ames
Simp le N ame
C lass N ame
Pu rp o se
Kerberos
com.sun.security.auth.module.Krb5Lo
ginModule
com.ibm.security.auth.module.Krb5Lo
ginModule
SPNEGO
org.jboss.security.negotiation.spnego
.SPNEGOLoginModule
AdvancedLdap
org.jboss.security.negotiation.Advanc
edLdapLoginModule
org.jboss.security.negotiation.Advanc
edAD LoginModule
AdvancedAdLdap
JB o ss N eg o t iat io n T o o lkit
The JBo ss Neg o ti ati o n T o o l ki t is a debugging tool which is available for download from
https://community.jboss.org/servlet/JiveServlet/download/16876-2-34629/jboss-negotiationtoolkit.war. It is provided as an extra tool to help you to debug and test the authentication
mechanisms before introducing your application into production. It is an unsupported tool, but is
considered to be very helpful, as SPNEGO can be difficult to configure for web applications.
Pro ced u re 14 .1. Set u p SSO Au t h en t icat io n f o r yo u r Web o r EJB Ap p licat io n s
1. C o n f ig u re o n e secu rit y d o main t o rep resen t t h e id en t it y o f t h e server. Set syst em
p ro p ert ies if n ecessary.
The first security domain authenticates the container itself to the directory service. It needs to
use a login module which accepts some type of static login mechanism, because a real user
is not involved. This example uses a static principal and references a keytab file which
contains the credential.
The XML code is given here for clarity, but you should use the Management Console or
Management CLI to configure your security domains.
< security-domain name="host" cache-type="default">
<authentication>
219
<module-option name="keyTab"
value="/home/username/service.keytab"/>
</login-module>
</authentication>
< /security-domain>
<authentication>
<module-option name="password-stacking"
value="useFirstPass"/>
</login-module>
<module-option name="password-stacking"
value="useFirstPass" />
</login-module>
</authentication>
< /security-domain>
3. Sp ecif y t h e secu rit y- co n st rain t an d lo g in - co n f ig in t h e web. xml
The web. xml descriptor contain information about security constraints and login
configuration. The following are example values for each.
< security-constraint>
<web-resource-collection>
<web-resource-name>examplesWebApp</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>RequiredRole</role-name>
</auth-constraint>
220
< /security-constraint>
< login-config>
<auth-method>SPNEGO</auth-method>
<realm-name>SPNEGO</realm-name>
< /login-config>
< security-role>
<role-name>RequiredRole</role-name>
< /security-role>
4. Sp ecif y t h e secu rit y d o main an d o t h er set t in g s in t h e jbo ss-web. xml d escrip t o r.
Specify the name of the client-side security domain (the second one in this example) in the
jbo ss-web. xml descriptor of your deployment, to direct your application to use this
security domain.
You can no longer override authenticators directly. Instead, you can add the
NegotiationAuthenticator as a valve to your jbo ss-web. xml descriptor, if you need to. The
<jacc-star-ro l e-al l o w> allows you to use the asterisk (*) character to match multiple
role names, and is optional.
< jboss-web>
<security-domain>SPNEGO</security-domain>
<valve>
<classname>org.jboss.security.negotiation.NegotiationAuthenticator</class
-name>
</valve>
<jacc-star-role-allow>true</jacc-star-role-allow>
< /jboss-web>
5. Ad d a d ep en d en cy t o yo u r ap p licat io n ' s MANIFEST . MF, t o lo cat e t h e N eg o t iat io n
classes.
The web application needs a dependency on class o rg . jbo ss. securi ty. neg o ti ati o n
to be added to the deployment's MET A-INF/MANIFEST . MF manifest, in order to locate the
JBoss Negotiation classes. The following shows a properly-formatted entry.
Manifest-Version: 1.0
Build-Jdk: 1.6.0_24
Dependencies: org.jboss.security.negotiation
A. As an alternative, add a dependency to your application by editing the MET AINF/jbo ss-d epl o yment-structure. xml file:
< ?xml version="1.0" encoding="UTF-8"?>
< jboss-deployment-structure>
<deployment>
<dependencies>
221
<module name='org.jboss.security.negotiation'/>
</dependencies>
</deployment>
< /jboss-deployment-structure>
R esu lt
Your web application accepts and authenticates credentials against your Kerberos, Microsoft Active
D irectory, or other SPNEGO-compatible directory service. If the user runs the application from a
system which is already logged into the directory service, and where the required roles are already
applied to the user, the web application does not prompt for authentication, and SSO capabilities are
achieved.
Report a bug
14 .9. Configure SPNEGO Fall Back t o Form Aut hent icat ion
Follow the procedure below to setup a SPNEGO fall back to form authentication.
Pro ced u re 14 .2. SPN EG O secu rit y wit h f all b ack t o f o rm au t h en t icat io n
1. Set u p SPN EG O
Refer the procedure described in Section 14.8, Configure Kerberos or Microsoft Active
D irectory D esktop SSO for Web Applications
2. Mo d if y web. xml
Add a l o g i n-co nfi g element to your application and setup the login and error pages in
web.xml:
<login-config>
<auth-method>SPNEGO</auth-method>
<realm-name>SPNEGO</realm-name>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/error.jsp</form-error-page>
</form-login-config>
</login-config>
3. Ad d web co n t en t
Add references of l o g i n. html and erro r. html to web. xml . These files are added to web
application archive to the place specified in fo rm-l o g i n-co nfi g configuration. For more
information refer Enable Form-based Authentication section in the Security Guide for JBoss EAP
6. A typical l o g i n. html looks like this:
<html>
<head>
<title>Vault Form Authentication</title>
</head>
<body>
<h1>Vault Login Page</h1>
<p>
222
Note
The fallback to FORM logic is only available in the case when no SPNEGO (or NTLM) tokens
are present. As a result, a login form is not presented to the browser if the browser sends an
NTLM token.
Report a bug
223
Note
Support for PKCS#11 tokens has been added to JBoss EAP from version 6.3.0.
EAP security realms can accept PKCS#11 keys and trust store definitions by using the
provider attribute. The value specified in this parameter is passed to the relevant
KeySto re. g etInstance("P KC S11") calls and the key and trust store are initialized.
Configuration for this new support is beyond the scope of EAP documentation. Users who
wish to utilize this feature should familiarize themselves with the correct installation of
PKCS#11 hardware and software as well as the correct entries required in the
java. securi ty policy file. Oracle's Java PKCs#11 Reference Guide document may be a
useful resource for this information.
The token request message is sent in the body of the SOAP message. All information related to the
token request is enclosed in the R eq uestSecuri tyT o ken element. The sample request contains
two other WS-Trust elements: R eq uestT ype, which specifies that this request is an Issue request,
and T o kenT ype, which specifies the type of the token to be issued.
The following is an example of the WS-Trust request message.
224
<wst:TokenType>http://www.tokens.org/SpecialToken</wst:TokenType>
<wst:RequestType>
http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue
</wst:RequestType>
</wst:RequestSecurityToken>
</S11:Body>
</S11:Envelope>
In the example for the security token response, the T o kenT ype element specifies the type of the
issued token, while the R eq uested Securi tyT o ken element contains the token itself. The format of
the token depends on the type of the token. The Li feti me element specifies when the token was
created and when it expires.
Secu rit y T o ken R eq u est Pro cessin g
The following are the steps in which the security token requests are processed:
A client sends a security token request to P i cketLi nkST S.
P i cketLi nkST S parses the request message, generating a JAXB object model.
P i cketLi nkST S reads the configuration file and creates the ST SC o nfi g urati o n object, if
needed. Then it obtains a reference to the WST rustR eq uestHand l er from the configuration and
delegates the request processing to the handler instance.
The request handler uses the ST SC o nfi g urati o n to set default values when needed (for
example, when the request doesn't specify a token lifetime value).
The WST rustR eq uestHand l er creates the WST rustR eq uestC o ntext, setting the JAXB request
object and the caller principal it received from P i cketLi nkST S.
The WST rustR eq uestHand l er uses the ST SC o nfi g urati o n to get the
Securi tyT o kenP ro vi d er that must be used to process the request based on the type of the
token that is being requested. Then it invokes the provider, passing the constructed
WST rustR eq uestC o ntext as a parameter.
225
The Securi tyT o kenP ro vi d er instance process the token request and stores the issued token
in the request context.
The WST rustR eq uestHand l er obtains the token from the context, encrypts it if needed, and
constructs the WS-Trust response object containing the security token.
P i cketLi nkST S dictates the response generated by the request handler and returns it to the
client.
Report a bug
Note
In the following text, a service provider refers to the Web service that requires a security token to
be presented by its clients.
P i cketLi nkST S: This is the root element. It defines some properties that allows the STS
administrator to set a the following default values:
ST SName: A string representing the name of the security token service. If not specified, the
default P i cketLi nkST S value is used.
T o kenT i meo ut: The token lifetime value in seconds. If not specified, the default value of 3600
(one hour) is used.
EncryptT o ken: A boolean specifying whether issued tokens are to be encrypted or not. The
default value is false.
KeyP ro vi d er: This element and all its sub elements are used to configure the keystore that are
used by PicketLink STS to sign and encrypt tokens. Properties like the keystore location, its
password, and the signing (private key) alias and password are all configured in this section.
R eq uestHand l er: This element specifies the fully qualified name of the
WST rustR eq uestHand l er implementation to be used. If not specified, the default
o rg . pi cketl i nk. i d enti ty. fed erati o n. co re. wstrust. Stand ard R eq uestHand l er is
used.
T o kenP ro vi d er: This section specifies the T o kenP ro vi d er implementations that must be
used to handle each type of security token. In the example we have two providers - one that
handles tokens of type Speci al T o ken and one that handles tokens of type SAMLV2. 0 . The
WST rustR eq uestHand l er calls the g etP ro vi d erFo rT o kenT ype(String type) method of
ST SC o nfi g urati o n to obtain a reference to the appropriate T o kenP ro vi d er.
T o kenT i meo ut: This is used by the WST rustR eq uestHand l er when no Lifetime has been
specified in the WS-Trust request. It creates a Lifetime instance that has the current time as the
creation time and expires after the specified number of seconds.
226
Servi ceP ro vi d ers: This section specifies the token types that must be used for each service
provider (the Web service that requires a security token). When a WS-Trust request does not
contain the token type, the WST rustR eq uestHand l er must use the service provider endpoint to
find out the type of the token that must be issued.
EncryptT o ken: This is used by the WST rustR eq uestHand l er to decide if the issued token
must be encrypted or not. If true, the public key certificate (PKC) of the service provider is used to
encrypt the token.
The following is an example of STS configuration.
Report a bug
A PicketLink Login Module is typically configured as part of the security setup of a JEE container to
use a Security Token Service for authenticating users. The STS may be collocated on the same
container as the Login Module or be accessed remotely through Web Service calls or another
technology. PicketLink Login Modules support non-PicketLink STS implementations through
standard WS-Trust calls.
T yp es o f ST S Lo g in Mo d u les
The following are the different types of STS Login Modules.
ST SIssu in g Lo g in Mo d u le
Calls the configured STS and requests for a security token. Upon successfully receiving the
R eq uested Securi tyT o ken, it marks the authentication as successful.
A call to STS typically requires authentication. This Login Module uses credentials from one of the
following sources:
Its properties file, if the useO pti o nsC red enti al s module option is set to true.
Previous login module credentials if the passwo rd -stacki ng module option is set to
useFi rstP ass.
From the configured C al l backHand l er by supplying a Name and Password Callback.
Upon successful authentication, the Saml C red enti al is inserted in the Subject's public
credentials if one with the same Assertion is not found to be already present there.
ST SValid at in g Lo g in Mo d u le
Calls the configured STS and validates an available security token.
A call to STS typically requires authentication. This Login Module uses credentials from one of the
following sources:
Its properties file, if the useO pti o nsC red enti al s module option is set to true.
Previous login module credentials if the passwo rd -stacki ng module option is set to
useFi rstP ass.
From the configured C al l backHand l er by supplying a Name and Password Callback.
Upon successful authentication, the SamlCredential is inserted in the Subject's public credentials
if one with the same Assertion is not found to be already present there.
SAML2ST SLo g in Mo d u le
This Login Module supplies a O bjectC al l back to the configured C al l backHand l er and
expects a Saml C red enti al object back. The Assertion is validated against the configured STS.
If a user ID and SAML token are shared, this Login Module bypasses validation When stacked on
top of another Login Module that is successfully authenticated.
Upon successful authentication, the Saml C red enti al is inspected for a NameID and a multivalued role attribute that is respectively set as the ID and roles of the user.
SAML2Lo g in Mo d u le
228
This login module is used in conjunction with other components for SAML authentication and
performs no authentication itself.
The SP R ed i rectFo rmAuthenti cato r uses this login module in PicketLink's implementation of
the SAML v2 HTTP Redirect Profile.
The Tomcat authenticator valve performs authentication through redirecting to the identity
provider and getting a SAML assertion.
This login module is used to pass the user ID and roles to the JBoss security framework to be
populated in the JAAS subject.
Report a bug
Most configurations can switch to the configuration sited in the above example by:
changing their declared security-domain
specifying a Principal mapping provider
specifying a RoleGroup mapping provider
229
The specified Principal mapping provider and the RoleGroup mapping provider results in an
authenticated Subject being populated that enables coarse-grained and role-based authorization.
After authentication, the Security Token is available and may be used to invoke other services by
Single Sign-On.
Report a bug
The configuration cited in the example enables Single Sign-On for your applications and services. A
token once issued, either by directly contacting the STS or through a token-issuing login module,
can be used to authenticate against multiple applications and services by employing the setup
provided in the example. Providing a Principal mapping provider and a RoleGroup mapping
provider result in an authenticated Subject being populated that enables coarse-grained and rolebased authorization. After authentication, the Security Token is available and can be used to invoke
other services by Single Sign-On.
Report a bug
230
The PicketLink provides a pool of STS clients on the server. This removes STS Client creation as a
bottleneck.
Client pooling can be utilized from login modules that need an STS client to obtain SAML tickets.
Login Modules that can utilize STS client pooling:
org.picketlink.identity.federation.core.wstrust.auth.STSIssuingLoginModule
org.picketlink.identity.federation.core.wstrust.auth.STSValidatingLoginModule
org.picketlink.trust.jbossws.jaas.JBWSTokenIssuingLoginModule
The default number of clients in the pool for each login module is configured via the
i ni ti al NumberO fC l i ents login module option.
The STSClientPoolFactory class
o rg . pi cketl i nk. i d enti ty. fed erati o n. bi nd i ng s. stspo o l . ST SC l i entP o o l Facto ry
provides client pool functionality to applications.
231
The SAML profile has support for both the HTTP/POST and the HTTP/Redirect bindings with
centralized identity services to enable web SSO for your applications. The architecture for the SAML
v2 based Web SSO follows the hub and spoke architecture of identity management. In this
architecture an identity provider (ID P) acts as the central source (hub) for identity and role
information to all the applications (Service Providers). The spokes are the service providers (SP).
Important
If there are two or more SPs both pointing to the same ID P, the ID P does not distinguish
between the different SPs. If you make requests to different SPs that point to the same ID P, the
ID P handles the most recent request from an SP and sends back SAML assertion about the
authenticated user. To get back to the an older SP request, you will need to reenter the SP URL
in the browser.
Report a bug
Note
The use of FORM based web application security is recommended as it gives you the
ability to customize the login page.
The following is an example of the web. xml configuration
232
233
name>org.picketlink.identity.federation.bindings.tomcat.idp.IDPWe
bBrowserSSOValve</class-name>
</valve>
</jboss-web>
By default, pi cketl i nk. xml is located in the WEB-INF directory of your ID P web
application. However, you can configure a custom path to a pi cketl i nk. xml that is
external to the application:
a. O p t io n al: C o n f ig u rin g a cu st o m p at h t o pi cketl i nk. xml
Add two paramaters to the valve element in your application's WEB-INF/jbo ssweb. xml : co nfi g Fi l e specifying for the path to pi cketl i nk. xml , and
ti merInterval which specifies the interval in milliseconds to reload the
configuration. For example:
<valve>
<class-name>...</class-name>
<param>
<param-name>timerInterval</param-name>
<param-value>5000</param-value>
</param>
<param>
234
<param-name>configFile</param-name>
<param-value>path-to/picketlink.xml</param-value>
</param>
</valve>
5. D eclare d ep en d en cies o n Picket Lin k mo d u le ( MET A-INF/MANIFEST . MF, o r jbo ssd epl o yment-structure. xml )
The web application also requires a dependency defining in MET A-INF/MANIFEST . MF or
jbo ss-d epl o yment-structure. xml , so that the PicketLink classes can be located.
Report a bug
235
<url-pattern>/images/*</url-pattern>
</web-resource-collection>
</security-constraint>
<!-- Define a Security Constraint on this Application -->
<security-constraint>
<web-resource-collection>
<web-resource-name>SP</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>manager</role-name>
</auth-constraint>
</security-constraint>
<!-- Define the Login Configuration for this Application -->
<login-config>
<auth-method>FORM</auth-method>
<realm-name>SP Application</realm-name>
<form-login-config>
<form-login-page>/jsp/login.jsp</form-login-page>
<form-error-page>/jsp/loginerror.jsp</form-error-page>
</form-login-config>
</login-config>
<!-- Security roles referenced by this web application -->
<security-role>
<description>
The role that is required to log in to the SP Application
</description>
<role-name>manager</role-name>
</security-role>
</web-app>
236
<valve>
<classname>org.picketlink.identity.federation.bindings.tomcat.sp.Servic
eProviderAuthenticator</class-name>
</valve>
</jboss-web>
By default, pi cketl i nk. xml is located in the WEB-INF directory of your application.
However, you can configure a custom path to a pi cketl i nk. xml that is external to the
application:
a. O p t io n al: C o n f ig u rin g a cu st o m p at h t o pi cketl i nk. xml
Add two paramaters to the valve element in your application's WEB-INF/jbo ssweb. xml : co nfi g Fi l e specifying for the path to pi cketl i nk. xml , and
ti merInterval which specifies the interval in milliseconds to reload the
configuration. For example:
<valve>
<class-name>...</class-name>
<param>
<param-name>timerInterval</param-name>
237
<param-value>5000</param-value>
</param>
<param>
<param-name>configFile</param-name>
<param-value>path-to/picketlink.xml</param-value>
</param>
</valve>
5. D eclare d ep en d en cies o n Picket Lin k mo d u le ( MET A-INF/MANIFEST . MF, o r jbo ssd epl o yment-structure. xml )
The web application also requires a dependency defining in MET A-INF/MANIFEST . MF or
jbo ss-d epl o yment-structure. xml , so that the PicketLink classes can be located.
Report a bug
238
For more information on configuring the SP, see Section 15.7.4, Configure Service Provider
using HTTP/RED IRECT Binding
Report a bug
239
Acco u n t C h o o serPag e
The name of the HTML/JSP page for listing the different ID P accounts. D efault is
/acco untC ho o ser. html .
2. D efine the mapping for the ID Ps. By default, this is a properties file i d pmap. pro perti es in
the WEB-INF directory of your SP web application.
3. Create a HTML page in your SP web application for the user to choose the ID P. By default,
this file is acco untC ho o ser. html . The URL to each of ID P must have the parameter i d p
that specifies the name of the ID P listed in i d pmap. pro perti es.
Report a bug
24 0
4. Upon authentication, the ID P shows the hosted section where the user gets a page that links
to all the SP applications.
5. The user chooses an SP application.
6. The ID P redirects the user to the service provider with an SAML assertion in the query
parameter, SAML response.
7. The SP checks the SAML assertion and provides access.
C o n f ig u rat io n
No special configuration is necessary to get Unsolicited Responses supported, you can configure
your ID P and SPs as usual. For more information about how to configure ID P and SP, refer to:
Section 15.7.3, Configure Identity Provider
Section 15.7.4, Configure Service Provider using HTTP/RED IRECT Binding
H o w t o U se
Once the user is authenticated, the ID P shows a page with links to all service provider applications.
A link will usually look like this:
<a href="http://localhost:8080/idp?
SAML_VERSION=2.0& TARGET=http://localhost:8080/sales-post/">Sales</a>
Note that the link above redirects the user to the ID P passing the TARGET query parameter, whose
value is the URL to the target SP application. Once the user clicks the link above, the ID P extracts the
TARGET parameter from the request, builds an SAML v2.0 response, and redirects the user to the
target URL. When the user hits the SP, it is automatically authenticated.
You can use the SAML_VERSION query parameter to specify the SAML version that must be used by
the ID P to create the SAML response. SAML_VERSION parameter can have the possible options as
2.0 and 1.1.
Report a bug
Note
For a Global Logout to function appropriately ensure that you have only up to five Service
Providers per Identity Provider.
24 1
24 2
Note
When using password stacking, set all modules to be required. This ensures that all modules
are considered, and have the chance to contribute roles to the authorization process.
24 3
flag=required, \
module-options=[ \
("password-stacking"=>"useFirstPass"), \
... Ldap login module configuration
])
/subsystem=security/securitydomain=pwdStack/authentication=classic/login-module=Database:add( \
code=Database, \
flag=required, \
module-options=[ \
("password-stacking"=>"useFirstPass"), \
... Database login module configuration
])
Report a bug
Important
Red Hat JBoss Enterprise Application Platform Common Criteria certified release only supports
SHA-256 for password hashing.
24 4
Name of the java. securi ty. Messag eD i g est algorithm to use to hash the password.
There is no default so this option must be specified to enable hashing. Typical values are
SHA-256 , SHA-1 and MD 5.
h ash En co d in g
String that specifies one of three encoding types: base6 4 , hex or rfc26 17. The default is
base6 4 .
h ash C h arset
Encoding character set used to convert the clear text password to a byte array. The platform
default encoding is the default.
h ash U serPasswo rd
Specifies the hashing algorithm must be applied to the password the user submits. The
hashed user password is compared against the value in the login module, which is
expected to be a hash of the password. The default is true.
h ash St o rePasswo rd
Specifies the hashing algorithm must be applied to the password stored on the server side.
This is used for digest authentication, where the user submits a hash of the user password
along with a request-specific tokens from the server to be compare. The hash algorithm (for
digest, this would be rfc26 17) is utilized to compute a server-side hash, which should
match the hashed value sent from the client.
If you must generate passwords in code, the o rg . jbo ss. securi ty. auth. spi . Uti l class
provides a static helper method that will hash a password using the specified encoding. The
following example produces a base64-encoded, MD 5 hashed password.
24 5
u n au t h en t icat ed Id en t it y: This defines the principal name that should be assigned to requests
that contain no authentication information.
Report a bug
Note
This login module also supports unauthenticated identity and password stacking.
The LD AP connectivity information is provided as configuration options that are passed through to
the environment object used to create JND I initial context. The standard LD AP JND I properties used
include the following:
java.n amin g .f act o ry.in it ial
Ini ti al C o ntextFacto ry implementation class name. This defaults to the Sun LD AP
provider implementation co m. sun. jnd i . l d ap. Ld apC txFacto ry.
java.n amin g .p ro vid er.u rl
LD AP URL for the LD AP server.
java.n amin g .secu rit y.au t h en t icat io n
Security protocol level to use. The available values include no ne, si mpl e, and stro ng . If
the property is undefined, the behavior is determined by the service provider.
java.n amin g .secu rit y.p ro t o co l
Transport protocol to use for secure access. Set this configuration option to the type of
service provider (for example, SSL). If the property is undefined, the behavior is determined
by the service provider.
24 6
Note
In certain directory schemas (e.g., Microsoft Active D irectory), role attributes in the user object
are stored as D Ns to role objects instead of simple names. For implementations that use this
schema type, roleAttributeIsD N must be set to true.
User authentication is performed by connecting to the LD AP server, based on the login module
configuration options. Connecting to the LD AP server is done by creating an
Ini ti al Ld apC o ntext with an environment composed of the LD AP JND I properties described
previously in this section.
The Context.SECURITY_PRINCIPAL is set to the distinguished name of the user obtained by the
callback handler in combination with the principalD NPrefix and principalD NSuffix option values,
and the Context.SECURITY_CRED ENTIALS property is set to the respective String password.
Once authentication has succeeded (Ini ti al Ld apC o ntext instance is created), the user's roles
are queried by performing a search on the ro l esC txD N location with search attributes set to the
roleAttributeName and uidAttributeName option values. The roles names are obtaining by invoking
the to Stri ng method on the role attributes in the search result set.
24 7
("matchOnUserDN"=>true), \
("roleAttributeID"=>"cn"), \
("roleAttributeIsDN"=>false) \
])
Note
The example assumes the LD AP server authenticates users using the userP asswo rd attribute
of the user's entry (thed uke in this example). Most LD AP servers operate in this manner,
however if your LD AP server handles authentication differently you must ensure LD AP is
configured according to your production environment requirements.
Once authentication succeeds, the roles on which authorization will be based are retrieved by
performing a subtree search of the ro l esC txD N for entries whose uidAttributeID match the user. If
matchOnUserD N is true, the search will be based on the full D N of the user. Otherwise the search will
be based on the actual user name entered. In this example, the search is under
o u= R o l es,d c= jbo ss,d c= o rg for any entries that have a member attribute equal to
ui d = jsmi th,o u= P eo pl e,d c= jbo ss,d c= o rg . The search would locate cn= JBo ssAd mi n
under the roles entry.
The search returns the attribute specified in the roleAttributeID option. In this example, the attribute is
cn. The value returned would be JBo ssAd mi n, so the jsmi th user is assigned to the JBo ssAd mi n
role.
A local LD AP server often provides identity and authentication services, but is unable to use
authorization services. This is because application roles do not always map well onto LD AP groups,
and LD AP administrators are often hesitant to allow external application-specific data in central
LD AP servers. The LD AP authentication module is often paired with another login module, such as
the database login module, that can provide roles more suitable to the application being developed.
An LD AP D ata Interchange Format (LD IF) file representing the structure of the directory this data
operates against is shown in Example 16.4, LD IF File Example .
LD AP D at a In t erch an g e Fo rmat ( LD IF)
Plain text data interchange format used to represent LD AP directory content and update
requests. D irectory content is represented as one record for each object or update request.
Content consists of add, modify, delete, and rename requests.
24 8
Report a bug
24 9
250
o: example2
dn: ou=People,o=example2,dc=jboss,dc=org
objectClass: top
objectClass: organizationalUnit
ou: People
dn: uid=jduke,ou=People,o=example2,dc=jboss,dc=org
objectClass: top
objectClass: uidObject
objectClass: person
objectClass: inetOrgPerson
cn: Java Duke
employeeNumber: judke-123
sn: Duke
uid: jduke
userPassword:: dGhlZHVrZQ==
dn: uid=jduke2,ou=People,o=example2,dc=jboss,dc=org
objectClass: top
objectClass: uidObject
objectClass: person
objectClass: inetOrgPerson
cn: Java Duke2
employeeNumber: judke2-123
sn: Duke2
uid: jduke2
userPassword:: dGhlZHVrZTI=
dn: ou=Roles,o=example2,dc=jboss,dc=org
objectClass: top
objectClass: organizationalUnit
ou: Roles
dn: uid=jduke,ou=Roles,o=example2,dc=jboss,dc=org
objectClass: top
objectClass: groupUserEx
memberOf: cn=Echo,ou=Roles,o=example2,dc=jboss,dc=org
memberOf: cn=TheDuke,ou=Roles,o=example2,dc=jboss,dc=org
uid: jduke
dn: uid=jduke2,ou=Roles,o=example2,dc=jboss,dc=org
objectClass: top
objectClass: groupUserEx
memberOf: cn=Echo2,ou=Roles,o=example2,dc=jboss,dc=org
memberOf: cn=TheDuke2,ou=Roles,o=example2,dc=jboss,dc=org
uid: jduke2
dn: cn=Echo,ou=Roles,o=example2,dc=jboss,dc=org
objectClass: top
objectClass: groupOfNames
cn: Echo
description: the echo role
member: uid=jduke,ou=People,dc=jboss,dc=org
dn: cn=TheDuke,ou=Roles,o=example2,dc=jboss,dc=org
251
objectClass: groupOfNames
objectClass: top
cn: TheDuke
description: the duke role
member: uid=jduke,ou=People,o=example2,dc=jboss,dc=org
dn: cn=Echo2,ou=Roles,o=example2,dc=jboss,dc=org
objectClass: top
objectClass: groupOfNames
cn: Echo2
description: the Echo2 role
member: uid=jduke2,ou=People,dc=jboss,dc=org
dn: cn=TheDuke2,ou=Roles,o=example2,dc=jboss,dc=org
objectClass: groupOfNames
objectClass: top
cn: TheDuke2
description: the duke2 role
member: uid=jduke2,ou=People,o=example2,dc=jboss,dc=org
dn: cn=JBossAdmin,ou=Roles,o=example2,dc=jboss,dc=org
objectClass: top
objectClass: groupOfNames
cn: JBossAdmin
description: the JBossAdmin group
member: uid=jduke,ou=People,dc=jboss,dc=org
The module configuration for this LD AP structure example is outlined in the following management
CLI command.
/subsystem=security/securitydomain=testLdapExample2/authentication=classic/loginmodule=LdapExtended:add( \
code=LdapExtended, \
flag=required, \
module-options=[ \
("java.naming.factory.initial"=>"com.sun.jndi.ldap.LdapCtxFactory"), \
("java.naming.provider.url"=>"ldap://ldaphost.jboss.org"), \
("java.naming.security.authentication"=>"simple"), \
("bindDN"=>"cn=Root,dc=jboss,dc=org"), \
("bindCredential"=>"secret1"), \
("baseCtxDN"=>"ou=People,o=example2,dc=jboss,dc=org"), \
("baseFilter"=>"(uid={0})"), \
("rolesCtxDN"=>"ou=Roles,o=example2,dc=jboss,dc=org"), \
("roleFilter"=>"(uid={0})"), \
("roleAttributeIsDN"=>"true"), \
("roleAttributeID"=>"memberOf"), \
("roleNameAttributeID"=>"cn") \
])
252
dn: o=example3,dc=jboss,dc=org
objectclass: top
objectclass: organization
o: example3
dn: ou=People,o=example3,dc=jboss,dc=org
objectclass: top
objectclass: organizationalUnit
ou: People
dn: uid=jduke,ou=People,o=example3,dc=jboss,dc=org
objectclass: top
objectclass: uidObject
objectclass: person
objectClass: inetOrgPerson
uid: jduke
employeeNumber: judke-123
cn: Java Duke
sn: Duke
userPassword: theduke
dn: ou=Roles,o=example3,dc=jboss,dc=org
objectClass: top
objectClass: organizationalUnit
ou: Roles
dn: uid=jduke,ou=Roles,o=example3,dc=jboss,dc=org
objectClass: top
objectClass: groupUserEx
memberOf: cn=Echo,ou=Roles,o=example3,dc=jboss,dc=org
memberOf: cn=TheDuke,ou=Roles,o=example3,dc=jboss,dc=org
uid: jduke
dn: cn=Echo,ou=Roles,o=example3,dc=jboss,dc=org
objectClass: top
objectClass: groupOfNames
cn: Echo
description: the JBossAdmin group
member: uid=jduke,ou=People,o=example3,dc=jboss,dc=org
dn: cn=TheDuke,ou=Roles,o=example3,dc=jboss,dc=org
objectClass: groupOfNames
objectClass: top
cn: TheDuke
member: uid=jduke,ou=People,o=example3,dc=jboss,dc=org
The module configuration for this LD AP structure example is outlined in the following management
CLI command.
/subsystem=security/securitydomain=testLdapExample3/authentication=classic/loginmodule=LdapExtended:add( \
code=LdapExtended, \
253
flag=required, \
module-options=[ \
("java.naming.factory.initial"=>"com.sun.jndi.ldap.LdapCtxFactory"),
\
("java.naming.provider.url"=>"ldap://ldaphost.jboss.org"), \
("java.naming.security.authentication"=>"simple"), \
("bindDN"=>"cn=Root,dc=jboss,dc=org"), \
("bindCredential"=>"secret1"), \
("baseCtxDN"=>"ou=People,o=example3,dc=jboss,dc=org"), \
("baseFilter"=>"(cn={0})"), \
("rolesCtxDN"=>"ou=Roles,o=example3,dc=jboss,dc=org"), \
("roleFilter"=>"(member={1})"), \
("roleAttributeID"=>"cn") \
])
dn: o=example4,dc=jboss,dc=org
objectclass: top
objectclass: organization
o: example4
dn: ou=People,o=example4,dc=jboss,dc=org
objectclass: top
objectclass: organizationalUnit
ou: People
dn: uid=jduke,ou=People,o=example4,dc=jboss,dc=org
objectClass: top
objectClass: uidObject
objectClass: person
objectClass: inetOrgPerson
cn: Java Duke
employeeNumber: jduke-123
sn: Duke
uid: jduke
userPassword:: dGhlZHVrZQ==
dn: ou=Roles,o=example4,dc=jboss,dc=org
objectClass: top
objectClass: organizationalUnit
ou: Roles
dn: cn=RG1,ou=Roles,o=example4,dc=jboss,dc=org
objectClass: groupOfNames
objectClass: top
cn: RG1
member: cn=empty
dn: cn=RG2,cn=RG1,ou=Roles,o=example4,dc=jboss,dc=org
objectClass: groupOfNames
objectClass: top
cn: RG2
member: cn=RG1,ou=Roles,o=example4,dc=jboss,dc=org
254
member: uid=jduke,ou=People,o=example4,dc=jboss,dc=org
dn: cn=RG3,cn=RG1,ou=Roles,o=example4,dc=jboss,dc=org
objectClass: groupOfNames
objectClass: top
cn: RG3
member: cn=RG1,ou=Roles,o=example4,dc=jboss,dc=org
dn: cn=R1,ou=Roles,o=example4,dc=jboss,dc=org
objectClass: groupOfNames
objectClass: top
cn: R1
member: cn=RG2,cn=RG1,ou=Roles,o=example4,dc=jboss,dc=org
dn: cn=R2,ou=Roles,o=example4,dc=jboss,dc=org
objectClass: groupOfNames
objectClass: top
cn: R2
member: cn=RG2,cn=RG1,ou=Roles,o=example4,dc=jboss,dc=org
dn: cn=R3,ou=Roles,o=example4,dc=jboss,dc=org
objectClass: groupOfNames
objectClass: top
cn: R3
member: cn=RG2,cn=RG1,ou=Roles,o=example4,dc=jboss,dc=org
member: cn=RG3,cn=RG1,ou=Roles,o=example4,dc=jboss,dc=org
dn: cn=R4,ou=Roles,o=example4,dc=jboss,dc=org
objectClass: groupOfNames
objectClass: top
cn: R4
member: cn=RG3,cn=RG1,ou=Roles,o=example4,dc=jboss,dc=org
dn: cn=R5,ou=Roles,o=example4,dc=jboss,dc=org
objectClass: groupOfNames
objectClass: top
cn: R5
member: cn=RG3,cn=RG1,ou=Roles,o=example4,dc=jboss,dc=org
member: uid=jduke,ou=People,o=example4,dc=jboss,dc=org
The module configuration for this LD AP structure example is outlined in the code sample.
/subsystem=security/securitydomain=testLdapExample4/authentication=classic/loginmodule=LdapExtended:add( \
code=LdapExtended, \
flag=required, \
module-options=[ \
("java.naming.factory.initial"=>"com.sun.jndi.ldap.LdapCtxFactory"), \
("java.naming.provider.url"=>"ldap://ldaphost.jboss.org"), \
("java.naming.security.authentication"=>"simple"), \
("bindDN"=>"cn=Root,dc=jboss,dc=org"), \
("bindCredential"=>"secret1"), \
("baseCtxDN"=>"ou=People,o=example4,dc=jboss,dc=org"), \
255
("baseFilter"=>"(cn={0})"), \
("rolesCtxDN"=>"ou=Roles,o=example4,dc=jboss,dc=org"), \
("roleFilter"=>"(member={1})"), \
("roleRecursion"=>"1"), \
("roleAttributeID"=>"memberOf") \
])
/subsystem=security/securitydomain=AD_Default/authentication=classic/login-module=LdapExtended:add(
\
code=LdapExtended, \
flag=required, \
module-options=[ \
("java.naming.provider.url"=>"ldap://ldaphost.jboss.org"), \
("bindDN"=>"JBOSS\searchuser"), \
("bindCredential"=>"password"), \
("baseCtxDN"=>"CN=Users,DC=jboss,DC=org"), \
("baseFilter"=>"(sAMAccountName={0})"), \
("rolesCtxDN"=>"CN=Users,DC=jboss,DC=org"), \
("roleFilter"=>"(sAMAccountName={0})"), \
("roleAttributeID"=>"memberOf"), \
("roleAttributeIsDN"=>"true"), \
("roleNameAttributeID"=>"cn"), \
("searchScope"=>"ONELEVEL_SCOPE"), \
("allowEmptyPasswords"=>"false") \
])
/subsystem=security/securitydomain=AD_Recursive/authentication=classic/loginmodule=LdapExtended:add( \
code=LdapExtended, \
flag=required, \
module-options=[ \
("java.naming.provider.url"=>"ldap://ldaphost.jboss.org"), \
("java.naming.referral"=>"follow"), \
("bindDN"=>"JBOSS\searchuser"), \
256
("bindCredential"=>"password"), \
("baseCtxDN"=>"CN=Users,DC=jboss,DC=org"), \
("baseFilter"=>"(sAMAccountName={0})"), \
("rolesCtxDN"=>"CN=Users,DC=jboss,DC=org"), \
("roleFilter"=>"(member={1})"), \
("roleAttributeID"=>"cn"), \
("roleAttributeIsDN"=>"false"), \
("roleRecursion"=>"2"), \
("searchScope"=>"ONELEVEL_SCOPE"), \
("allowEmptyPasswords"=>"false") \
])
Report a bug
In Example 16.10, UserRoles Login Module , the ejb3-sampl eapp-users. pro perti es file uses
a username= passwo rd format with each user entry on a separate line:
username1=password1
username2=password2
...
The ejb3-sampl eapp-ro l es. pro perti es file referenced in Example 16.10, UserRoles Login
Module uses the pattern username= ro l e1,ro l e2, with an optional group name value. For
example:
257
username1=role1,role2,...
username1.RoleGroup1=role3,role4,...
username2=role1,role3,...
The user name.XXX property name pattern present in ejb3-sampl eapp-ro l es. pro perti es is
used to assign the user name roles to a particular named group of roles where the XXX portion of the
property name is the group name. The user name=... form is an abbreviation for user name.Roles=...,
where the R o l es group name is the standard name the JBo ssAutho ri zati o nManag er expects to
contain the roles which define the permissions of users.
The following would be equivalent definitions for the jd uke user name:
jduke=TheDuke,AnimatedCharacter
jduke.Roles=TheDuke,AnimatedCharacter
Report a bug
Note
This module supports password stacking, password hashing and unauthenticated identity.
The D atabase login module is based on two logical tables:
Table Principals(PrincipalID text, Password text)
Table Roles(PrincipalID text, Role text, RoleGroup text)
The P ri nci pal s table associates the user P ri nci pal ID with the valid password and the R o l es
table associates the user P ri nci pal ID with its role sets. The roles used for user permissions must
be contained in rows with a R o l eG ro up column value of R o l es.
The tables are logical in that you can specify the SQL query that the login module uses. The only
requirement is that the java. sq l . R esul tSet has the same logical structure as the P ri nci pal s
and R o l es tables described previously. The actual names of the tables and columns are not
relevant as the results are accessed based on the column index.
To clarify this notion, consider a database with two tables, P ri nci pal s and R o l es, as already
declared. The following statements populate the tables with the following data:
P ri nci pal ID java with a P asswo rd of echo man in the P ri nci pal s table
P ri nci pal ID java with a role named Echo in the R o l esR o l eG ro up in the R o l es table
P ri nci pal ID java with a role named cal l er_java in the C al l erP ri nci pal R o l eG ro up in
the R o l es table
258
259
flag=required, \
module-options=[ \
("securityDomain"=>"trust-domain"), \
])
Pro ced u re 16 .1. Secu re Web Ap p licat io n s wit h C ert if icat es an d R o le- b ased
Au t h o riz at io n
This procedure describes how to secure a web application, such as the user-app. war, using client
certificates and role-based authorization. In this example the C erti fi cateR o l es login module is
used for authentication and authorization. Both the trusted -cl i ents. keysto re and the appro l es. pro perti es require an entry that maps to the principal associated with the client certificate.
By default, the principal is created using the client certificate distinguished name, such as the D N
specified in Example 16.11, Certificate Example .
1. D eclare R eso u rces an d R o les
Modify web. xml to declare the resources to be secured along with the allowed roles and
security domain to be used for authentication and authorization.
260
< jboss-web>
<security-domain>app-sec-domain</security-domain>
< /jboss-web>
3. C o n f ig u re Lo g in Mo d u le
D efine the login module configuration for the app-sec-d o mai n domain you just specified
using the management CLI.
[
/subsystem=security/security-domain=trust-domain:add
/subsystem=security/security-domain=trust-domain/jsse=classic:add( \
truststore={ \
password=>pass1234, \
url=>/home/jbosseap/trusted-clients.jks \
})
/subsystem=security/security-domain=app-sec-domain:add
/subsystem=security/security-domain=app-secdomain/authentication=classic:add
/subsystem=security/security-domain=app-secdomain/authentication=classic/login-module=CertificateRoles:add( \
code=CertificateRoles, \
flag=required, \
module-options=[ \
("securityDomain"=>"trust-domain"), \
("rolesProperties"=>"app-roles.properties") \
])
The trusted -cl i ents. keysto re would need the certificate in Example 16.11, Certificate
Example stored with an alias of C N= val i d -cl i ent, O U= Securi ty Q E, O U= JBo ss, O = R ed
Hat, C = C Z. The app-ro l es. pro perti es must have the same entry. Since the D N contains
characters that are normally treated as delimiters, you must escape the problem characters using a
261
Note
This module supports password stacking.
This login module is useful when you need to provide a fixed identity to a service, and in
development environments when you want to test the security associated with a given principal and
associated roles.
For details of Identity login module options see Section A.1, Included Authentication Modules .
A sample security domain configuration is described below. It authenticates all users as the principal
named jd uke and assigns role names of T heD uke, and Ani mated C haracter:.
/subsystem=security/security-domain=testIdentity:add
/subsystem=security/securitydomain=testIdentity/authentication=classic:add
/subsystem=security/securitydomain=testIdentity/authentication=classic/login-module=Identity:add( \
code=Identity, \
flag=required, \
module-options=[ \
("principal"=>"jduke"), \
("roles"=>"TheDuke,AnimatedCharacter") \
])
Report a bug
262
Report a bug
1 6 .1 .1 0 .1 . RunAsIde nt it y Cre at io n
In order for JBoss EAP 6 to secure access to EJB methods, the identity of the user must be known at
the time the method call is made.
A user's identity in the server is represented either by a javax. securi ty. auth. Subject instance
or an o rg . jbo ss. securi ty. R unAsId enti ty instance. Both these classes store one or more
principals that represent the identity and a list of roles that the identity possesses. In the case of the
javax. securi ty. auth. Subject a list of credentials is also stored.
In the <assembly-descriptor> section of the ejb-jar. xml deployment descriptor, you specify one or
more roles that a user must have to access the various EJB methods. A comparison of these lists
reveals whether the user has one of the roles necessary to access the EJB method.
...
<security-identity>
<run-as>
<role-name>Admin</role-name>
</run-as>
</security-identity>
...
< /session>
This declaration signifies that an Ad mi n RunAsIdentity role must be created.
To name a principal for the Ad mi n role, you define a <run-as-pri nci pal > element in the
jbo ss-ejb3. xml file.
< jboss:ejb-jar
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:jboss="http://www.jboss.com/xml/ns/javaee"
xmlns:s="urn:security:1.1"
version="3.1" impl-version="2.0">
<assembly-descriptor>
<s:security>
<ejb-name>WhoAmIBean</ejb-name>
<s:run-as-principal>John</s:run-as-principal>
</s:security>
</assembly-descriptor>
< /jboss:ejb-jar>
The <securi ty-i d enti ty> element in both the ejb-jar. xml and <securi ty> element in the
jbo ss-ejb3. xml files are parsed at deployment time. The <run-as> role name and the <runas-pri nci pal > name are then stored in the
o rg . jbo ss. metad ata. ejb. spec. Securi tyId enti tyMetaD ata class.
263
...>
<assembly-descriptor>
...
<sr:security-role>
<sr:role-name>Support</sr:role-name>
<sr:principal-name>John</sr:principal-name>
<sr:principal-name>Jill</sr:principal-name>
<sr:principal-name>Tony</sr:principal-name>
</sr:security-role>
</assembly-descriptor>
< /jboss:ejb-jar>
In Example 16.12, org.jboss.security.RunAsIdentity Creation , the <run-as-pri nci pal > of
Jo hn was created. The configuration in this example extends the Ad mi n role, by adding the
Suppo rt role. The new role contains extra principals, including the originally defined principal
Jo hn.
The <securi ty-ro l e> element in both the ejb-jar. xml and jbo ss-ejb3. xml files are
parsed at deployment time. The <ro l e-name> and the <pri nci pal -name> data is stored in the
o rg . jbo ss. metad ata. ejb. spec. Securi tyId enti tyMetaD ata class.
Report a bug
264
< jboss-deployment-structure>
<deployment>
<dependencies>
</dependencies>
</deployment>
< /jboss-deployment-structure>
Report a bug
265
)
/subsystem=security/security-domain=test-domain2/authentication=classic/login-module=test2-map/:add(\
flag=optional,\
code=RoleMapping,\
module-options=[("rolesProperties"=>"rolesMapping-roles.properties")]\
)
Another example achieving the same result, but using the mapping module. This is the preferred
method of role mapping:
266
To obtain the password from the output of an external command, use the format {EXT }. . .
where the . . . is the external command. The first line of the command output is used as the
password.
To improve performance, the {EXT C [: expi rati o n_i n_mi l l i s]} variant caches the
password for a specified number of milliseconds. By default the cached password does not
expire. If the value 0 (zero) is specified, the cached credentials do not expire.
The EXT C variant is only supported by the Ld apExtend ed login module.
Report a bug
getPrincipals()
getPrincipals(java.lang.Class c)
getPrivateCredentials()
getPrivateCredentials(java.lang.Class c)
getPublicCredentials()
getPublicCredentials(java.lang.Class c)
For Subject identities and roles, EAP has selected the most logical choice: the principals sets
obtained via g etP ri nci pal s() and g etP ri nci pal s(java. l ang . C l ass). The usage pattern
is as follows:
User identities (for example; user name, social security number, employee ID ) are stored as
java. securi ty. P ri nci pal objects in the SubjectP ri nci pal s set. The P ri nci pal
implementation that represents the user identity must base comparisons and equality on the name
of the principal. A suitable implementation is available as the
o rg . jbo ss. securi ty. Si mpl eP ri nci pal class. Other P ri nci pal instances may be added
to the SubjectP ri nci pal s set as needed.
267
Assigned user roles are also stored in the P ri nci pal s set, and are grouped in named role sets
using java. securi ty. acl . G ro up instances. The G ro up interface defines a collection of
P ri nci pal s and/or G ro ups, and is a subinterface of java. securi ty. P ri nci pal .
Any number of role sets can be assigned to a Subject.
The EAP security framework uses two well-known role sets with the names R o l es and
C al l erP ri nci pal .
The R o l es group is the collection of P ri nci pal s for the named roles as known in the
application domain under which the Subject has been authenticated. This role set is used by
methods like the EJBC o ntext. i sC al l erInR o l e(Stri ng ), which EJBs can use to see if
the current caller belongs to the named application domain role. The security interceptor logic
that performs method permission checks also uses this role set.
The C al l erP ri nci pal G ro up consists of the single P ri nci pal identity assigned to the
user in the application domain. The EJBC o ntext. g etC al l erP ri nci pal () method uses
the C al l erP ri nci pal to allow the application domain to map from the operation
environment identity to a user identity suitable for the application. If a Subject does not have
a C al l erP ri nci pal G ro up, the application identity is the same as operational environment
identity.
Report a bug
Important
The l o g i nO k instance variable is pivotal. This must be set to true if the log in succeeds, or
fal se by any subclasses that override the log in method. If this variable is incorrectly set, the
commit method will not correctly update the subject.
Tracking the log in phase outcomes allows login modules to be chained together with control flags.
These control flags do not require the login modules to succeed as part of the authentication
process.
268
implements javax.security.auth.spi.LoginModule
{
// ...
/**
* <p>
*/
CallbackHandler callbackHandler,
Map sharedState,
Map options)
269
// ...
/**
* Looks for javax.security.auth.login.name and
* javax.security.auth.login.password values in the sharedState
* map if the useFirstPass option was true and returns true if
* they exist. If they do not or are null this method returns
* false.
* Note that subclasses that override the login method
* must set the loginOk var to true if the login succeeds in
* order for the commit phase to populate the Subject. This
* implementation sets loginOk to true if the login() method
* returns true, otherwise, it sets loginOk to false.
*/
public boolean login()
throws LoginException
{
// ...
}
/**
* Overridden by subclasses to return the Principal that
* corresponds to the user primary identity.
*/
abstract protected Principal getIdentity();
/**
* Overridden by subclasses to return the Groups that correspond
* to the role sets assigned to the user. Subclasses should
* create at least a Group named "Roles" that contains the roles
* assigned to the user. A second common group is
* "CallerPrincipal," which provides the application identity of
* the user rather than the security domain identity.
*
* @ return Group[] containing the sets of roles
*/
abstract protected Group[] getRoleSets() throws LoginException;
U sern amePasswo rd Lo g in Mo d u le
The second abstract base login module suitable for custom login modules is the
o rg . jbo ss. securi ty. auth. spi . UsernameP asswo rd Lo g i nMo d ul e.
This login module further simplifies custom login module implementation by enforcing a string-based
user name as the user identity and a char[] password as the authentication credentials. It also
supports the mapping of anonymous users (indicated by a null user name and password) to a
principal with no roles. The key details of the class are highlighted in the following class fragment.
The JavaD oc comments detail the responsibilities of subclasses.
270
p ackage org.jboss.security.auth.spi;
/ **
* An abstract subclass of AbstractServerLoginModule that imposes a
* an identity == String username, credentials == String password
* view on the login process. Subclasses override the
* getUsersPassword() and getUsersRoles() methods to return the
* expected password and roles for the user.
*/
p ublic abstract class UsernamePasswordLoginModule
extends AbstractServerLoginModule
{
/** The principal to use when a null username and password are seen
*/
/**
* The message digest algorithm used to hash passwords. If null
then
* plain passwords will be used. */
private String hashAlgorithm = null;
/**
* The name of the charset/encoding to use when converting the
* password String to a byte array. Default is the platform's
* default encoding.
*/
private String hashCharset = null;
// ...
/**
* Override the superclass method to look for an
* unauthenticatedIdentity property. This method first invokes
* the super version.
*
* @ param options,
* @ option unauthenticatedIdentity: the name of the principal to
* assign and authenticate when a null username and password are
* seen.
*/
public void initialize(Subject subject,
CallbackHandler callbackHandler,
Map sharedState,
Map options)
{
super.initialize(subject, callbackHandler, sharedState,
options);
// Check for unauthenticatedIdentity option.
271
// ...
/**
* A hook that allows subclasses to change the validation of the
* input password against the expected password. This version
* checks that neither inputPassword or expectedPassword are null
* and that inputPassword.equals(expectedPassword) is true;
*
* @ return true if the inputPassword is valid, false otherwise.
*/
protected boolean validatePassword(String inputPassword,
String expectedPassword)
{
if (inputPassword == null || expectedPassword == null) {
return false;
}
return inputPassword.equals(expectedPassword);
}
/**
* Get the expected password for the current username available
* via the getUsername() method. This is called from within the
* login() method after the CallbackHandler has returned the
* username and candidate password.
*
* @ return the valid password String
*/
abstract protected String getUsersPassword()
throws LoginException;
Su b classin g Lo g in Mo d u les
The choice of sub-classing the AbstractServerLo g i nMo d ul e versus
UsernameP asswo rd Lo g i nMo d ul e is based on whether a string-based user name and credentials
are usable for the authentication technology you are writing the login module for. If the string-based
semantic is valid, then subclass UsernameP asswo rd Lo g i nMo d ul e, otherwise subclass
AbstractServerLo g i nMo d ul e.
Su b classin g St ep s
The steps your custom login module must execute depend on which base login module class you
choose. When writing a custom login module that integrates with your security infrastructure, you
should start by sub-classing AbstractServerLo g i nMo d ul e or
UsernameP asswo rd Lo g i nMo d ul e to ensure that your login module provides the authenticated
P ri nci pal information in the form expected by the EAP security manager.
When sub-classing the AbstractServerLo g i nMo d ul e, you must override the following:
272
i mport
i mport
i mport
i mport
i mport
i mport
java.security.acl.Group;
java.util.Map;
javax.naming.InitialContext;
javax.naming.NamingException;
javax.security.auth.Subject;
javax.security.auth.callback.CallbackHandler;
273
i mport javax.security.auth.login.LoginException;
i mport org.jboss.logging.Logger;
i mport org.jboss.security.SimpleGroup;
i mport org.jboss.security.SimplePrincipal;
i mport org.jboss.security.auth.spi.UsernamePasswordLoginModule;
/ **
* An example custom login module that obtains passwords and roles for
a user from a JNDI lookup.
*
* @ author Scott.Stark@ jboss.org
*/
p ublic class JndiUserAndPassLoginModule extends
UsernamePasswordLoginModule {
/** The JNDI name to the context that handles the password/username
lookup */
private String userPathPrefix;
/** The JNDI name to the context that handles the roles/username
lookup */
private String rolesPathPrefix;
private static Logger log =
Logger.getLogger(JndiUserAndPassLoginModule.class);
/**
*/
@ Override
public void initialize(Subject subject, CallbackHandler
callbackHandler, Map sharedState, Map options) {
*/
@ Override
protected Group[] getRoleSets() throws LoginException {
try {
groups[0].addMember(role);
return groups;
} catch (NamingException e) {
}
}
/**
274
*/
@ Override
protected String getUsersPassword() throws LoginException {
try {
return passwd;
} catch (NamingException e) {
}
}
Examp le 16 .23. D ef in it io n o f secu rit y- ex2 secu rit y d o main wit h t h e n ewly- creat ed
cu st o m lo g in mo d u le
/subsystem=security/security-domain=security-ex2/:add
/subsystem=security/security-domain=securityex2/authentication=classic:add
/subsystem=security/security-domain=securityex2/authentication=classic/login-module=ex2/:add(\
flag=required,\
code=org.jboss.book.security.ex2.JndiUserAndPassLoginModule,\
module-options=[("userPathPrefix"=>"/security/store/password"),\
("rolesPathPrefix"=>"/security/store/roles")]\
)
The choice of using the Jnd i UserAnd P assLo g i nMo d ul e custom login module for the server side
authentication of the user is determined by the login configuration for the example security domain.
The EJB JAR MET A-INF/jbo ss-ejb3. xml descriptor sets the security domain. For a web
application it is part of the WEB-INF/jbo ss-web. xml file.
<s:security>
<ejb-name>*</ejb-name>
<s:security-domain>security-ex2</s:security-domain>
</s:security>
</assembly-descriptor>
< /jboss:ejb-jar>
275
<security-domain>security-ex2</security-domain>
< /jboss-web>
Report a bug
276
17.2. About Java Aut hent icat ion and Aut horiz at ion Service (JAAS)
The security architecture of JBoss EAP 6 is comprised of the security configuration subsystem, and
application-specific security configurations which are included in several configuration files within
the application.
D o main , Server G ro u p , an d Server Sp ecif ic C o n f ig u rat io n
Server groups (in a managed domain) and servers (in a standalone server) include the configuration
for security domains. A security domain includes information about a combination of authentication,
authorization, mapping, and auditing modules, with configuration details. An application specifies
which security domain it requires, by name, in its jbo ss-web. xml .
Ap p licat io n - sp ecif ic C o n f ig u rat io n
Application-specific configuration takes place in one or more of the following four files.
T ab le 17.1. Ap p licat io n - Sp ecif ic C o n f ig u rat io n Files
File
D escrip t io n
ejb-jar.xml
277
File
D escrip t io n
web.xml
jboss-ejb3.xml
jboss-web.xml
Note
The ejb-jar. xml and web. xml are defined in the Java Enterprise Edition (Java EE)
specification. The jbo ss-ejb3. xml provides JBoss-specific extensions for the ejbjar. xml , and the jbo ss-web. xml provides JBoss-specific extensions for the web. xml .
Report a bug
Warning
If an application is part of a security domain that uses an authentication cache, user
authentications for that application will also be available to other applications in that security
domain.
278
configuration file. If the JBoss EAP 6 instance is running in a managed domain, this
is the d o mai n/co nfi g urati o n/d o mai n. xml file. If the JBoss EAP 6 instance is
running as a standalone server, this is the
stand al o ne/co nfi g urati o n/stand al o ne. xml file.
The o ther, jbo ss-web-po l i cy, and jbo ss-ejb-po l i cy security domains are
provided by default in JBoss EAP 6. The following XML example was copied from the
securi ty subsystem in the server's configuration file.
The cache-type attribute of a security domain specifies a cache for faster
authentication checks. Allowed values are d efaul t to use a simple map as the
cache, or i nfi ni span to use an Infinispan cache.
< subsystem xmlns="urn:jboss:domain:security:1.2">
<security-domains>
<authentication>
<login-module code="Remoting"
flag="optional">
<module-option name="password-stacking"
value="useFirstPass"/>
</login-module>
<login-module code="RealmDirect"
flag="required">
<module-option name="password-stacking"
value="useFirstPass"/>
</login-module>
</authentication>
</security-domain>
<authorization>
<policy-module code="Delegating"
flag="required"/>
</authorization>
</security-domain>
<authorization>
<policy-module code="Delegating"
flag="required"/>
</authorization>
</security-domain>
</security-domains>
< /subsystem>
You can configure additional security domains as needed using the Management
Console or CLI.
b. En ab le t h e secu rit y d o main in t h e ap p licat io n ' s d escrip t o r f ile
The security domain is specified in the <securi ty-d o mai n> child element of the
<jbo ss-web> element in the application's WEB-INF/jbo ss-web. xml file. The
following example configures a security domain named my-d o mai n.
279
< jboss-web>
<security-domain>my-domain</security-domain>
< /jboss-web>
This is only one of many settings which you can specify in the WEB-INF/jbo ssweb. xml descriptor.
2. Ad d t h e R eq u ired An n o t at io n t o t h e EJB
You configure security in the EJB using the @ Securi tyD o mai n and @ R o l esAl l o wed
annotations. The following EJB code example limits access to the o ther security domain by
users in the g uest role.
p ackage example.ejb3;
i mport java.security.Principal;
i mport
i mport
i mport
i mport
javax.annotation.Resource;
javax.annotation.security.RolesAllowed;
javax.ejb.SessionContext;
javax.ejb.Stateless;
i mport org.jboss.ejb3.annotation.SecurityDomain;
/ **
* Simple secured EJB using EJB security annotations
* Allow access to "other" security domain by users in a "guest"
role.
*/
@ Stateless
@ RolesAllowed({ "guest" })
@ SecurityDomain("other")
p ublic class SecuredEJB {
/**
* Secured EJB method using security annotations
*/
public String getSecurityInfo() {
// Session context injected using the resource annotation
Principal principal = ctx.getCallerPrincipal();
return principal.toString();
}
For more code examples, see the ejb-securi ty quickstart in the JBoss EAP 6 Quickstarts
bundle, which is available from the Red Hat Customer Portal.
Report a bug
To add security to a servlet, you map each servlet to a URL pattern, and create security constraints
on the URL patterns which need to be secured. The security constraints limit access to the URLs to
roles. The authentication and authorization are handled by the security domain specified in the
WAR's jbo ss-web. xml .
Prereq u isit es
Before you use role-based security in a servlet, the security domain used to authenticate and
authorize access needs to be configured in the JBoss EAP 6 container.
Pro ced u re 17.2. Ad d R o le- B ased Secu rit y t o Servlet s
1. Ad d map p in g s b et ween servlet s an d U R L p at t ern s.
Use <servl et-mappi ng > elements in the web. xml to map individual servlets to URL
patterns. The following example maps the servlet called D i spl ayO pR esul t to the URL
pattern /D i spl ayO pR esul t.
< servlet-mapping>
<servlet-name>DisplayOpResult</servlet-name>
<url-pattern>/DisplayOpResult</url-pattern>
< /servlet-mapping>
< security-constraint>
<display-name>Restrict access to role eap_admin</display-name>
<web-resource-collection>
<web-resource-name>Restrict access to role eap_admin</webresource-name>
<url-pattern>/DisplayOpResult/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>eap_admin</role-name>
</auth-constraint>
< /security-constraint>
< security-role>
<role-name>eap_admin</role-name>
< /security-role>
< login-config>
<auth-method>BASIC</auth-method>
< /login-config>
281
You need to specify the authentication method, which can be any of the following: BASIC ,
FO R M, D IG EST , C LIENT -C ER T , SP NEG O . This example uses BASIC authentication.
3. Sp ecif y t h e secu rit y d o main in t h e WAR ' s jbo ss-web. xml
Add the security domain to the WAR's jbo ss-web. xml in order to connect the servlets to the
configured security domain, which knows how to authenticate and authorize principals
against the security constraints. The following example uses the security domain called
acme_d o mai n.
< jboss-web>
...
<security-domain>acme_domain</security-domain>
...
< /jboss-web>
Examp le 17.1. Examp le web. xml wit h R o le- B ased Secu rit y C o n f ig u red
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
< display-name>Use Role-Based Security In Servlets</display-name>
< welcome-file-list>
<welcome-file>/index.jsp</welcome-file>
< /welcome-file-list>
< servlet-mapping>
<servlet-name>DisplayOpResult</servlet-name>
<url-pattern>/DisplayOpResult</url-pattern>
< /servlet-mapping>
< security-constraint>
<display-name>Restrict access to role eap_admin</display-name>
<web-resource-collection>
<url-pattern>/DisplayOpResult/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>eap_admin</role-name>
</auth-constraint>
</security-constraint>
282
<security-role>
<role-name>eap_admin</role-name>
</security-role>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
< /web-app>
Report a bug
17.5. Use A T hird-Part y Aut hent icat ion Syst em In Your Applicat ion
You can integrate third-party security systems with JBoss EAP 6. These types of systems are usually
token-based. The external system performs the authentication and passes a token back to the Web
application through the request headers. This is often referred to as perimeter authentication. To
configure perimeter authentication in your application, add a custom authentication valve. If you
have a valve from a third-party provider, be sure it is in your classpath and follow the examples
below, along with the documentation for your third-party authentication module.
Note
The location for configuring valves has changed in JBoss EAP 6. There is no longer a
co ntext. xml deployment descriptor. Valves are configured directly in the jbo ss-web. xml
descriptor instead. The co ntext. xml is now ignored.
<classname>org.jboss.security.negotiation.NegotiationAuthenticator</classname>
</valve>
< /jboss-web>
This valve is used for Kerberos-based SSO. It also shows the most simple pattern for specifying a
third-party authenticator for your Web application.
<classname>org.jboss.web.tomcat.security.GenericHeaderAuthenticator</classname>
<param>
<param-name>httpHeaderForSSOAuth</param-name>
<param-value>sm_ssoid,ct-remote-user,HTTP_OBLIX_UID</param-value>
</param>
<param>
283
<param-name>sessionCookieForSSOAuth</param-name>
<param-value>SMSESSION,CTSESSION,ObSSOCookie</param-value>
</param>
</valve>
< /jboss-web>
This example shows how to set custom attributes on your valve. The authenticator checks for the
presence of the header ID and the session key, and passes them into the JAAS framework which
drives the security layer, as the username and password value. You need a custom JAAS login
module which can process the username and password and populate the subject with the correct
roles. If no header values match the configured values, regular form-based authentication
semantics apply.
Writ in g a C u st o m Au t h en t icat o r
Writing your own authenticator is out of scope of this document. However, the following Java code is
provided as an example.
p ackage org.jboss.web.tomcat.security;
i mport java.io.IOException;
i mport java.security.Principal;
i mport java.util.StringTokenizer;
i mport
i mport
i mport
i mport
i mport
284
javax.management.JMException;
javax.management.ObjectName;
javax.servlet.http.Cookie;
javax.servlet.http.HttpServletRequest;
javax.servlet.http.HttpServletResponse;
i mport
i mport
i mport
i mport
i mport
i mport
i mport
org.apache.catalina.Realm;
org.apache.catalina.Session;
org.apache.catalina.authenticator.Constants;
org.apache.catalina.connector.Request;
org.apache.catalina.connector.Response;
org.apache.catalina.deploy.LoginConfig;
org.jboss.logging.Logger;
i mport org.jboss.as.web.security.ExtendedFormAuthenticator;
/ **
* JBAS-2283: Provide custom header based authentication support
*
* Header Authenticator that deals with userid from the request header
Requires
* two attributes configured on the Tomcat Service - one for the http
header
* denoting the authenticated identity and the other is the SESSION
cookie
*
* @ author <a href="mailto:Anil.Saldhana@ jboss.org">Anil Saldhana</a>
* @ author <a href="mailto:sguilhen@ redhat.com">Stefan Guilhen</a>
* @ version $Revision$
* @ since Sep 11, 2006
*/
p ublic class GenericHeaderAuthenticator extends
ExtendedFormAuthenticator {
protected static Logger log = Logger
.getLogger(GenericHeaderAuthenticator.class);
protected boolean trace = log.isTraceEnabled();
/**
* <p>
* security system.
* </p>
*
<code>httpHeaderForSSOAuth</code> attribute.
*/
public String getHttpHeaderForSSOAuth() {
return httpHeaderForSSOAuth;
}
285
/**
* <p>
* security system.
* </p>
* @ param httpHeaderForSSOAuth
*
a <code>String</code> containing the value of the
*
<code>httpHeaderForSSOAuth</code> attribute.
*/
public void setHttpHeaderForSSOAuth(String httpHeaderForSSOAuth) {
this.httpHeaderForSSOAuth = httpHeaderForSSOAuth;
}
/**
* <p>
* </p>
*
<code>','</code>) of the SSO cookies that may have been
set by a
*
third party security system in the request.
*/
public String getSessionCookieForSSOAuth() {
return sessionCookieForSSOAuth;
}
/**
* <p>
* </p>
* @ param sessionCookieForSSOAuth
*
a <code>String</code> containing the names (separated
by a
*
<code>','</code>) of the SSO cookies that may have
been set by
*
a third party security system in the request.
*/
public void setSessionCookieForSSOAuth(String
sessionCookieForSSOAuth) {
286
this.sessionCookieForSSOAuth = sessionCookieForSSOAuth;
}
/**
* <p>
* Creates an instance of <code>GenericHeaderAuthenticator</code>.
* </p>
*/
public GenericHeaderAuthenticator() {
super();
}
log.trace("Authenticating user");
if (trace)
return true;
if (principal == null) {
forwardToErrorPage(request, response, config);
return false;
}
session.setNote(Constants.SESS_USERNAME_NOTE, username);
session.setNote(Constants.SESS_PASSWORD_NOTE, password);
request.setUserPrincipal(principal);
username, password);
return true;
}
/**
* Get the username from the request header
287
*
* @ param request
* @ return
*/
protected String getUserId(Request request) {
String ssoid = null;
// We can have a comma-separated ids
String ids = "";
try {
ids = this.getIdentityHeaderId();
} catch (JMException e) {
if (trace)
log.trace("getUserId exception", e);
}
if (ids == null || ids.length() == 0)
throw new IllegalStateException(
"Http headers configuration in tomcat service missing");
/**
* Obtain the session cookie from the request
*
* @ param request
* @ return
*/
protected String getSessionCookie(Request request) {
Cookie[] cookies = request.getCookies();
log.trace("Cookies:" + cookies);
int numCookies = cookies != null ? cookies.length : 0;
288
}
if (trace)
log.trace("Session Cookie not found");
return null;
/**
* Get the configured header identity id in the tomcat service
*
* @ return
* @ throws JMException
*/
protected String getIdentityHeaderId() throws JMException {
if (this.httpHeaderForSSOAuth != null)
return this.httpHeaderForSSOAuth;
return (String) mserver.getAttribute(new ObjectName(
"jboss.web:service=WebServer"), "HttpHeaderForSSOAuth");
}
/**
* Get the configured session cookie id in the tomcat service
*
* @ return
* @ throws JMException
*/
protected String getSessionCookieId() throws JMException {
if (this.sessionCookieForSSOAuth != null)
return this.sessionCookieForSSOAuth;
return (String) mserver.getAttribute(new ObjectName(
"jboss.web:service=WebServer"), "SessionCookieForSSOAuth");
}
/**
* @ param cookies
*
array of cookies
* @ param numCookies
*
number of cookies in the array
* @ param token
*
Key
*/
protected String getCookieValue(Cookie[] cookies, int numCookies,
String token) {
+ cookie.getName());
if (token.equals(cookie.getName())) {
if (trace)
289
return cookie.getValue();
}
return null;
}
}
Report a bug
290
Important
You must stop the server before editing the server configuration file for your change to be
persisted on server restart.
To configure security for basic authentication, add a new security domain under securi tyd o mai ns to the stand al o ne/co nfi g urati o n/stand al o ne. xml or the
d o mai n/co nfi g urati o n/d o mai n. xml server configuration file:
< security-domain name="example">
<authentication>
<module-option name="usersProperties"
value="${jboss.server.config.dir}/exampleusers.properties"/>
<module-option name="rolesProperties"
value="${jboss.server.config.dir}/exampleroles.properties"/>
</login-module>
</authentication>
< /security-domain>
If the JBoss EAP 6 instance is running as a standalone server, ${jbo ss. server. co nfi g . d i r}
refers to the EAP_HOME/stand al o ne/co nfi g urati o n/ directory. If the instance is running in a
managed domain, ${jbo ss. server. co nfi g . d i r} refers to the
EAP_HOME/d o mai n/co nfi g urati o n/ directory.
Mo d if y secu rit y d o main n ames
In JBoss EAP 6, security domains no longer use the prefix java: /jaas/ in their names.
For Web applications, you must remove this prefix from the security domain configurations in the
jbo ss-web. xml .
For Enterprise applications, you must remove this prefix from the security domain configurations
in the jbo ss-ejb3. xml file. This file has replaced the jbo ss. xml in JBoss EAP 6.
Report a bug
291
Reference
A.1. Included Aut hent icat ion Modules
The following authentication modules are included in JBoss EAP 6. Some of these handle
authorization as well as authentication. These usually include the word R o l e within the C o d e name.
When you configure these modules, use the C o d e value or the full (package qualified) name to refer
to the module.
Au t h en t icat io n Mo d u les
Table A.1, R eal mD i rect
Table A.2, R eal mD i rect Module Options
Table A.3, C l i ent
Table A.4, C l i ent Module Options
Table A.5, R emo ti ng
Table A.6, R emo ti ng Module Options
Table A.7, C erti fi cate
Table A.8, C erti fi cate Module Options
Table A.9, C erti fi cateR o l es
Table A.10, C erti fi cateR o l es Module Options
Table A.11, D atabase
Table A.12, D atabase Module Options
Table A.13, D atabaseC erti fi cate
Table A.14, D atabaseC erti fi cate Module Options
Table A.15, Id enti ty
Table A.16, Id enti ty Module Options
Table A.17, Ld ap
Table A.18, Ld ap Module Options
Table A.19, Ld apExtend ed
Table A.20, Ld apExtend ed Module Options
Table A.21, R o l eMappi ng
Table A.22, R o l eMappi ng Module Options
Table A.23, R unAs
Table A.24, R unAs Options
292
Reference
R eal mD i rect
o rg . jbo ss. as. securi ty. R eal mD i rectLo
g i nMo d ul e
A login module implementation to interface
directly with the security realm. This login
module allows all interactions with the backing
store to be delegated to the realm removing the
need for any duplicate and synchronized
definitions. Used for remoting calls and
management interface.
D escription
T yp e
D ef au lt
D escrip t io n
real m
string
T ab le A.3. C l i ent
Code
C l i ent
293
Class
D escription
T ab le A.4 . C l i ent Mo d u le O p t io n s
O p t io n
T yp e
D ef au lt
D escrip t io n
mul ti -thread ed
true or fal se
fal se
passwo rd -stacki ng
fal se
true or fal se
fal se
T ab le A.5. R emo ti ng
Code
Class
D escription
T ab le A.6 . R emo ti ng Mo d u le O p t io n s
294
R emo ti ng
o rg . jbo ss. as. securi ty. remo ti ng . R emo
ti ng Lo g i nMo d ul e
This login module is used to check if the request
currently being authenticated is a request
received over a Remoting connection, and if so
the identity that was created during the
Remoting authentication process is used and
associated with the current request. If the
request did not arrive over a Remoting
connection this module does nothing and
allows the JAAS based login to continue to the
next module.
Reference
T ab le A.6 . R emo ti ng Mo d u le O p t io n s
O p t io n
T yp e
D ef au lt
D escrip t io n
passwo rd -stacki ng
fal se
A fully-qualified
classname.
none
unauthenti cated Id
enti ty
A principal name.
none
A value of
useFi rstP ass
indicates that this login
module should first
look to the information
stored in the
Lo g i nC o ntext for the
identity. This option
can be used when
stacking other login
modules with this one.
A P ri nci pal
implementation class
which contains a
constructor that takes
String arguments for
the principal name.
D efines the principal
name assigned to
requests which contain
no authentication
information. This can
allow unprotected
servlets to invoke
methods on EJBs that
do not require a
specific role. Such a
principal has no
associated roles and
can only access
unsecured EJBs or
EJB methods that are
associated with the
unchecked
permi ssi o n
constraint.
C erti fi cate
o rg . jbo ss. securi ty. auth. spi . BaseC er
tLo g i nMo d ul e
This login module is designed to authenticate
users based on X50 9 C erti fi cates. A use
case for this is C LIENT -C ER T authentication of
a web application.
D escription
T yp e
D ef au lt
D escrip t io n
295
O p t io n
T yp e
D ef au lt
D escrip t io n
string
o ther
veri fi er
class
none
C erti fi cateR o l es
o rg . jbo ss. securi ty. auth. spi . C ertR o l
esLo g i nMo d ul e
This login module extends the Certificate login
module to add role mapping capabilities from a
properties file. It takes all of the same options as
the Certificate login module, and adds the
following options.
D escription
T yp e
D ef au lt
D escrip t io n
ro l esP ro perti es
string
296
Reference
O p t io n
T yp e
D ef au lt
D escrip t io n
d efaul tR o l esP ro p
erti es
string
ro l eG ro upSeparato
r
A single character.
. (a single period)
T ab le A.11. D atabase
Code
Class
D atabase
o rg . jbo ss. securi ty. auth. spi . D atabas
eServerLo g i nMo d ul e
A JD BC-based login module that supports
authentication and role mapping. It is based on
two logical tables, with the following definitions.
D escription
T ab le A.12. D atabase Mo d u le O p t io n s
O p t io n
T yp e
D ef au lt
D escrip t io n
d i g estC al l ba
ck
A fully-qualified
classname
none
d sJnd i Name
A JND I resource
java: /D efaul t
DS
hashAl g o ri thm
String
Use plain
passwords
hashC harset
String
The platform's
default encoding
hashEnco d i ng
String
i g no reP asswo r boolean
d C ase
Base64
false
297
O p t io n
T yp e
D ef au lt
D escrip t io n
i nputVal i d ato
r
A fully-qualified
classname
none
prepared SQL
statement
ro l esQ uery
prepared SQL
statement
A fully-qualified
classname
suspend R esume
boolean
boolean
transacti o nMa
nag erJnd i Name
JND I Resource
sel ect
P asswo rd fro m
P ri nci pal s
where
P ri nci pal ID = ?
none
The prepared SQL query to obtain the
information about the roles. It should
be equivalent to sel ect R o l e,
R o l eG ro up fro m R o l es where
P ri nci pal ID = ?, where Role is the
role name and the RoleGroup column
value should always be either R o l es
with a capital R or
C al l erP ri nci pal .
none
The class name of the
D i g estC al l back implementation
that includes pre/post digest content
like salts for hashing the
store/expected password. Only used if
hashSto reP asswo rd or
hashUserP asswo rd is true and
hashAl g o ri thm has been specified.
true
Whether any existing JTA transaction
should be suspended during
database operations.
false
A flag that indicates whether
validation errors should be exposed
to clients or not
java:/Transaction The JND I name of the transaction
Manager
manager used by the login module.
D escription
T yp e
D ef au lt
D escrip t io n
d sJnd i Name
A JND I resource
java: /D efaul tD S
298
Reference
O p t io n
T yp e
D ef au lt
D escrip t io n
ro l esQ uery
prepared SQL
statement
sel ect
R o l e,R o l eG ro up
fro m R o l es where
P ri nci pal ID = ?
suspend R esume
true or fal se
true
SQL prepared
statement to be
executed in order to
map roles. It should be
an equivalent to
sel ect R o l e,
R o l eG ro up fro m
R o l es where
P ri nci pal ID = ?,
where Role is the role
name and the
RoleGroup column
value should always
be either R o l es with a
capital R or
C al l erP ri nci pal .
Whether any existing
JTA transaction should
be suspended during
database operations.
T ab le A.15. Id enti ty
Code
Class
Id enti ty
o rg . jbo ss. securi ty. auth. spi . Id enti t
yLo g i nMo d ul e
Associates the principal specified in the module
options with any subject authenticated against
the module. The type of Principal class used is
o rg . jbo ss. securi ty. Si mpl eP ri nci pal .
If no principal option is specified a principal
with the name of g uest is used.
D escription
T ab le A.16 . Id enti ty Mo d u le O p t io n s
O p t io n
T yp e
D ef au lt
D escrip t io n
String
g uest
ro l es
comma-separated list
of strings
none
T ab le A.17. Ld ap
Code
Class
Ld ap
o rg . jbo ss. securi ty. auth. spi . Ld apLo g
i nMo d ul e
299
D escription
T ab le A.18. Ld ap Mo d u le O p t io n s
O p t io n
T yp e
D ef au lt
class name
co m. sun. jnd i . l d a
p. Ld apC txFacto ry
l d ap: // URL
string
credential type
300
D escrip t io n
Ini ti al C o ntextFac
to ry implementation
class name.
If the value of
URL for the LD AP
java. nami ng . secur server.
i ty. pro to co l is
SSL,
l d ap: //l o cal ho st
: 6 36 , otherwise
l d ap: //l o cal ho st
: 389
si mpl e
The security level to
use to bind to the
LD AP server.
If unspecified,
The transport protocol
determined by the
to use for secure
provider.
access, such as SSL.
none
The name of the
principal for
authenticating the
caller to the service.
This is built from other
properties described
below.
none
The type of credential
used by the
authentication scheme.
Some examples
include hashed
password, clear-text
password, key, or
certificate. If this
property is unspecified,
the behavior is
determined by the
service provider.
Reference
O p t io n
T yp e
string
string
true or fal se
false
ro l esC txD N
fully-qualified D N
none
ro l eAttri buteID
attribute
D ef au lt
none
ro l es
D escrip t io n
Prefix added to the
username to form the
user D N. You can
prompt the user for a
username and build
the fully-qualified D N
by using the
pri nci pal D NP refi x
and
pri nci pal D NSuffi x
.
Suffix added to the
username to form the
user D N. You can
prompt the user for a
username and build
the fully-qualified D N
by using the
pri nci pal D NP refi x
and
pri nci pal D NSuffi x
.
Whether the credential
should be obtained as
an opaque Object
using the
o rg . jbo ss. securi t
y. auth. cal l back.
O bjectC al l back
type of Callback rather
than as a char[]
password using a
JAAS
PasswordCallback.
This allows for passing
no n-char[]
credential information
to the LD AP server.
The fully-qualified D N
for the context to
search for user roles.
The attribute in the
user object that
contains the D N for the
context to search for
user roles. This differs
from ro l esC txD N in
that the context to
search for a user's
roles may be unique
for each user.
Name of the attribute
containing the user
roles.
301
O p t io n
T yp e
D ef au lt
D escrip t io n
ro l eAttri buteIsD N
true or fal se
fal se
ro l eNameAttri bute
ID
attribute
name
ui d Attri buteID
attribute
ui d
matchO nUserD N
true or fal se
fal se
al l o wEmptyP asswo
rd s
true or fal se
fal se
T ab le A.19 . Ld apExtend ed
302
Reference
T ab le A.19 . Ld apExtend ed
Code
Class
Ld apExtend ed
o rg . jbo ss. securi ty. auth. spi . Ld apExt
Lo g i nMo d ul e
An alternate LD AP login module implementation
that uses searches to locate the bind user and
associated roles. The roles query recursively
follows D Ns to navigate a hierarchical role
structure. It uses the same java. nami ng
options as the Ldap module, and uses the
following options instead of the other options of
the Ldap module.
D escription
T ab le A.20. Ld apExtend ed Mo d u le O p t io n s
O p t io n
T yp e
D ef au lt
D escrip t io n
baseC txD N
fully-qualified D N
none
bi nd C red enti al
string, optionally
encrypted
none
bi nd D N
fully-qualified D N
none
303
O p t io n
T yp e
D ef au lt
D escrip t io n
baseFi l ter
LD AP filter string
none
ro l esC txD N
fully-qualified D N
none
ro l eFi l ter
LD AP filter string
none
304
Reference
O p t io n
T yp e
D ef au lt
D escrip t io n
ro l eAttri buteIsD N
true or fal se
fal se
d efaul tR o l e
Role name
none
fal se
parseUsername
true or fal se
fal se
usernameBeg i nStri
ng
string
none
305
O p t io n
T yp e
D ef au lt
D escrip t io n
usernameEnd Stri ng
string
none
ro l eNameAttri bute
ID
attribute
name
attribute
ro l eR ecursi o n
integer
searchT i meLi mi t
integer
10 0 0 0 (10 seconds)
searchSco pe
One of:
O BJEC T _SC O P E,
O NELEVEL_SC O P E,
SUBT R EE_SC O P E
true or fal se
SUBT R EE_SC O P E
al l o wEmptyP asswo
rd s
306
fal se
Reference
O p t io n
T yp e
D ef au lt
D escrip t io n
none
T ab le A.21. R o l eMappi ng
Code
Class
R o l eMappi ng
o rg . jbo ss. securi ty. auth. spi . R o l eMap
pi ng Lo g i nMo d ul e
Maps a role which is the end result of the
authentication process to a declarative role.
This module must be flagged as o pti o nal
when you add it to the security domain.
D escription
T ab le A.22. R o l eMappi ng Mo d u le O p t io n s
O p t io n
T yp e
D ef au lt
D escrip t io n
ro l esP ro perti es
no ne
repl aceR o l e
true or fal se
fal se
Note
The ro l esP ro perti es module option is required for RoleMapping.
307
T ab le A.23. R unAs
Code
Class
R unAs
o rg . jbo ss. securi ty. auth. spi . R unAsLo
g i nMo d ul e
A helper module that pushes a run as role onto
the stack for the duration of the login phase of
authentication, and pops the run as role off the
stack in either the commit or abort phase. This
login module provides a role for other login
modules that must access secured resources in
order to perform their authentication, such as a
login module which accesses a secured EJB.
R unAsLo g i nMo d ul e must be configured
before the login modules that require a run as
role to be established.
D escription
T ab le A.24 . R unAs O p t io n s
O p t io n
T yp e
D ef au lt
D escrip t io n
ro l eName
role name
no bo d y
principal name
no bo d y
A fully-qualified
classname.
none
T ab le A.25. Si mpl e
Code
Class
D escription
Si mpl e
o rg . jbo ss. securi ty. auth. spi . Si mpl eS
erverLo g i nMo d ul e
A module for quick setup of security for testing
purposes. It implements the following simple
algorithm:
If the password is null, authenticate the user
and assign an identity of g uest and a role
of g uest.
Otherwise, if the password is equal to the
user, assign an identity equal to the
username and both ad mi n and g uest roles.
Otherwise, authentication fails.
Si mpl e Mo d u le O p t io n s
308
Reference
Si mpl e Mo d u le O p t io n s
The Si mpl e module has no options.
T ab le A.26 . C o nfi g ured Id enti ty
Code
Class
D escription
T yp e
D ef au lt
D escrip t io n
username
string
none
passwo rd
encrypted string
""
Name of a principal
no ne
SecureId enti ty
o rg . pi cketbo x. d ataso urce. securi ty. S
ecureId enti tyLo g i nMo d ul e
309
D escription
T yp e
D ef au lt
D escrip t io n
username
string
none
passwo rd
encrypted string
""
manag ed C o nnecti o
nFacto ryName
JCA resource
none
P ro perti esUsers
o rg . jbo ss. securi ty. auth. spi . P ro pert
i esUsersLo g i nMo d ul e
Uses a properties file to store usernames and
passwords for authentication. No authorization
(role mapping) is provided. This module is only
appropriate for testing.
310
Si mpl eUsers
o rg . jbo ss. securi ty. auth. spi . Si mpl eU
sersLo g i nMo d ul e
Reference
D escription
T ab le A.32. Ld apUsers
Code
Class
Ld apUsers
o rg . jbo ss. securi ty. auth. spi . Ld apUse
rsLo g i nMo d ul e
The Ld apUsers module is superseded by the
Extend ed LD AP and Ad vanced Ld ap modules.
D escription
T ab le A.33. Kerbero s
Code
Class
Kerbero s
co m. sun. securi ty. auth. mo d ul e. Krb5Lo
g i nMo d ul e. In the IBM JD K the classname is
co m. i bm. securi ty. auth. mo d ul e. Krb5Lo
g i nMo d ul e.
Performs Kerberos login authentication, using
GSSAPI. This module is part of the security
framework from the API provided by Sun
Microsystems. D etails can be found at
http://docs.oracle.com/javase/7/docs/jre/api/sec
urity/jaas/spec/com/sun/security/auth/module/Kr
b5LoginModule.html. This module needs to be
paired with another module which handles the
authentication and roles mapping.
D escription
T ab le A.34 . Kerbero s Mo d u le O p t io n s
O p t io n
T yp e
D ef au lt
D escrip t io n
sto rekey
true or fal se
false
d o No tP ro mpt
true or fal se
false
false
311
O p t io n
T yp e
D ef au lt
D escrip t io n
ti cketcache
A file or resource
representing a
Kerberos ticket cache.
true or fal se
false
keytab
A file or resource
representing a
Kerberos keytab.
string
true or fal se
false
312
Reference
O p t io n
T yp e
D ef au lt
D escrip t io n
true or fal se
false
true or fal se
false
cl earP ass
true or fal se
false
Same as
useFi rstP ass, but if
authentication fails, the
module uses the
C al l backHand l er to
retrieve a new
username and
password. If the
second authentication
fails, the failure is
reported to the calling
application.
Whether to store the
username and
password in the
module's shared state.
This does not happen
if the keys already exist
in the shared state, or if
authentication fails.
Set this to true to clear
the username and
password from the
shared state after both
phases of
authentication
complete.
T ab le A.35. SP NEG O
Code
Class
SP NEG O
o rg . jbo ss. securi ty. neg o ti ati o n. spne
g o . SP NEG O Lo g i nMo d ul e
Allows SPNEGO authentication to a Microsoft
Active D irectory server or other environment
which supports SPNEGO. SPNEGO can also
carry Kerberos credentials. This module needs
to be paired with another module which handles
authentication and role mapping.
D escription
T ab le A.36 . SP NEG O Mo d u le O p t io n s
O p t io n
T yp e
D ef au lt
D escrip t io n
serverSecuri tyD o m
ai n
stri ng
nul l .
313
O p t io n
T yp e
D ef au lt
D escrip t io n
fal se
usernameP asswo rd D
o mai n
nul l
stri ng
T ab le A.37. Ad vanced Ld ap
Code
Class
Ad vanced Ld ap
o rg . jbo ss. securi ty. neg o ti ati o n. Ad va
nced Ld apLo g i nMo d ul e
A module which provides additional
functionality, such as SASL and the use of a
JAAS security domain.
D escription
T ab le A.38. Ad vanced Ld ap Mo d u le O p t io n s
O p t io n
T yp e
D ef au lt
bi nd Authenti cati o
n
string
none
stri ng
baseC txD N
fully-qualified D N
baseFi l ter
String representing a
LD AP search filter.
ro l eAttri buteID
String value
representing an LD AP
attribute.
ro l eAttri buteIsD N
true or fal se
314
D escrip t io n
Reference
O p t io n
T yp e
D ef au lt
D escrip t io n
ro l eNameAttri bute
ID
String representing an
LD AP attribute.
none
recurseR o l es
true or fal se
fal se
none
T ab le A.39 . Ad vanced AD Ld ap
Code
Class
Ad vanced AD Ld ap
o rg . jbo ss. securi ty. neg o ti ati o n. Ad va
nced AD Lo g i nMo d ul e
This module extends the Ad vanced Ld ap login
module, and adds extra parameters that are
relevant to Microsoft Active D irectory.
D escription
T ab le A.4 0. UsersR o l es
Code
Class
UsersR o l es
o rg . jbo ss. securi ty. auth. spi . UsersR o
l esLo g i nMo d ul
A simple login module that supports multiple
users and user roles stored in two different
properties files.
D escription
T ab le A.4 1. UsersR o l es Mo d u le O p t io n s
O p t io n
T yp e
D ef au lt
D escrip t io n
315
O p t io n
T yp e
D ef au lt
D escrip t io n
usersP ro perti es
Path to a file or
resource.
ro l esP ro perti es
Path to a file or
resource.
passwo rd -stacki ng
fal se
hashAl g o ri thm
String representing a
password hashing
algorithm.
no ne
hashEnco d i ng
base6 4 or hex
base6 4
316
Reference
O p t io n
T yp e
D ef au lt
D escrip t io n
hashC harset
string
unauthenti cated Id
enti ty
principal name
none
C u st o m Au t h en t icat io n Mo d u les
Authentication modules are implementations of javax. securi ty. auth. spi . Lo g i nMo d ul e.
Refer to the API documentation for more information about creating a custom authentication module.
Report a bug
C lass
D enyAll
org.jboss.security.authorization.modules.AllD en
yAuthorizationModule
org.jboss.security.authorization.modules.AllPer
mitAuthorizationModule
org.jboss.security.authorization.modules.D eleg
atingAuthorizationModule
org.jboss.security.authorization.modules.web.W
ebAuthorizationModule
org.jboss.security.authorization.modules.JACCA
uthorizationModule
org.jboss.security.authorization.modules.XACM
LAuthorizationModule
PermitAll
D elegating
Web
JACC
XACML
317
AllPermit Au t h o riz at io n Mo d u le
This is a simple authorization module that always permits an authorization request. No configuration
options are available.
D eleg at in g Au t h o riz at io n Mo d u le
This is the default authorization module that delegates decision making to the configured delegates.
Web Au t h o riz at io n Mo d u le
This is the default web authorization module with the default Tomcat authorization logic (permit all).
JAC C Au t h o riz at io n Mo d u le
This module enforces JACC semantics using two delegates (WebJACCPolicyModuleD elegate for web
container authorization requests and EJBJACCPolicyModuleD elegate for EJB container requests).
No configuration options available.
XAC MLAu t h o riz at io n Mo d u le
This module enforces XACML authorization using two delegates for web and EJB containers
(WebXACMLPolicyModuleD elegate and EJBXACMLPolicyModuleD elegate). It creates a PD P object
based on registered policies and evaluates web or EJB requests against it.
Ab st ract Au t h o riz at io n Mo d u le
This is the base authorization module which has to be overridden and provides a facility for
delegating to other authorization modules.
Report a bug
C lass
PropertiesRoles
SimpleRoles
D eploymentRoles
D atabaseRoles
LdapRoles
LdapAttributes
318
Reference
A Role Mapping Module that takes into consideration a principal to roles mapping that can be done
in jbo ss-web. xml and jbo ss-app. xml deployment descriptors.
< jboss-web>
. ..
<security-role>
<role-name>Support</role-name>
<principal-name>Mark</principal-name>
<principal-name>Tom</principal-name>
</security-role>
. ..
< /jboss-web>
o rg .jb o ss.secu rit y.map p in g .p ro vid ers.D ep lo ymen t R o leT o R o lesMap p in g Pro vid er
A Role to Roles Mapping Module that takes into consideration a principal to roles mapping that can
be done in the deployment descriptors jbo ss-web. xml and jbo ss-app. xml . In this case
principal-name denotes role to map other roles.
<jboss-web>
...
<security-role>
<role-name>Employee</role-name>
<principal-name>Support</principal-name>
<principal-name>Sales</principal-name>
</security-role>
...
</jboss-web>
Which means that each principal having role Support or Sales will also have role Employee
assigned.
319
320
Reference
o rg .jb o ss.secu rit y.map p in g .p ro vid ers.at t rib u t e.D ef au lt At t rib u t eMap p in g Pro vid er
Checks module and locates principal name from mapping context to create attribute e-mail address
from module option named principalName + " .email" and maps it to the given principal.
Ld ap At t rib u t eMap p in g Pro vid er
Maps attributes from LD AP to the subject. The options include whatever options your LD AP JND I
provider supports.
C ontext.INITIAL_CONTEXT_FACTORY = "java.naming.factory.initial"
C ontext.SECURITY_PROTOCOL = "java.naming.security.protocol"
C ontext.PROVIDER_URL = "java.naming.provider.url"
C ontext.SECURITY_AUTHENTICATION =
"java.naming.security.authentication"
Options:
bi nd D N: The D N used to bind against the LD AP server for the user and roles queries. This D N
needs read and search permissions on the baseCtxD N and rolesCtxD N values.
bi nd C red enti al : The password for the bindD N. This can be encrypted if the
jaasSecurityD omain is specified.
baseC txD N: The fixed D N of the context to start the user search from.
321
baseFi l ter: A search filter used to locate the context of the user to authenticate. The input
username or userD N as obtained from the login module callback is substituted into the filter
anywhere a {0 } expression is used. This substituion behavior comes from the standard
__D i rC o ntext. search(Name, Stri ng , O bject[], SearchC o ntro l s co ns)__ method.
An common example search filter is (ui d = {0 }).
searchT i meLi mi t: The timeout in milliseconds for the user/role searches. D efaults to 10000 (10
seconds).
attri buteLi st: A comma-separated list of attributes for the user. For example,
mail,cn,sn,employeeType,employeeNumber.
jaasSecuri tyD o mai n: The JaasSecurityD omain to use to decrypt the
java. nami ng . securi ty. pri nci pal . The encrypted form of the password is that returned by
the JaasSecuri tyD o mai n#encrypt6 4 (byte[]) method. The
o rg . jbo ss. securi ty. pl ug i ns. P BEUti l s can also be used to generate the encrypted form.
Report a bug
C lass
LogAuditProvider
org.jboss.security.audit.providers.LogAuditProvi
der
Report a bug
D escrip t io n
env-entry
322
Reference
At t rib u t e
D escrip t io n
ejb-ref
ejb-local-ref
service-ref
resource-ref
resource-env-ref
message-destination-ref
persistence-context-ref
persistence-unit-ref
post-construct
pre-destroy
data-source
context-root
virtual-host
annotation
listener
session-config
valve
overlay
security-domain
security-role
323
At t rib u t e
D escrip t io n
use-jboss-authorization
disable-audit
disable-cross-context
D escrip t io n
class-name
servlet-security
run-as
multipart-config
<list en er>
D escribes a listener. The following table lists the child elements of a <l i stener>.
T ab le A.4 4 . List en er C o n f ig u rat io n Elemen t s
At t rib u t e
D escrip t io n
class-name
324
Reference
At t rib u t e
D escrip t io n
listener-type
module
param
<valve>
D escribes a valve of the application. Similar to the <listener>, has class-name, module and param
elements.
Report a bug
D escrip t io n
<ro l e-name>
<d escri pti o n>
Examp le A.5. Secu rit y id en t it y examp les
This example shows each tag described in Table A.45, EJB security parameter elements . They
can also be used inside a <sessi o n>.
< ejb-jar>
325
<enterprise-beans>
<session>
<ejb-name>ASessionBean</ejb-name>
<security-identity>
<use-caller-identity/>
</security-identity>
</session>
<session>
<ejb-name>RunAsBean</ejb-name>
<security-identity>
<run-as>
<role-name>InternalRole</role-name>
</run-as>
</security-identity>
</session>
<session>
<ejb-name>RunAsBean</ejb-name>
<security-identity>
<run-as-principal>internal</run-as-principal>
</security-identity>
</session>
</enterprise-beans>
< /ejb-jar>
Report a bug
326
Reference
Revision History
R evisio n 6 .3.0- 50
T u esd ay N o vemb er 18 2014 R u ssell D icken so n
Red Hat JBoss Enterprise Application Platform 6.3.0 Continuous Release
R evisio n 6 .3.0- 4 3
Frid ay Au g u st 8 2014
Lu cas C o st i
Red Hat JBoss Enterprise Application Platform 6.3.0 Continuous Release
R evisio n 6 .3.0- 4 2
Wed n esd ay, Ju ly 30 2014
Red Hat JBoss Enterprise Application Platform 6.3.0.GA
R u ssell D icken so n
327