Search in sources :

Example 6 with Ssl

use of org.glassfish.grizzly.config.dom.Ssl in project Payara by payara.

the class DynamicConfigListener method changed.

@Override
public synchronized UnprocessedChangeEvents changed(final PropertyChangeEvent[] events) {
    return ConfigSupport.sortAndDispatch(events, new Changed() {

        @Override
        public <T extends ConfigBeanProxy> NotProcessed changed(TYPE type, Class<T> tClass, T t) {
            if (logger.isLoggable(Level.FINE)) {
                logger.log(Level.FINE, "NetworkConfig changed {0} {1} {2}", new Object[] { type, tClass, t });
            }
            if (tClass == NetworkListener.class && t instanceof NetworkListener) {
                return processNetworkListener(type, (NetworkListener) t, events);
            } else if (tClass == Http.class && t instanceof Http) {
                return processProtocol(type, (Protocol) t.getParent(), events);
            } else if (tClass == FileCache.class && t instanceof FileCache) {
                return processProtocol(type, (Protocol) t.getParent().getParent(), null);
            } else if (tClass == Ssl.class && t instanceof Ssl) {
                /*
                         * Make sure the SSL parent is in fact a protocol.  It could
                         * be a jmx-connector.
                     */
                final ConfigBeanProxy parent = t.getParent();
                if (parent instanceof Protocol) {
                    return processProtocol(type, (Protocol) parent, null);
                }
            } else if (tClass == Protocol.class && t instanceof Protocol) {
                return processProtocol(type, (Protocol) t, null);
            } else if (tClass == ThreadPool.class && t instanceof ThreadPool) {
                NotProcessed notProcessed = null;
                ThreadPool threadPool = (ThreadPool) t;
                for (NetworkListener listener : threadPool.findNetworkListeners()) {
                    notProcessed = processNetworkListener(type, listener, null);
                }
                // Throw an unprocessed event change if one hasn't already if HTTP or ThreadPool monitoring is enabled.
                MonitoringService ms = config.getMonitoringService();
                String threadPoolLevel = ms.getModuleMonitoringLevels().getThreadPool();
                String httpServiceLevel = ms.getModuleMonitoringLevels().getHttpService();
                if (((threadPoolLevel != null && !threadPoolLevel.equals(OFF)) || (httpServiceLevel != null && !httpServiceLevel.equals(OFF))) && notProcessed == null) {
                    notProcessed = new NotProcessed("Monitoring statistics will be incorrect for " + threadPool.getName() + " until restart due to changed attribute(s).");
                }
                return notProcessed;
            } else if (tClass == Transport.class && t instanceof Transport) {
                NotProcessed notProcessed = null;
                for (NetworkListener listener : ((Transport) t).findNetworkListeners()) {
                    notProcessed = processNetworkListener(type, listener, null);
                }
                return notProcessed;
            } else if (tClass == VirtualServer.class && t instanceof VirtualServer && !grizzlyService.hasMapperUpdateListener()) {
                return processVirtualServer(type, (VirtualServer) t);
            } else if (tClass == SystemProperty.class && t instanceof SystemProperty) {
                NetworkConfig networkConfig = config.getNetworkConfig();
                if ((networkConfig != null) && ((SystemProperty) t).getName().endsWith("LISTENER_PORT")) {
                    for (NetworkListener listener : networkConfig.getNetworkListeners().getNetworkListener()) {
                        if (listener.getPort().equals(((SystemProperty) t).getValue())) {
                            return processNetworkListener(Changed.TYPE.CHANGE, listener, events);
                        }
                    }
                }
                return null;
            }
            return null;
        }
    }, logger);
}
Also used : ThreadPool(org.glassfish.grizzly.config.dom.ThreadPool) NetworkConfig(org.glassfish.grizzly.config.dom.NetworkConfig) Http(org.glassfish.grizzly.config.dom.Http) Ssl(org.glassfish.grizzly.config.dom.Ssl) SystemProperty(com.sun.enterprise.config.serverbeans.SystemProperty) VirtualServer(com.sun.enterprise.config.serverbeans.VirtualServer) FileCache(org.glassfish.grizzly.config.dom.FileCache) ConfigBeanProxy(org.jvnet.hk2.config.ConfigBeanProxy) Changed(org.jvnet.hk2.config.Changed) NotProcessed(org.jvnet.hk2.config.NotProcessed) Protocol(org.glassfish.grizzly.config.dom.Protocol) Transport(org.glassfish.grizzly.config.dom.Transport) MonitoringService(com.sun.enterprise.config.serverbeans.MonitoringService) NetworkListener(org.glassfish.grizzly.config.dom.NetworkListener)

