From 68474f524989a616d1af5a3d1eba7534ce37fea4 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Wed, 11 Jun 2014 16:59:56 +0200 Subject: Remove unused stuff. --- src/catlfish.erl | 15 ------- src/https_server.erl | 50 ----------------------- src/tools/README | 85 ---------------------------------------- src/tools/httpd_config.OFF | 9 ----- src/tools/httpd_inets.config | 31 --------------- src/tools/httpd_inets.erl | 8 ---- src/tools/httpd_inets_props.conf | 19 --------- 7 files changed, 217 deletions(-) delete mode 100644 src/catlfish.erl delete mode 100644 src/https_server.erl delete mode 100644 src/tools/README delete mode 100644 src/tools/httpd_config.OFF delete mode 100644 src/tools/httpd_inets.config delete mode 100644 src/tools/httpd_inets.erl delete mode 100644 src/tools/httpd_inets_props.conf diff --git a/src/catlfish.erl b/src/catlfish.erl deleted file mode 100644 index ad99f78..0000000 --- a/src/catlfish.erl +++ /dev/null @@ -1,15 +0,0 @@ -%%% Copyright (c) 2014, NORDUnet A/S. -%%% See LICENSE for licensing information. - -%% 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/https_server.erl b/src/https_server.erl deleted file mode 100644 index 465d77b..0000000 --- a/src/https_server.erl +++ /dev/null @@ -1,50 +0,0 @@ -%%% Copyright (c) 2014, NORDUnet A/S. -%%% See LICENSE for licensing information. - --module(https_server). --export([start/0, stop/1]). - -start() -> - io:format("Starting https server~n"), - case code:ensure_loaded(jiffy) of - {module, jiffy} -> ok; - _ -> io:format("missing jiffy -- please add to load path~n") - 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/catlfish/webroot", - {ok, Pid} = - inets:start(httpd, - [{port, 8080}, - %%{bind_address, {127,0,0,1}}, - {bind_address, {192, 168, 122, 119}}, - {server_name, "flimsy.ct.nordu.net"}, - {server_root, ServerRoot}, - {document_root, ServerRoot ++ "/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"}}, - {re_write, {"^/ct/v1/(.*)_(.*)$", "/ct/v1/\\1-\\2"}}, - {erl_script_alias, {"/ct", [v1]}}, - {erl_script_nocache, true}, - {error_log, "log/error"}, - {security_log, "log/security"}, - {transfer_log, "log/transfer"}, - %% See ssl(3erl) for SSL options. - {socket_type, {essl, [ - {certfile, ServerRoot ++ "/certs/webcert.pem"}, - {keyfile, ServerRoot ++ "/keys/webkey.pem"}, - %%{cacertfile, ServerRoot ++ "/certs/cacert.pem"}, - {ciphers, ssl:cipher_suites()}, - {verify, verify_none} - ]}} - ]), - Pid. - -stop(Pid) -> - inets:stop(httpd, Pid). diff --git a/src/tools/README b/src/tools/README deleted file mode 100644 index 3db5c00..0000000 --- a/src/tools/README +++ /dev/null @@ -1,85 +0,0 @@ -* httpd -** ssl -Run httpd using inets. Tell inets what to start by configuring -'services' in a config file that you pass to erl(1) at startup: - -$ cat httpd_inets.config -[{inets, [{services, [ - {httpd, [{proplist_file, "httpd_inets_props.conf"}]} - ]}]}]. -$ - -Then start erl with `-config httpd_inets'. -In erl, start inets: - -1> inets.start(). -ok - -There are two ways to configure the httpd server. - -Either configure httpd using a props list with all the httpd arguments: - -$ cat httpd_inets_props.conf -[ - {port, 8080}, - {bind_address, {127,0,0,1}}, - {server_name, "httpd_inets_FQDN"}, - {server_root, "/tmp/httpd_inets"}, - {document_root, "/tmp/httpd_inets/docroot"}, - {socket_type, essl}, - {ssl_certificate_file, "/tmp/httpd_inets/02.pem"}, - {ssl_certificate_key_file, "/tmp/httpd_inets/srv1.key"}, - {ssl_ca_certificate_file, "/tmp/httpd_inets/01.pem"} -]. -$ - -In the example config for inets above, this is what will be used. - -Or configure httpd using an Apache like configuration file. Configure -inets to start httpd with {file, "httpd_config"} in -httpd_inets.config. Here's a config file equivalent to what's seen -above in the props list: - -$ cat httpd_config.OFF -ServerName httpd_inets_FQDN -ServerRoot /tmp/httpd_inets -DocumentRoot /tmp/httpd_inets/docroot -Port 8080 -SocketType essl - -SSLCertificateFile /tmp/httpd_inets/02.pem -SSLCertificateKeyFile /tmp/httpd_inets/srv1.key -SSLCACertificateFile /tmp/httpd_inets/01.pem -$ -** dynamic content -Configuring httpd with {erl_script_alias, {"/d", [httpd_inets]}} and -compiling httpd_inets.erl will make the following URL refer to -httpd_inets:hello/3: - - https://localhost:8080/d/httpd_inets:hello - -Here's an example of what http_inets.erl can look like: - -$ cat httpd_inets.erl --module('httpd_inets'). --export([hello/3]). - -hello(SessionID, _Env, _Input) -> - mod_esi:deliver(SessionID, [ - "Content-Type: text/html\r\n\r\n", - "hello, erlang world" - ]). -$ - -httpd config 'modules' seems to be crucial to get right, including the -order of the modules listed. The mod_esi module is the one providing -the erl_script_alias functionality. Here's a configuration that's -working with Erlang R15B01 (erts-5.9.1): - - {modules, [mod_alias, - mod_auth, - mod_esi, - mod_get, - mod_head, - mod_log, - mod_disk_log]}, diff --git a/src/tools/httpd_config.OFF b/src/tools/httpd_config.OFF deleted file mode 100644 index 5a75648..0000000 --- a/src/tools/httpd_config.OFF +++ /dev/null @@ -1,9 +0,0 @@ -ServerName httpd_inets_FQDN -ServerRoot /tmp/httpd_inets -DocumentRoot /tmp/httpd_inets/docroot -Port 8080 -SocketType essl - -SSLCertificateFile /tmp/httpd_inets/02.pem -SSLCertificateKeyFile /tmp/httpd_inets/srv1.key -SSLCACertificateFile /tmp/httpd_inets/01.pem diff --git a/src/tools/httpd_inets.config b/src/tools/httpd_inets.config deleted file mode 100644 index 7baa8ef..0000000 --- a/src/tools/httpd_inets.config +++ /dev/null @@ -1,31 +0,0 @@ -%% http://ftp.sunet.se/pub/lang/erlang/doc/apps/inets/http_server.html -%% http://www.erlang.org/doc/man/httpd.html -%% -%% $ erl -config httpd_inets -%% Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:4:4]%% [async-threads:0] [kernel-poll:false] -%% -%% Eshell V5.9.1 (abort with ^G) -%% 1> inets:start(). -%% ok -%% 2> [_, Httpd] = inets:services(). -%% 3> {httpd, Pid} = Httpd. -%% {httpd,<0.45.0>} -%% 4> httpd:info(Pid). -%% [{mime_types,[{"html","text/html"},{"htm","text/html"}]}, -%% {ipfamily,inet6fb4}, -%% {server_name,"httpd_inets_FQDN"}, -%% {ssl_certificate_file,"/tmp/httpd_inets/02.pem"}, -%% {socket_type,essl}, -%% {ssl_ca_certificate_file,"/tmp/httpd_inets/01.pem"}, -%% {ssl_certificate_key_file,"/tmp/httpd_inets/srv1.key"}, -%% {file,"httpd_config"}, -%% {server_root,"/tmp/httpd_inets"}, -%% {port,8080}, -%% {document_root,"/tmp/httpd_inets/docroot"}, -%% {bind_address,any}] -%% 5> -%% -[{inets, [{services, [ - {httpd, [{proplist_file, "httpd_inets_props.conf"}]} - %%{httpd, [{file, "httpd_config"}]} - ]}]}]. diff --git a/src/tools/httpd_inets.erl b/src/tools/httpd_inets.erl deleted file mode 100644 index 161d0f5..0000000 --- a/src/tools/httpd_inets.erl +++ /dev/null @@ -1,8 +0,0 @@ --module('httpd_inets'). --export([hello/3]). - -hello(SessionID, _Env, _Input) -> - mod_esi:deliver(SessionID, [ - "Content-Type: text/html\r\n\r\n", - "hello, erlang world" - ]). diff --git a/src/tools/httpd_inets_props.conf b/src/tools/httpd_inets_props.conf deleted file mode 100644 index c94fed9..0000000 --- a/src/tools/httpd_inets_props.conf +++ /dev/null @@ -1,19 +0,0 @@ -[ - {port, 8080}, - {bind_address, {127,0,0,1}}, - {server_name, "httpd_inets_FQDN"}, - {server_root, "/tmp/httpd_inets"}, - {document_root, "/tmp/httpd_inets/docroot"}, - {socket_type, essl}, - {ssl_certificate_file, "/tmp/httpd_inets/02.pem"}, - {ssl_certificate_key_file, "/tmp/httpd_inets/srv1.key"}, - {ssl_ca_certificate_file, "/tmp/httpd_inets/01.pem"}, - {modules, [mod_alias, - mod_auth, - mod_esi, - mod_get, - mod_head, - mod_log, - mod_disk_log]}, - {erl_script_alias, {"/d", [httpd_inets]}} -]. -- cgit v1.1