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

Tim Watson tim at rabbitmq.com
Fri Dec 28 14:10:25 GMT 2012


Simon - this works for me! Ha ha.

Here's what I did. Firstly, I tweaked the package.mk so that the plugin got included in the release bundle, plus I had to add some noise to the compiler flags in order to build the native library on 64bit Mac OS (Lion). Then I made sure that the hard coded path which the on_load function uses to locate the image was exactly where $RABBITMQ_PLUGINS_EXPAND_DIR points to, plus the app+vsn/priv/.... etc.

After this, the plugin loads correctly, the NIF is instantiated properly and I can interact with the kinit module as expected:

t4 at iske:rabbitmq-server $ RABBITMQ_ALLOW_INPUT=1 ~/.bash/utilities/start-rabbit-noconf rabbit 5672 15672
Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:4:4] [async-threads:30] [hipe] [kernel-poll:true] [lock-counting]

Eshell V5.9.1  (abort with ^G)
(rabbit at iske)1> 
+---+   +---+
|   |   |   |
|   |   |   |
|   |   |   |
|   +---+   +-------+
|                   |
| RabbitMQ  +---+   |
|           |   |   |
| v%%VSN%%  +---+   |
|                   |
+-------------------+
AMQP 0-9-1 / 0-9 / 0-8
Copyright (C) 2007-2012 VMware, Inc.
Licensed under the MPL.  See http://www.rabbitmq.com/

node           : rabbit at iske
app descriptor : /Users/t4/work/vmware/rabbitmq-umbrella/rabbitmq-server/scripts/../ebin/rabbit.app
home dir       : /Users/t4
config file(s) : /tmp/etc/rabbit.config
cookie hash    : s5K3NR4kyNZMeKMtaQLkvQ==
log            : /tmp/rabbit.log
sasl log       : /tmp/rabbit-sasl.log
database dir   : /tmp/rabbitmq-rabbit-mnesia
erlang version : 5.9.1

[SNIP]

broker running

-- plugins running
amqp_client                                                             0.0.0
rabbitmq_auth_backend_kerberos                                          0.0.0
rabbitmq_shovel                                                         0.0.0

(rabbit at iske)1> 
(rabbit at iske)1> 
(rabbit at iske)1> kinit:module_info().
[{exports,[{init,0},
           {kinit,2},
           {module_info,0},
           {module_info,1}]},
 {imports,[]},
 {attributes,[{vsn,[179147207627583207794822872273379546429]}]},
 {compile,[{options,[{outdir,"/Users/t4/work/vmware/rabbitmq-umbrella/rabbitmq-public-umbrella/rabbitmq-auth-backend-kerberos/ebin"},
                     {i,"/Users/t4/work/vmware/rabbitmq-umbrella/rabbitmq-public-umbrella/rabbitmq-auth-backend-kerberos/include"},
                     debug_info]},
           {version,"4.8.1"},
           {time,{2012,12,28,14,4,2}},
           {source,"/Users/t4/work/vmware/rabbitmq-umbrella/rabbitmq-public-umbrella/rabbitmq-auth-backend-kerberos/src/kinit.erl"}]}]
(rabbit at iske)2> kinit:kinit(<<"foo">>, <<"bar">>).
true
(rabbit at iske)3> 
BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
       (v)ersion (k)ill (D)b-tables (d)istribution
a

I suspect your problem is that you're not calculating the location of the directory into which the plugins are exploded properly. Take a look at rabbit_plugins:setup/0 to see how all these things are calculated, then try and mimic this behaviour to locate your target directory dynamically (and correctly!) at runtime.

Cheers,
Tim

On 21 Dec 2012, at 10:21, Tim Watson wrote:

> On 21 Dec 2012, at 09:40, Simon Lundström wrote:
> 
>> No worries, I'm on holiday and paternity leave until end of january.
>> 
> 
> Great, because I'm not likely to spend much time on it for next couple of week either! :)
> 
>> Happy holidays!
> 
> You too!
> 
>> - Simon
>> 
>> On Fri, 2012-12-14 at 19:28:24 +0000, Tim Watson wrote:
>>> Sorry I haven't managed to look at this yet. I will take a look at some point soon and see if I can debug the problem though.
>> _______________________________________________
>> rabbitmq-discuss mailing list
>> rabbitmq-discuss at lists.rabbitmq.com
>> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
> 
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss



More information about the rabbitmq-discuss mailing list