Skip to content

Commit 3b1d177

Browse files
committed
Revert "api: support ssl_verify_client option"
This reverts commit f894779.
1 parent 6737576 commit 3b1d177

File tree

9 files changed

+1
-200
lines changed

9 files changed

+1
-200
lines changed

CHANGELOG.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
88

99
## Added
1010

11-
- `ssl_verify_client` option (#207).
12-
1311
## Changed
1412

1513
## Fixed

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,6 @@ httpd = require('http.server').new(host, port[, { options } ])
158158
* `ssl_ciphers` is a colon-separated list of SSL ciphers, optional;
159159
* `ssl_password` is a password for decrypting SSL private key, optional;
160160
* `ssl_password_file` is a SSL file with key for decrypting SSL private key, optional.
161-
* `ssl_verify_client` is an option that allows to verify client. It has following values:
162-
* `off` (default) means that no client's certs will be verified;
163-
* `on` means that server will verify client's certs;
164-
* `optional` means that server will verify client's certs only if it exist.
165161

166162
## Using routes
167163

http/server.lua

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,12 +1296,6 @@ local function url_for_httpd(httpd, name, args, query)
12961296
end
12971297
end
12981298

1299-
local VERIFY_CLIENT_OPTS = {
1300-
off = sslsocket.SET_VERIFY_FLAGS.SSL_VERIFY_NONE,
1301-
optional = sslsocket.SET_VERIFY_FLAGS.SSL_VERIFY_PEER,
1302-
on = bit.bor(sslsocket.SET_VERIFY_FLAGS.SSL_VERIFY_PEER, sslsocket.SET_VERIFY_FLAGS.SSL_VERIFY_FAIL_IF_NO_PEER),
1303-
}
1304-
13051299
local function create_ssl_ctx(host, port, opts)
13061300
local ok, ctx = pcall(sslsocket.ctx, sslsocket.tls_server_method())
13071301
if ok ~= true then
@@ -1334,11 +1328,7 @@ local function create_ssl_ctx(host, port, opts)
13341328
)
13351329
end
13361330

1337-
local set_verify_flag = (
1338-
opts.ssl_verify_client and VERIFY_CLIENT_OPTS[opts.ssl_verify_client] or
1339-
VERIFY_CLIENT_OPTS.off
1340-
)
1341-
sslsocket.ctx_set_verify(ctx, set_verify_flag)
1331+
sslsocket.ctx_set_verify(ctx, 0x00)
13421332
end
13431333

13441334
if opts.ssl_ciphers ~= nil then
@@ -1393,12 +1383,6 @@ local function validate_ssl_opts(opts)
13931383
errorf("%s option must be a string", key)
13941384
end
13951385

1396-
if key == 'ssl_verify_client' then
1397-
if VERIFY_CLIENT_OPTS[value] == nil then
1398-
errorf('%q option not exists. Available options: "on", "off", "optional"', value)
1399-
end
1400-
end
1401-
14021386
if string.find(key, 'file') ~= nil and fio.path.exists(value) ~= true then
14031387
errorf("file %q not exists", value)
14041388
end
@@ -1445,7 +1429,6 @@ local exports = {
14451429
ssl_password_file = options.ssl_password_file,
14461430
ssl_ca_file = options.ssl_ca_file,
14471431
ssl_ciphers = options.ssl_ciphers,
1448-
ssl_verify_client = options.ssl_verify_client,
14491432
})
14501433

14511434
local default = {
@@ -1516,7 +1499,6 @@ local exports = {
15161499
ssl_password_file = self.options.ssl_password_file,
15171500
ssl_ca_file = self.options.ssl_ca_file,
15181501
ssl_ciphers = self.options.ssl_ciphers,
1519-
ssl_verify_client = self.options.ssl_verify_client,
15201502
})
15211503
return sslsocket.tcp_server(host, port, handler, timeout, ssl_ctx)
15221504
end

http/sslsocket.lua

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,6 @@ pcall(ffi.cdef, [[
5656
const void *needle, size_t needlelen);
5757
]])
5858

59-
local SET_VERIFY_FLAGS = {
60-
SSL_VERIFY_NONE = 0x00,
61-
SSL_VERIFY_PEER = 0x01,
62-
SSL_VERIFY_FAIL_IF_NO_PEER = 0x02,
63-
}
64-
6559
local function slice_wait(timeout, starttime)
6660
if timeout == nil then
6761
return nil
@@ -458,8 +452,6 @@ local function tcp_server(host, port, handler, timeout, sslctx)
458452
end
459453