Example 7 with Ssl

use of org.glassfish.grizzly.config.dom.Ssl in project Payara by payara.

the class PEORBConfigurator method createORBListeners.

private void createORBListeners(IIOPUtils iiopUtils, IiopListener[] iiopListenerBeans, org.omg.CORBA.ORB orb) {
    if (iiopListenerBeans != null) {
        int lazyCount = 0;
        for (IiopListener ilb : iiopListenerBeans) {
            boolean securityEnabled = Boolean.valueOf(ilb.getSecurityEnabled());
            boolean isLazy = Boolean.valueOf(ilb.getLazyInit());
            if (isLazy) {
                lazyCount++;
            }
            if (lazyCount > 1) {
                throw new IllegalStateException("Invalid iiop-listener " + ilb.getId() + ". Only one iiop-listener can be configured " + "with lazy-init=true");
            }
            int port = Integer.parseInt(ilb.getPort());
            String host = handleAddrAny(ilb.getAddress());
            if (!securityEnabled || ilb.getSsl() == null) {
                Acceptor acceptor = addAcceptor(orb, isLazy, host, IIOP_CLEAR_TEXT_CONNECTION, port);
                if (isLazy) {
                    lazyAcceptor = acceptor;
                }
            } else {
                if (isLazy) {
                    throw new IllegalStateException("Invalid iiop-listener " + ilb.getId() + ". Lazy-init not supported for SSL iiop-listeners");
                }
                Ssl sslBean = ilb.getSsl();
                assert sslBean != null;
                boolean clientAuth = Boolean.valueOf(sslBean.getClientAuthEnabled());
                String type = clientAuth ? SSL_MUTUALAUTH : SSL;
                addAcceptor(orb, isLazy, host, type, port);
            }
        }
        if (lazyCount == 1) {
            getHelper().setSelectableChannelDelegate(new AcceptorDelegateImpl(lazyAcceptor));
        }
    }
}
Also used : IiopListener(org.glassfish.orb.admin.config.IiopListener) Acceptor(com.sun.corba.ee.spi.transport.Acceptor) Ssl(org.glassfish.grizzly.config.dom.Ssl) PluginPoint(org.glassfish.external.probe.provider.PluginPoint)

Example 8 with Ssl

use of org.glassfish.grizzly.config.dom.Ssl in project Payara by payara.

the class IiopServiceSslConfigHandler method create.

@Override
public void create(final CreateSsl command, ActionReport report) {
    IiopService iiopSvc = command.config.getExtensionByType(IiopService.class);
    if (iiopSvc.getSslClientConfig() != null) {
        report.setMessage(localStrings.getLocalString("create.ssl.iiopsvc.alreadyExists", "IIOP Service " + "already has been configured with SSL configuration."));
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        return;
    }
    try {
        ConfigSupport.apply(new SingleConfigCode<IiopService>() {

            public Object run(IiopService param) throws PropertyVetoException, TransactionFailure {
                SslClientConfig newSslClientCfg = param.createChild(SslClientConfig.class);
                Ssl newSsl = newSslClientCfg.createChild(Ssl.class);
                command.populateSslElement(newSsl);
                newSslClientCfg.setSsl(newSsl);
                param.setSslClientConfig(newSslClientCfg);
                return newSsl;
            }
        }, iiopSvc);
    } catch (TransactionFailure e) {
        command.reportError(report, e);
    }
    command.reportSuccess(report);
}
Also used : PropertyVetoException(java.beans.PropertyVetoException) TransactionFailure(org.jvnet.hk2.config.TransactionFailure) SslClientConfig(com.sun.enterprise.config.serverbeans.SslClientConfig) IiopService(org.glassfish.orb.admin.config.IiopService) CreateSsl(com.sun.enterprise.admin.commands.CreateSsl) DeleteSsl(com.sun.enterprise.admin.commands.DeleteSsl) Ssl(org.glassfish.grizzly.config.dom.Ssl)

Example 9 with Ssl

use of org.glassfish.grizzly.config.dom.Ssl in project Payara by payara.

the class IiopSslConfigHandler method create.

