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.
This commit is contained in:
@@ -23,8 +23,8 @@ feature {NONE} -- Initialization
|
||||
keep_alive_timeout := default_keep_alive_timeout
|
||||
max_keep_alive_requests := default_max_keep_alive_requests
|
||||
is_secure := False
|
||||
create ca_crt.make_empty
|
||||
create ca_key.make_empty
|
||||
create secure_certificate.make_empty
|
||||
create secure_certificate_key.make_empty
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
@@ -75,8 +75,8 @@ feature -- Access
|
||||
-- To disable KeepAlive, set `max_keep_alive_requests' to 0.
|
||||
-- By default: 100 .
|
||||
|
||||
has_ssl_support: BOOLEAN
|
||||
-- Has SSL support?
|
||||
has_secure_support: BOOLEAN
|
||||
-- Has SSL/TLS secure support?
|
||||
deferred
|
||||
end
|
||||
|
||||
@@ -96,30 +96,30 @@ feature -- Access: SSL
|
||||
is_secure: BOOLEAN
|
||||
-- Is SSL/TLS session?.
|
||||
|
||||
ca_crt: detachable IMMUTABLE_STRING_32
|
||||
secure_certificate: detachable IMMUTABLE_STRING_32
|
||||
-- the signed certificate.
|
||||
|
||||
ca_key: detachable IMMUTABLE_STRING_32
|
||||
-- private key to the certificate.
|
||||
secure_certificate_key: detachable IMMUTABLE_STRING_32
|
||||
-- private key to the certificate authority.
|
||||
|
||||
ssl_protocol: NATURAL
|
||||
secure_protocol: NATURAL
|
||||
-- By default protocol is tls 1.2.
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_ssl_settings (v: detachable separate TUPLE [protocol: separate READABLE_STRING_GENERAL; ca_crt, ca_key: detachable separate READABLE_STRING_GENERAL])
|
||||
set_secure_settings (v: detachable separate TUPLE [protocol: separate READABLE_STRING_GENERAL; ca_crt, ca_key: detachable separate READABLE_STRING_GENERAL])
|
||||
local
|
||||
prot: STRING_32
|
||||
do
|
||||
is_secure := False
|
||||
ca_crt := Void
|
||||
ca_key := Void
|
||||
secure_certificate := Void
|
||||
secure_certificate_key := Void
|
||||
if v /= Void then
|
||||
is_secure := True
|
||||
create prot.make_from_separate (v.protocol)
|
||||
set_ssl_protocol_from_string (prot)
|
||||
set_ca_crt (v.ca_crt)
|
||||
set_ca_key (v.ca_key)
|
||||
set_secure_protocol_from_string (prot)
|
||||
set_secure_certificate (v.ca_crt)
|
||||
set_secure_certificate_key (v.ca_key)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -229,7 +229,7 @@ feature -- Element change
|
||||
set_is_secure (b: BOOLEAN)
|
||||
-- Set `is_secure' to `b'.
|
||||
do
|
||||
if b and has_ssl_support then
|
||||
if b and has_secure_support then
|
||||
is_secure := True
|
||||
if
|
||||
http_server_port = 80
|
||||
@@ -245,8 +245,8 @@ feature -- Element change
|
||||
end
|
||||
end
|
||||
ensure
|
||||
is_secure_set: has_ssl_support implies is_secure
|
||||
is_not_secure: not has_ssl_support implies not is_secure
|
||||
is_secure_set: has_secure_support implies is_secure
|
||||
is_not_secure: not has_secure_support implies not is_secure
|
||||
end
|
||||
|
||||
mark_secure
|
||||
@@ -254,84 +254,84 @@ feature -- Element change
|
||||
do
|
||||
set_is_secure (True)
|
||||
ensure
|
||||
is_secure_set: has_ssl_support implies is_secure
|
||||
-- http_server_port_set: has_ssl_support implies http_server_port = 443
|
||||
is_not_secure: not has_ssl_support implies not is_secure
|
||||
-- default_port: not has_ssl_support implies http_server_port = 80
|
||||
is_secure_set: has_secure_support implies is_secure
|
||||
-- http_server_port_set: has_secure_support implies http_server_port = 443
|
||||
is_not_secure: not has_secure_support implies not is_secure
|
||||
-- default_port: not has_secure_support implies http_server_port = 80
|
||||
end
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_ca_crt (a_value: detachable separate READABLE_STRING_GENERAL)
|
||||
-- Set `ca_crt' from `a_value'.
|
||||
set_secure_certificate (a_value: detachable separate READABLE_STRING_GENERAL)
|
||||
-- Set `secure_certificate' from `a_value'.
|
||||
do
|
||||
if a_value /= Void then
|
||||
create ca_crt.make_from_separate (a_value)
|
||||
create secure_certificate.make_from_separate (a_value)
|
||||
else
|
||||
ca_crt := Void
|
||||
secure_certificate := Void
|
||||
end
|
||||
end
|
||||
|
||||
set_ca_key (a_value: detachable separate READABLE_STRING_GENERAL)
|
||||
-- Set `ca_key' with `a_value'.
|
||||
set_secure_certificate_key (a_value: detachable separate READABLE_STRING_GENERAL)
|
||||
-- Set `secure_certificate_key' with `a_value'.
|
||||
do
|
||||
if a_value /= Void then
|
||||
create ca_key.make_from_separate (a_value)
|
||||
create secure_certificate_key.make_from_separate (a_value)
|
||||
else
|
||||
ca_key := Void
|
||||
secure_certificate_key := Void
|
||||
end
|
||||
end
|
||||
|
||||
set_ssl_protocol (a_version: NATURAL)
|
||||
-- Set `ssl_protocol' with `a_version'
|
||||
set_secure_protocol (a_version: NATURAL)
|
||||
-- Set `secure_protocol' with `a_version'
|
||||
do
|
||||
ssl_protocol := a_version
|
||||
secure_protocol := a_version
|
||||
ensure
|
||||
ssl_protocol_set: ssl_protocol = a_version
|
||||
secure_protocol_set: secure_protocol = a_version
|
||||
end
|
||||
|
||||
set_ssl_protocol_from_string (a_ssl_version: READABLE_STRING_GENERAL)
|
||||
-- Set `ssl_protocol' with `a_ssl_version'
|
||||
set_secure_protocol_from_string (a_ssl_version: READABLE_STRING_GENERAL)
|
||||
-- Set `secure_protocol' with `a_ssl_version'
|
||||
do
|
||||
if a_ssl_version.is_case_insensitive_equal ("ssl_2_3") then
|
||||
set_ssl_protocol_to_ssl_2_or_3
|
||||
set_secure_protocol_to_ssl_2_or_3
|
||||
elseif a_ssl_version.is_case_insensitive_equal ("tls_1_0") then
|
||||
set_ssl_protocol_to_tls_1_0
|
||||
set_secure_protocol_to_tls_1_0
|
||||
elseif a_ssl_version.is_case_insensitive_equal ("tls_1_1") then
|
||||
set_ssl_protocol_to_tls_1_1
|
||||
set_secure_protocol_to_tls_1_1
|
||||
elseif a_ssl_version.is_case_insensitive_equal ("tls_1_2") then
|
||||
set_ssl_protocol_to_tls_1_2
|
||||
set_secure_protocol_to_tls_1_2
|
||||
elseif a_ssl_version.is_case_insensitive_equal ("dtls_1_0") then
|
||||
set_ssl_protocol_to_dtls_1_0
|
||||
set_secure_protocol_to_dtls_1_0
|
||||
else -- Default
|
||||
set_ssl_protocol_to_tls_1_2
|
||||
set_secure_protocol_to_tls_1_2
|
||||
end
|
||||
end
|
||||
|
||||
feature -- SSL Helpers
|
||||
|
||||
set_ssl_protocol_to_ssl_2_or_3
|
||||
-- Set `ssl_protocol' with `Ssl_23'.
|
||||
set_secure_protocol_to_ssl_2_or_3
|
||||
-- Set `secure_protocol' with `Ssl_23'.
|
||||
deferred
|
||||
end
|
||||
|
||||
set_ssl_protocol_to_tls_1_0
|
||||
-- Set `ssl_protocol' with `Tls_1_0'.
|
||||
set_secure_protocol_to_tls_1_0
|
||||
-- Set `secure_protocol' with `Tls_1_0'.
|
||||
deferred
|
||||
end
|
||||
|
||||
set_ssl_protocol_to_tls_1_1
|
||||
-- Set `ssl_protocol' with `Tls_1_1'.
|
||||
set_secure_protocol_to_tls_1_1
|
||||
-- Set `secure_protocol' with `Tls_1_1'.
|
||||
deferred
|
||||
end
|
||||
|
||||
set_ssl_protocol_to_tls_1_2
|
||||
-- Set `ssl_protocol' with `Tls_1_2'.
|
||||
set_secure_protocol_to_tls_1_2
|
||||
-- Set `secure_protocol' with `Tls_1_2'.
|
||||
deferred
|
||||
end
|
||||
|
||||
set_ssl_protocol_to_dtls_1_0
|
||||
-- Set `ssl_protocol' with `Dtls_1_0'.
|
||||
set_secure_protocol_to_dtls_1_0
|
||||
-- Set `secure_protocol' with `Dtls_1_0'.
|
||||
deferred
|
||||
end
|
||||
|
||||
|
||||
@@ -9,6 +9,9 @@ note
|
||||
deferred class
|
||||
HTTPD_CONSTANTS
|
||||
|
||||
inherit
|
||||
HTTP_SECURE_HELPER
|
||||
|
||||
feature -- Default connection settings
|
||||
|
||||
default_http_server_port: INTEGER = 80
|
||||
|
||||
@@ -65,4 +65,7 @@
|
||||
</cluster>
|
||||
</cluster>
|
||||
</target>
|
||||
<target name="httpd_ssl" extends="httpd">
|
||||
<variable name="ssl_enabled" value="true" />
|
||||
</target>
|
||||
</system>
|
||||
|
||||
@@ -525,7 +525,7 @@ feature -- Parsing
|
||||
if a_socket.was_error then
|
||||
report_error ("Socket error")
|
||||
if is_verbose then
|
||||
log (request_header +"%N" + Result + "%N## was_error=False! ##", debug_level)
|
||||
log (request_header +"%N" + Result + "%N## Network error: " + a_socket.error + " ##", debug_level)
|
||||
end
|
||||
end
|
||||
else
|
||||
|
||||
@@ -113,7 +113,7 @@ feature -- Execution
|
||||
log (" - socket_recv_timeout = " + configuration.socket_recv_timeout.out + " seconds")
|
||||
log (" - keep_alive_timeout = " + configuration.keep_alive_timeout.out + " seconds")
|
||||
log (" - max_keep_alive_requests = " + configuration.max_keep_alive_requests.out)
|
||||
if configuration.has_ssl_support then
|
||||
if configuration.has_secure_support then
|
||||
if configuration.is_secure then
|
||||
log (" - SSL = enabled")
|
||||
else
|
||||
|
||||
@@ -11,7 +11,7 @@ feature -- Access
|
||||
new_client_socket (a_is_secure: BOOLEAN): HTTPD_STREAM_SOCKET
|
||||
do
|
||||
if a_is_secure then
|
||||
create {HTTPD_STREAM_SSL_SOCKET} Result.make_empty
|
||||
create {HTTPD_STREAM_SECURE_SOCKET} Result.make_empty
|
||||
else
|
||||
create Result.make_empty
|
||||
end
|
||||
|
||||
@@ -6,10 +6,10 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
HTTPD_STREAM_SSL_SOCKET
|
||||
HTTPD_STREAM_SECURE_SOCKET
|
||||
|
||||
inherit
|
||||
HTTP_STREAM_SSL_SOCKET
|
||||
HTTP_STREAM_SECURE_SOCKET
|
||||
|
||||
HTTPD_STREAM_SOCKET
|
||||
undefine
|
||||
@@ -27,7 +27,7 @@ inherit
|
||||
read_stream_noexception,
|
||||
read_into_pointer_noexception,
|
||||
put_pointer_content_noexception,
|
||||
is_ssl_supported
|
||||
is_secure_connection_supported
|
||||
end
|
||||
|
||||
create
|
||||
@@ -16,38 +16,38 @@ feature -- Status
|
||||
|
||||
Server_details: STRING_8 = "Server: Standalone Eiffel Server"
|
||||
|
||||
has_ssl_support: BOOLEAN = False
|
||||
has_secure_support: BOOLEAN = False
|
||||
-- Precursor
|
||||
|
||||
feature -- SSL Helpers
|
||||
|
||||
set_ssl_protocol_to_ssl_2_or_3
|
||||
-- Set `ssl_protocol' with `Ssl_23'.
|
||||
set_secure_protocol_to_ssl_2_or_3
|
||||
-- Set `secure_protocol' with `Ssl_23'.
|
||||
do
|
||||
-- Ignored
|
||||
end
|
||||
|
||||
|
||||
set_ssl_protocol_to_tls_1_0
|
||||
-- Set `ssl_protocol' with `Tls_1_0'.
|
||||
set_secure_protocol_to_tls_1_0
|
||||
-- Set `secure_protocol' with `Tls_1_0'.
|
||||
do
|
||||
-- Ignored
|
||||
end
|
||||
|
||||
set_ssl_protocol_to_tls_1_1
|
||||
-- Set `ssl_protocol' with `Tls_1_1'.
|
||||
set_secure_protocol_to_tls_1_1
|
||||
-- Set `secure_protocol' with `Tls_1_1'.
|
||||
do
|
||||
-- Ignored
|
||||
end
|
||||
|
||||
set_ssl_protocol_to_tls_1_2
|
||||
-- Set `ssl_protocol' with `Tls_1_2'.
|
||||
set_secure_protocol_to_tls_1_2
|
||||
-- Set `secure_protocol' with `Tls_1_2'.
|
||||
do
|
||||
-- Ignored
|
||||
end
|
||||
|
||||
set_ssl_protocol_to_dtls_1_0
|
||||
-- Set `ssl_protocol' with `Dtls_1_0'.
|
||||
set_secure_protocol_to_dtls_1_0
|
||||
-- Set `secure_protocol' with `Dtls_1_0'.
|
||||
do
|
||||
-- Ignored
|
||||
end
|
||||
|
||||
@@ -21,48 +21,48 @@ feature {NONE} -- Initialization
|
||||
-- Create a new instance and set ssl protocol to tls_1_2.
|
||||
do
|
||||
Precursor
|
||||
set_ssl_protocol_to_tls_1_2
|
||||
set_secure_protocol_to_tls_1_2
|
||||
ensure then
|
||||
ssl_protocol_set: ssl_protocol = {SSL_PROTOCOL}.tls_1_2
|
||||
secure_protocol_set: secure_protocol = {SSL_PROTOCOL}.tls_1_2
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
Server_details: STRING_8 = "Server: Standalone Eiffel Server (https)"
|
||||
Server_details: STRING_8 = "Server: Standalone Eiffel Server (secure)"
|
||||
|
||||
has_ssl_support: BOOLEAN = True
|
||||
has_secure_support: BOOLEAN = True
|
||||
-- Precursor
|
||||
|
||||
feature -- SSL Helpers
|
||||
|
||||
set_ssl_protocol_to_ssl_2_or_3
|
||||
-- Set `ssl_protocol' with `Ssl_23'.
|
||||
set_secure_protocol_to_ssl_2_or_3
|
||||
-- Set `secure_protocol' with `Ssl_23'.
|
||||
do
|
||||
set_ssl_protocol ({SSL_PROTOCOL}.Ssl_23)
|
||||
set_secure_protocol ({SSL_PROTOCOL}.Ssl_23)
|
||||
end
|
||||
|
||||
set_ssl_protocol_to_tls_1_0
|
||||
-- Set `ssl_protocol' with `Tls_1_0'.
|
||||
set_secure_protocol_to_tls_1_0
|
||||
-- Set `secure_protocol' with `Tls_1_0'.
|
||||
do
|
||||
set_ssl_protocol ({SSL_PROTOCOL}.Tls_1_0)
|
||||
set_secure_protocol ({SSL_PROTOCOL}.Tls_1_0)
|
||||
end
|
||||
|
||||
set_ssl_protocol_to_tls_1_1
|
||||
-- Set `ssl_protocol' with `Tls_1_1'.
|
||||
set_secure_protocol_to_tls_1_1
|
||||
-- Set `secure_protocol' with `Tls_1_1'.
|
||||
do
|
||||
set_ssl_protocol ({SSL_PROTOCOL}.Tls_1_1)
|
||||
set_secure_protocol ({SSL_PROTOCOL}.Tls_1_1)
|
||||
end
|
||||
|
||||
set_ssl_protocol_to_tls_1_2
|
||||
-- Set `ssl_protocol' with `Tls_1_2'.
|
||||
set_secure_protocol_to_tls_1_2
|
||||
-- Set `secure_protocol' with `Tls_1_2'.
|
||||
do
|
||||
set_ssl_protocol ({SSL_PROTOCOL}.Tls_1_2)
|
||||
set_secure_protocol ({SSL_PROTOCOL}.Tls_1_2)
|
||||
end
|
||||
|
||||
set_ssl_protocol_to_dtls_1_0
|
||||
-- Set `ssl_protocol' with `Dtls_1_0'.
|
||||
set_secure_protocol_to_dtls_1_0
|
||||
-- Set `secure_protocol' with `Dtls_1_0'.
|
||||
do
|
||||
set_ssl_protocol ({SSL_PROTOCOL}.Dtls_1_0)
|
||||
set_secure_protocol ({SSL_PROTOCOL}.Dtls_1_0)
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
note
|
||||
description: "[
|
||||
SSL enabled server
|
||||
SECURE enabled server
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
@@ -21,24 +21,24 @@ feature {NONE} -- Factory
|
||||
|
||||
new_listening_socket (a_addr: detachable INET_ADDRESS; a_http_port: INTEGER): HTTPD_STREAM_SOCKET
|
||||
local
|
||||
s_ssl: HTTPD_STREAM_SSL_SOCKET
|
||||
s_secure: HTTPD_STREAM_SECURE_SOCKET
|
||||
do
|
||||
if configuration.is_secure then
|
||||
if a_addr /= Void then
|
||||
create s_ssl.make_server_by_address_and_port (a_addr, a_http_port)
|
||||
Result := s_ssl
|
||||
create s_secure.make_server_by_address_and_port (a_addr, a_http_port)
|
||||
Result := s_secure
|
||||
else
|
||||
create s_ssl.make_server_by_port (a_http_port)
|
||||
create s_secure.make_server_by_port (a_http_port)
|
||||
end
|
||||
s_ssl.set_tls_protocol (configuration.ssl_protocol)
|
||||
if attached configuration.ca_crt as l_crt then
|
||||
s_ssl.set_certificate_file_name (l_crt)
|
||||
s_secure.set_tls_protocol (configuration.secure_protocol)
|
||||
if attached configuration.secure_certificate as l_crt then
|
||||
s_secure.set_certificate_file_name (l_crt)
|
||||
end
|
||||
if attached configuration.ca_key as l_key then
|
||||
s_ssl.set_key_file_name (l_key)
|
||||
if attached configuration.secure_certificate_key as l_key then
|
||||
s_secure.set_key_file_name (l_key)
|
||||
end
|
||||
|
||||
Result := s_ssl
|
||||
Result := s_secure
|
||||
else
|
||||
Result := Precursor (a_addr, a_http_port)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user