460454
return {
461-
SET_VERIFY_FLAGS = SET_VERIFY_FLAGS,
462-
463455
tls_server_method = tls_server_method,
464456

465457
ctx = ctx,

test/helpers.lua

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,6 @@ helpers.base_host = '127.0.0.1'
1212
helpers.base_uri = ('http://%s:%s'):format(helpers.base_host, helpers.base_port)
1313
helpers.tls_uri = ('https://%s:%s'):format('localhost', helpers.base_port)
1414

15-
local is_tarantool1 = luatest_utils.version_ge(
16-
luatest_utils.get_tarantool_version(),
17-
luatest_utils.version(1, 0, 0)
18-
)
19-
20-
helpers.CONNECTION_REFUSED_ERR_MSG = "Failure when receiving data from the peer: Connection refused"
21-
if is_tarantool1 then
22-
helpers.CONNECTION_REFUSED_ERR_MSG = "Failure when receiving data from the peer"
23-
end
24-
2515
helpers.get_testdir_path = function()
2616
local path = os.getenv('LUA_SOURCE_DIR') or './'
2717
return fio.pathjoin(path, 'test')

test/integration/http_tls_enabled_test.lua

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -145,73 +145,6 @@ local client_test_cases = {
145145
},
146146
expected_err_msg = "curl: Problem with the local SSL certificate",
147147
},
148-
test_verify_client_optional_with_certs_valid = {
149-
ssl_opts = {
150-
ssl_verify_client = 'optional',
151-
ssl_key_file = fio.pathjoin(ssl_data_dir, 'server.key'),
152-
ssl_cert_file = fio.pathjoin(ssl_data_dir, 'server.crt'),
153-
ssl_ca_file = fio.pathjoin(ssl_data_dir, 'ca.crt'),
154-
},
155-
request_opts = {
156-
ssl_cert = fio.pathjoin(ssl_data_dir, 'client.crt'),
157-
ssl_key = fio.pathjoin(ssl_data_dir, 'client.key'),
158-
},
159-
},
160-
test_verify_client_optional_with_certs_invalid = {
161-
ssl_opts = {
162-
ssl_verify_client = 'optional',
163-
ssl_key_file = fio.pathjoin(ssl_data_dir, 'server.key'),
164-
ssl_cert_file = fio.pathjoin(ssl_data_dir, 'server.crt'),
165-
ssl_ca_file = fio.pathjoin(ssl_data_dir, 'ca.crt'),
166-
},
167-
request_opts = {
168-
ssl_cert = fio.pathjoin(ssl_data_dir, 'bad_client.crt'),
169-
ssl_key = fio.pathjoin(ssl_data_dir, 'bad_client.key'),
170-
},
171-
expected_err_msg = helpers.CONNECTION_REFUSED_ERR_MSG,
172-
},
173-
test_verify_client_optional_withouts_certs = {
174-
ssl_opts = {
175-
ssl_verify_client = 'optional',
176-
ssl_key_file = fio.pathjoin(ssl_data_dir, 'server.key'),
177-
ssl_cert_file = fio.pathjoin(ssl_data_dir, 'server.crt'),
178-
ssl_ca_file = fio.pathjoin(ssl_data_dir, 'ca.crt'),
179-
},
180-
},
181-
test_verify_client_on_valid = {
182-
ssl_opts = {
183-
ssl_verify_client = 'on',
184-
ssl_key_file = fio.pathjoin(ssl_data_dir, 'server.key'),
185-
ssl_cert_file = fio.pathjoin(ssl_data_dir, 'server.crt'),
186-
ssl_ca_file = fio.pathjoin(ssl_data_dir, 'ca.crt'),
187-
},
188-
request_opts = {
189-
ssl_cert = fio.pathjoin(ssl_data_dir, 'client.crt'),
190-
ssl_key = fio.pathjoin(ssl_data_dir, 'client.key'),
191-
},
192-
},
193-
test_verify_client_on_invalid = {
194-
ssl_opts = {
195-
ssl_verify_client = 'on',
196-
ssl_key_file = fio.pathjoin(ssl_data_dir, 'server.key'),
197-
ssl_cert_file = fio.pathjoin(ssl_data_dir, 'server.crt'),
198-
ssl_ca_file = fio.pathjoin(ssl_data_dir, 'ca.crt'),
199-
},
200-
request_opts = {
201-
ssl_cert = fio.pathjoin(ssl_data_dir, 'bad_client.crt'),
202-
ssl_key = fio.pathjoin(ssl_data_dir, 'bad_client.key'),
203-
},
204-
expected_err_msg = helpers.CONNECTION_REFUSED_ERR_MSG,
205-
},
206-
test_verify_client_on_certs_missing = {
207-
ssl_opts = {
208-
ssl_verify_client = 'on',
209-
ssl_key_file = fio.pathjoin(ssl_data_dir, 'server.key'),
210-
ssl_cert_file = fio.pathjoin(ssl_data_dir, 'server.crt'),
211-
ssl_ca_file = fio.pathjoin(ssl_data_dir, 'ca.crt'),
212-
},
213-
expected_err_msg = helpers.CONNECTION_REFUSED_ERR_MSG,
214-
},
215148
}
216149

217150
for name, tc in pairs(client_test_cases) do

test/integration/http_tls_enabled_validate_test.lua

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,6 @@ local test_cases = {
105105
},
106106
expected_err_msg = "ssl_ciphers option must be a string",
107107
},
108-
ssl_verify_client_incorrect_value = {
109-
opts = {
110-
ssl_verify_client = "unknown",
111-
},
112-
expected_err_msg = '"unknown" option not exists. Available options: "on", "off", "optional"'
113-
},
114108
}
115109

116110
for name, case in pairs(test_cases) do

test/ssl_data/bad_client.crt

Lines changed: 0 additions & 32 deletions
This file was deleted.

test/ssl_data/bad_client.key

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)