Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Openfire
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Openfire
Commits
1f4d6288
Commit
1f4d6288
authored
Nov 28, 2015
by
Guus der Kinderen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CertificateStoreManager should be a proper module.
parent
953b85af
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
288 additions
and
197 deletions
+288
-197
modules.xml
src/conf/modules.xml
+2
-1
XMPPServer.java
src/java/org/jivesoftware/openfire/XMPPServer.java
+23
-4
SSLProtocolSocketFactory.java
...oftware/openfire/clearspace/SSLProtocolSocketFactory.java
+2
-1
AdminConsolePlugin.java
...g/jivesoftware/openfire/container/AdminConsolePlugin.java
+1
-1
HttpBindManager.java
src/java/org/jivesoftware/openfire/http/HttpBindManager.java
+1
-1
CertificateStoreManager.java
...vesoftware/openfire/keystore/CertificateStoreManager.java
+41
-37
SASLAuthentication.java
...ava/org/jivesoftware/openfire/net/SASLAuthentication.java
+3
-2
LocalIncomingServerSession.java
...software/openfire/session/LocalIncomingServerSession.java
+3
-2
ConnectionConfiguration.java
...rg/jivesoftware/openfire/spi/ConnectionConfiguration.java
+4
-2
ConnectionManagerImpl.java
.../org/jivesoftware/openfire/spi/ConnectionManagerImpl.java
+33
-31
admin-sidebar.xml
src/resources/jar/admin-sidebar.xml
+86
-15
import-keystore-certificate.jsp
src/web/import-keystore-certificate.jsp
+1
-2
import-truststore-certificate.jsp
src/web/import-truststore-certificate.jsp
+2
-2
index.jsp
src/web/index.jsp
+1
-2
security-certificate-details.jsp
src/web/security-certificate-details.jsp
+4
-2
security-certificate-store-management.jsp
src/web/security-certificate-store-management.jsp
+43
-54
security-keystore.jsp
src/web/security-keystore.jsp
+22
-22
security-truststore.jsp
src/web/security-truststore.jsp
+16
-16
No files found.
src/conf/modules.xml
View file @
1f4d6288
...
@@ -28,7 +28,8 @@
...
@@ -28,7 +28,8 @@
<module
interface=
"org.jivesoftware.openfire.OfflineMessageStrategy"
implementation=
"org.jivesoftware.openfire.OfflineMessageStrategy"
/>
<module
interface=
"org.jivesoftware.openfire.OfflineMessageStrategy"
implementation=
"org.jivesoftware.openfire.OfflineMessageStrategy"
/>
<module
interface=
"org.jivesoftware.openfire.OfflineMessageStore"
implementation=
"org.jivesoftware.openfire.OfflineMessageStore"
/>
<module
interface=
"org.jivesoftware.openfire.OfflineMessageStore"
implementation=
"org.jivesoftware.openfire.OfflineMessageStore"
/>
<module
interface=
"org.jivesoftware.openfire.vcard.VCardManager"
implementation=
"org.jivesoftware.openfire.vcard.VCardManager"
/>
<module
interface=
"org.jivesoftware.openfire.vcard.VCardManager"
implementation=
"org.jivesoftware.openfire.vcard.VCardManager"
/>
<module
interface=
"org.jivesoftware.openfire.keystore.CertificateStoreManager"
"
implementation=
"org.jivesoftware.openfire.keystore.CertificateStoreManager"
/>
<!-- Standard Modules -->
<!-- Standard Modules -->
<module
interface=
"org.jivesoftware.openfire.handler.IQBindHandler"
implementation=
"org.jivesoftware.openfire.handler.IQBindHandler"
/>
<module
interface=
"org.jivesoftware.openfire.handler.IQBindHandler"
implementation=
"org.jivesoftware.openfire.handler.IQBindHandler"
/>
<module
interface=
"org.jivesoftware.openfire.handler.IQSessionEstablishmentHandler"
implementation=
"org.jivesoftware.openfire.handler.IQSessionEstablishmentHandler"
/>
<module
interface=
"org.jivesoftware.openfire.handler.IQSessionEstablishmentHandler"
implementation=
"org.jivesoftware.openfire.handler.IQSessionEstablishmentHandler"
/>
...
...
src/java/org/jivesoftware/openfire/XMPPServer.java
View file @
1f4d6288
...
@@ -373,13 +373,22 @@ public class XMPPServer {
...
@@ -373,13 +373,22 @@ public class XMPPServer {
// Set default SASL SCRAM-SHA-1 iteration count
// Set default SASL SCRAM-SHA-1 iteration count
JiveGlobals
.
setProperty
(
"sasl.scram-sha-1.iteration-count"
,
Integer
.
toString
(
ScramUtils
.
DEFAULT_ITERATION_COUNT
));
JiveGlobals
.
setProperty
(
"sasl.scram-sha-1.iteration-count"
,
Integer
.
toString
(
ScramUtils
.
DEFAULT_ITERATION_COUNT
));
// Update certificates (if required)
// Check if keystore (that out-of-the-box is a fallback for all keystores) already has certificates for current domain.
CertificateStoreManager
certificateStoreManager
=
null
;
// Will be a module after finishing setup.
try
{
try
{
// Check if keystore (that out-of-the-box is a fallback for all keystores) already has certificates for current domain.
certificateStoreManager
=
new
CertificateStoreManager
();
final
IdentityStore
storeConfig
=
CertificateStoreManager
.
getIdentityStore
(
ConnectionType
.
SOCKET_C2S
);
certificateStoreManager
.
initialize
(
this
);
storeConfig
.
ensureDomainCertificates
(
"DSA"
,
"RSA"
);
certificateStoreManager
.
start
();
final
IdentityStore
identityStore
=
certificateStoreManager
.
getIdentityStore
(
ConnectionType
.
SOCKET_C2S
);
identityStore
.
ensureDomainCertificates
(
"DSA"
,
"RSA"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"Error generating self-signed certificates"
,
e
);
logger
.
error
(
"Error generating self-signed certificates"
,
e
);
}
finally
{
if
(
certificateStoreManager
!=
null
)
{
certificateStoreManager
.
stop
();
certificateStoreManager
.
destroy
();
}
}
}
// Initialize list of admins now (before we restart Jetty)
// Initialize list of admins now (before we restart Jetty)
...
@@ -1408,6 +1417,16 @@ public class XMPPServer {
...
@@ -1408,6 +1417,16 @@ public class XMPPServer {
return
(
InternalComponentManager
)
modules
.
get
(
InternalComponentManager
.
class
.
getName
());
return
(
InternalComponentManager
)
modules
.
get
(
InternalComponentManager
.
class
.
getName
());
}
}
/**
* Returns the <code>CertificateStoreManager</code> registered with this server. The
* <code>CertificateStoreManager</code> was registered with the server as a module while starting up
* the server.
*
* @return the <code>CertificateStoreManager</code> registered with this server.
*/
public
CertificateStoreManager
getCertificateStoreManager
()
{
return
(
CertificateStoreManager
)
modules
.
get
(
CertificateStoreManager
.
class
.
getName
()
);
}
/**
/**
* Returns the locator to use to find sessions hosted in other cluster nodes. When not running
* Returns the locator to use to find sessions hosted in other cluster nodes. When not running
* in a cluster a <tt>null</tt> value is returned.
* in a cluster a <tt>null</tt> value is returned.
...
...
src/java/org/jivesoftware/openfire/clearspace/SSLProtocolSocketFactory.java
View file @
1f4d6288
...
@@ -35,6 +35,7 @@ import org.apache.commons.httpclient.ConnectTimeoutException;
...
@@ -35,6 +35,7 @@ import org.apache.commons.httpclient.ConnectTimeoutException;
import
org.apache.commons.httpclient.HttpClientError
;
import
org.apache.commons.httpclient.HttpClientError
;
import
org.apache.commons.httpclient.params.HttpConnectionParams
;
import
org.apache.commons.httpclient.params.HttpConnectionParams
;
import
org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory
;
import
org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory
;
import
org.jivesoftware.openfire.XMPPServer
;
import
org.jivesoftware.openfire.keystore.CertificateStoreManager
;
import
org.jivesoftware.openfire.keystore.CertificateStoreManager
;
import
org.jivesoftware.openfire.spi.ConnectionType
;
import
org.jivesoftware.openfire.spi.ConnectionType
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -70,7 +71,7 @@ public class SSLProtocolSocketFactory implements SecureProtocolSocketFactory {
...
@@ -70,7 +71,7 @@ public class SSLProtocolSocketFactory implements SecureProtocolSocketFactory {
new
ClearspaceX509TrustManager
(
new
ClearspaceX509TrustManager
(
host
,
host
,
manager
.
getProperties
(),
manager
.
getProperties
(),
CertificateStoreManager
.
getTrustStore
(
ConnectionType
.
SOCKET_S2S
).
getStore
()
)
XMPPServer
.
getInstance
().
getCertificateStoreManager
()
.
getTrustStore
(
ConnectionType
.
SOCKET_S2S
).
getStore
()
)
},
},
null
);
null
);
return
context
;
return
context
;
...
...
src/java/org/jivesoftware/openfire/container/AdminConsolePlugin.java
View file @
1f4d6288
...
@@ -141,7 +141,7 @@ public class AdminConsolePlugin implements Plugin {
...
@@ -141,7 +141,7 @@ public class AdminConsolePlugin implements Plugin {
// Create a connector for https traffic if it's enabled.
// Create a connector for https traffic if it's enabled.
sslEnabled
=
false
;
sslEnabled
=
false
;
try
{
try
{
final
IdentityStore
identityStore
=
CertificateStoreManager
.
getIdentityStore
(
ConnectionType
.
WEBADMIN
);
final
IdentityStore
identityStore
=
XMPPServer
.
getInstance
().
getCertificateStoreManager
()
.
getIdentityStore
(
ConnectionType
.
WEBADMIN
);
if
(
adminSecurePort
>
0
)
if
(
adminSecurePort
>
0
)
{
{
if
(
identityStore
.
getAllCertificates
().
isEmpty
()
)
if
(
identityStore
.
getAllCertificates
().
isEmpty
()
)
...
...
src/java/org/jivesoftware/openfire/http/HttpBindManager.java
View file @
1f4d6288
...
@@ -248,7 +248,7 @@ public final class HttpBindManager {
...
@@ -248,7 +248,7 @@ public final class HttpBindManager {
private
void
createSSLConnector
(
int
securePort
,
int
bindThreads
)
{
private
void
createSSLConnector
(
int
securePort
,
int
bindThreads
)
{
httpsConnector
=
null
;
httpsConnector
=
null
;
try
{
try
{
final
IdentityStore
identityStore
=
CertificateStoreManager
.
getIdentityStore
(
ConnectionType
.
BOSH_C2S
);
final
IdentityStore
identityStore
=
XMPPServer
.
getInstance
().
getCertificateStoreManager
()
.
getIdentityStore
(
ConnectionType
.
BOSH_C2S
);
if
(
securePort
>
0
&&
identityStore
.
getStore
().
aliases
().
hasMoreElements
()
)
{
if
(
securePort
>
0
&&
identityStore
.
getStore
().
aliases
().
hasMoreElements
()
)
{
if
(
!
identityStore
.
containsDomainCertificate
(
"RSA"
)
)
{
if
(
!
identityStore
.
containsDomainCertificate
(
"RSA"
)
)
{
...
...
src/java/org/jivesoftware/openfire/keystore/CertificateStoreManager.java
View file @
1f4d6288
package
org
.
jivesoftware
.
openfire
.
keystore
;
package
org
.
jivesoftware
.
openfire
.
keystore
;
import
org.jivesoftware.openfire.XMPPServer
;
import
org.jivesoftware.openfire.XMPPServer
;
import
org.jivesoftware.openfire.container.BasicModule
;
import
org.jivesoftware.openfire.spi.ConnectionListener
;
import
org.jivesoftware.openfire.spi.ConnectionListener
;
import
org.jivesoftware.openfire.spi.ConnectionManagerImpl
;
import
org.jivesoftware.openfire.spi.ConnectionManagerImpl
;
import
org.jivesoftware.openfire.spi.ConnectionType
;
import
org.jivesoftware.openfire.spi.ConnectionType
;
...
@@ -19,7 +20,7 @@ import java.util.concurrent.ConcurrentMap;
...
@@ -19,7 +20,7 @@ import java.util.concurrent.ConcurrentMap;
*/
*/
// TODO Code duplication should be reduced.
// TODO Code duplication should be reduced.
// TODO Allow changing the store type.
// TODO Allow changing the store type.
public
class
CertificateStoreManager
public
class
CertificateStoreManager
extends
BasicModule
{
{
private
final
static
Logger
Log
=
LoggerFactory
.
getLogger
(
CertificateStoreManager
.
class
);
private
final
static
Logger
Log
=
LoggerFactory
.
getLogger
(
CertificateStoreManager
.
class
);
...
@@ -28,17 +29,16 @@ public class CertificateStoreManager
...
@@ -28,17 +29,16 @@ public class CertificateStoreManager
private
final
ConcurrentMap
<
CertificateStoreConfiguration
,
IdentityStore
>
identityStores
=
new
ConcurrentHashMap
<>();
private
final
ConcurrentMap
<
CertificateStoreConfiguration
,
IdentityStore
>
identityStores
=
new
ConcurrentHashMap
<>();
private
final
ConcurrentMap
<
CertificateStoreConfiguration
,
TrustStore
>
trustStores
=
new
ConcurrentHashMap
<>();
private
final
ConcurrentMap
<
CertificateStoreConfiguration
,
TrustStore
>
trustStores
=
new
ConcurrentHashMap
<>();
private
static
CertificateStoreManager
INSTANCE
;
public
CertificateStoreManager
(
)
{
static
synchronized
CertificateStoreManager
getInstance
(
)
{
super
(
"Certificate Store Manager"
);
if
(
INSTANCE
==
null
)
{
INSTANCE
=
new
CertificateStoreManager
();
}
return
INSTANCE
;
}
}
private
CertificateStoreManager
(
)
@Override
public
synchronized
void
initialize
(
XMPPServer
server
)
{
{
super
.
initialize
(
server
);
for
(
ConnectionType
type
:
ConnectionType
.
values
()
)
for
(
ConnectionType
type
:
ConnectionType
.
values
()
)
{
{
try
try
...
@@ -73,21 +73,29 @@ public class CertificateStoreManager
...
@@ -73,21 +73,29 @@ public class CertificateStoreManager
}
}
}
}
public
static
IdentityStore
getIdentityStore
(
ConnectionType
type
)
@Override
public
synchronized
void
destroy
()
{
{
final
CertificateStoreManager
manager
=
getInstance
();
typeToIdentityStore
.
clear
();
final
CertificateStoreConfiguration
configuration
=
manager
.
typeToIdentityStore
.
get
(
type
);
typeToTrustStore
.
clear
();
return
manager
.
identityStores
.
get
(
configuration
);
identityStores
.
clear
();
trustStores
.
clear
();
super
.
destroy
();
}
}
public
static
TrustStore
getTrust
Store
(
ConnectionType
type
)
public
IdentityStore
getIdentity
Store
(
ConnectionType
type
)
{
{
final
CertificateStoreManager
manager
=
getInstance
();
final
CertificateStoreConfiguration
configuration
=
typeToIdentityStore
.
get
(
type
);
final
CertificateStoreConfiguration
configuration
=
manager
.
typeToTrustStore
.
get
(
type
);
return
identityStores
.
get
(
configuration
);
return
manager
.
trustStores
.
get
(
configuration
);
}
}
public
static
void
replaceIdentityStore
(
ConnectionType
type
,
CertificateStoreConfiguration
configuration
)
throws
CertificateStoreConfigException
public
TrustStore
getTrustStore
(
ConnectionType
type
)
{
final
CertificateStoreConfiguration
configuration
=
typeToTrustStore
.
get
(
type
);
return
trustStores
.
get
(
configuration
);
}
public
void
replaceIdentityStore
(
ConnectionType
type
,
CertificateStoreConfiguration
configuration
)
throws
CertificateStoreConfigException
{
{
if
(
type
==
null
)
if
(
type
==
null
)
{
{
...
@@ -98,27 +106,25 @@ public class CertificateStoreManager
...
@@ -98,27 +106,25 @@ public class CertificateStoreManager
throw
new
IllegalArgumentException
(
"Argument 'configuration' cannot be null."
);
throw
new
IllegalArgumentException
(
"Argument 'configuration' cannot be null."
);
}
}
final
CertificateStoreManager
manager
=
getInstance
();
final
CertificateStoreConfiguration
oldConfig
=
typeToIdentityStore
.
get
(
type
);
// can be null if persisted properties are invalid
final
CertificateStoreConfiguration
oldConfig
=
manager
.
typeToIdentityStore
.
get
(
type
);
// can be null if persisted properties are invalid
if
(
oldConfig
==
null
||
!
oldConfig
.
equals
(
configuration
)
)
if
(
oldConfig
==
null
||
!
oldConfig
.
equals
(
configuration
)
)
{
{
// If the new store is not already being used by any other type, it'll need to be registered.
// If the new store is not already being used by any other type, it'll need to be registered.
if
(
!
manager
.
identityStores
.
containsKey
(
configuration
)
)
if
(
!
identityStores
.
containsKey
(
configuration
)
)
{
{
// This constructor can throw an exception. If it does, the state of the manager should not have already changed.
// This constructor can throw an exception. If it does, the state of the manager should not have already changed.
final
IdentityStore
store
=
new
IdentityStore
(
configuration
,
true
);
final
IdentityStore
store
=
new
IdentityStore
(
configuration
,
true
);
manager
.
identityStores
.
put
(
configuration
,
store
);
identityStores
.
put
(
configuration
,
store
);
}
}
manager
.
typeToIdentityStore
.
put
(
type
,
configuration
);
typeToIdentityStore
.
put
(
type
,
configuration
);
// If the old store is not used by any other type, it can be shut down.
// If the old store is not used by any other type, it can be shut down.
if
(
oldConfig
!=
null
&&
!
manager
.
typeToIdentityStore
.
containsValue
(
oldConfig
)
)
if
(
oldConfig
!=
null
&&
!
typeToIdentityStore
.
containsValue
(
oldConfig
)
)
{
{
manager
.
identityStores
.
remove
(
oldConfig
);
identityStores
.
remove
(
oldConfig
);
}
}
// Update all connection listeners that were using the old configuration.
// Update all connection listeners that were using the old configuration.
...
@@ -137,7 +143,7 @@ public class CertificateStoreManager
...
@@ -137,7 +143,7 @@ public class CertificateStoreManager
JiveGlobals
.
setProperty
(
type
.
getPrefix
()
+
"keypass"
,
new
String
(
configuration
.
getPassword
()
)
);
JiveGlobals
.
setProperty
(
type
.
getPrefix
()
+
"keypass"
,
new
String
(
configuration
.
getPassword
()
)
);
}
}
public
static
void
replaceTrustStore
(
ConnectionType
type
,
CertificateStoreConfiguration
configuration
)
throws
CertificateStoreConfigException
public
void
replaceTrustStore
(
ConnectionType
type
,
CertificateStoreConfiguration
configuration
)
throws
CertificateStoreConfigException
{
{
if
(
type
==
null
)
if
(
type
==
null
)
{
{
...
@@ -148,27 +154,25 @@ public class CertificateStoreManager
...
@@ -148,27 +154,25 @@ public class CertificateStoreManager
throw
new
IllegalArgumentException
(
"Argument 'configuration' cannot be null."
);
throw
new
IllegalArgumentException
(
"Argument 'configuration' cannot be null."
);
}
}
final
CertificateStoreManager
manager
=
getInstance
();
final
CertificateStoreConfiguration
oldConfig
=
typeToTrustStore
.
get
(
type
);
// can be null if persisted properties are invalid
final
CertificateStoreConfiguration
oldConfig
=
manager
.
typeToTrustStore
.
get
(
type
);
// can be null if persisted properties are invalid
if
(
oldConfig
==
null
||
!
oldConfig
.
equals
(
configuration
)
)
if
(
oldConfig
==
null
||
!
oldConfig
.
equals
(
configuration
)
)
{
{
// If the new store is not already being used by any other type, it'll need to be registered.
// If the new store is not already being used by any other type, it'll need to be registered.
if
(
!
manager
.
trustStores
.
containsKey
(
configuration
)
)
if
(
!
trustStores
.
containsKey
(
configuration
)
)
{
{
// This constructor can throw an exception. If it does, the state of the manager should not have already changed.
// This constructor can throw an exception. If it does, the state of the manager should not have already changed.
final
TrustStore
store
=
new
TrustStore
(
configuration
,
true
);
final
TrustStore
store
=
new
TrustStore
(
configuration
,
true
);
manager
.
trustStores
.
put
(
configuration
,
store
);
trustStores
.
put
(
configuration
,
store
);
}
}
manager
.
typeToTrustStore
.
put
(
type
,
configuration
);
typeToTrustStore
.
put
(
type
,
configuration
);
// If the old store is not used by any other type, it can be shut down.
// If the old store is not used by any other type, it can be shut down.
if
(
oldConfig
!=
null
&&
!
manager
.
typeToTrustStore
.
containsValue
(
oldConfig
)
)
if
(
oldConfig
!=
null
&&
!
typeToTrustStore
.
containsValue
(
oldConfig
)
)
{
{
manager
.
trustStores
.
remove
(
oldConfig
);
trustStores
.
remove
(
oldConfig
);
}
}
// Update all connection listeners that were using the old configuration.
// Update all connection listeners that were using the old configuration.
...
@@ -188,7 +192,7 @@ public class CertificateStoreManager
...
@@ -188,7 +192,7 @@ public class CertificateStoreManager
JiveGlobals
.
setProperty
(
type
.
getPrefix
()
+
"trustpass"
,
new
String
(
configuration
.
getPassword
()
)
);
JiveGlobals
.
setProperty
(
type
.
getPrefix
()
+
"trustpass"
,
new
String
(
configuration
.
getPassword
()
)
);
}
}
public
static
CertificateStoreConfiguration
getIdentityStoreConfiguration
(
ConnectionType
type
)
throws
IOException
public
CertificateStoreConfiguration
getIdentityStoreConfiguration
(
ConnectionType
type
)
throws
IOException
{
{
// Getting individual properties might use fallbacks. It is assumed (but not asserted) that each property value
// Getting individual properties might use fallbacks. It is assumed (but not asserted) that each property value
// is obtained from the same connectionType (which is either the argument to this method, or one of its
// is obtained from the same connectionType (which is either the argument to this method, or one of its
...
@@ -201,7 +205,7 @@ public class CertificateStoreManager
...
@@ -201,7 +205,7 @@ public class CertificateStoreManager
return
new
CertificateStoreConfiguration
(
keyStoreType
,
file
,
password
.
toCharArray
()
);
return
new
CertificateStoreConfiguration
(
keyStoreType
,
file
,
password
.
toCharArray
()
);
}
}
public
static
CertificateStoreConfiguration
getTrustStoreConfiguration
(
ConnectionType
type
)
throws
IOException
public
CertificateStoreConfiguration
getTrustStoreConfiguration
(
ConnectionType
type
)
throws
IOException
{
{
// Getting individual properties might use fallbacks. It is assumed (but not asserted) that each property value
// Getting individual properties might use fallbacks. It is assumed (but not asserted) that each property value
// is obtained from the same connectionType (which is either the argument to this method, or one of its
// is obtained from the same connectionType (which is either the argument to this method, or one of its
...
...
src/java/org/jivesoftware/openfire/net/SASLAuthentication.java
View file @
1f4d6288
...
@@ -656,9 +656,10 @@ public class SASLAuthentication {
...
@@ -656,9 +656,10 @@ public class SASLAuthentication {
}
}
public
static
boolean
verifyCertificates
(
Certificate
[]
chain
,
String
hostname
,
boolean
isS2S
)
{
public
static
boolean
verifyCertificates
(
Certificate
[]
chain
,
String
hostname
,
boolean
isS2S
)
{
final
CertificateStoreManager
certificateStoreManager
=
XMPPServer
.
getInstance
().
getCertificateStoreManager
();
final
ConnectionType
connectionType
=
isS2S
?
ConnectionType
.
SOCKET_S2S
:
ConnectionType
.
SOCKET_C2S
;
final
ConnectionType
connectionType
=
isS2S
?
ConnectionType
.
SOCKET_S2S
:
ConnectionType
.
SOCKET_C2S
;
final
KeyStore
keyStore
=
C
ertificateStoreManager
.
getIdentityStore
(
connectionType
).
getStore
();
final
KeyStore
keyStore
=
c
ertificateStoreManager
.
getIdentityStore
(
connectionType
).
getStore
();
final
KeyStore
trustStore
=
C
ertificateStoreManager
.
getTrustStore
(
connectionType
).
getStore
();
final
KeyStore
trustStore
=
c
ertificateStoreManager
.
getTrustStore
(
connectionType
).
getStore
();
final
X509Certificate
trusted
=
CertificateManager
.
getEndEntityCertificate
(
chain
,
keyStore
,
trustStore
);
final
X509Certificate
trusted
=
CertificateManager
.
getEndEntityCertificate
(
chain
,
keyStore
,
trustStore
);
if
(
trusted
!=
null
)
{
if
(
trusted
!=
null
)
{
return
verifyCertificate
(
trusted
,
hostname
);
return
verifyCertificate
(
trusted
,
hostname
);
...
...
src/java/org/jivesoftware/openfire/session/LocalIncomingServerSession.java
View file @
1f4d6288
...
@@ -34,6 +34,7 @@ import org.dom4j.io.XMPPPacketReader;
...
@@ -34,6 +34,7 @@ import org.dom4j.io.XMPPPacketReader;
import
org.jivesoftware.openfire.Connection
;
import
org.jivesoftware.openfire.Connection
;
import
org.jivesoftware.openfire.SessionManager
;
import
org.jivesoftware.openfire.SessionManager
;
import
org.jivesoftware.openfire.StreamID
;
import
org.jivesoftware.openfire.StreamID
;
import
org.jivesoftware.openfire.XMPPServer
;
import
org.jivesoftware.openfire.auth.UnauthorizedException
;
import
org.jivesoftware.openfire.auth.UnauthorizedException
;
import
org.jivesoftware.openfire.keystore.CertificateStoreManager
;
import
org.jivesoftware.openfire.keystore.CertificateStoreManager
;
import
org.jivesoftware.openfire.net.SASLAuthentication
;
import
org.jivesoftware.openfire.net.SASLAuthentication
;
...
@@ -153,7 +154,7 @@ public class LocalIncomingServerSession extends LocalServerSession implements In
...
@@ -153,7 +154,7 @@ public class LocalIncomingServerSession extends LocalServerSession implements In
Connection
.
TLSPolicy
.
required
;
Connection
.
TLSPolicy
.
required
;
boolean
hasCertificates
=
false
;
boolean
hasCertificates
=
false
;
try
{
try
{
hasCertificates
=
CertificateStoreManager
.
getIdentityStore
(
ConnectionType
.
SOCKET_S2S
).
getStore
().
size
()
>
0
;
hasCertificates
=
XMPPServer
.
getInstance
().
getCertificateStoreManager
()
.
getIdentityStore
(
ConnectionType
.
SOCKET_S2S
).
getStore
().
size
()
>
0
;
}
}
catch
(
Exception
e
)
{
catch
(
Exception
e
)
{
Log
.
error
(
e
.
getMessage
(),
e
);
Log
.
error
(
e
.
getMessage
(),
e
);
...
@@ -374,7 +375,7 @@ public class LocalIncomingServerSession extends LocalServerSession implements In
...
@@ -374,7 +375,7 @@ public class LocalIncomingServerSession extends LocalServerSession implements In
usingSelfSigned
=
true
;
usingSelfSigned
=
true
;
}
else
{
}
else
{
try
{
try
{
final
KeyStore
keyStore
=
CertificateStoreManager
.
getIdentityStore
(
ConnectionType
.
SOCKET_S2S
).
getStore
();
final
KeyStore
keyStore
=
XMPPServer
.
getInstance
().
getCertificateStoreManager
()
.
getIdentityStore
(
ConnectionType
.
SOCKET_S2S
).
getStore
();
usingSelfSigned
=
CertificateManager
.
isSelfSignedCertificate
(
keyStore
,
(
X509Certificate
)
chain
[
0
]);
usingSelfSigned
=
CertificateManager
.
isSelfSignedCertificate
(
keyStore
,
(
X509Certificate
)
chain
[
0
]);
}
catch
(
KeyStoreException
ex
)
{
}
catch
(
KeyStoreException
ex
)
{
Log
.
warn
(
"Exception occurred while trying to determine whether local certificate is self-signed. Proceeding as if it is."
,
ex
);
Log
.
warn
(
"Exception occurred while trying to determine whether local certificate is self-signed. Proceeding as if it is."
,
ex
);
...
...
src/java/org/jivesoftware/openfire/spi/ConnectionConfiguration.java
View file @
1f4d6288
...
@@ -3,6 +3,7 @@ package org.jivesoftware.openfire.spi;
...
@@ -3,6 +3,7 @@ package org.jivesoftware.openfire.spi;
import
org.apache.mina.filter.ssl.SslFilter
;
import
org.apache.mina.filter.ssl.SslFilter
;
import
org.eclipse.jetty.util.ssl.SslContextFactory
;
import
org.eclipse.jetty.util.ssl.SslContextFactory
;
import
org.jivesoftware.openfire.Connection
;
import
org.jivesoftware.openfire.Connection
;
import
org.jivesoftware.openfire.XMPPServer
;
import
org.jivesoftware.openfire.keystore.*
;
import
org.jivesoftware.openfire.keystore.*
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -375,8 +376,9 @@ public class ConnectionConfiguration
...
@@ -375,8 +376,9 @@ public class ConnectionConfiguration
this
.
cipherSuitesEnabled
=
Collections
.
unmodifiableSet
(
suitesEnabled
);
this
.
cipherSuitesEnabled
=
Collections
.
unmodifiableSet
(
suitesEnabled
);
this
.
cipherSuitesDisabled
=
Collections
.
unmodifiableSet
(
cipherSuitesDisabled
);
this
.
cipherSuitesDisabled
=
Collections
.
unmodifiableSet
(
cipherSuitesDisabled
);
this
.
identityStore
=
CertificateStoreManager
.
getIdentityStore
(
type
);
final
CertificateStoreManager
certificateStoreManager
=
XMPPServer
.
getInstance
().
getCertificateStoreManager
();
this
.
trustStore
=
CertificateStoreManager
.
getTrustStore
(
type
);
this
.
identityStore
=
certificateStoreManager
.
getIdentityStore
(
type
);
this
.
trustStore
=
certificateStoreManager
.
getTrustStore
(
type
);
this
.
Log
=
LoggerFactory
.
getLogger
(
this
.
getClass
().
getName
()
+
"["
+
port
+
"-"
+
type
+
"]"
);
this
.
Log
=
LoggerFactory
.
getLogger
(
this
.
getClass
().
getName
()
+
"["
+
port
+
"-"
+
type
+
"]"
);
}
}
...
...
src/java/org/jivesoftware/openfire/spi/ConnectionManagerImpl.java
View file @
1f4d6288
...
@@ -85,6 +85,8 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
...
@@ -85,6 +85,8 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
Log
.
warn
(
"Unable to resolve bind address: "
,
e
);
Log
.
warn
(
"Unable to resolve bind address: "
,
e
);
}
}
final
CertificateStoreManager
certificateStoreManager
=
XMPPServer
.
getInstance
().
getCertificateStoreManager
();
// client-to-server
// client-to-server
clientListener
=
new
ConnectionListener
(
clientListener
=
new
ConnectionListener
(
ConnectionType
.
SOCKET_C2S
,
ConnectionType
.
SOCKET_C2S
,
...
@@ -96,8 +98,8 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
...
@@ -96,8 +98,8 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
ConnectionSettings
.
Client
.
TLS_POLICY
,
ConnectionSettings
.
Client
.
TLS_POLICY
,
ConnectionSettings
.
Client
.
AUTH_PER_CLIENTCERT_POLICY
,
ConnectionSettings
.
Client
.
AUTH_PER_CLIENTCERT_POLICY
,
bindAddress
,
bindAddress
,
C
ertificateStoreManager
.
getIdentityStoreConfiguration
(
ConnectionType
.
SOCKET_C2S
),
c
ertificateStoreManager
.
getIdentityStoreConfiguration
(
ConnectionType
.
SOCKET_C2S
),
C
ertificateStoreManager
.
getTrustStoreConfiguration
(
ConnectionType
.
SOCKET_C2S
)
c
ertificateStoreManager
.
getTrustStoreConfiguration
(
ConnectionType
.
SOCKET_C2S
)
);
);
clientSslListener
=
new
ConnectionListener
(
clientSslListener
=
new
ConnectionListener
(
ConnectionType
.
SOCKET_C2S
,
ConnectionType
.
SOCKET_C2S
,
...
@@ -109,8 +111,8 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
...
@@ -109,8 +111,8 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
Connection
.
TLSPolicy
.
legacyMode
.
name
(),
// force legacy mode
Connection
.
TLSPolicy
.
legacyMode
.
name
(),
// force legacy mode
ConnectionSettings
.
Client
.
AUTH_PER_CLIENTCERT_POLICY
,
ConnectionSettings
.
Client
.
AUTH_PER_CLIENTCERT_POLICY
,
bindAddress
,
bindAddress
,
C
ertificateStoreManager
.
getIdentityStoreConfiguration
(
ConnectionType
.
SOCKET_C2S
),
c
ertificateStoreManager
.
getIdentityStoreConfiguration
(
ConnectionType
.
SOCKET_C2S
),
C
ertificateStoreManager
.
getTrustStoreConfiguration
(
ConnectionType
.
SOCKET_C2S
)
c
ertificateStoreManager
.
getTrustStoreConfiguration
(
ConnectionType
.
SOCKET_C2S
)
);
);
// BOSH / HTTP-bind
// BOSH / HTTP-bind
boshListener
=
new
ConnectionListener
(
boshListener
=
new
ConnectionListener
(
...
@@ -123,8 +125,8 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
...
@@ -123,8 +125,8 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
Connection
.
TLSPolicy
.
disabled
.
name
(),
// StartTLS over HTTP? Should use boshSslListener instead.
Connection
.
TLSPolicy
.
disabled
.
name
(),
// StartTLS over HTTP? Should use boshSslListener instead.
HttpBindManager
.
HTTP_BIND_AUTH_PER_CLIENTCERT_POLICY
,
HttpBindManager
.
HTTP_BIND_AUTH_PER_CLIENTCERT_POLICY
,
bindAddress
,
bindAddress
,
C
ertificateStoreManager
.
getIdentityStoreConfiguration
(
ConnectionType
.
BOSH_C2S
),
c
ertificateStoreManager
.
getIdentityStoreConfiguration
(
ConnectionType
.
BOSH_C2S
),
C
ertificateStoreManager
.
getTrustStoreConfiguration
(
ConnectionType
.
BOSH_C2S
)
c
ertificateStoreManager
.
getTrustStoreConfiguration
(
ConnectionType
.
BOSH_C2S
)
);
);
boshSslListener
=
new
ConnectionListener
(
boshSslListener
=
new
ConnectionListener
(
ConnectionType
.
BOSH_C2S
,
ConnectionType
.
BOSH_C2S
,
...
@@ -136,8 +138,8 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
...
@@ -136,8 +138,8 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
Connection
.
TLSPolicy
.
legacyMode
.
name
(),
Connection
.
TLSPolicy
.
legacyMode
.
name
(),
HttpBindManager
.
HTTP_BIND_AUTH_PER_CLIENTCERT_POLICY
,
HttpBindManager
.
HTTP_BIND_AUTH_PER_CLIENTCERT_POLICY
,
bindAddress
,
bindAddress
,
C
ertificateStoreManager
.
getIdentityStoreConfiguration
(
ConnectionType
.
BOSH_C2S
),
c
ertificateStoreManager
.
getIdentityStoreConfiguration
(
ConnectionType
.
BOSH_C2S
),
C
ertificateStoreManager
.
getTrustStoreConfiguration
(
ConnectionType
.
BOSH_C2S
)
c
ertificateStoreManager
.
getTrustStoreConfiguration
(
ConnectionType
.
BOSH_C2S
)
);
);
// server-to-server (federation)
// server-to-server (federation)
serverListener
=
new
ConnectionListener
(
serverListener
=
new
ConnectionListener
(
...
@@ -150,8 +152,8 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
...
@@ -150,8 +152,8 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
ConnectionSettings
.
Server
.
TLS_POLICY
,
ConnectionSettings
.
Server
.
TLS_POLICY
,
ConnectionSettings
.
Server
.
AUTH_PER_CLIENTCERT_POLICY
,
ConnectionSettings
.
Server
.
AUTH_PER_CLIENTCERT_POLICY
,
bindAddress
,
bindAddress
,
C
ertificateStoreManager
.
getIdentityStoreConfiguration
(
ConnectionType
.
SOCKET_S2S
),
c
ertificateStoreManager
.
getIdentityStoreConfiguration
(
ConnectionType
.
SOCKET_S2S
),
C
ertificateStoreManager
.
getTrustStoreConfiguration
(
ConnectionType
.
SOCKET_S2S
)
c
ertificateStoreManager
.
getTrustStoreConfiguration
(
ConnectionType
.
SOCKET_S2S
)
);
);
// external components (XEP 0114)
// external components (XEP 0114)
componentListener
=
new
ConnectionListener
(
componentListener
=
new
ConnectionListener
(
...
@@ -164,8 +166,8 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
...
@@ -164,8 +166,8 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
ConnectionSettings
.
Component
.
TLS_POLICY
,
ConnectionSettings
.
Component
.
TLS_POLICY
,
ConnectionSettings
.
Component
.
AUTH_PER_CLIENTCERT_POLICY
,
ConnectionSettings
.
Component
.
AUTH_PER_CLIENTCERT_POLICY
,
bindAddress
,
bindAddress
,
C
ertificateStoreManager
.
getIdentityStoreConfiguration
(
ConnectionType
.
COMPONENT
),
c
ertificateStoreManager
.
getIdentityStoreConfiguration
(
ConnectionType
.
COMPONENT
),
C
ertificateStoreManager
.
getTrustStoreConfiguration
(
ConnectionType
.
COMPONENT
)
c
ertificateStoreManager
.
getTrustStoreConfiguration
(
ConnectionType
.
COMPONENT
)
);
);
componentSslListener
=
new
ConnectionListener
(
componentSslListener
=
new
ConnectionListener
(
ConnectionType
.
COMPONENT
,
ConnectionType
.
COMPONENT
,
...
@@ -177,8 +179,8 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
...
@@ -177,8 +179,8 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
Connection
.
TLSPolicy
.
legacyMode
.
name
(),
// force legacy mode
Connection
.
TLSPolicy
.
legacyMode
.
name
(),
// force legacy mode
ConnectionSettings
.
Component
.
AUTH_PER_CLIENTCERT_POLICY
,
ConnectionSettings
.
Component
.
AUTH_PER_CLIENTCERT_POLICY
,
bindAddress
,
bindAddress
,
C
ertificateStoreManager
.
getIdentityStoreConfiguration
(
ConnectionType
.
COMPONENT
),
c
ertificateStoreManager
.
getIdentityStoreConfiguration
(
ConnectionType
.
COMPONENT
),
C
ertificateStoreManager
.
getTrustStoreConfiguration
(
ConnectionType
.
COMPONENT
)
c
ertificateStoreManager
.
getTrustStoreConfiguration
(
ConnectionType
.
COMPONENT
)
);
);
// Multiplexers (our propertietary connection manager implementation)
// Multiplexers (our propertietary connection manager implementation)
...
@@ -192,8 +194,8 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
...
@@ -192,8 +194,8 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
ConnectionSettings
.
Multiplex
.
TLS_POLICY
,
ConnectionSettings
.
Multiplex
.
TLS_POLICY
,
ConnectionSettings
.
Multiplex
.
AUTH_PER_CLIENTCERT_POLICY
,
ConnectionSettings
.
Multiplex
.
AUTH_PER_CLIENTCERT_POLICY
,
bindAddress
,
bindAddress
,
C
ertificateStoreManager
.
getIdentityStoreConfiguration
(
ConnectionType
.
CONNECTION_MANAGER
),
c
ertificateStoreManager
.
getIdentityStoreConfiguration
(
ConnectionType
.
CONNECTION_MANAGER
),
C
ertificateStoreManager
.
getTrustStoreConfiguration
(
ConnectionType
.
CONNECTION_MANAGER
)
c
ertificateStoreManager
.
getTrustStoreConfiguration
(
ConnectionType
.
CONNECTION_MANAGER
)
);
);
connectionManagerSslListener
=
new
ConnectionListener
(
connectionManagerSslListener
=
new
ConnectionListener
(
ConnectionType
.
CONNECTION_MANAGER
,
ConnectionType
.
CONNECTION_MANAGER
,
...
@@ -205,23 +207,23 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
...
@@ -205,23 +207,23 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
Connection
.
TLSPolicy
.
legacyMode
.
name
(),
// force legacy mode
Connection
.
TLSPolicy
.
legacyMode
.
name
(),
// force legacy mode
ConnectionSettings
.
Multiplex
.
AUTH_PER_CLIENTCERT_POLICY
,
ConnectionSettings
.
Multiplex
.
AUTH_PER_CLIENTCERT_POLICY
,
bindAddress
,
bindAddress
,
C
ertificateStoreManager
.
getIdentityStoreConfiguration
(
ConnectionType
.
CONNECTION_MANAGER
),
c
ertificateStoreManager
.
getIdentityStoreConfiguration
(
ConnectionType
.
CONNECTION_MANAGER
),
C
ertificateStoreManager
.
getTrustStoreConfiguration
(
ConnectionType
.
CONNECTION_MANAGER
)
c
ertificateStoreManager
.
getTrustStoreConfiguration
(
ConnectionType
.
CONNECTION_MANAGER
)
);
);
// Admin console (the Openfire web-admin) // TODO these use the XML properties instead of normal properties!
// Admin console (the Openfire web-admin) // TODO these use the XML properties instead of normal properties!
webAdminListener
=
new
ConnectionListener
(
webAdminListener
=
new
ConnectionListener
(
ConnectionType
.
WEBADMIN
,
ConnectionType
.
WEBADMIN
,
"adminConsole.port"
,
"adminConsole.port"
,
9090
,
9090
,
null
,
null
,
"adminConsole.serverThreads"
,
"adminConsole.serverThreads"
,
null
,
null
,
Connection
.
TLSPolicy
.
disabled
.
name
(),
// StartTLS over HTTP? Should use webAdminSslListener instead.
Connection
.
TLSPolicy
.
disabled
.
name
(),
// StartTLS over HTTP? Should use webAdminSslListener instead.
null
,
null
,
bindAddress
,
bindAddress
,
C
ertificateStoreManager
.
getIdentityStoreConfiguration
(
ConnectionType
.
WEBADMIN
),
c
ertificateStoreManager
.
getIdentityStoreConfiguration
(
ConnectionType
.
WEBADMIN
),
C
ertificateStoreManager
.
getTrustStoreConfiguration
(
ConnectionType
.
WEBADMIN
)
c
ertificateStoreManager
.
getTrustStoreConfiguration
(
ConnectionType
.
WEBADMIN
)
);
);
webAdminSslListener
=
new
ConnectionListener
(
webAdminSslListener
=
new
ConnectionListener
(
...
@@ -234,8 +236,8 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
...
@@ -234,8 +236,8 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
Connection
.
TLSPolicy
.
legacyMode
.
name
(),
Connection
.
TLSPolicy
.
legacyMode
.
name
(),
null
,
null
,
bindAddress
,
bindAddress
,
C
ertificateStoreManager
.
getIdentityStoreConfiguration
(
ConnectionType
.
WEBADMIN
),
c
ertificateStoreManager
.
getIdentityStoreConfiguration
(
ConnectionType
.
WEBADMIN
),
C
ertificateStoreManager
.
getTrustStoreConfiguration
(
ConnectionType
.
WEBADMIN
)
c
ertificateStoreManager
.
getTrustStoreConfiguration
(
ConnectionType
.
WEBADMIN
)
);
);
}
}
...
...
src/resources/jar/admin-sidebar.xml
View file @
1f4d6288
...
@@ -141,28 +141,99 @@
...
@@ -141,28 +141,99 @@
url=
"security-certificate-store-management.jsp"
url=
"security-certificate-store-management.jsp"
description=
"Manage Openfire Certificate stores"
>
description=
"Manage Openfire Certificate stores"
>
<!--<!– Certificate key stores ("Openfire Certificates") –>-->
<sidebar
id=
"sidebar-certificate-store-socket-c2s"
name=
"${sidebar.client-connections-settings}"
>
<item
id=
"sidebar-certificate-store-SOCKET_C2S-identity-store"
name=
"Identity Store"
url=
"security-keystore.jsp?connectionType=SOCKET_C2S"
description=
"Contains key and certificate that serve as identification of Openfire."
/>
<item
id=
"sidebar-certificate-store-SOCKET_C2S-trust-store"
name=
"Trust Store"
url=
"security-truststore.jsp?connectionType=SOCKET_C2S"
description=
"Contains certificates that are used to verify the identity of peers."
/>
</sidebar>
<sidebar
id=
"sidebar-certificate-store-socket-s2s"
name=
"${sidebar.server2server-settings}"
>
<item
id=
"sidebar-certificate-store-SOCKET_S2S-identity-store"
name=
"Identity Store"
url=
"security-keystore.jsp?connectionType=SOCKET_S2S"
description=
"Contains key and certificate that serve as identification of Openfire."
/>
<item
id=
"sidebar-certificate-store-SOCKET_S2S-trust-store"
name=
"Trust Store"
url=
"security-truststore.jsp?connectionType=SOCKET_S2S"
description=
"Contains certificates that are used to verify the identity of peers."
/>
</sidebar>
<sidebar
id=
"sidebar-certificate-store-bosh-c2s"
name=
"${sidebar.http-bind}"
>
<item
id=
"sidebar-certificate-store-BOSH_C2S-identity-store"
name=
"Identity Store"
url=
"security-keystore.jsp?connectionType=BOSH_C2S"
description=
"Contains key and certificate that serve as identification of Openfire."
/>
<item
id=
"sidebar-certificate-store-BOSH_C2S-trust-store"
name=
"Trust Store"
url=
"security-truststore.jsp?connectionType=BOSH_C2S"
description=
"Contains certificates that are used to verify the identity of peers."
/>
</sidebar>
<sidebar
id=
"sidebar-certificate-store-component"
name=
"${sidebar.external-components-settings}"
>
<item
id=
"sidebar-certificate-store-COMPONENT-identity-store"
name=
"Identity Store"
url=
"security-keystore.jsp?connectionType=COMPONENT"
description=
"Contains key and certificate that serve as identification of Openfire."
/>
<item
id=
"sidebar-certificate-store-COMPONENT-trust-store"
name=
"Trust Store"
url=
"security-truststore.jsp?connectionType=COMPONENT"
description=
"Contains certificates that are used to verify the identity of peers."
/>
</sidebar>
<sidebar
id=
"sidebar-certificate-store-connection-manager"
name=
"${sidebar.connection-managers-settings}"
>
<item
id=
"sidebar-certificate-store-CONNECTION_MANAGER-identity-store"
name=
"Identity Store"
url=
"security-keystore.jsp?connectionType=CONNECTION_MANAGER"
description=
"Contains key and certificate that serve as identification of Openfire."
/>
<item
id=
"sidebar-certificate-store-CONNECTION_MANAGER-trust-store"
name=
"Trust Store"
url=
"security-truststore.jsp?connectionType=CONNECTION_MANAGER"
description=
"Contains certificates that are used to verify the identity of peers."
/>
</sidebar>
<sidebar
id=
"sidebar-certificate-store-webadmin"
name=
"${admin.console}"
>
<item
id=
"sidebar-certificate-store-WEBADMIN-identity-store"
name=
"Identity Store"
url=
"security-keystore.jsp?connectionType=WEBADMIN"
description=
"Contains key and certificate that serve as identification of Openfire."
/>
<item
id=
"sidebar-certificate-store-WEBADMIN-trust-store"
name=
"Trust Store"
url=
"security-truststore.jsp?connectionType=WEBADMIN"
description=
"Contains certificates that are used to verify the identity of peers."
/>
</sidebar>
<!--<!– Certificate key stores ("Openfire Certificates") –>-->
<!--<item id="sidebar-certificates-keys" name="${sidebar.sidebar-certificates-keys}"-->
<!--<item id="sidebar-certificates-keys" name="${sidebar.sidebar-certificates-keys}"-->
<!--url="security-keystore.jsp">-->
<!--url="security-keystore.jsp">-->
<
sidebar
id=
"sidebar-certificates-keys-submenu"
name=
"${sidebar.sidebar-certificates-keys-submenu}"
>
<
!--<sidebar id="sidebar-certificates-keys-submenu" name="${sidebar.sidebar-certificates-keys-submenu}">--
>
<!--
Socket Server Certificates
-->
<!--
<!– Socket Server Certificates –>
-->
<
item
id=
"security-keystore-socket"
name=
"${sidebar.security-keystore-socket}"
<
!--<item id="security-keystore-socket" name="${sidebar.security-keystore-socket}"-->
url=
"security-keystore.jsp?connectivityType=socket"
<!--url="security-keystore.jsp?connectivityType=socket"-->
description=
"${sidebar.security-keystore-socket.descr}"
/
>
<!--description="${sidebar.security-keystore-socket.descr}"/>--
>
<!--
BOSH Server Certificates
-->
<!--
<!– BOSH Server Certificates –>
-->
<
item
id=
"security-keystore-bosh"
name=
"${sidebar.security-keystore-bosh}"
<
!--<item id="security-keystore-bosh" name="${sidebar.security-keystore-bosh}"-->
url=
"security-keystore.jsp?connectivityType=bosh"
<!--url="security-keystore.jsp?connectivityType=bosh"-->
description=
"${sidebar.security-keystore-bosh.descr}"
/
>
<!--description="${sidebar.security-keystore-bosh.descr}"/>--
>
<!--
Administrative Server Certificates
-->
<!--
<!– Administrative Server Certificates –>
-->
<
item
id=
"security-keystore-administrative"
name=
"${sidebar.security-keystore-administrative}"
<
!--<item id="security-keystore-administrative" name="${sidebar.security-keystore-administrative}"-->
url=
"security-keystore.jsp?connectivityType=administrative"
<!--url="security-keystore.jsp?connectivityType=administrative"-->
description=
"${sidebar.security-keystore-administrative.descr}"
/
>
<!--description="${sidebar.security-keystore-administrative.descr}"/>--
>
<
/sidebar
>
<
!--</sidebar>--
>
</item>
</item>
...
...
src/web/import-keystore-certificate.jsp
View file @
1f4d6288
<%@ page
errorPage=
"error.jsp"
%>
<%@ page
errorPage=
"error.jsp"
%>
<%@ page
import=
"org.jivesoftware.openfire.XMPPServer"
%>
<%@ page
import=
"org.jivesoftware.openfire.XMPPServer"
%>
<%@ page
import=
"org.jivesoftware.openfire.keystore.CertificateStoreManager"
%>
<%@ page
import=
"org.jivesoftware.openfire.keystore.IdentityStore"
%>
<%@ page
import=
"org.jivesoftware.openfire.keystore.IdentityStore"
%>
<%@ page
import=
"org.jivesoftware.openfire.spi.ConnectionType"
%>
<%@ page
import=
"org.jivesoftware.openfire.spi.ConnectionType"
%>
<%@ page
import=
"org.jivesoftware.util.ParamUtils"
%>
<%@ page
import=
"org.jivesoftware.util.ParamUtils"
%>
...
@@ -42,7 +41,7 @@
...
@@ -42,7 +41,7 @@
}
}
if
(
errors
.
isEmpty
())
{
if
(
errors
.
isEmpty
())
{
try
{
try
{
final
IdentityStore
identityStore
=
CertificateStoreManager
.
getIdentityStore
(
storeConnectionType
);
final
IdentityStore
identityStore
=
XMPPServer
.
getInstance
().
getCertificateStoreManager
()
.
getIdentityStore
(
storeConnectionType
);
// Create an alias for the signed certificate
// Create an alias for the signed certificate
String
domain
=
XMPPServer
.
getInstance
().
getServerInfo
().
getXMPPDomain
();
String
domain
=
XMPPServer
.
getInstance
().
getServerInfo
().
getXMPPDomain
();
...
...
src/web/import-truststore-certificate.jsp
View file @
1f4d6288
<%@ page
errorPage=
"error.jsp"
%>
<%@ page
errorPage=
"error.jsp"
%>
<%@ page
import=
"org.jivesoftware.openfire.keystore.CertificateStoreManager"
%>
<%@ page
import=
"org.jivesoftware.openfire.keystore.TrustStore"
%>
<%@ page
import=
"org.jivesoftware.openfire.keystore.TrustStore"
%>
<%@ page
import=
"org.jivesoftware.openfire.spi.ConnectionType"
%>
<%@ page
import=
"org.jivesoftware.openfire.spi.ConnectionType"
%>
<%@ page
import=
"org.jivesoftware.util.ParamUtils"
%>
<%@ page
import=
"org.jivesoftware.util.ParamUtils"
%>
<%@ page
import=
"java.util.HashMap"
%>
<%@ page
import=
"java.util.HashMap"
%>
<%@ page
import=
"java.util.Map"
%>
<%@ page
import=
"java.util.Map"
%>
<%@ page
import=
"org.jivesoftware.openfire.XMPPServer"
%>
<%@ taglib
uri=
"admin"
prefix=
"admin"
%>
<%@ taglib
uri=
"admin"
prefix=
"admin"
%>
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%>
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%>
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
if
(
save
&&
errors
.
isEmpty
())
if
(
save
&&
errors
.
isEmpty
())
{
{
final
TrustStore
trustStoreConfig
=
CertificateStoreManager
.
getTrustStore
(
storeConnectionType
);
final
TrustStore
trustStoreConfig
=
XMPPServer
.
getInstance
().
getCertificateStoreManager
()
.
getTrustStore
(
storeConnectionType
);
if
(
alias
==
null
||
""
.
equals
(
alias
))
if
(
alias
==
null
||
""
.
equals
(
alias
))
{
{
...
...
src/web/index.jsp
View file @
1f4d6288
...
@@ -32,7 +32,6 @@
...
@@ -32,7 +32,6 @@
<%@ page
import=
"org.jivesoftware.openfire.container.AdminConsolePlugin"
%>
<%@ page
import=
"org.jivesoftware.openfire.container.AdminConsolePlugin"
%>
<%@ page
import=
"org.jivesoftware.openfire.filetransfer.proxy.FileTransferProxy"
%>
<%@ page
import=
"org.jivesoftware.openfire.filetransfer.proxy.FileTransferProxy"
%>
<%@ page
import=
"org.jivesoftware.openfire.http.HttpBindManager"
%>
<%@ page
import=
"org.jivesoftware.openfire.http.HttpBindManager"
%>
<%@ page
import=
"org.jivesoftware.openfire.keystore.CertificateStoreManager"
%>
<%@ page
import=
"org.jivesoftware.openfire.keystore.IdentityStore"
%>
<%@ page
import=
"org.jivesoftware.openfire.keystore.IdentityStore"
%>
<%@ page
import=
"org.jivesoftware.openfire.mediaproxy.MediaProxyService"
%>
<%@ page
import=
"org.jivesoftware.openfire.mediaproxy.MediaProxyService"
%>
<%@ page
import=
"org.jivesoftware.openfire.spi.ConnectionListener"
%>
<%@ page
import=
"org.jivesoftware.openfire.spi.ConnectionListener"
%>
...
@@ -243,7 +242,7 @@
...
@@ -243,7 +242,7 @@
<fmt:message
key=
"index.server_name"
/>
<fmt:message
key=
"index.server_name"
/>
</td>
</td>
<td
class=
"c2"
>
<td
class=
"c2"
>
<%
final
IdentityStore
identityStore
=
CertificateStoreManager
.
getIdentityStore
(
ConnectionType
.
SOCKET_C2S
);
%>
<%
final
IdentityStore
identityStore
=
XMPPServer
.
getInstance
().
getCertificateStoreManager
()
.
getIdentityStore
(
ConnectionType
.
SOCKET_C2S
);
%>
<%
try
{
%>
<%
try
{
%>
<%
if
(!
identityStore
.
containsDomainCertificate
(
"RSA"
))
{
%>
<%
if
(!
identityStore
.
containsDomainCertificate
(
"RSA"
))
{
%>
<img
src=
"images/warning-16x16.gif"
width=
"16"
height=
"16"
border=
"0"
alt=
"
<fmt:message
key=
"index.certificate-warning"
/>
"
title=
"
<fmt:message
key=
"index.certificate-warning"
/>
"
>
<img
src=
"images/warning-16x16.gif"
width=
"16"
height=
"16"
border=
"0"
alt=
"
<fmt:message
key=
"index.certificate-warning"
/>
"
title=
"
<fmt:message
key=
"index.certificate-warning"
/>
"
>
...
...
src/web/security-certificate-details.jsp
View file @
1f4d6288
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
<%@ page
import=
"java.security.cert.X509Certificate"
%>
<%@ page
import=
"java.security.cert.X509Certificate"
%>
<%@ page
import=
"java.util.HashMap"
%>
<%@ page
import=
"java.util.HashMap"
%>
<%@ page
import=
"java.util.Map"
%>
<%@ page
import=
"java.util.Map"
%>
<%@ page
import=
"org.jivesoftware.openfire.XMPPServer"
%>
<%@ taglib
uri=
"admin"
prefix=
"admin"
%>
<%@ taglib
uri=
"admin"
prefix=
"admin"
%>
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%>
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%>
...
@@ -43,11 +44,12 @@
...
@@ -43,11 +44,12 @@
{
{
try
try
{
{
final
CertificateStoreManager
certificateStoreManager
=
XMPPServer
.
getInstance
().
getCertificateStoreManager
();
final
CertificateStore
store
;
final
CertificateStore
store
;
if
(
isTrustStore
)
{
if
(
isTrustStore
)
{
store
=
C
ertificateStoreManager
.
getTrustStore
(
storeConnectionType
);
store
=
c
ertificateStoreManager
.
getTrustStore
(
storeConnectionType
);
}
else
{
}
else
{
store
=
C
ertificateStoreManager
.
getIdentityStore
(
storeConnectionType
);
store
=
c
ertificateStoreManager
.
getIdentityStore
(
storeConnectionType
);
}
}
// Get the certificate
// Get the certificate
...
...
src/web/security-certificate-store-management.jsp
View file @
1f4d6288
<%@ page
errorPage=
"error.jsp"
%>
<%@ page
errorPage=
"error.jsp"
%>
>
<%@ page
import=
"org.jivesoftware.util.ParamUtils"
%>
<%@ page
import=
"java.util.HashMap"
%>
<%@ page
import=
"java.util.Map"
%>
<%@ page
import=
"java.util.Map"
%>
<%@ page
import=
"java.util.HashMap"
%>
<%@ page
import=
"org.jivesoftware.openfire.spi.ConnectionType"
%>
<%@ page
import=
"org.jivesoftware.openfire.keystore.CertificateStoreManager"
%>
<%@ page
import=
"org.jivesoftware.openfire.XMPPServer"
%>
<%@ taglib
uri=
"admin"
prefix=
"admin"
%>
<%@ taglib
uri=
"admin"
prefix=
"admin"
%>
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%>
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%>
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/fmt"
prefix=
"fmt"
%>
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/fmt"
prefix=
"fmt"
%>
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/functions"
prefix=
"fn"
%>
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/functions"
prefix=
"fn"
%>
<jsp:useBean
id=
"webManager"
class=
"org.jivesoftware.util.WebManager"
/>
<jsp:useBean
id=
"webManager"
class=
"org.jivesoftware.util.WebManager"
/>
<%
webManager
.
init
(
request
,
response
,
session
,
application
,
out
);
<jsp:useBean
id=
"now"
class=
"java.util.Date"
/>
<%
webManager
.
init
(
request
,
response
,
session
,
application
,
out
);
// Read parameters
final
boolean
save
=
request
.
getParameter
(
"save"
)
!=
null
;
// TODO actually save something!
// Pre-update property values
final
Map
<
String
,
String
>
errors
=
new
HashMap
<
>
();
final
Map
<
String
,
String
>
errors
=
new
HashMap
<
>
();
pageContext
.
setAttribute
(
"errors"
,
errors
);
pageContext
.
setAttribute
(
"errors"
,
errors
);
pageContext
.
setAttribute
(
"connectionTypes"
,
ConnectionType
.
values
()
);
pageContext
.
setAttribute
(
"certificateStoreManager"
,
XMPPServer
.
getInstance
().
getCertificateStoreManager
());
%>
%>
<html>
<html>
<head>
<head>
<title>
Certificate Stores
</title>
<title>
Certificate Stores
</title>
<meta
name=
"pageID"
content=
"security-certificate-store-management"
/>
<meta
name=
"pageID"
content=
"security-certificate-store-management"
/>
</head>
</head>
<>
<c:forEach
var=
"err"
items=
"
${
errors
}
"
>
<c:forEach
var=
"err"
items=
"
${
errors
}
"
>
<admin:infobox
type=
"error"
>
<admin:infobox
type=
"error"
>
<c:if
test=
"
${
not
empty
err
.
value
}
"
>
<c:choose>
<fmt:message
key=
"admin.error"
/>
:
<c:out
value=
"
${
err
.
value
}
"
/>
<!--Use the template below for specific error messages. -->
</c:if>
<c:when
test=
"
${
err
.
key
eq
'template'
}
"
>
(
<c:out
value=
"
${
err
.
key
}
"
/>
)
An unexpected error occurred.
</c:when>
<c:otherwise>
<c:if
test=
"
${
not
empty
err
.
value
}
"
>
<fmt:message
key=
"admin.error"
/>
:
<c:out
value=
"
${
err
.
value
}
"
/>
</c:if>
(
<c:out
value=
"
${
err
.
key
}
"
/>
)
</c:otherwise>
</c:choose>
</admin:infobox>
</admin:infobox>
</c:forEach>
</c:forEach>
<c:if
test=
"
${
param
.
success
}
"
>
<admin:infobox
type=
"success"
>
Settings Updated Successfully
</admin:infobox>
</c:if>
<c:if
test=
"
${
param
.
noChange
}
"
>
<admin:infobox
type=
"info"
>
The provided settings were no different than before. Nothing changed.
</admin:infobox>
</c:if>
<p>
<p>
Certificates are used (through TLS and SSL protocols) to establish secure connections between servers and clients.
Certificates are used (through TLS and SSL protocols) to establish secure connections between servers and clients.
When a secured connection is being created, parties can retrieve a certificate from the other party and (amongst
When a secured connection is being created, parties can retrieve a certificate from the other party and (amongst
...
@@ -66,46 +64,37 @@
...
@@ -66,46 +64,37 @@
<p>
<p>
This section of the admin panel is dedicated to management of the various key and trust stores that act as
This section of the admin panel is dedicated to management of the various key and trust stores that act as
repositories for sets of security certificates. By default, a small set of stores is re-used for various purposes,
repositories for sets of security certificates. By default, a small set of stores is re-used for various purposes,
but Openfire allows you to configure a distinct set of stores for each type. To do so, please change the store
but Openfire allows you to configure a distinct set of stores for each connection type.
locations below.
</p>
</p>
<
form
action=
"security-certificate-store-management.jsp"
method=
"post
"
>
<
c:forEach
items=
"
${
connectionTypes
}
"
var=
"connectionType
"
>
<div
class=
"jive-contentBoxHeader"
>
<c:set
var=
"trustStore"
value=
"
${
certificateStoreManager
.
Regular XMPP connection Stores
<
admin:
contentBox
title
=
"XMPP Client Connection Stores"
>
</div>
<div
class=
"jive-contentBox"
>
<p>
These stores are used for regular, TCP-based XMPP communication. Three stores are provided: one identity store
and two trust stores. One of the trust stores applies to server-to-server federation. The other trust store
applies to the optional client-based mutual authentication feature in Openfire.
</p>
<
p
>
<
p
>
Openfire ships with an empty client trust store, as in typical environments, certificate-based authentication of
These
stores
are
used
for
regular
,
TCP
-
based
client
-
to
-
server
XMPP
communication
.
Two
stores
are
provided:
clients is not required.
one
identity
store
and
a
trust
store
.
Openfire
ships
with
an
empty
client
trust
store
,
as
in
typical
environments
,
certificate
-
based
authentication
of
clients
is
not
required
.
</
p
>
</
p
>
<
table
cellpadding
=
"0"
cellspacing
=
"0"
border
=
"0"
>
<
table
cellpadding
=
"0"
cellspacing
=
"0"
border
=
"0"
>
<
tbody
>
<
tbody
>
<tr>
<
tr
>
<td><label
for=
"loc-key-socket"
>
Identity Store:
</label></td>
<
td
><
label
for
=
"loc-key-socket"
>
Identity
Store:
</
label
></
td
>
<td><input
id=
"loc-key-socket"
name=
"loc-key-socket"
type=
"text"
size=
"40"
value=
"${locKeySocket}"
/></td>
<
td
><
input
id
=
"loc-key-socket"
name
=
"loc-key-socket"
type
=
"text"
size
=
"40"
value
=
"$
{
locKeySocket
}
"
/></td>
<td><a
href=
"security-keystore.jsp?storeConnectionType=SOCKETBASED_IDENTITYSTORE"
>
Manage Store Contents
</a></td>
<td><a
href=
"security-keystore.jsp?connectionType=${connectionType}"
>
Manage Store Contents
</a></td>
</tr>
</tr>
<tr>
<tr>
<td><label
for=
"loc-trust-socket-s2s"
>
Server Trust Store:
</label></td>
<td><label
for=
"loc-trust-socket-c2s"
>
Trust Store:
</label></td>
<td><input
id=
"loc-trust-socket-s2s"
name=
"loc-trust-socket-s2s"
type=
"text"
size=
"40"
value=
"${locTrustSocketS2S}"
/></td>
<td><input
id=
"loc-trust-socket-c2s"
name=
"loc-trust-socket-c2s"
type=
"text"
size=
"40"
value=
"${locTrustSocketC2S}"
/></td>
<td><a
href=
"security-truststore.jsp?storeConnectionType=SOCKETBASED_S2S_TRUSTSTORE"
>
Manage Store Contents
</a></td>
<td><a
href=
"security-truststore.jsp?storeConnectionType=${connectionType}"
>
Manage Store Contents
</a></td>
</tr>
</tr>
<tr>
<td><label
for=
"loc-trust-socket-c2s"
>
Client Trust Store:
</label></td>
<td><input
id=
"loc-trust-socket-c2s"
name=
"loc-trust-socket-c2s"
type=
"text"
size=
"40"
value=
"${locTrustSocketC2S}"
/></td>
<td><a
href=
"security-truststore.jsp?storeConnectionType=SOCKETBASED_C2S_TRUSTSTORE"
>
Manage Store Contents
</a></td>
</tr>
</tbody>
</tbody>
</table>
</table>
</div>
</admin:contentBox>
</c:forEach>
<div
class=
"jive-contentBoxHeader"
>
<div
class=
"jive-contentBoxHeader"
>
BOSH (HTTP Binding) connection Stores
BOSH (HTTP Binding) connection Stores
...
@@ -188,8 +177,8 @@
...
@@ -188,8 +177,8 @@
</table>
</table>
</div>
</div>
<!-- TODO enable me <input type="submit" name="save" value="
<fmt:message
key=
"global.save_settings"
/>
"> -->
</form>
</form>
-->
</body>
</body>
</html>
</html>
src/web/security-keystore.jsp
View file @
1f4d6288
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
<%@ page
import=
"org.jivesoftware.openfire.XMPPServer"
%>
<%@ page
import=
"org.jivesoftware.openfire.XMPPServer"
%>
<%@ page
import=
"org.jivesoftware.openfire.container.AdminConsolePlugin"
%>
<%@ page
import=
"org.jivesoftware.openfire.container.AdminConsolePlugin"
%>
<%@ page
import=
"org.jivesoftware.openfire.keystore.CertificateStoreManager"
%>
<%@ page
import=
"org.jivesoftware.openfire.keystore.IdentityStore"
%>
<%@ page
import=
"org.jivesoftware.openfire.keystore.IdentityStore"
%>
<%@ page
import=
"org.jivesoftware.openfire.spi.ConnectionType"
%>
<%@ page
import=
"org.jivesoftware.openfire.spi.ConnectionType"
%>
<%@ page
import=
"org.jivesoftware.util.ParamUtils"
%>
<%@ page
import=
"org.jivesoftware.util.ParamUtils"
%>
...
@@ -15,26 +14,27 @@
...
@@ -15,26 +14,27 @@
<%@ taglib
uri=
"admin"
prefix=
"admin"
%>
<%@ taglib
uri=
"admin"
prefix=
"admin"
%>
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%>
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%>
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/fmt"
prefix=
"fmt"
%>
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/fmt"
prefix=
"fmt"
%>
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/functions"
prefix=
"fn"
%>
<jsp:useBean
id=
"now"
class=
"java.util.Date"
/>
<jsp:useBean
id=
"now"
class=
"java.util.Date"
/>
<jsp:useBean
id=
"webManager"
class=
"org.jivesoftware.util.WebManager"
/>
<jsp:useBean
id=
"webManager"
class=
"org.jivesoftware.util.WebManager"
/>
<%
webManager
.
init
(
request
,
response
,
session
,
application
,
out
);
%>
<%
webManager
.
init
(
request
,
response
,
session
,
application
,
out
);
%>
<%
// Get parameters:
<%
// Get parameters:
final
boolean
generate
=
ParamUtils
.
getBooleanParameter
(
request
,
"generate"
);
final
boolean
generate
=
ParamUtils
.
getBooleanParameter
(
request
,
"generate"
);
final
boolean
delete
=
ParamUtils
.
getBooleanParameter
(
request
,
"delete"
);
final
boolean
delete
=
ParamUtils
.
getBooleanParameter
(
request
,
"delete"
);
final
boolean
importReply
=
ParamUtils
.
getBooleanParameter
(
request
,
"importReply"
);
final
boolean
importReply
=
ParamUtils
.
getBooleanParameter
(
request
,
"importReply"
);
final
String
alias
=
ParamUtils
.
getParameter
(
request
,
"alias"
);
final
String
alias
=
ParamUtils
.
getParameter
(
request
,
"alias"
);
final
String
storePurposeText
=
ParamUtils
.
getParameter
(
request
,
"storeC
onnectionType"
);
final
String
connectionTypeText
=
ParamUtils
.
getParameter
(
request
,
"c
onnectionType"
);
final
Map
<
String
,
String
>
errors
=
new
HashMap
<
String
,
String
>
();
final
Map
<
String
,
String
>
errors
=
new
HashMap
<
>
();
ConnectionType
storeC
onnectionType
=
null
;
ConnectionType
c
onnectionType
=
null
;
IdentityStore
identityStore
=
null
;
IdentityStore
identityStore
=
null
;
try
try
{
{
storeConnectionType
=
ConnectionType
.
valueOf
(
storePurpos
eText
);
connectionType
=
ConnectionType
.
valueOf
(
connectionTyp
eText
);
identityStore
=
CertificateStoreManager
.
getIdentityStore
(
storeC
onnectionType
);
identityStore
=
XMPPServer
.
getInstance
().
getCertificateStoreManager
().
getIdentityStore
(
c
onnectionType
);
if
(
identityStore
==
null
)
if
(
identityStore
==
null
)
{
{
errors
.
put
(
"identityStore"
,
"Unable to get an instance."
);
errors
.
put
(
"identityStore"
,
"Unable to get an instance."
);
...
@@ -42,15 +42,15 @@
...
@@ -42,15 +42,15 @@
}
}
catch
(
RuntimeException
ex
)
catch
(
RuntimeException
ex
)
{
{
errors
.
put
(
"
storeC
onnectionType"
,
ex
.
getMessage
()
);
errors
.
put
(
"
c
onnectionType"
,
ex
.
getMessage
()
);
}
}
if
(
errors
.
isEmpty
()
)
if
(
errors
.
isEmpty
()
)
{
{
pageContext
.
setAttribute
(
"
storeConnectionType"
,
storeC
onnectionType
);
pageContext
.
setAttribute
(
"
connectionType"
,
c
onnectionType
);
pageContext
.
setAttribute
(
"identityStore"
,
identityStore
);
pageContext
.
setAttribute
(
"identityStore"
,
identityStore
);
final
Set
<
ConnectionType
>
sameStoreConnectionTypes
=
Collections
.
EMPTY_SET
;
// TODO FIXME: SSLConfig.getInstance().getOtherPurposesForSameStore(
storeC
onnectionType );
final
Set
<
ConnectionType
>
sameStoreConnectionTypes
=
Collections
.
EMPTY_SET
;
// TODO FIXME: SSLConfig.getInstance().getOtherPurposesForSameStore(
c
onnectionType );
pageContext
.
setAttribute
(
"sameStoreConnectionTypes"
,
sameStoreConnectionTypes
);
pageContext
.
setAttribute
(
"sameStoreConnectionTypes"
,
sameStoreConnectionTypes
);
final
Map
<
String
,
X509Certificate
>
certificates
=
identityStore
.
getAllCertificates
();
final
Map
<
String
,
X509Certificate
>
certificates
=
identityStore
.
getAllCertificates
();
...
@@ -72,8 +72,8 @@
...
@@ -72,8 +72,8 @@
identityStore
.
delete
(
alias
);
identityStore
.
delete
(
alias
);
// Log the event
// Log the event
webManager
.
logEvent
(
"deleted SSL cert from "
+
storePurposeText
+
" with alias "
+
alias
,
null
);
webManager
.
logEvent
(
"deleted SSL cert from "
+
connectionType
+
" with alias "
+
alias
,
null
);
response
.
sendRedirect
(
"security-keystore.jsp?
storeConnectionType="
+
storePurposeText
+
"&deletesuccess=true"
);
response
.
sendRedirect
(
"security-keystore.jsp?
connectionType="
+
connectionType
+
"&deletesuccess=true"
);
return
;
return
;
}
}
catch
(
Exception
e
)
catch
(
Exception
e
)
...
@@ -141,13 +141,13 @@
...
@@ -141,13 +141,13 @@
<html>
<html>
<head>
<head>
<title><fmt:message
key=
"ssl.certificates.keystore.title"
/></title>
<title><fmt:message
key=
"ssl.certificates.keystore.title"
/></title>
<meta
name=
"
pageID"
content=
"security-key
store"
/>
<meta
name=
"
subPageID"
content=
"sidebar-certificate-store-${fn:toLowerCase(connectionType)}-identity-
store"
/>
</head>
</head>
<body>
<body>
<c:if
test=
"
${
restartNeeded
}
"
>
<c:if
test=
"
${
restartNeeded
}
"
>
<admin:infobox
type=
"warning"
>
<admin:infobox
type=
"warning"
>
<fmt:message
key=
"ssl.certificates.keystore.restart_server"
>
<fmt:message
key=
"ssl.certificates.keystore.restart_server"
>
<fmt:param
value=
"<a href='server-restart.jsp?page=security-keystore.jsp&
storeConnectionType=${storeC
onnectionType}'>"
/>
<fmt:param
value=
"<a href='server-restart.jsp?page=security-keystore.jsp&
connectionType=${c
onnectionType}'>"
/>
<fmt:param
value=
"</a>"
/>
<fmt:param
value=
"</a>"
/>
</fmt:message>
</fmt:message>
</admin:infobox>
</admin:infobox>
...
@@ -175,9 +175,9 @@
...
@@ -175,9 +175,9 @@
<c:if
test=
"
${
not
validDSACert
or
not
validRSACert
}
"
>
<c:if
test=
"
${
not
validDSACert
or
not
validRSACert
}
"
>
<admin:infobox
type=
"warning"
>
<admin:infobox
type=
"warning"
>
<fmt:message
key=
"ssl.certificates.keystore.no_installed"
>
<fmt:message
key=
"ssl.certificates.keystore.no_installed"
>
<fmt:param
value=
"<a href='security-keystore.jsp?generate=true&
storeConnectionType=${storeC
onnectionType}'>"
/>
<fmt:param
value=
"<a href='security-keystore.jsp?generate=true&
connectionType=${c
onnectionType}'>"
/>
<fmt:param
value=
"</a>"
/>
<fmt:param
value=
"</a>"
/>
<fmt:param
value=
"<a href='import-keystore-certificate.jsp?
storeConnectionType=${storeC
onnectionType}'>"
/>
<fmt:param
value=
"<a href='import-keystore-certificate.jsp?
connectionType=${c
onnectionType}'>"
/>
<fmt:param
value=
"</a>"
/>
<fmt:param
value=
"</a>"
/>
</fmt:message>
</fmt:message>
</admin:infobox>
</admin:infobox>
...
@@ -200,7 +200,7 @@
...
@@ -200,7 +200,7 @@
<p>
<p>
<fmt:message
key=
"ssl.certificates.keystore.info"
>
<fmt:message
key=
"ssl.certificates.keystore.info"
>
<fmt:param
value=
"<a href='import-keystore-certificate.jsp?
storeConnectionType=${storeC
onnectionType}'>"
/>
<fmt:param
value=
"<a href='import-keystore-certificate.jsp?
connectionType=${c
onnectionType}'>"
/>
<fmt:param
value=
"</a>"
/>
<fmt:param
value=
"</a>"
/>
</fmt:message>
</fmt:message>
</p>
</p>
...
@@ -274,7 +274,7 @@
...
@@ -274,7 +274,7 @@
%>
%>
<tr
valign=
"top"
>
<tr
valign=
"top"
>
<td>
<td>
<a
href=
"security-certificate-details.jsp?
storeConnectionType=${storeC
onnectionType}&alias=${alias}"
title=
"
<fmt:message
key=
'session.row.cliked'
/>
"
>
<a
href=
"security-certificate-details.jsp?
connectionType=${c
onnectionType}&alias=${alias}"
title=
"
<fmt:message
key=
'session.row.cliked'
/>
"
>
<c:forEach
items=
"
${
identities
}
"
var=
"currentItem"
varStatus=
"stat"
>
<c:forEach
items=
"
${
identities
}
"
var=
"currentItem"
varStatus=
"stat"
>
<c:out
value=
"
${
stat
.
first
?
''
:
','
}
${currentItem}"
/>
<c:out
value=
"
${
stat
.
first
?
''
:
','
}
${currentItem}"
/>
</c:forEach>
</c:forEach>
...
@@ -326,7 +326,7 @@
...
@@ -326,7 +326,7 @@
<c:out
value=
"
${
certificate
.
publicKey
.
algorithm
}
"
/>
<c:out
value=
"
${
certificate
.
publicKey
.
algorithm
}
"
/>
</td>
</td>
<td
width=
"1"
align=
"center"
>
<td
width=
"1"
align=
"center"
>
<a
href=
"security-keystore.jsp?alias=${alias}&
storeConnectionType=${storeC
onnectionType}&delete=true"
<a
href=
"security-keystore.jsp?alias=${alias}&
connectionType=${c
onnectionType}&delete=true"
title=
"
<fmt:message
key=
"global.click_delete"
/>
"
title=
"
<fmt:message
key=
"global.click_delete"
/>
"
onclick=
"return confirm('
<fmt:message
key=
"ssl.certificates.confirm_delete"
/>
');"
onclick=
"return confirm('
<fmt:message
key=
"ssl.certificates.confirm_delete"
/>
');"
><img
src=
"images/delete-16x16.gif"
width=
"16"
height=
"16"
border=
"0"
alt=
""
></a>
><img
src=
"images/delete-16x16.gif"
width=
"16"
height=
"16"
border=
"0"
alt=
""
></a>
...
...
src/web/security-truststore.jsp
View file @
1f4d6288
<%@ page
errorPage=
"error.jsp"
%>
<%@ page
errorPage=
"error.jsp"
%>
<%@ page
import=
"org.jivesoftware.openfire.keystore.CertificateStoreManager"
%>
<%@ page
import=
"org.jivesoftware.openfire.keystore.TrustStore"
%>
<%@ page
import=
"org.jivesoftware.openfire.keystore.TrustStore"
%>
<%@ page
import=
"org.jivesoftware.openfire.spi.ConnectionType"
%>
<%@ page
import=
"org.jivesoftware.openfire.spi.ConnectionType"
%>
<%@ page
import=
"org.jivesoftware.util.ParamUtils"
%>
<%@ page
import=
"org.jivesoftware.util.ParamUtils"
%>
...
@@ -8,6 +7,7 @@
...
@@ -8,6 +7,7 @@
<%@ page
import=
"java.util.Map"
%>
<%@ page
import=
"java.util.Map"
%>
<%@ page
import=
"java.util.Set"
%>
<%@ page
import=
"java.util.Set"
%>
<%@ page
import=
"java.security.cert.X509Certificate"
%>
<%@ page
import=
"java.security.cert.X509Certificate"
%>
<%@ page
import=
"org.jivesoftware.openfire.XMPPServer"
%>
<%@ taglib
uri=
"admin"
prefix=
"admin"
%>
<%@ taglib
uri=
"admin"
prefix=
"admin"
%>
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%>
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%>
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/fmt"
prefix=
"fmt"
%>
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/fmt"
prefix=
"fmt"
%>
...
@@ -20,29 +20,29 @@
...
@@ -20,29 +20,29 @@
final
boolean
delete
=
ParamUtils
.
getBooleanParameter
(
request
,
"delete"
);
final
boolean
delete
=
ParamUtils
.
getBooleanParameter
(
request
,
"delete"
);
final
String
alias
=
ParamUtils
.
getParameter
(
request
,
"alias"
);
final
String
alias
=
ParamUtils
.
getParameter
(
request
,
"alias"
);
final
String
storePurposeText
=
ParamUtils
.
getParameter
(
request
,
"storeConnectionType"
);
final
String
connectionTypeText
=
ParamUtils
.
getParameter
(
request
,
"connectionType"
);
final
Map
<
String
,
String
>
errors
=
new
HashMap
<
>
();
final
Map
<
String
,
String
>
errors
=
new
HashMap
<
>
();
ConnectionType
storeC
onnectionType
=
null
;
ConnectionType
c
onnectionType
=
null
;
TrustStore
trustStore
=
null
;
TrustStore
trustStore
=
null
;
try
try
{
{
storeConnectionType
=
ConnectionType
.
valueOf
(
storePurpos
eText
);
connectionType
=
ConnectionType
.
valueOf
(
connectionTyp
eText
);
trustStore
=
CertificateStoreManager
.
getTrustStore
(
storeC
onnectionType
);
trustStore
=
XMPPServer
.
getInstance
().
getCertificateStoreManager
().
getTrustStore
(
c
onnectionType
);
if
(
trustStore
==
null
)
if
(
trustStore
==
null
)
{
{
errors
.
put
(
"trustStore"
,
"Unable to get an instance."
);
errors
.
put
(
"trustStore"
,
"Unable to get an instance."
);
}
}
}
}
catch
(
RuntimeException
ex
)
catch
(
RuntimeException
ex
)
{
{
errors
.
put
(
"
storeC
onnectionType"
,
ex
.
getMessage
()
);
errors
.
put
(
"
c
onnectionType"
,
ex
.
getMessage
()
);
}
}
if
(
errors
.
isEmpty
()
)
if
(
errors
.
isEmpty
()
)
{
{
pageContext
.
setAttribute
(
"
storeConnectionType"
,
storeC
onnectionType
);
pageContext
.
setAttribute
(
"
connectionType"
,
c
onnectionType
);
pageContext
.
setAttribute
(
"trustStore"
,
trustStore
);
pageContext
.
setAttribute
(
"trustStore"
,
trustStore
);
final
Set
<
ConnectionType
>
sameStoreConnectionTypes
=
Collections
.
EMPTY_SET
;
// TODO FIXME: SSLConfig.getInstance().getOtherPurposesForSameStore( storeConnectionType );
final
Set
<
ConnectionType
>
sameStoreConnectionTypes
=
Collections
.
EMPTY_SET
;
// TODO FIXME: SSLConfig.getInstance().getOtherPurposesForSameStore( storeConnectionType );
...
@@ -64,8 +64,8 @@
...
@@ -64,8 +64,8 @@
trustStore
.
delete
(
alias
);
trustStore
.
delete
(
alias
);
// Log the event
// Log the event
webManager
.
logEvent
(
"deleted SSL cert from "
+
storePurposeText
+
" with alias "
+
alias
,
null
);
webManager
.
logEvent
(
"deleted SSL cert from "
+
connectionType
+
" with alias "
+
alias
,
null
);
response
.
sendRedirect
(
"security-
truststore.jsp?storeConnectionType="
+
storePurposeText
+
"&deletesuccess=true"
);
response
.
sendRedirect
(
"security-
keystore.jsp?connectionType="
+
connectionType
+
"&deletesuccess=true"
);
return
;
return
;
}
}
catch
(
Exception
e
)
catch
(
Exception
e
)
...
@@ -81,7 +81,7 @@
...
@@ -81,7 +81,7 @@
<html>
<html>
<head>
<head>
<title><fmt:message
key=
"certificate-management.connectionType.${
storeC
onnectionType}.title"
/></title>
<title><fmt:message
key=
"certificate-management.connectionType.${
c
onnectionType}.title"
/></title>
<meta
name=
"pageID"
content=
"security-truststore"
/>
<meta
name=
"pageID"
content=
"security-truststore"
/>
<style>
<style>
.info-header
{
.info-header
{
...
@@ -133,9 +133,9 @@
...
@@ -133,9 +133,9 @@
<admin:infobox
type=
"success"
><fmt:message
key=
"ssl.certificates.added_updated"
/></admin:infobox>
<admin:infobox
type=
"success"
><fmt:message
key=
"ssl.certificates.added_updated"
/></admin:infobox>
</c:if>
</c:if>
<c:if
test=
"
${
storeC
onnectionType
!=
null
}
"
>
<c:if
test=
"
${
c
onnectionType
!=
null
}
"
>
<p>
<p>
<fmt:message
key=
"certificate-management.connectionType.${
storeC
onnectionType}.description"
/>
<fmt:message
key=
"certificate-management.connectionType.${
c
onnectionType}.description"
/>
</p>
</p>
<table
border=
"0"
width=
"100%"
>
<table
border=
"0"
width=
"100%"
>
...
@@ -177,7 +177,7 @@
...
@@ -177,7 +177,7 @@
<p>
<p>
<fmt:message
key=
"ssl.certificates.truststore.link-to-import"
>
<fmt:message
key=
"ssl.certificates.truststore.link-to-import"
>
<fmt:param
value=
"<a href='import-truststore-certificate.jsp?
storeConnectionType=${storeC
onnectionType}'>"
/>
<fmt:param
value=
"<a href='import-truststore-certificate.jsp?
connectionType=${c
onnectionType}'>"
/>
<fmt:param
value=
"</a>"
/>
<fmt:param
value=
"</a>"
/>
</fmt:message>
</fmt:message>
</p>
</p>
...
@@ -230,7 +230,7 @@
...
@@ -230,7 +230,7 @@
<tr
valign=
"top"
>
<tr
valign=
"top"
>
<td>
<td>
<a
href=
"security-certificate-details.jsp?
storeConnectionType=${storeC
onnectionType}&alias=${alias}"
title=
"
<fmt:message
key=
'session.row.cliked'
/>
"
>
<a
href=
"security-certificate-details.jsp?
connectionType=${c
onnectionType}&alias=${alias}"
title=
"
<fmt:message
key=
'session.row.cliked'
/>
"
>
<c:choose>
<c:choose>
<c:when
test=
"
${
empty
fn:
trim
(
organization
)
}
"
>
<c:when
test=
"
${
empty
fn:
trim
(
organization
)
}
"
>
<c:out
value=
"
${
commonname
}
"
/>
<c:out
value=
"
${
commonname
}
"
/>
...
@@ -264,7 +264,7 @@
...
@@ -264,7 +264,7 @@
<c:out
value=
"
${
certificate
.
publicKey
.
algorithm
}
"
/>
<c:out
value=
"
${
certificate
.
publicKey
.
algorithm
}
"
/>
</td>
</td>
<td
width=
"1"
align=
"center"
>
<td
width=
"1"
align=
"center"
>
<a
href=
"security-truststore.jsp?
storeConnectionType=${storeC
onnectionType}&alias=${alias}&delete=true"
<a
href=
"security-truststore.jsp?
connectionType=${c
onnectionType}&alias=${alias}&delete=true"
title=
"
<fmt:message
key=
"global.click_delete"
/>
"
title=
"
<fmt:message
key=
"global.click_delete"
/>
"
onclick=
"return confirm('
<fmt:message
key=
"ssl.certificates.confirm_delete"
/>
');"
onclick=
"return confirm('
<fmt:message
key=
"ssl.certificates.confirm_delete"
/>
');"
><img
src=
"images/delete-16x16.gif"
width=
"16"
height=
"16"
border=
"0"
alt=
""
></a>
><img
src=
"images/delete-16x16.gif"
width=
"16"
height=
"16"
border=
"0"
alt=
""
></a>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment