[rabbitmq-discuss] Creating an auth plugin (Kerberos)

Simon Lundström simlu at su.se
Tue Dec 11 16:20:45 GMT 2012


That was easy. The only hard thing was to get it to compile correctly on
OS X = ).
(Note to future readers see
<http://stackoverflow.com/questions/8288358/erlang-nif-test-os-x-lion>)

The NIF needs to be loaded at some point and from the examples and
documentation I've found that it's done via -on_load, like this:
<https://github.com/simmel/rabbitmq-auth-backend-kerberos/blob/use_nif/src/rabbit_auth_backend_kerberos.erl#L10-L14>

However, I've tried using -on_load before in my plugin and it didn't
work. I suspected that the -behaviour had some magic which involved
-on_load and using -on_load in your model bricks that. I worked around
needing -on_load and forgot about it. However, now I need it again. This
is from the error log:

When logging in via AMQP:

=ERROR REPORT==== 11-Dec-2012::09:57:02 ===
closing AMQP connection <0.287.0> (130.237.168.221:48736 -> 77.238.35.76:5671):
{channel0_error,starting,
    {error,undef,'connection.start_ok',
        [{rabbit_auth_backend_kerberos,check_user_login,
             [<<"simlu">>,[{password,<<"notmypassword">>}]]},
         {rabbit_access_control,'-check_user_login/2-fun-0-',4},
         {lists,foldl,3},
         {rabbit_reader,auth_phase,2},
         {rabbit_reader,handle_method0,3},
         {rabbit_reader,handle_input,3},
         {rabbit_reader,recvloop,2},
         {rabbit_reader,start_connection,7}]}}

when using the API (this is in the sasl log):

=CRASH REPORT==== 11-Dec-2012::11:51:04 ===
  crasher:
    initial call: mochiweb_acceptor:init/3
    pid: <0.256.0>
    registered_name: []
    exception error: undefined function rabbit_auth_backend_kerberos:check_user_login/2
      in function  rabbit_access_control:'-check_user_login/2-fun-0-'/4
      in call from lists:foldl/3
      in call from rabbit_mgmt_app:'-make_loop/0-fun-0-'/4
      in call from mochiweb_http:headers/5
    ancestors: [rabbit_mochiweb_web_mgmt,rabbit_mochiweb_sup,<0.132.0>]
    messages: []
    links: [<0.252.0>]
    dictionary: []
    trap_exit: false
    status: running
    heap_size: 4181
    stack_size: 24
    reductions: 1467
  neighbours:


Thanks,
- Simon


More information about the rabbitmq-discuss mailing list