diff --git a/ChangeLog b/ChangeLog index 5f4337cce..8b7d90340 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-05-08 Alexey Shchepin + + * doc/guide.tex: Updated + + * src/ejabberd_listener.erl: Now possible to specify interface on + which one socket will be listened, also added another way to + specify SSL options + * src/ejabberd.cfg.example: Updated + 2004-05-07 Alexey Shchepin * src/web/ejabberd_web_admin.erl: Updated (thanks to Andrey diff --git a/doc/guide.html b/doc/guide.html index e35e53870..fe22bbd91 100644 --- a/doc/guide.html +++ b/doc/guide.html @@ -21,7 +21,7 @@ mailto:alexey@sevcom.net
xmpp:aleksey@jabber.ru -

July 12, 2003

+

May 8, 2004

@@ -181,10 +181,12 @@ To compile ejabberd in MS Windows environment, you will need the follow packages: @@ -222,39 +224,29 @@ TBD
  1. -Install Erlang emulator (for example, into C:\Program Files\erl5.1.2). -
  2. Install Expat library into C:\Program Files\Expat-1.95.6 - directory. Copy file C:\Program Files\Expat-1.95.6\Libs\libexpat.dll +Install Erlang emulator (for example, into C:\Program Files\erl5.3). +
  3. Install Expat library into C:\Program Files\Expat-1.95.7 + directory. Copy file C:\Program Files\Expat-1.95.7\Libs\libexpat.dll to your Windows system directory (for example, C:\WINNT or C:\WINNT\System32) -
  4. Install Iconv library into C:\Program Files\GnuWin32 directory. - Copy file C:\Program Files\GnuWin32\bin\libiconv-2.dll to your +
  5. Build and install Iconv library into C:\Program Files\iconv-1.9.1 directory. + Copy file C:\Program Files\iconv-1.9.1\bin\iconv.dll to your Windows system directory.

    -Note: Instead of copying libexpat.dll and libiconv-2.dll to Windows +Note: Instead of copying libexpat.dll and iconv.dll to Windows directory, you can add directories - C:\Program Files\Expat-1.95.6\Libs and - C:\Program Files\GnuWin32\bin to PATH environment + C:\Program Files\Expat-1.95.7\Libs and + C:\Program Files\iconv-1.9.1\bin to PATH environment variable.
  6. Being in ejabberd\src directory run:
     configure
     nmake -f Makefile.win32
    -
  7. To build MUC, IRC and pub/sub modules run -
    -nmake -f Makefile.win32
    -
    in ejabberd\src\mod_muc, ejabberd\src\mod_muc and - ejabberd\src\mod_pubsub directories -
  8. Edit file ejabberd\src\ejabberd.cfg and run +
  9. Edit file ejabberd\src\ejabberd.cfg and run
     werl -s ejabberd -name ejabberd
     
  10. Enjoy!
-Some recent versions of Erlang distribution it seems have bug in crypto -application, so ejabberd could be built but users can't use digest -authentication (only plain-text). Also it seems SSL support is broken in -Windows distribution of Erlang emulator.
-

2.4  Starting

@@ -452,9 +444,12 @@ The following options are defined:
{shaper, <access rule>}
This option is like previous, but use shapers instead of ``allow'' and ``deny''. Default value is ``none''. -
{ssl, SSLOpts}
This option defines that traffic on this port - will be encrypted using SSL. SSL options are the same as described by - ``erl -man ssl'' command +
{ip, IPAddress}
This option specifies which network interface to + listen on. +
inet6
Set up the socket for IPv6. +
ssl
This option specifies that traffic on this port will be + encrypted using SSL. You should also set ``certfile'' option. +
{certfile, Path}
Path to a file containing the SSL certificate.
ejabberd_s2s_in
This module serves incoming S2S connections.
ejabberd_service
This module serves connections from Jabber diff --git a/doc/guide.tex b/doc/guide.tex index 696d3e21b..7e980b3d9 100644 --- a/doc/guide.tex +++ b/doc/guide.tex @@ -39,7 +39,7 @@ c \author{Alexey Shchepin \\ \ahrefurl{mailto:alexey@sevcom.net} \\ \ahrefurl{xmpp:aleksey@jabber.ru}} -\date{July 12, 2003} +\date{May 8, 2004} \begin{document} \begin{titlepage} @@ -425,9 +425,12 @@ Currently three modules are implemented: \item[\verb|{shaper, }|] This option is like previous, but use shapers instead of ``\texttt{allow}'' and ``\texttt{deny}''. Default value is ``\texttt{none}''. - \item[\verb|{ssl, SSLOpts}|] This option defines that traffic on this port - will be encrypted using SSL. SSL options are the same as described by - ``\verb|erl -man ssl|'' command + \item[\verb|{ip, IPAddress}|] This option specifies which network interface to + listen on. + \item[\verb|inet6|] Set up the socket for IPv6. + \item[\verb|ssl|] This option specifies that traffic on this port will be + encrypted using SSL. You should also set ``\verb|certfile|'' option. + \item[\verb|{certfile, Path}|] Path to a file containing the SSL certificate. \end{description} \item[\verb|ejabberd_s2s_in|] This module serves incoming S2S connections. \item[\verb|ejabberd_service|] This module serves connections from \Jabber{} @@ -449,7 +452,7 @@ except admins have traffic limit 1000\,b/s. {listen, [{5222, ejabberd_c2s, [{access, c2s}, {shaper, c2s_shaper}]}, {5223, ejabberd_c2s, [{access, c2s}, - {ssl, [{certfile, "/path/to/ssl.pem"}]}]}, + ssl, {certfile, "/path/to/ssl.pem"}]}, {5269, ejabberd_s2s_in, []}, {8888, ejabberd_service, [{hosts, ["conference.example.org"], [{password, "secret"}]}]} diff --git a/src/ejabberd.cfg.example b/src/ejabberd.cfg.example index d9bc3b53d..0db4e011c 100644 --- a/src/ejabberd.cfg.example +++ b/src/ejabberd.cfg.example @@ -87,7 +87,7 @@ {listen, [{5222, ejabberd_c2s, [{access, c2s}, {shaper, c2s_shaper}]}, {5223, ejabberd_c2s, [{access, c2s}, - {ssl, [{certfile, "./ssl.pem"}]}]}, + ssl, {certfile, "./ssl.pem"}]}, {5269, ejabberd_s2s_in, [{shaper, s2s_shaper}]}, {8888, ejabberd_service, [%{access, local}, {hosts, diff --git a/src/ejabberd_listener.erl b/src/ejabberd_listener.erl index 7285a22b0..ad1a0f328 100644 --- a/src/ejabberd_listener.erl +++ b/src/ejabberd_listener.erl @@ -45,15 +45,28 @@ start(Port, Module, Opts) -> {ok, proc_lib:spawn_link(?MODULE, init_ssl, [Port, Module, Opts, SSLOpts])}; _ -> - {ok, proc_lib:spawn_link(?MODULE, init, [Port, Module, Opts])} + case lists:member(ssl, Opts) of + true -> + {ok, proc_lib:spawn_link(?MODULE, init_ssl, + [Port, Module, Opts, []])}; + false -> + {ok, proc_lib:spawn_link(?MODULE, init, + [Port, Module, Opts])} + end end. init(Port, Module, Opts) -> + SockOpts = lists:filter(fun({ip, _}) -> true; + (inet6) -> true; + (inet) -> true; + (_) -> false + end, Opts), {ok, ListenSocket} = gen_tcp:listen(Port, [binary, {packet, 0}, {active, false}, {reuseaddr, true}, - {nodelay, true}]), + {nodelay, true} | + SockOpts]), accept(ListenSocket, Module, Opts). accept(ListenSocket, Module, Opts) -> @@ -77,11 +90,23 @@ accept(ListenSocket, Module, Opts) -> init_ssl(Port, Module, Opts, SSLOpts) -> + SockOpts = lists:filter(fun({ip, _}) -> true; + (inet6) -> true; + (inet) -> true; + ({verify, _}) -> true; + ({depth, _}) -> true; + ({certfile, _}) -> true; + ({keyfile, _}) -> true; + ({password, _}) -> true; + ({cacertfile, _}) -> true; + ({ciphers, _}) -> true; + (_) -> false + end, Opts), {ok, ListenSocket} = ssl:listen(Port, [binary, {packet, 0}, {active, false}, {nodelay, true} | - SSLOpts]), + SockOpts ++ SSLOpts]), accept_ssl(ListenSocket, Module, Opts). accept_ssl(ListenSocket, Module, Opts) ->