Skip to content

Commit 6d830e0

Browse files
committed
Prepare TLS acceptor to recieve change CRL message
1 parent c486874 commit 6d830e0

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

apps/epp_proxy/src/epp_tls_acceptor.erl

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
-export([handle_call/3, handle_cast/2, init/1,
1515
start_link/1, terminate/2, handle_info/2]).
1616

17-
-export([crl_file/0]).
17+
-export([crl_file/0, crl_file/1]).
1818

19-
-record(state, {socket, port, options, timer}).
19+
-record(state, {socket, port, options, timer, crl_path}).
2020

2121
start_link(Port) ->
2222
gen_server:start_link({local, ?SERVER}, ?MODULE, Port,
@@ -35,7 +35,7 @@ init(Port) ->
3535
gen_server:cast(self(), accept),
3636
{ok,
3737
#state{socket = ListenSocket, port = Port,
38-
options = Options, timer = TimerReference}}.
38+
options = Options, timer = TimerReference, crl_path = []}}.
3939

4040
%% Acceptor has only one state that goes in a loop:
4141
%% 1. Listen for a connection from anyone.
@@ -57,11 +57,22 @@ handle_cast(accept,
5757
options = Options}}.
5858

5959
handle_info(reload_crl_file, State) ->
60-
case crl_file() of
61-
undefined -> {noreply, State};
62-
{ok, File} ->
63-
ssl_crl_cache:insert({file, File}),
64-
{noreply, State}
60+
crl_path = State#state.crl_path,
61+
case crl_path of
62+
[] ->
63+
case crl_file() of
64+
undefined -> {noreply, State};
65+
{ok, File} ->
66+
ssl_crl_cache:insert({file, File}),
67+
{noreply, State}
68+
end;
69+
[_] ->
70+
case crl_file(crl_path) of
71+
undefined -> {noreply, State};
72+
{ok, File} ->
73+
ssl_crl_cache:insert({file, File}),
74+
{noreply, State}
75+
end
6576
end.
6677

6778
terminate(_Reason, State) ->
@@ -105,6 +116,10 @@ crl_file() ->
105116
{ok, CrlFile} -> epp_util:path_for_file(CrlFile)
106117
end.
107118

119+
crl_file(path) ->
120+
epp_util:path_for_file(path).
121+
122+
108123
%% In some environments, we do not perform a CRL check. Therefore, we need
109124
%% different options proplist.
110125
handle_crl_check_options(Options) ->

apps/epp_proxy/test/tls_client_SUITE.erl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ revoked_cert_test_case(Config) ->
215215
{tls_alert,
216216
{certificate_revoked,
217217
"received CLIENT ALERT: Fatal - Certificate Revoked"}} = Error,
218+
%% "TLS client: In state cipher received SERVER ALERT: Fatal - Certificate Revoked\n "}} = Error,
218219
ok.
219220

220221
%% Helper functions:

0 commit comments

Comments
 (0)