@Override
public void create(final CreateSsl command, ActionReport report) {
    IiopService iiopService = command.config.getExtensionByType(IiopService.class);
    // ensure we have the specified listener
    IiopListener iiopListener = null;
    for (IiopListener listener : iiopService.getIiopListener()) {
        if (listener.getId().equals(command.listenerId)) {
            iiopListener = listener;
        }
    }
    if (iiopListener == null) {
        report.setMessage(localStrings.getLocalString("create.ssl.iiop.notfound", "IIOP Listener named {0} to which this ssl element is " + "being added does not exist.", command.listenerId));
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        return;
    }
    if (iiopListener.getSsl() != null) {
        report.setMessage(localStrings.getLocalString("create.ssl.iiop.alreadyExists", "IIOP Listener named {0} to which this ssl element is " + "being added already has an ssl element.", command.listenerId));
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        return;
    }
    try {
        ConfigSupport.apply(new SingleConfigCode<IiopListener>() {

            public Object run(IiopListener param) throws PropertyVetoException, TransactionFailure {
                Ssl newSsl = param.createChild(Ssl.class);
                command.populateSslElement(newSsl);
                param.setSsl(newSsl);
                return newSsl;
            }
        }, iiopListener);
    } catch (TransactionFailure e) {
        command.reportError(report, e);
    }
    command.reportSuccess(report);
}
Also used : IiopListener(org.glassfish.orb.admin.config.IiopListener) PropertyVetoException(java.beans.PropertyVetoException) TransactionFailure(org.jvnet.hk2.config.TransactionFailure) IiopService(org.glassfish.orb.admin.config.IiopService) CreateSsl(com.sun.enterprise.admin.commands.CreateSsl) DeleteSsl(com.sun.enterprise.admin.commands.DeleteSsl) Ssl(org.glassfish.grizzly.config.dom.Ssl)

Example 10 with Ssl

use of org.glassfish.grizzly.config.dom.Ssl in project Payara by payara.

the class SecureAdminConfigUpgrade method isOriginalAdminSecured.

private boolean isOriginalAdminSecured() {
    /*
         * The Grizzly conversion has already occurred.  So look for
         * 
         * <server-config>
         *   <network-config>
         *     <protocols>
         *       <protocol name="admin-listener">
         *         <ssl ...>
         *
         */
    final Config serverConfig;
    final NetworkConfig nc;
    final Protocol p;
    final Ssl ssl;
    if ((serverConfig = configs.getConfigByName(SecureAdminUpgradeHelper.DAS_CONFIG_NAME)) == null) {
        return false;
    }
    if ((nc = serverConfig.getNetworkConfig()) == null) {
        return false;
    }
    if ((p = nc.findProtocol(ADMIN_LISTENER_NAME)) == null) {
        return false;
    }
    if ((ssl = p.getSsl()) == null) {
        return false;
    }
    return true;
}
Also used : Config(com.sun.enterprise.config.serverbeans.Config) NetworkConfig(org.glassfish.grizzly.config.dom.NetworkConfig) NetworkConfig(org.glassfish.grizzly.config.dom.NetworkConfig) Protocol(org.glassfish.grizzly.config.dom.Protocol) Ssl(org.glassfish.grizzly.config.dom.Ssl)

Aggregations

Ssl (org.glassfish.grizzly.config.dom.Ssl)11 Protocol (org.glassfish.grizzly.config.dom.Protocol)5 TransactionFailure (org.jvnet.hk2.config.TransactionFailure)5 PropertyVetoException (java.beans.PropertyVetoException)4 NetworkListener (org.glassfish.grizzly.config.dom.NetworkListener)4 CreateSsl (com.sun.enterprise.admin.commands.CreateSsl)3 DeleteSsl (com.sun.enterprise.admin.commands.DeleteSsl)3 NetworkConfig (org.glassfish.grizzly.config.dom.NetworkConfig)3 IiopListener (org.glassfish.orb.admin.config.IiopListener)3 Http (org.glassfish.grizzly.config.dom.Http)2 ThreadPool (org.glassfish.grizzly.config.dom.ThreadPool)2 Transport (org.glassfish.grizzly.config.dom.Transport)2 IiopService (org.glassfish.orb.admin.config.IiopService)2 Acceptor (com.sun.corba.ee.spi.transport.Acceptor)1 AdminService (com.sun.enterprise.config.serverbeans.AdminService)1 Config (com.sun.enterprise.config.serverbeans.Config)1 JmxConnector (com.sun.enterprise.config.serverbeans.JmxConnector)1 MonitoringService (com.sun.enterprise.config.serverbeans.MonitoringService)1 SslClientConfig (com.sun.enterprise.config.serverbeans.SslClientConfig)1 SystemProperty (com.sun.enterprise.config.serverbeans.SystemProperty)1