Skip to content

Commit

Permalink
WFLY-5748 IIOP: refuse to start subsystem if IOR settings imply ssl, …
Browse files Browse the repository at this point in the history
…but it is not configured in ssl tag
  • Loading branch information
tadamski committed Nov 30, 2015
1 parent 1ed22f0 commit b26b9a5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
Expand Up @@ -154,7 +154,7 @@ public void execute(DeploymentProcessorTarget processorTarget) {
this.setupInitializers(props); this.setupInitializers(props);


// setup the SSL socket factories, if necessary. // setup the SSL socket factories, if necessary.
this.setupSSLFactories(props); final boolean sslConfigured = this.setupSSLFactories(props);


// create the service that initializes and starts the CORBA ORB. // create the service that initializes and starts the CORBA ORB.


Expand All @@ -178,7 +178,7 @@ public void execute(DeploymentProcessorTarget processorTarget) {


// create the IOR security config metadata service. // create the IOR security config metadata service.
final IORSecurityConfigMetaData securityConfigMetaData = this.createIORSecurityConfigMetaData(context, final IORSecurityConfigMetaData securityConfigMetaData = this.createIORSecurityConfigMetaData(context,
model); model, sslConfigured);
final IORSecConfigMetaDataService securityConfigMetaDataService = new IORSecConfigMetaDataService(securityConfigMetaData); final IORSecConfigMetaDataService securityConfigMetaDataService = new IORSecConfigMetaDataService(securityConfigMetaData);
context.getServiceTarget() context.getServiceTarget()
.addService(IORSecConfigMetaDataService.SERVICE_NAME, securityConfigMetaDataService) .addService(IORSecConfigMetaDataService.SERVICE_NAME, securityConfigMetaDataService)
Expand Down Expand Up @@ -320,10 +320,11 @@ private void setupInitializers(Properties props) {
* </p> * </p>
* *
* @param props the subsystem configuration properties. * @param props the subsystem configuration properties.
* @return true if ssl has been configured
* @throws OperationFailedException if the SSL setup has not been done correctly (SSL support has been turned on but no * @throws OperationFailedException if the SSL setup has not been done correctly (SSL support has been turned on but no
* security domain has been specified). * security domain has been specified).
*/ */
private void setupSSLFactories(final Properties props) throws OperationFailedException { private boolean setupSSLFactories(final Properties props) throws OperationFailedException {
boolean supportSSL = "true".equalsIgnoreCase(props.getProperty(Constants.SECURITY_SUPPORT_SSL)); boolean supportSSL = "true".equalsIgnoreCase(props.getProperty(Constants.SECURITY_SUPPORT_SSL));


if (supportSSL) { if (supportSSL) {
Expand All @@ -335,10 +336,14 @@ private void setupSSLFactories(final Properties props) throws OperationFailedExc
// add the domain socket factories. // add the domain socket factories.
SocketFactory.setSecurityDomain(securityDomain); SocketFactory.setSecurityDomain(securityDomain);
props.setProperty(ORBConstants.SOCKET_FACTORY_CLASS_PROPERTY, SocketFactory.class.getName()); props.setProperty(ORBConstants.SOCKET_FACTORY_CLASS_PROPERTY, SocketFactory.class.getName());

return true;
} }

return false;
} }


private IORSecurityConfigMetaData createIORSecurityConfigMetaData(final OperationContext context, final ModelNode resourceModel) private IORSecurityConfigMetaData createIORSecurityConfigMetaData(final OperationContext context, final ModelNode resourceModel, final boolean sslConfigured)
throws OperationFailedException { throws OperationFailedException {
final IORSecurityConfigMetaData securityConfigMetaData = new IORSecurityConfigMetaData(); final IORSecurityConfigMetaData securityConfigMetaData = new IORSecurityConfigMetaData();


Expand All @@ -363,6 +368,14 @@ private IORSecurityConfigMetaData createIORSecurityConfigMetaData(final Operatio
transportConfigMetaData.setDetectReplay(IIOPRootDefinition.DETECT_REPLAY.resolveModelAttribute(context, resourceModel).asString()); transportConfigMetaData.setDetectReplay(IIOPRootDefinition.DETECT_REPLAY.resolveModelAttribute(context, resourceModel).asString());
securityConfigMetaData.setTransportConfig(transportConfigMetaData); securityConfigMetaData.setTransportConfig(transportConfigMetaData);


final boolean sslRequired = IORTransportConfigMetaData.INTEGRITY_REQUIRED.equals(transportConfigMetaData.getIntegrity())
|| IORTransportConfigMetaData.CONFIDENTIALITY_REQUIRED.equals(transportConfigMetaData.getConfidentiality())
|| IORTransportConfigMetaData.ESTABLISH_TRUST_IN_CLIENT_REQUIRED.equals(transportConfigMetaData.getEstablishTrustInClient());

if (sslRequired && !sslConfigured) {
throw IIOPLogger.ROOT_LOGGER.sslNotConfigured();
}

return securityConfigMetaData; return securityConfigMetaData;
} }


Expand Down
Expand Up @@ -379,4 +379,7 @@ public interface IIOPLogger extends BasicLogger {


@Message(id = 102, value = "Caught exception destroying Iterator %s") @Message(id = 102, value = "Caught exception destroying Iterator %s")
INTERNAL exceptionDestroingIterator(String cause); INTERNAL exceptionDestroingIterator(String cause);

@Message(id = 103, value = "IOR settings imply ssl connections usage, but secure connections have not been configured")
OperationFailedException sslNotConfigured();
} }

0 comments on commit b26b9a5

Please sign in to comment.