From f473802d5ebe9192c635c477d053523b2baaa3a3 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Tue, 10 Jun 2014 20:27:06 +0200 Subject: Change ctls -> catlfish. --- README.md | 11 ++++++----- catlfish.config | 12 ++++++++++++ ctls.config | 12 ------------ doc/design.txt | 4 ++-- ebin/catlfish.app | 10 ++++++++++ ebin/ctls.app | 9 --------- httpd_props.conf | 10 +++++----- src/catlfish.erl | 12 ++++++++++++ src/ctls.erl | 12 ------------ src/https_server.erl | 2 +- test/catlfish_test.erl | 33 +++++++++++++++++++++++++++++++++ test/ctls_test.erl | 33 --------------------------------- 12 files changed, 81 insertions(+), 79 deletions(-) create mode 100644 catlfish.config delete mode 100644 ctls.config create mode 100644 ebin/catlfish.app delete mode 100644 ebin/ctls.app create mode 100644 src/catlfish.erl delete mode 100644 src/ctls.erl create mode 100644 test/catlfish_test.erl delete mode 100644 test/ctls_test.erl diff --git a/README.md b/README.md index e9fe990..13cb679 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# ctls +# catlfish -ctls is a Certificate Transparency log server (RFC 6962). +catlfish is a Certificate Transparency log server (RFC 6962). # Compile @@ -15,8 +15,8 @@ jiffie for JSON encoding and decoding. # Start -NOTE: Kludge ahead! ctls will turn into a proper OTP application at -some point in the future. +NOTE: Kludge ahead! catlfish will turn into a proper OTP application +at some point in the future. Make sure mnesia and plop are running and that plop has been installed, i.e. has a database. See `plop/README`. You might also want @@ -34,4 +34,5 @@ To enable a crazy amount of tracing information from inets, do # To do -- Stop using inets httpd mod_esi and make ctls a proper application. +- Stop using inets httpd mod_esi and make catlfish a proper + application. diff --git a/catlfish.config b/catlfish.config new file mode 100644 index 0000000..cda8789 --- /dev/null +++ b/catlfish.config @@ -0,0 +1,12 @@ +%% catlfish configuration file (-*- erlang -*-) +%% Start like this: +%% $ erl -boot start_sasl -config catlfish -run inets +[{sasl, + [{sasl_error_logger, false}, + {errlog_type, error}, + {error_logger_mf_dir, "log"}, + {error_logger_mf_maxbytes, 10485760}, % 10 MB + {error_logger_mf_maxfiles, 10}]}, + {inets, + [{services, + [{httpd, [{proplist_file, "httpd_props.conf"}]}]}]}]. diff --git a/ctls.config b/ctls.config deleted file mode 100644 index c453492..0000000 --- a/ctls.config +++ /dev/null @@ -1,12 +0,0 @@ -%% ctls configuration file (-*- erlang -*-) -%% Start like this: -%% $ erl -boot start_sasl -config ctls -run inets -[{sasl, - [{sasl_error_logger, false}, - {errlog_type, error}, - {error_logger_mf_dir, "log"}, - {error_logger_mf_maxbytes, 10485760}, % 10 MB - {error_logger_mf_maxfiles, 10}]}, - {inets, - [{services, - [{httpd, [{proplist_file, "httpd_props.conf"}]}]}]}]. diff --git a/doc/design.txt b/doc/design.txt index 4f7ad85..472a270 100644 --- a/doc/design.txt +++ b/doc/design.txt @@ -1,6 +1,6 @@ -ctls design (in Emacs -*- org -*- mode) +catlfish design (in Emacs -*- org -*- mode) -This document describes the design of ctls, an implementation of a +This document describes the design of catlfish, an implementation of a Certificate Transparency (RFC6962) log server. We have diff --git a/ebin/catlfish.app b/ebin/catlfish.app new file mode 100644 index 0000000..33d7050 --- /dev/null +++ b/ebin/catlfish.app @@ -0,0 +1,10 @@ +%% Application resource file for catlfish (in -*- erlang -*- mode). +%% Point out the proper configuration file (-config catlfish) when +%% starting beam. +{application, catlfish, + [{description, "catlfish -- Certificate Transparency Log Server"}, + {vsn, "0.0.1"}, + {modules, [v1]}, + {applications, [kernel, stdlib, plop, inets]}]}. +%% {registered, [catlfish]}]}. +%% {mod, {catlfish, ["test/eckey.pem", "test/eckey-public.pem"]}}]}. diff --git a/ebin/ctls.app b/ebin/ctls.app deleted file mode 100644 index eeaaf11..0000000 --- a/ebin/ctls.app +++ /dev/null @@ -1,9 +0,0 @@ -%% Application resource file for ctls (in -*- erlang -*- mode). -%% Point out the proper configuration file (-config ctls) when starting beam. -{application, ctls, - [{description, "ctls -- Certificate Transparency Log Server"}, - {vsn, "0.0.1"}, - {modules, [v1]}, - {applications, [kernel, stdlib, plop, inets]}]}. -%% {registered, [ctls]}]}. -%% {mod, {ctls, ["test/eckey.pem", "test/eckey-public.pem"]}}]}. diff --git a/httpd_props.conf b/httpd_props.conf index 09b9338..967c082 100644 --- a/httpd_props.conf +++ b/httpd_props.conf @@ -2,8 +2,8 @@ {port, 8080}, {bind_address, {127, 0, 0, 1}}, {server_name, "flimsy"}, - {server_root, "ctls/webroot"}, - {document_root, "ctls/webroot/docroot"}, + {server_root, "catlfish/webroot"}, + {document_root, "catlfish/webroot/docroot"}, {modules, [mod_alias, mod_auth, mod_esi, mod_get, mod_head, mod_log, mod_disk_log]}, %%{re_write, {"^/ct/v1/(.*)$", "/ct/v1/https_server/\\1"}}, @@ -15,7 +15,7 @@ {transfer_log, "log/transfer"}, {socket_type, {essl, % See ssl(3erl) for SSL options. - [{certfile, "ctls/webroot/certs/webcert.pem"}, - {keyfile, "ctls/webroot/keys/webkey.pem"}, - {cacertfile, "ctls/webroot/certs/webcert.pem"}]}} + [{certfile, "catlfish/webroot/certs/webcert.pem"}, + {keyfile, "catlfish/webroot/keys/webkey.pem"}, + {cacertfile, "catlfish/webroot/certs/webcert.pem"}]}} ]. diff --git a/src/catlfish.erl b/src/catlfish.erl new file mode 100644 index 0000000..015d8b4 --- /dev/null +++ b/src/catlfish.erl @@ -0,0 +1,12 @@ +%% This is a CA transparency log. + +%% In order to find https_server and other required modules, a couple +%% of subdirectories need to be added to the Erlang path +%% (code:add_pathz/1). This can be done in an ~/.erlang file. + +-module('catlfish'). +-export([start/0]). + +start() -> + io:format("Starting catlfish~n"), + https_server:start(). diff --git a/src/ctls.erl b/src/ctls.erl deleted file mode 100644 index 9c4c9b4..0000000 --- a/src/ctls.erl +++ /dev/null @@ -1,12 +0,0 @@ -%% This is a CA transparency log. - -%% In order to find https_server and other required modules, a couple -%% of subdirectories need to be added to the Erlang path -%% (code:add_pathz/1). This can be done in an ~/.erlang file. - --module('ctls'). --export([start/0]). - -start() -> - io:format("Starting ctls~n"), - https_server:start(). diff --git a/src/https_server.erl b/src/https_server.erl index ccbc2e7..47b4465 100644 --- a/src/https_server.erl +++ b/src/https_server.erl @@ -9,7 +9,7 @@ start() -> end, %% TODO: put this in httpd_props.conf and use that at erlang %% start. inets:start(httpd, {proplist_file, "httpd_props.conf"}). - ServerRoot = "/home/linus/usr/src/ct/ctls/webroot", + ServerRoot = "/home/linus/usr/src/ct/catlfish/webroot", {ok, Pid} = inets:start(httpd, [{port, 8080}, diff --git a/test/catlfish_test.erl b/test/catlfish_test.erl new file mode 100644 index 0000000..5782984 --- /dev/null +++ b/test/catlfish_test.erl @@ -0,0 +1,33 @@ +-module(catlfish_test). +-include_lib("eunit/include/eunit.hrl"). + +%% Requires that catlfish is running (or, at the moment, that v1 has +%% been installed as an mod_esi module -- use https_server:start()). + +-define(URL, "https://flimsytest:8080/ct/v1/add_chain"). + +add_chain_test_() -> + {setup, + fun() -> + Input = "{\"chain\": [\"some test data\"]}", + {OK, {{_, RC, _}, _, _}} = httpc:request(post, {?URL, [], [], Input}, [], []), + %% TODO: Verify signature. + {OK, RC} + end, + fun(_) -> ok end, + fun({OK, RC}) -> + [?_assertEqual(ok, OK), + ?_assertEqual(RC, 200)] + end}. + +add_sth_test_() -> + {setup, + fun() -> + {OK, {{_, RC, _}, _, _}} = httpc:request(get, {?URL, []}, [], []), + {OK, RC} + end, + fun(_) -> ok end, + fun({OK, RC}) -> + [?_assertEqual(ok, OK), + ?_assertEqual(RC, 200)] + end}. diff --git a/test/ctls_test.erl b/test/ctls_test.erl deleted file mode 100644 index bd477de..0000000 --- a/test/ctls_test.erl +++ /dev/null @@ -1,33 +0,0 @@ --module(ctls_test). --include_lib("eunit/include/eunit.hrl"). - -%% Requires that ctls is running (or, at the moment, that v1 has been -%% installed as an mod_esi module -- use https_server:start()). - --define(URL, "https://flimsytest:8080/ct/v1/add_chain"). - -add_chain_test_() -> - {setup, - fun() -> - Input = "{\"chain\": [\"some test data\"]}", - {OK, {{_, RC, _}, _, _}} = httpc:request(post, {?URL, [], [], Input}, [], []), - %% TODO: Verify signature. - {OK, RC} - end, - fun(_) -> ok end, - fun({OK, RC}) -> - [?_assertEqual(ok, OK), - ?_assertEqual(RC, 200)] - end}. - -add_sth_test_() -> - {setup, - fun() -> - {OK, {{_, RC, _}, _, _}} = httpc:request(get, {?URL, []}, [], []), - {OK, RC} - end, - fun(_) -> ok end, - fun({OK, RC}) -> - [?_assertEqual(ok, OK), - ?_assertEqual(RC, 200)] - end}. -- cgit v1.1