badmatch, {error, "SSL_CTX_use_certificate_file failed

Error

When a user tries to login on the server using SSL, TLS or SASL:

=CRASH REPORT==== 20-Dec-2004::13:35:22 ===
  crasher:
    pid: <0.311.0>
    registered_name: []
    error_info: {{badmatch, {error, "SSL_CTX_use_certificate_file failed"}},
                  [{ejabberd_c2s,init,1},
                   {gen_fsm,init_it,6},
                   {proc_lib,init_p,5}]}
    initial_call: {gen,init_it,
                      [gen_fsm,
                       <0.223.0>,
                       <0.223.0>,
                       ejabberd_c2s,
                       [{gen_tcp,#Port<0.309>},
                        [{access,c2s},tls,{certfile,"./ejabberd/server.pem"}]],
                       []]}
    ancestors: [ejabberd_c2s_sup,ejabberd_sup,<0.38.0>]
    messages: []
    links: [<0.185.0>,<0.223.0>,#Port<0.375>]
    dictionary: []
    trap_exit: false
    status: running
    heap_size: 610
    stack_size: 21
    reductions: 178
  neighbours:

Explanation

The path to the SSL file you have specified on ejabberd.cfg is wrong. When a user tries to login using a supported and active encryption method, ejabberd tries to read the file but it cannot be found.

Solution

Specify the SSL file correctly in your ejabberd.cfg file. The best solution is to specify the full path instead of a relative one:

{listen,
 [{5222, ejabberd_c2s, [{access, c2s}, {shaper, c2s_shaper},
                        starttls, {certfile, "/home/ejabberd/server.pem"}]},
  {5223, ejabberd_c2s, [{access, c2s},
                        tls, {certfile, "/home/ejabberd/server.pem"}]},
Syndicate content