[英]Is there a way to specify port range for SSLSocketFactory and SSLServerSocketFactory
I am configuring jacorb to use with SSL. 我正在配置jacorb以使用SSL。 The server/client ports picked are random. 选择的服务器/客户端端口是随机的。 I need to specify a range of ports much like PortRangeSocketFactory/PortRangeServerSocketFactory in case of non-SSL configuration. 在非SSL配置的情况下,我需要指定一系列端口,就像PortRangeSocketFactory / PortRangeServerSocketFactory一样。
I am trying to avoid OASSLPort property, as the port becomes fixed (instead of range) and applicable for only server/listening ports. 我试图避免OASSLPort属性,因为端口变得固定(而不是范围)并且仅适用于服务器/侦听端口。 Client ports will still be random. 客户端端口仍然是随机的。
I have a set of processes, some acting as both server and client- with jacorb.properties shared. 我有一组进程,一些充当服务器和客户端 - jacorb.properties共享。
Current jacorb.properties configuration: 当前的jacorb.properties配置:
jacorb.ssl.socket_factory=org.jacorb.security.ssl.sun_jsse.SSLSocketFactory
jacorb.ssl.server_socket_factory=org.jacorb.security.ssl.sun_jsse.SSLServerSocketFactory
I am using Jacorb 3.9, RHEL 7.3 and Java 1.8.0_171. 我使用的是Jacorb 3.9,RHEL 7.3和Java 1.8.0_171。
Achieved this by writing custom factories: 通过编写自定义工厂实现这一目标:
configure() overridden to also read the min/max port config from jacorb.properties . configure()重写以从jacorb.properties读取最小/最大端口配置。
createServerSocket() overridden to handle port selection. 重写createServerSocket()以处理端口选择。 Logic imported from org.jacorb.orb.factory.PortRangeServerSocketFactory . 从org.jacorb.orb.factory.PortRangeServerSocketFactory导入的逻辑。
Handled multi-homed cases for both via the OAIAddr property. 通过OAIAddr属性处理多宿主案例。
Pros: Lot of customization possible. 优点:可以进行大量定制。 Cons: Minimal code usage as many attributes and methods whose logic was implemented were private. 缺点:最少的代码使用,因为许多属性和方法的逻辑是私有的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.