From d4ec640ac806729c859670b345708b1891c3d37b Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Fri, 14 Oct 2016 11:52:48 +0200 Subject: [PATCH] Renamed many classes and feature to use "secure" term instead of "ssl". (note, the .ecf are still using the "ssl" terminologie). Provided easy way to set secure settings for Standalone. For wsf launcher boolean option accept "true" or "yes" for True boolean, anything else is False. --- examples/debug/debug.ecf | 8 +- examples/debug/debug.ini | 2 + examples/simple/simple.ecf | 13 +- examples/simple/simple.ini | 5 +- examples/simple_ssl/{simple.crt => ca.crt} | 0 examples/simple_ssl/{simple.key => ca.key} | 0 examples/simple_ssl/simple.ini | 8 +- examples/websocket/application.e | 18 +-- examples/websocket/application_execution.e | 11 +- examples/websocket/ca.crt | 15 +++ examples/websocket/ca.key | 15 +++ examples/websocket/websocket_app.ecf | 3 + examples/websocket/ws.ini | 4 + .../src/spec/net/net_http_client_request.e | 6 +- .../http_network/http_network-safe.ecf | 3 +- library/network/http_network/http_network.ecf | 7 ++ .../http_network/src/http_stream_socket.e | 6 +- .../src/no_ssl/http_secure_helper.e | 18 +++ ...l_socket.e => http_stream_secure_socket.e} | 36 +++++- .../http_network/src/ssl/http_secure_helper.e | 18 +++ ...l_socket.e => http_stream_secure_socket.e} | 38 +++--- ..._ext.e => http_stream_secure_socket_ext.e} | 2 +- ..._ext.e => http_stream_secure_socket_ext.e} | 2 +- .../example/ws_client/ws_client-safe.ecf | 2 +- .../client/src/no_ssl/web_socket_client.e | 6 +- .../client/src/ssl/web_socket_client.e | 32 ++--- .../network/websocket/client/src/web_socket.e | 3 +- .../client/src/web_socket_client_i.e | 31 +++-- .../websocket/client/src/web_socket_impl.e | 10 +- .../websocket/client/web_socket_client.ecf | 35 ++---- .../echo_websocket_server/application.e | 4 +- .../example/echo_websocket_server/ca.crt | 15 +++ .../example/echo_websocket_server/ca.key | 15 +++ .../echo_websocket_server-safe.ecf | 10 +- .../configuration/httpd_configuration_i.e | 102 ++++++++-------- .../httpd/configuration/httpd_constants.e | 3 + library/server/httpd/httpd-safe.ecf | 3 + .../server/httpd/httpd_request_handler_i.e | 2 +- library/server/httpd/httpd_server_i.e | 2 +- .../httpd/network/httpd_socket_factory.e | 2 +- ..._socket.e => httpd_stream_secure_socket.e} | 6 +- .../server/httpd/no_ssl/httpd_configuration.e | 22 ++-- .../server/httpd/ssl/httpd_configuration.e | 38 +++--- library/server/httpd/ssl/httpd_server.e | 22 ++-- .../wsf_standalone_service_launcher.e | 58 +++++---- .../wsf_standalone_service_options.e | 114 +++++++++++------- .../service/wsf_service_launcher_options.e | 6 + 47 files changed, 483 insertions(+), 298 deletions(-) create mode 100644 examples/debug/debug.ini rename examples/simple_ssl/{simple.crt => ca.crt} (100%) rename examples/simple_ssl/{simple.key => ca.key} (100%) create mode 100644 examples/websocket/ca.crt create mode 100644 examples/websocket/ca.key create mode 100644 library/network/http_network/src/no_ssl/http_secure_helper.e rename library/network/http_network/src/no_ssl/{http_stream_ssl_socket.e => http_stream_secure_socket.e} (52%) create mode 100644 library/network/http_network/src/ssl/http_secure_helper.e rename library/network/http_network/src/ssl/{http_stream_ssl_socket.e => http_stream_secure_socket.e} (85%) rename library/network/http_network/src/ssl/{http_stream_ssl_socket_ext.e => http_stream_secure_socket_ext.e} (93%) rename library/network/http_network/src/until_16_05/ssl/{http_stream_ssl_socket_ext.e => http_stream_secure_socket_ext.e} (96%) create mode 100644 library/network/websocket/server/example/echo_websocket_server/ca.crt create mode 100644 library/network/websocket/server/example/echo_websocket_server/ca.key rename library/server/httpd/network/{httpd_stream_ssl_socket.e => httpd_stream_secure_socket.e} (92%) diff --git a/examples/debug/debug.ecf b/examples/debug/debug.ecf index 2d625508..b7e9eb0f 100644 --- a/examples/debug/debug.ecf +++ b/examples/debug/debug.ecf @@ -1,5 +1,5 @@ - + /EIFGENs$ @@ -18,7 +18,7 @@ - + @@ -27,7 +27,7 @@ - + @@ -44,6 +44,4 @@ - - diff --git a/examples/debug/debug.ini b/examples/debug/debug.ini new file mode 100644 index 00000000..abab4e03 --- /dev/null +++ b/examples/debug/debug.ini @@ -0,0 +1,2 @@ +port=9090 +verbose=true diff --git a/examples/simple/simple.ecf b/examples/simple/simple.ecf index dcdf618a..4aaeac1f 100644 --- a/examples/simple/simple.ecf +++ b/examples/simple/simple.ecf @@ -1,5 +1,5 @@ - + /.svn$ @@ -16,13 +16,20 @@ - + + + + + + - - diff --git a/examples/simple/simple.ini b/examples/simple/simple.ini index ae90215c..33266fcd 100644 --- a/examples/simple/simple.ini +++ b/examples/simple/simple.ini @@ -2,7 +2,8 @@ verbose=true verbose_level=ALERT port=9090 #max_concurrent_connections=100 -#keep_alive_timeout=15 +keep_alive_timeout=3 #max_tcp_clients=100 -#socket_timeout=300 +socket_timeout=60 +socket_recv_timeout=15 #max_keep_alive_requests=300 diff --git a/examples/simple_ssl/simple.crt b/examples/simple_ssl/ca.crt similarity index 100% rename from examples/simple_ssl/simple.crt rename to examples/simple_ssl/ca.crt diff --git a/examples/simple_ssl/simple.key b/examples/simple_ssl/ca.key similarity index 100% rename from examples/simple_ssl/simple.key rename to examples/simple_ssl/ca.key diff --git a/examples/simple_ssl/simple.ini b/examples/simple_ssl/simple.ini index 2ec39e14..5f3fda5c 100644 --- a/examples/simple_ssl/simple.ini +++ b/examples/simple_ssl/simple.ini @@ -17,11 +17,11 @@ port=9090 #keep_alive_timeout=15 #max_keep_alive_requests=100 -### SSL settings +### Secure connection settings # enable SSL, with file certificate. -ssl_enabled=true -ssl_ca_key=simple.key -ssl_ca_crt=simple.crt +is_secure=true +secure_certificate=ca.crt +secure_certificate_key=ca.key ### App settings verbose=true diff --git a/examples/websocket/application.e b/examples/websocket/application.e index 72f4f627..31f6c841 100644 --- a/examples/websocket/application.e +++ b/examples/websocket/application.e @@ -14,16 +14,18 @@ feature {NONE} -- Initialization make_and_launch local l_launcher: WSF_STANDALONE_WEBSOCKET_SERVICE_LAUNCHER [APPLICATION_EXECUTION] - opts: WSF_SERVICE_LAUNCHER_OPTIONS + opts: WSF_STANDALONE_WEBSOCKET_SERVICE_OPTIONS do - create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI} opts.make_from_file ("ws.ini") - create l_launcher.make_and_launch (options) - end + create opts + if opts.is_secure_connection_supported then + opts.is_secure := True + opts.set_secure_protocol_to_tls_1_2 + opts.secure_certificate := "ca.crt" + opts.secure_certificate_key := "ca.key" + end - options: WSF_SERVICE_LAUNCHER_OPTIONS - -- Initialize current service. - do - create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI} Result.make_from_file ("ws.ini") + opts.import_ini_file_options ("ws.ini") + create l_launcher.make_and_launch (opts) end end diff --git a/examples/websocket/application_execution.e b/examples/websocket/application_execution.e index 92f82bec..fc920446 100644 --- a/examples/websocket/application_execution.e +++ b/examples/websocket/application_execution.e @@ -88,7 +88,7 @@ feature -- HTML Resource - +